1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <alibabacloud/oss/model/ListLiveChannelRequest.h>
18 #include <sstream>
19 #include "ModelError.h"
20 #include "Const.h"
21 
22 using namespace AlibabaCloud::OSS;
23 
ListLiveChannelRequest(const std::string & bucket)24 ListLiveChannelRequest::ListLiveChannelRequest(const std::string &bucket):
25     OssBucketRequest(bucket),
26     maxKeys_(100)
27 {
28 
29 }
30 
specialParameters() const31 ParameterCollection ListLiveChannelRequest::specialParameters() const
32 {
33     ParameterCollection colletion;
34     colletion["live"] = "";
35     if(!marker_.empty())
36     {
37         colletion["marker"] = marker_;
38     }
39     if(!prefix_.empty())
40     {
41         colletion["prefix"] = prefix_;
42     }
43     if(0 != maxKeys_)
44     {
45         colletion["max-keys"] = std::to_string(maxKeys_);
46     }
47     return colletion;
48 }
49 
validate() const50 int ListLiveChannelRequest::validate() const
51 {
52     if(0 == maxKeys_ || MaxListLiveChannelKeys < maxKeys_)
53     {
54         return ARG_ERROR_LIVECHANNEL_BAD_MAXKEY_PARAM;
55     }
56     return OssBucketRequest::validate();
57 }
58 
setMarker(const std::string & marker)59 void ListLiveChannelRequest::setMarker(const std::string &marker)
60 {
61     marker_ = marker;
62 }
63 
setPrefix(const std::string & prefix)64 void ListLiveChannelRequest::setPrefix(const std::string &prefix)
65 {
66     prefix_ = prefix;
67 }
68 
setMaxKeys(uint32_t maxKeys)69 void ListLiveChannelRequest::setMaxKeys(uint32_t maxKeys)
70 {
71     maxKeys_ = maxKeys;
72 }
73 
74