code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/CreateSelectObjectMetaResult.h>
#include <iostream>
#include <sstream>
#include "../utils/Crc32.h"
#define FRAME_HEADER_LEN (12+8)
#define PARSE_FOUR_BYTES(a, b, c, d) (((uint64_t)(a) << 24)|((uint64_t)(b) << 16)|((uint64_t)(c) << 8)|(d))
#define PARSE_EIGHT_BYTES(a, b, c, d, e, f, g, h) (((uint64_t)(a)<<56)|((uint64_t)(b)<<48)| ((uint64_t)(c)<<40)| ((uint64_t)(d)<<32)| ((uint64_t)(e)<<24)| ((uint64_t)(f)<<16)| ((uint64_t)(g)<<8)| (h))
using namespace AlibabaCloud::OSS;
CreateSelectObjectMetaResult::CreateSelectObjectMetaResult()
:OssResult(),
offset_(0),
totalScanned_(0),
status_(0),
splitsCount_(0),
rowsCount_(0),
colsCount_(0)
{
}
CreateSelectObjectMetaResult::CreateSelectObjectMetaResult( const std::string& bucket, const std::string& key,
const std::string& requestId, const std::shared_ptr<std::iostream>& data) :
CreateSelectObjectMetaResult()
{
bucket_ = bucket;
key_ = key;
requestId_ = requestId;
*this = data;
}
CreateSelectObjectMetaResult& CreateSelectObjectMetaResult::operator=(const std::shared_ptr<std::iostream>& data)
{
data->seekg(0, data->beg);
uint8_t buffer[36];
char messageBuffer[256];
parseDone_ = true;
while (data->good()) {
// header 12 bytes
data->read(reinterpret_cast<char*>(buffer), 12);
if (!data->good()) {
break;
}
// type 3 bytes
int type = 0;
type = (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
// payload length 4 bytes
int length = PARSE_FOUR_BYTES(buffer[4], buffer[5], buffer[6], buffer[7]);
// header checksum
// payload
switch (type)
{
case 0x800006:
case 0x800007:
{
uint32_t payloadCrc32 = 0;
int messageLength = length - 32;
data->read(reinterpret_cast<char*>(buffer), 32);
payloadCrc32 = CRC32::CalcCRC(payloadCrc32, buffer, 32);
// offset 8 bytes
offset_ = PARSE_EIGHT_BYTES(buffer[0],buffer[1],buffer[2],buffer[3],
buffer[4],buffer[5],buffer[6],buffer[7]);
// total scaned 8bytes
totalScanned_ = PARSE_EIGHT_BYTES(buffer[8],buffer[9],buffer[10],buffer[11],
buffer[12],buffer[13],buffer[14],buffer[15]);
// status 4 bytes
status_ = PARSE_FOUR_BYTES(buffer[16], buffer[17], buffer[18], buffer[19]);
// splitsCount 4 bytes
splitsCount_ = PARSE_FOUR_BYTES(buffer[20], buffer[21], buffer[22], buffer[23]);
// rowsCount 8 bytes
rowsCount_ = PARSE_EIGHT_BYTES(buffer[24],buffer[25],buffer[26],buffer[27],
buffer[28],buffer[29],buffer[30],buffer[31]);
if (type == 0x800006) {
messageLength -= 4;
// colsCount
data->read(reinterpret_cast<char*>(buffer), 4);
payloadCrc32 = CRC32::CalcCRC(payloadCrc32, buffer, 4);
colsCount_ = PARSE_FOUR_BYTES(buffer[0],buffer[1],buffer[2],buffer[3]);
}
data->read(messageBuffer, messageLength);
payloadCrc32 = CRC32::CalcCRC(payloadCrc32, messageBuffer, messageLength);
errorMessage_ = std::string(messageBuffer);
if (!data->good()) {
parseDone_ = false;
break;
}
// payload crc32 checksum
uint32_t payloadChecksum = 0;
data->read(reinterpret_cast<char*>(buffer), 4);
payloadChecksum = PARSE_FOUR_BYTES(buffer[0],buffer[1],buffer[2],buffer[3]);
if (payloadChecksum != 0 && payloadChecksum != payloadCrc32) {
parseDone_ = false;
return *this;
}
}
break;
default:
data->seekg(length + 4, data->cur);
break;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/CreateSelectObjectMetaResult.cc | C++ | apache-2.0 | 4,595 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/CreateSymlinkRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
CreateSymlinkRequest::CreateSymlinkRequest(const std::string &bucket, const std::string &key):
OssObjectRequest(bucket, key)
{
}
CreateSymlinkRequest::CreateSymlinkRequest(const std::string &bucket, const std::string &key,
const ObjectMetaData &metaData):
OssObjectRequest(bucket, key),
metaData_(metaData)
{
}
void CreateSymlinkRequest::SetSymlinkTarget(const std::string& value)
{
metaData_.addHeader("x-oss-symlink-target", value);
}
void CreateSymlinkRequest::setTagging(const std::string& value)
{
metaData_.addHeader("x-oss-tagging", value);
}
HeaderCollection CreateSymlinkRequest::specialHeaders() const
{
auto headers = metaData_.toHeaderCollection();
auto baseHeaders = OssObjectRequest::specialHeaders();
headers.insert(baseHeaders.begin(), baseHeaders.end());
return headers;
}
ParameterCollection CreateSymlinkRequest::specialParameters() const
{
ParameterCollection paramters;
paramters["symlink"] = "";
return paramters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/CreateSymlinkRequest.cc | C++ | apache-2.0 | 1,849 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/CreateSymlinkResult.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
CreateSymlinkResult::CreateSymlinkResult():
OssObjectResult()
{
}
CreateSymlinkResult::CreateSymlinkResult(const std::string& etag):
OssObjectResult(),
etag_(TrimQuotes(etag.c_str()))
{
}
CreateSymlinkResult::CreateSymlinkResult(const HeaderCollection& headers):
OssObjectResult(headers)
{
if (headers.find(Http::ETAG) != headers.end()) {
etag_ = TrimQuotes(headers.at(Http::ETAG).c_str());
}
}
| YifuLiu/AliOS-Things | components/oss/src/model/CreateSymlinkResult.cc | C++ | apache-2.0 | 1,260 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketCorsRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketCorsRequest::DeleteBucketCorsRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketCorsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["cors"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketCorsRequest.cc | C++ | apache-2.0 | 999 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketEncryptionRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketEncryptionRequest::DeleteBucketEncryptionRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketEncryptionRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["encryption"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketEncryptionRequest.cc | C++ | apache-2.0 | 1,026 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketInventoryConfigurationRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketInventoryConfigurationRequest::DeleteBucketInventoryConfigurationRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
DeleteBucketInventoryConfigurationRequest::DeleteBucketInventoryConfigurationRequest(const std::string& bucket, const std::string& id) :
DeleteBucketInventoryConfigurationRequest(bucket)
{
id_ = id;
}
ParameterCollection DeleteBucketInventoryConfigurationRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["inventory"] = "";
parameters["inventoryId"] = id_;
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketInventoryConfigurationRequest.cc | C++ | apache-2.0 | 1,320 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketLifecycleRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketLifecycleRequest::DeleteBucketLifecycleRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketLifecycleRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["lifecycle"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketLifecycleRequest.cc | C++ | apache-2.0 | 1,024 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketLoggingRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketLoggingRequest::DeleteBucketLoggingRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketLoggingRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["logging"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketLoggingRequest.cc | C++ | apache-2.0 | 1,014 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketPolicyRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketPolicyRequest::DeleteBucketPolicyRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketPolicyRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["policy"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketPolicyRequest.cc | C++ | apache-2.0 | 1,009 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketQosInfoRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketQosInfoRequest::DeleteBucketQosInfoRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketQosInfoRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["qosInfo"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketQosInfoRequest.cc | C++ | apache-2.0 | 1,011 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketTaggingRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketTaggingRequest::DeleteBucketTaggingRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketTaggingRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["tagging"] = "";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketTaggingRequest.cc | C++ | apache-2.0 | 1,013 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteBucketWebsiteRequest.h>
using namespace AlibabaCloud::OSS;
DeleteBucketWebsiteRequest::DeleteBucketWebsiteRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection DeleteBucketWebsiteRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["website"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/DeleteBucketWebsiteRequest.cc | C++ | apache-2.0 | 1,014 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteLiveChannelRequest.h>
#include "utils/Utils.h"
#include "ModelError.h"
using namespace AlibabaCloud::OSS;
DeleteLiveChannelRequest::DeleteLiveChannelRequest(const std::string &bucket,
const std::string &channelName)
:LiveChannelRequest(bucket, channelName)
{
}
ParameterCollection DeleteLiveChannelRequest::specialParameters() const
{
ParameterCollection collection;
collection["live"] = "";
return collection;
}
int DeleteLiveChannelRequest::validate() const
{
return LiveChannelRequest::validate();
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteLiveChannelRequest.cc | C++ | apache-2.0 | 1,199 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectResult.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
DeleteObjectResult::DeleteObjectResult():
OssObjectResult(),
deleteMarker_(false)
{
}
DeleteObjectResult::DeleteObjectResult(const HeaderCollection& headers):
OssObjectResult(headers),
deleteMarker_(false)
{
if (headers.find("x-oss-delete-marker") != headers.end()) {
deleteMarker_ = true;
}
}
bool DeleteObjectResult::DeleteMarker() const
{
return deleteMarker_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectResult.cc | C++ | apache-2.0 | 1,191 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectTaggingRequest.h>
using namespace AlibabaCloud::OSS;
DeleteObjectTaggingRequest::DeleteObjectTaggingRequest(const std::string& bucket, const std::string& key):
OssObjectRequest(bucket, key)
{
}
ParameterCollection DeleteObjectTaggingRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["tagging"] = "";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectTaggingRequest.cc | C++ | apache-2.0 | 1,101 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectVersionsRequest.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
DeleteObjectVersionsRequest::DeleteObjectVersionsRequest(const std::string &bucket) :
OssBucketRequest(bucket),
quiet_(false),
encodingType_(),
requestPayer_(RequestPayer::NotSet)
{
setFlags(Flags() | REQUEST_FLAG_CONTENTMD5);
}
bool DeleteObjectVersionsRequest::Quiet() const
{
return quiet_;
}
const std::string &DeleteObjectVersionsRequest::EncodingType() const
{
return encodingType_;
}
void DeleteObjectVersionsRequest::addObject(const ObjectIdentifier& object)
{
objects_.push_back(object);
}
void DeleteObjectVersionsRequest::setObjects(const ObjectIdentifierList& objects)
{
objects_ = objects;
}
const ObjectIdentifierList& DeleteObjectVersionsRequest::Objects() const
{
return objects_;
}
void DeleteObjectVersionsRequest::clearObjects()
{
objects_.clear();
}
void DeleteObjectVersionsRequest::setQuiet(bool quiet)
{
quiet_ = quiet;
}
void DeleteObjectVersionsRequest::setEncodingType(const std::string &value)
{
encodingType_ = value;
}
void DeleteObjectVersionsRequest::setRequestPayer(RequestPayer value)
{
requestPayer_ = value;
}
std::string DeleteObjectVersionsRequest::payload() const
{
std::stringstream ss;
ss << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
ss << "<Delete>" << std::endl;
ss << " <Quiet>" << (quiet_ ? "true":"false") << "</Quiet>" << std::endl;
for (auto const& object : objects_) {
ss << " <Object>" << std::endl << "";
ss << " <Key>" << XmlEscape(object.Key()) << "</Key>" << std::endl;
if (!object.VersionId().empty()) {
ss << " <VersionId>" << object.VersionId() << "</VersionId>" << std::endl;
}
ss << " </Object>" << std::endl;
}
ss << "</Delete>" << std::endl;
return ss.str();
}
ParameterCollection DeleteObjectVersionsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["delete"] = "";
if (!encodingType_.empty()) {
parameters["encoding-type"] = encodingType_;
}
return parameters;
}
HeaderCollection DeleteObjectVersionsRequest::specialHeaders() const
{
HeaderCollection headers;
if (requestPayer_ == RequestPayer::Requester) {
headers["x-oss-request-payer"] = ToLower(ToRequestPayerName(RequestPayer::Requester));
}
return headers;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectVersionsRequest.cc | C++ | apache-2.0 | 3,085 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectVersionsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
DeleteObjectVersionsResult::DeleteObjectVersionsResult() :
OssResult(),
quiet_(false),
deletedObjects_()
{
}
DeleteObjectVersionsResult::DeleteObjectVersionsResult(const std::string& result) :
DeleteObjectVersionsResult()
{
*this = result;
}
DeleteObjectVersionsResult::DeleteObjectVersionsResult(const std::shared_ptr<std::iostream>& result) :
DeleteObjectVersionsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
DeleteObjectVersionsResult& DeleteObjectVersionsResult::operator =(const std::string& result)
{
if (result.empty()) {
quiet_ = true;
parseDone_ = true;
return *this;
}
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("DeleteResult", root->Name(), 12)) {
XMLElement *node;
std::string encodeType;
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodeType = node->GetText();
bool useUrlDecode = !ToLower(encodeType.c_str()).compare(0, 3, "url", 3);
//Deleted
node = root->FirstChildElement("Deleted");
for (; node; node = node->NextSiblingElement("Deleted")) {
XMLElement *sub_node;
DeletedObject object;
sub_node = node->FirstChildElement("Key");
if (sub_node && sub_node->GetText()) {
object.setKey(useUrlDecode ? UrlDecode(sub_node->GetText()) : sub_node->GetText());
}
sub_node = node->FirstChildElement("VersionId");
if (sub_node && sub_node->GetText()) {
object.setVersionId(sub_node->GetText());
}
sub_node = node->FirstChildElement("DeleteMarker");
if (sub_node && sub_node->GetText()) {
object.setDeleteMarker(!std::strncmp("true", sub_node->GetText(), 4));
}
sub_node = node->FirstChildElement("DeleteMarkerVersionId");
if (sub_node && sub_node->GetText()) {
object.setDeleteMarkerVersionId(sub_node->GetText());
}
deletedObjects_.push_back(object);
}
}
parseDone_ = true;
}
return *this;
}
bool DeleteObjectVersionsResult::Quiet() const
{
return quiet_;
}
const DeletedObjectList& DeleteObjectVersionsResult::DeletedObjects() const
{
return deletedObjects_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectVersionsResult.cc | C++ | apache-2.0 | 3,601 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectsRequest.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
DeleteObjectsRequest::DeleteObjectsRequest(const std::string &bucket) :
OssBucketRequest(bucket),
quiet_(false),
encodingType_(),
requestPayer_(RequestPayer::NotSet)
{
setFlags(Flags() | REQUEST_FLAG_CONTENTMD5);
}
bool DeleteObjectsRequest::Quiet() const
{
return quiet_;
}
const std::string &DeleteObjectsRequest::EncodingType() const
{
return encodingType_;
}
const std::list<std::string> &DeleteObjectsRequest::KeyList() const
{
return keyList_;
}
void DeleteObjectsRequest::setQuiet(bool quiet)
{
quiet_ = quiet;
}
void DeleteObjectsRequest::setEncodingType(const std::string &value)
{
encodingType_ = value;
}
void DeleteObjectsRequest::addKey(const std::string &key)
{
keyList_.push_back(key);
}
void DeleteObjectsRequest::setKeyList(const DeletedKeyList &keyList)
{
keyList_ = keyList;
}
void DeleteObjectsRequest::clearKeyList()
{
keyList_.clear();
}
void DeleteObjectsRequest::setRequestPayer(RequestPayer value)
{
requestPayer_ = value;
}
std::string DeleteObjectsRequest::payload() const
{
std::stringstream ss;
ss << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
ss << "<Delete>" << std::endl;
ss << " <Quiet>" << (quiet_ ? "true":"false") << "</Quiet>" << std::endl;
for (auto const &key : keyList_) {
ss << " <Object>" << std::endl << "";
ss << " <Key>" << XmlEscape(key) << "</Key>" << std::endl;
ss << " </Object>" << std::endl;
}
ss << "</Delete>" << std::endl;
return ss.str();
}
ParameterCollection DeleteObjectsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["delete"] = "";
if (!encodingType_.empty()) {
parameters["encoding-type"] = encodingType_;
}
return parameters;
}
HeaderCollection DeleteObjectsRequest::specialHeaders() const
{
HeaderCollection headers;
if (requestPayer_ == RequestPayer::Requester) {
headers["x-oss-request-payer"] = ToLower(ToRequestPayerName(RequestPayer::Requester));
}
return headers;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectsRequest.cc | C++ | apache-2.0 | 2,823 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/DeleteObjectsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
DeleteObjectsResult::DeleteObjectsResult() :
OssResult(),
quiet_(false),
keyList_()
{
}
DeleteObjectsResult::DeleteObjectsResult(const std::string& result) :
DeleteObjectsResult()
{
*this = result;
}
DeleteObjectsResult::DeleteObjectsResult(const std::shared_ptr<std::iostream>& result) :
DeleteObjectsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
DeleteObjectsResult& DeleteObjectsResult::operator =(const std::string& result)
{
if (result.empty()) {
quiet_ = true;
parseDone_ = true;
return *this;
}
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("DeleteResult", root->Name(), 12)) {
XMLElement *node;
std::string encodeType;
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodeType = node->GetText();
bool useUrlDecode = !ToLower(encodeType.c_str()).compare(0, 3, "url", 3);
//Deleted
node = root->FirstChildElement("Deleted");
for (; node; node = node->NextSiblingElement("Deleted")) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("Key");
if (sub_node && sub_node->GetText()) keyList_.push_back(useUrlDecode?UrlDecode(sub_node->GetText()):sub_node->GetText());
}
}
parseDone_ = true;
}
return *this;
}
bool DeleteObjectsResult::Quiet() const
{
return quiet_;
}
const std::list<std::string>& DeleteObjectsResult::keyList() const
{
return keyList_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/DeleteObjectsResult.cc | C++ | apache-2.0 | 2,680 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GeneratePresignedUrlRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
#include <sstream>
#include <chrono>
using namespace AlibabaCloud::OSS;
GeneratePresignedUrlRequest::GeneratePresignedUrlRequest(const std::string &bucket, const std::string &key) :
GeneratePresignedUrlRequest(bucket, key, Http::Method::Get)
{
}
GeneratePresignedUrlRequest::GeneratePresignedUrlRequest(const std::string &bucket, const std::string &key, Http::Method method):
bucket_(bucket),
key_(key),
method_(method)
{
//defalt 15 min
std::time_t t = std::time(nullptr) + 15*60;
metaData_.setExpirationTime(std::to_string(t));
}
void GeneratePresignedUrlRequest::setBucket(const std::string &bucket)
{
bucket_ = bucket;
}
void GeneratePresignedUrlRequest::setKey(const std::string &key)
{
key_ = key;
}
void GeneratePresignedUrlRequest::setContentType(const std::string &value)
{
metaData_.HttpMetaData()[Http::CONTENT_TYPE] = value;
}
void GeneratePresignedUrlRequest::setContentMd5(const std::string &value)
{
metaData_.HttpMetaData()[Http::CONTENT_MD5] = value;
}
void GeneratePresignedUrlRequest::setExpires(int64_t unixTime)
{
metaData_.setExpirationTime(std::to_string(unixTime));
}
void GeneratePresignedUrlRequest::setProcess(const std::string &value)
{
parameters_["x-oss-process"] = value;
}
void GeneratePresignedUrlRequest::setTrafficLimit(uint64_t value)
{
parameters_["x-oss-traffic-limit"] = std::to_string(value);
}
void GeneratePresignedUrlRequest::setVersionId(const std::string& versionId)
{
parameters_["versionId"] = versionId;
}
void GeneratePresignedUrlRequest::setRequestPayer(RequestPayer value)
{
if (value == RequestPayer::Requester) {
parameters_["x-oss-request-payer"] = ToLower(ToRequestPayerName(value));
}
}
void GeneratePresignedUrlRequest::addResponseHeaders(RequestResponseHeader header, const std::string &value)
{
static const char *ResponseHeader[] = {
"response-content-type", "response-content-language",
"response-expires", "response-cache-control",
"response-content-disposition", "response-content-encoding" };
parameters_[ResponseHeader[header - RequestResponseHeader::ContentType]] = value;
}
void GeneratePresignedUrlRequest::addParameter(const std::string&key, const std::string &value)
{
parameters_[key] = value;
}
MetaData &GeneratePresignedUrlRequest::UserMetaData()
{
return metaData_.UserMetaData();
}
| YifuLiu/AliOS-Things | components/oss/src/model/GeneratePresignedUrlRequest.cc | C++ | apache-2.0 | 3,150 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GenerateRTMPSignedUrlRequest.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
GenerateRTMPSignedUrlRequest::GenerateRTMPSignedUrlRequest(
const std::string& bucket,
const std::string& channelName, const std::string& playlist,
uint64_t expires):
LiveChannelRequest(bucket, channelName),
playList_(playlist),
expires_(expires)
{
}
ParameterCollection GenerateRTMPSignedUrlRequest::Parameters() const
{
ParameterCollection collection;
if(!playList_.empty())
{
collection["playlistName"] = playList_;
}
return collection;
}
void GenerateRTMPSignedUrlRequest::setPlayList(const std::string &playList)
{
playList_ = playList;
}
void GenerateRTMPSignedUrlRequest::setExpires(uint64_t expires)
{
expires_ = expires;
}
const std::string& GenerateRTMPSignedUrlRequest::PlayList() const
{
return playList_;
}
uint64_t GenerateRTMPSignedUrlRequest::Expires() const
{
return expires_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GenerateRTMPSignedUrlRequest.cc | C++ | apache-2.0 | 1,647 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketAclRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketAclRequest::GetBucketAclRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketAclRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["acl"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketAclRequest.cc | C++ | apache-2.0 | 982 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketAclResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketAclResult::GetBucketAclResult() :
OssResult()
{
}
GetBucketAclResult::GetBucketAclResult(const std::string& result):
GetBucketAclResult()
{
*this = result;
}
GetBucketAclResult::GetBucketAclResult(const std::shared_ptr<std::iostream>& result):
GetBucketAclResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketAclResult& GetBucketAclResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("AccessControlPolicy", root->Name(), 19)) {
XMLElement *node;
node = root->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
node = root->FirstChildElement("AccessControlList");
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("Grant");
if (sub_node && sub_node->GetText()) acl_ = ToAclType(sub_node->GetText());
}
owner_ = AlibabaCloud::OSS::Owner(owner_ID, owner_DisplayName);
//TODO check the result and the parse flag;
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketAclResult.cc | C++ | apache-2.0 | 2,597 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketCorsRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketCorsRequest::GetBucketCorsRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketCorsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["cors"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketCorsRequest.cc | C++ | apache-2.0 | 987 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketCorsResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketCorsResult::GetBucketCorsResult() :
OssResult()
{
}
GetBucketCorsResult::GetBucketCorsResult(const std::string& result):
GetBucketCorsResult()
{
*this = result;
}
GetBucketCorsResult::GetBucketCorsResult(const std::shared_ptr<std::iostream>& result):
GetBucketCorsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketCorsResult& GetBucketCorsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("CORSConfiguration", root->Name(), 17)) {
XMLElement *rule_node = root->FirstChildElement("CORSRule");
for (; rule_node; rule_node = rule_node->NextSiblingElement("CORSRule")) {
XMLElement *node = rule_node->FirstChildElement();
CORSRule rule;
for (; node; node = node->NextSiblingElement()) {
if (!strncmp(node->Name(), "AllowedOrigin", 13))
if (node->GetText()) rule.addAllowedOrigin(node->GetText());
if (!strncmp(node->Name(), "AllowedMethod", 13))
if (node->GetText()) rule.addAllowedMethod(node->GetText());
if (!strncmp(node->Name(), "AllowedHeader", 13))
if (node->GetText()) rule.addAllowedHeader(node->GetText());
if (!strncmp(node->Name(), "ExposeHeader", 12))
if (node->GetText()) rule.addExposeHeader(node->GetText());
if (!strncmp(node->Name(), "MaxAgeSeconds", 13))
if (node->GetText()) rule.setMaxAgeSeconds(std::atoi(node->GetText()));
}
ruleList_.push_back(rule);
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketCorsResult.cc | C++ | apache-2.0 | 2,842 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketEncryptionRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketEncryptionRequest::GetBucketEncryptionRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketEncryptionRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["encryption"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketEncryptionRequest.cc | C++ | apache-2.0 | 1,014 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketEncryptionResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketEncryptionResult::GetBucketEncryptionResult() :
OssResult()
{
}
GetBucketEncryptionResult::GetBucketEncryptionResult(const std::string& result) :
GetBucketEncryptionResult()
{
*this = result;
}
GetBucketEncryptionResult::GetBucketEncryptionResult(const std::shared_ptr<std::iostream>& result) :
GetBucketEncryptionResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketEncryptionResult& GetBucketEncryptionResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("ServerSideEncryptionRule", root->Name(), 24)) {
XMLElement* node;
node = root->FirstChildElement("ApplyServerSideEncryptionByDefault");
if (node) {
XMLElement* sub_node;
sub_node = node->FirstChildElement("SSEAlgorithm");
if (sub_node && sub_node->GetText()) SSEAlgorithm_ = ToSSEAlgorithm(sub_node->GetText());
sub_node = node->FirstChildElement("KMSMasterKeyID");
if (sub_node && sub_node->GetText()) KMSMasterKeyID_ = sub_node->GetText();
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketEncryptionResult.cc | C++ | apache-2.0 | 2,217 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketInfoRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketInfoRequest::GetBucketInfoRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketInfoRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["bucketInfo"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketInfoRequest.cc | C++ | apache-2.0 | 993 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketInfoResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketInfoResult::GetBucketInfoResult() :
OssResult(),
dataRedundancyType_(AlibabaCloud::OSS::DataRedundancyType::NotSet),
sseAlgorithm_(AlibabaCloud::OSS::SSEAlgorithm::NotSet),
versioningStatus_(AlibabaCloud::OSS::VersioningStatus::NotSet)
{
}
GetBucketInfoResult::GetBucketInfoResult(const std::string& result):
GetBucketInfoResult()
{
*this = result;
}
GetBucketInfoResult::GetBucketInfoResult(const std::shared_ptr<std::iostream>& result):
GetBucketInfoResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketInfoResult& GetBucketInfoResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("BucketInfo", root->Name(), 10)) {
XMLElement *node;
XMLElement *bucket_node;
bucket_node = root->FirstChildElement("Bucket");
if (bucket_node) {
node = bucket_node->FirstChildElement("CreationDate");
if (node && node->GetText()) creationDate_ = node->GetText();
node = bucket_node->FirstChildElement("ExtranetEndpoint");
if (node && node->GetText()) extranetEndpoint_ = node->GetText();
node = bucket_node->FirstChildElement("IntranetEndpoint");
if (node && node->GetText()) intranetEndpoint_ = node->GetText();
node = bucket_node->FirstChildElement("Location");
if (node && node->GetText()) location_ = node->GetText();
node = bucket_node->FirstChildElement("Name");
if (node && node->GetText()) name_ = node->GetText();
node = bucket_node->FirstChildElement("StorageClass");
if (node && node->GetText()) storageClass_ = ToStorageClassType(node->GetText());
node = bucket_node->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
owner_ = AlibabaCloud::OSS::Owner(owner_ID, owner_DisplayName);
node = bucket_node->FirstChildElement("AccessControlList");
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("Grant");
if (sub_node && sub_node->GetText()) acl_ = ToAclType(sub_node->GetText());
}
node = bucket_node->FirstChildElement("DataRedundancyType");
if (node && node->GetText()) dataRedundancyType_ = ToDataRedundancyType(node->GetText());
node = bucket_node->FirstChildElement("Comment");
if (node && node->GetText()) comment_ = node->GetText();
node = bucket_node->FirstChildElement("ServerSideEncryptionRule");
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("SSEAlgorithm");
if (sub_node && sub_node->GetText()) sseAlgorithm_ = ToSSEAlgorithm(sub_node->GetText());
sub_node = node->FirstChildElement("KMSMasterKeyID");
if (sub_node && sub_node->GetText()) kmsMasterKeyID_ = sub_node->GetText();
}
node = bucket_node->FirstChildElement("Versioning");
if (node && node->GetText()) versioningStatus_ = ToVersioningStatusType(node->GetText());
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketInfoResult.cc | C++ | apache-2.0 | 5,032 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketInventoryConfigurationRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketInventoryConfigurationRequest::GetBucketInventoryConfigurationRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
GetBucketInventoryConfigurationRequest::GetBucketInventoryConfigurationRequest(const std::string& bucket, const std::string& id) :
GetBucketInventoryConfigurationRequest(bucket)
{
id_ = id;
}
ParameterCollection GetBucketInventoryConfigurationRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["inventory"] = "";
parameters["inventoryId"] = id_;
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketInventoryConfigurationRequest.cc | C++ | apache-2.0 | 1,299 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketInventoryConfigurationResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketInventoryConfigurationResult::GetBucketInventoryConfigurationResult() :
OssResult()
{
}
GetBucketInventoryConfigurationResult::GetBucketInventoryConfigurationResult(const std::string& result) :
GetBucketInventoryConfigurationResult()
{
*this = result;
}
GetBucketInventoryConfigurationResult::GetBucketInventoryConfigurationResult(const std::shared_ptr<std::iostream>& result) :
GetBucketInventoryConfigurationResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketInventoryConfigurationResult& GetBucketInventoryConfigurationResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("InventoryConfiguration", root->Name(), 22)) {
XMLElement* node;
node = root->FirstChildElement("Id");
if (node && node->GetText()) inventoryConfiguration_.setId(node->GetText());
node = root->FirstChildElement("IsEnabled");
if (node && node->GetText()) inventoryConfiguration_.setIsEnabled((std::strncmp(node->GetText(), "true", 4) ? false : true));
node = root->FirstChildElement("Filter");
if (node) {
InventoryFilter filter;
XMLElement* prefix_node = node->FirstChildElement("Prefix");
if (prefix_node && prefix_node->GetText()) filter.setPrefix(prefix_node->GetText());
inventoryConfiguration_.setFilter(filter);
}
node = root->FirstChildElement("Destination");
if (node) {
XMLElement* next_node;
next_node = node->FirstChildElement("OSSBucketDestination");
if (next_node) {
XMLElement* sub_node;
InventoryOSSBucketDestination dest;
sub_node = next_node->FirstChildElement("Format");
if (sub_node && sub_node->GetText()) dest.setFormat(ToInventoryFormatType(sub_node->GetText()));
sub_node = next_node->FirstChildElement("AccountId");
if (sub_node && sub_node->GetText()) dest.setAccountId(sub_node->GetText());
sub_node = next_node->FirstChildElement("RoleArn");
if (sub_node && sub_node->GetText()) dest.setRoleArn(sub_node->GetText());
sub_node = next_node->FirstChildElement("Bucket");
if (sub_node && sub_node->GetText()) dest.setBucket(ToInventoryBucketShortName(sub_node->GetText()));
sub_node = next_node->FirstChildElement("Prefix");
if (sub_node && sub_node->GetText()) dest.setPrefix(sub_node->GetText());
sub_node = next_node->FirstChildElement("Encryption");
if (sub_node) {
InventoryEncryption encryption;
XMLElement* sse_node;
sse_node = sub_node->FirstChildElement("SSE-KMS");
if (sse_node) {
InventorySSEKMS ssekms;
XMLElement* key_node;
key_node = sse_node->FirstChildElement("KeyId");
if (key_node && key_node->GetText()) ssekms.setKeyId(key_node->GetText());
encryption.setSSEKMS(ssekms);
}
sse_node = sub_node->FirstChildElement("SSE-OSS");
if (sse_node) {
encryption.setSSEOSS(InventorySSEOSS());
}
dest.setEncryption(encryption);
}
inventoryConfiguration_.setDestination(InventoryDestination(dest));
}
}
node = root->FirstChildElement("Schedule");
if (node) {
XMLElement* freq_node = node->FirstChildElement("Frequency");
if (freq_node && freq_node->GetText()) inventoryConfiguration_.setSchedule(ToInventoryFrequencyType(freq_node->GetText()));
}
node = root->FirstChildElement("IncludedObjectVersions");
if (node && node->GetText()) inventoryConfiguration_.setIncludedObjectVersions(ToInventoryIncludedObjectVersionsType(node->GetText()));
node = root->FirstChildElement("OptionalFields");
if (node) {
InventoryOptionalFields field;
XMLElement* field_node = node->FirstChildElement("Field");
for (; field_node; field_node = field_node->NextSiblingElement()) {
if (field_node->GetText())
field.push_back(ToInventoryOptionalFieldType(field_node->GetText()));
}
inventoryConfiguration_.setOptionalFields(field);
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketInventoryConfigurationResult.cc | C++ | apache-2.0 | 5,937 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLifecycleRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketLifecycleRequest::GetBucketLifecycleRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketLifecycleRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["lifecycle"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLifecycleRequest.cc | C++ | apache-2.0 | 1,012 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLifecycleResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketLifecycleResult::GetBucketLifecycleResult() :
OssResult()
{
}
GetBucketLifecycleResult::GetBucketLifecycleResult(const std::string& result):
GetBucketLifecycleResult()
{
*this = result;
}
GetBucketLifecycleResult::GetBucketLifecycleResult(const std::shared_ptr<std::iostream>& result):
GetBucketLifecycleResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketLifecycleResult& GetBucketLifecycleResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("LifecycleConfiguration", root->Name(), 22)) {
XMLElement *rule_node = root->FirstChildElement("Rule");
for (; rule_node; rule_node = rule_node->NextSiblingElement("Rule")) {
LifecycleRule rule;
XMLElement *node;
node = rule_node->FirstChildElement("ID");
if (node && node->GetText()) rule.setID(node->GetText());
node = rule_node->FirstChildElement("Prefix");
if (node && node->GetText()) rule.setPrefix(node->GetText());
node = rule_node->FirstChildElement("Status");
if (node && node->GetText()) rule.setStatus(ToRuleStatusType(node->GetText()));
node = rule_node->FirstChildElement("Expiration");
if (node) {
XMLElement *subNode;
//Days
subNode = node->FirstChildElement("Days");
if (subNode && subNode->GetText()) {
rule.Expiration().setDays(std::stoi(subNode->GetText(), nullptr, 10));
}
//CreatedBeforeDate
subNode = node->FirstChildElement("CreatedBeforeDate");
if (subNode && subNode->GetText()) {
rule.Expiration().setCreatedBeforeDate(subNode->GetText());
}
//ExpiredObjectDeleteMarker
subNode = node->FirstChildElement("ExpiredObjectDeleteMarker");
if (subNode && subNode->GetText()) {
rule.setExpiredObjectDeleteMarker(!std::strncmp("true", subNode->GetText(), 4));
}
}
node = rule_node->FirstChildElement("Transition");
for (; node; node = node->NextSiblingElement("Transition")) {
LifeCycleTransition transiton;
XMLElement *subNode;
//Days
subNode = node->FirstChildElement("Days");
if (subNode && subNode->GetText()) {
transiton.Expiration().setDays(std::stoi(subNode->GetText(), nullptr, 10));
}
//CreatedBeforeDate
subNode = node->FirstChildElement("CreatedBeforeDate");
if (subNode && subNode->GetText()) {
transiton.Expiration().setCreatedBeforeDate(subNode->GetText());
}
//StorageClass
subNode = node->FirstChildElement("StorageClass");
if (subNode && subNode->GetText()) {
transiton.setStorageClass(ToStorageClassType(subNode->GetText()));
}
rule.addTransition(transiton);
}
node = rule_node->FirstChildElement("AbortMultipartUpload");
if (node) {
XMLElement *subNode;
//Days
subNode = node->FirstChildElement("Days");
if (subNode && subNode->GetText()) {
rule.AbortMultipartUpload().setDays(std::stoi(subNode->GetText(), nullptr, 10));
}
//CreatedBeforeDate
subNode = node->FirstChildElement("CreatedBeforeDate");
if (subNode && subNode->GetText()) {
rule.AbortMultipartUpload().setCreatedBeforeDate(subNode->GetText());
}
}
node = rule_node->FirstChildElement("Tag");
for (; node; node = node->NextSiblingElement("Tag")) {
Tag tag;
XMLElement *subNode;
//Key
subNode = node->FirstChildElement("Key");
if (subNode && subNode->GetText()) {
tag.setKey(subNode->GetText());
}
//Value
subNode = node->FirstChildElement("Value");
if (subNode && subNode->GetText()) {
tag.setValue(subNode->GetText());
}
rule.addTag(tag);
}
node = rule_node->FirstChildElement("NoncurrentVersionExpiration");
if (node) {
XMLElement *subNode;
//Days
subNode = node->FirstChildElement("NoncurrentDays");
if (subNode && subNode->GetText()) {
rule.NoncurrentVersionExpiration().setDays(std::stoi(subNode->GetText(), nullptr, 10));
}
}
node = rule_node->FirstChildElement("NoncurrentVersionTransition");
for (; node; node = node->NextSiblingElement("NoncurrentVersionTransition")) {
LifeCycleTransition transiton;
XMLElement *subNode;
//Days
subNode = node->FirstChildElement("NoncurrentDays");
if (subNode && subNode->GetText()) {
transiton.Expiration().setDays(std::stoi(subNode->GetText(), nullptr, 10));
}
//StorageClass
subNode = node->FirstChildElement("StorageClass");
if (subNode && subNode->GetText()) {
transiton.setStorageClass(ToStorageClassType(subNode->GetText()));
}
rule.addNoncurrentVersionTransition(transiton);
}
lifecycleRuleList_.emplace_back(std::move(rule));
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLifecycleResult.cc | C++ | apache-2.0 | 7,539 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLocationRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketLocationRequest::GetBucketLocationRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketLocationRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["location"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLocationRequest.cc | C++ | apache-2.0 | 1,007 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLocationResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketLocationResult::GetBucketLocationResult() :
OssResult()
{
}
GetBucketLocationResult::GetBucketLocationResult(const std::string& result):
GetBucketLocationResult()
{
*this = result;
}
GetBucketLocationResult::GetBucketLocationResult(const std::shared_ptr<std::iostream>& result):
GetBucketLocationResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketLocationResult& GetBucketLocationResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("LocationConstraint", root->Name(), 18)) {
if (root->GetText())
location_ = root->GetText();
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLocationResult.cc | C++ | apache-2.0 | 1,731 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLoggingRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketLoggingRequest::GetBucketLoggingRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketLoggingRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["logging"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLoggingRequest.cc | C++ | apache-2.0 | 1,002 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketLoggingResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketLoggingResult::GetBucketLoggingResult() :
OssResult()
{
}
GetBucketLoggingResult::GetBucketLoggingResult(const std::string& result):
GetBucketLoggingResult()
{
*this = result;
}
GetBucketLoggingResult::GetBucketLoggingResult(const std::shared_ptr<std::iostream>& result):
GetBucketLoggingResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketLoggingResult& GetBucketLoggingResult::operator=(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("BucketLoggingStatus", root->Name(), 19)) {
XMLElement *log_node;
log_node = root->FirstChildElement("LoggingEnabled");
if (log_node) {
XMLElement *node;
node = log_node->FirstChildElement("TargetBucket");
if (node && node->GetText()) targetBucket_ = node->GetText();
node = log_node->FirstChildElement("TargetPrefix");
if (node && node->GetText()) targetPrefix_ = node->GetText();
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketLoggingResult.cc | C++ | apache-2.0 | 2,115 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketPaymentRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketRequestPaymentRequest::GetBucketRequestPaymentRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketRequestPaymentRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["requestPayment"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketPaymentRequest.cc | C++ | apache-2.0 | 1,030 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketPaymentResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketPaymentResult::GetBucketPaymentResult() :
OssResult()
{
}
GetBucketPaymentResult::GetBucketPaymentResult(const std::string& result) :
GetBucketPaymentResult()
{
*this = result;
}
GetBucketPaymentResult::GetBucketPaymentResult(const std::shared_ptr<std::iostream>& result) :
GetBucketPaymentResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketPaymentResult& GetBucketPaymentResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("RequestPaymentConfiguration", root->Name(), 27)) {
XMLElement* node;
node = root->FirstChildElement("Payer");
if (node && node->GetText()) payer_ = ToRequestPayer(node->GetText());
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketPaymentResult.cc | C++ | apache-2.0 | 1,830 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketPolicyRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketPolicyRequest::GetBucketPolicyRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketPolicyRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["policy"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketPolicyRequest.cc | C++ | apache-2.0 | 997 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketPolicyResult.h>
using namespace AlibabaCloud::OSS;
GetBucketPolicyResult::GetBucketPolicyResult() :
OssResult()
{
}
GetBucketPolicyResult::GetBucketPolicyResult(const std::string& result):
GetBucketPolicyResult()
{
*this = result;
}
GetBucketPolicyResult::GetBucketPolicyResult(const std::shared_ptr<std::iostream>& result):
GetBucketPolicyResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketPolicyResult& GetBucketPolicyResult::operator =(const std::string& result)
{
policy_ = result;
parseDone_ = true;
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketPolicyResult.cc | C++ | apache-2.0 | 1,303 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketQosInfoRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketQosInfoRequest::GetBucketQosInfoRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketQosInfoRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["qosInfo"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketQosInfoRequest.cc | C++ | apache-2.0 | 999 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketQosInfoResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketQosInfoResult::GetBucketQosInfoResult() :
OssResult()
{
}
GetBucketQosInfoResult::GetBucketQosInfoResult(const std::string& result) :
GetBucketQosInfoResult()
{
*this = result;
}
GetBucketQosInfoResult::GetBucketQosInfoResult(const std::shared_ptr<std::iostream>& result) :
GetBucketQosInfoResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketQosInfoResult& GetBucketQosInfoResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("QoSConfiguration", root->Name(), 16)) {
XMLElement* node;
node = root->FirstChildElement("TotalUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setTotalUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setIntranetUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setExtranetUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("TotalDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setTotalDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setIntranetDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setExtranetDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("TotalQps");
if (node && node->GetText()) {
qosInfo_.setTotalQps(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetQps");
if (node && node->GetText()) {
qosInfo_.setIntranetQps(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetQps");
if (node && node->GetText()) {
qosInfo_.setExtranetQps(std::strtoll(node->GetText(), nullptr, 10));
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketQosInfoResult.cc | C++ | apache-2.0 | 3,627 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketRefererRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketRefererRequest::GetBucketRefererRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketRefererRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["referer"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketRefererRequest.cc | C++ | apache-2.0 | 1,002 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketRefererResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketRefererResult::GetBucketRefererResult() :
OssResult()
{
}
GetBucketRefererResult::GetBucketRefererResult(const std::string& result):
GetBucketRefererResult()
{
*this = result;
}
GetBucketRefererResult::GetBucketRefererResult(const std::shared_ptr<std::iostream>& result):
GetBucketRefererResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketRefererResult& GetBucketRefererResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("RefererConfiguration", root->Name(), 20)) {
XMLElement *node;
node = root->FirstChildElement("AllowEmptyReferer");
if (node && node->GetText()) allowEmptyReferer_ = (std::strncmp(node->GetText(), "true", 4)? false:true);
node = root->FirstChildElement("RefererList");
if (node) {
XMLElement *referer_node = node->FirstChildElement("Referer");
for (; referer_node; referer_node = referer_node->NextSiblingElement()) {
if (referer_node->GetText())
refererList_.push_back(referer_node->GetText());
}
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketRefererResult.cc | C++ | apache-2.0 | 2,262 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketStatRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketStatRequest::GetBucketStatRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketStatRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["stat"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketStatRequest.cc | C++ | apache-2.0 | 987 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketStatResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketStatResult::GetBucketStatResult() :
OssResult(),
storage_(0),
objectCount_(0),
multipartUploadCount_(0)
{
}
GetBucketStatResult::GetBucketStatResult(const std::string& result):
GetBucketStatResult()
{
*this = result;
}
GetBucketStatResult::GetBucketStatResult(const std::shared_ptr<std::iostream>& result):
GetBucketStatResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketStatResult& GetBucketStatResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("BucketStat", root->Name(), 10)) {
XMLElement *node;
node = root->FirstChildElement("Storage");
if (node && node->GetText()) storage_ = atoll(node->GetText());
node = root->FirstChildElement("ObjectCount");
if (node && node->GetText()) objectCount_ = atoll(node->GetText());
node = root->FirstChildElement("MultipartUploadCount");
if (node && node->GetText()) multipartUploadCount_ = atoll(node->GetText());
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketStatResult.cc | C++ | apache-2.0 | 2,134 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketStorageCapacityRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketStorageCapacityRequest::GetBucketStorageCapacityRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketStorageCapacityRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["qos"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketStorageCapacityRequest.cc | C++ | apache-2.0 | 1,030 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketStorageCapacityResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketStorageCapacityResult::GetBucketStorageCapacityResult() :
OssResult(),
storageCapacity_(-1)
{
}
GetBucketStorageCapacityResult::GetBucketStorageCapacityResult(const std::string& result):
GetBucketStorageCapacityResult()
{
*this = result;
}
GetBucketStorageCapacityResult::GetBucketStorageCapacityResult(const std::shared_ptr<std::iostream>& result):
GetBucketStorageCapacityResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketStorageCapacityResult& GetBucketStorageCapacityResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("BucketUserQos", root->Name(), 13)) {
XMLElement *node = root->FirstChildElement("StorageCapacity");
if (node && node->GetText()) storageCapacity_ = std::atoll(node->GetText());
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketStorageCapacityResult.cc | C++ | apache-2.0 | 1,925 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketTaggingRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketTaggingRequest::GetBucketTaggingRequest(const std::string& bucket)
:OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketTaggingRequest::specialParameters() const
{
ParameterCollection paramters;
paramters["tagging"] = "";
return paramters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketTaggingRequest.cc | C++ | apache-2.0 | 997 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketTaggingResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketTaggingResult::GetBucketTaggingResult() :
OssResult()
{
}
GetBucketTaggingResult::GetBucketTaggingResult(const std::string& result) :
GetBucketTaggingResult()
{
*this = result;
}
GetBucketTaggingResult::GetBucketTaggingResult(const std::shared_ptr<std::iostream>& result) :
GetBucketTaggingResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketTaggingResult& GetBucketTaggingResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("Tagging", root->Name(), 7)) {
XMLElement* tagSet_node = root->FirstChildElement("TagSet");
if (tagSet_node) {
XMLElement* tag_node = tagSet_node->FirstChildElement("Tag");
for (; tag_node; tag_node = tag_node->NextSiblingElement("Tag")) {
XMLElement* subNode;
Tag tag;
//Key
subNode = tag_node->FirstChildElement("Key");
if (subNode && subNode->GetText()) {
tag.setKey(subNode->GetText());
}
//Value
subNode = tag_node->FirstChildElement("Value");
if (subNode && subNode->GetText()) {
tag.setValue(subNode->GetText());
}
tagging_.addTag(tag);
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketTaggingResult.cc | C++ | apache-2.0 | 2,565 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketVersioningRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketVersioningRequest::GetBucketVersioningRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketVersioningRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["versioning"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketVersioningRequest.cc | C++ | apache-2.0 | 1,047 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketVersioningResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketVersioningResult::GetBucketVersioningResult() :
OssResult(),
status_(VersioningStatus::NotSet)
{
}
GetBucketVersioningResult::GetBucketVersioningResult(const std::string& result):
GetBucketVersioningResult()
{
*this = result;
}
GetBucketVersioningResult::GetBucketVersioningResult(const std::shared_ptr<std::iostream>& result):
GetBucketVersioningResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketVersioningResult& GetBucketVersioningResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("VersioningConfiguration", root->Name(), 23)) {
XMLElement *node;
node = root->FirstChildElement("Status");
if (node && node->GetText()) {
status_ = ToVersioningStatusType(node->GetText());
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketVersioningResult.cc | C++ | apache-2.0 | 1,994 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketWebsiteRequest.h>
using namespace AlibabaCloud::OSS;
GetBucketWebsiteRequest::GetBucketWebsiteRequest(const std::string &bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection GetBucketWebsiteRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["website"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetBucketWebsiteRequest.cc | C++ | apache-2.0 | 1,002 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetBucketWebsiteResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetBucketWebsiteResult::GetBucketWebsiteResult() :
OssResult()
{
}
GetBucketWebsiteResult::GetBucketWebsiteResult(const std::string& result):
GetBucketWebsiteResult()
{
*this = result;
}
GetBucketWebsiteResult::GetBucketWebsiteResult(const std::shared_ptr<std::iostream>& result):
GetBucketWebsiteResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetBucketWebsiteResult& GetBucketWebsiteResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("WebsiteConfiguration", root->Name(), 20)) {
XMLElement *node;
node = root->FirstChildElement("IndexDocument");
if (node) node = node->FirstChildElement("Suffix");
if (node && node->GetText()) indexDocument_ = node->GetText();
node = root->FirstChildElement("ErrorDocument");
if (node) node = node->FirstChildElement("Key");
if (node && node->GetText()) errorDocument_ = node->GetText();
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetBucketWebsiteResult.cc | C++ | apache-2.0 | 2,070 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelHistoryRequest.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
GetLiveChannelHistoryRequest::GetLiveChannelHistoryRequest(const std::string& bucket,
const std::string& channelName):
LiveChannelRequest(bucket, channelName)
{
}
ParameterCollection GetLiveChannelHistoryRequest::specialParameters() const
{
ParameterCollection collection;
collection["live"] = "";
collection["comp"] = "history";
return collection;
}
int GetLiveChannelHistoryRequest::validate() const
{
return LiveChannelRequest::validate();
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelHistoryRequest.cc | C++ | apache-2.0 | 1,297 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelHistoryResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetLiveChannelHistoryResult::GetLiveChannelHistoryResult() :
OssResult()
{
}
GetLiveChannelHistoryResult::GetLiveChannelHistoryResult(const std::string& result):
GetLiveChannelHistoryResult()
{
*this = result;
}
GetLiveChannelHistoryResult::GetLiveChannelHistoryResult(const std::shared_ptr<std::iostream>& result):
GetLiveChannelHistoryResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetLiveChannelHistoryResult& GetLiveChannelHistoryResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("LiveChannelHistory", root->Name(), 18)) {
XMLElement *node;
XMLElement *recordNode = root->FirstChildElement("LiveRecord");
for(; recordNode; recordNode = recordNode->NextSiblingElement("LiveRecord"))
{
LiveRecord rec;
node = recordNode->FirstChildElement("StartTime");
if(node && node->GetText())
{
rec.startTime = node->GetText();
}
node = recordNode->FirstChildElement("EndTime");
if(node && node->GetText())
{
rec.endTime = node->GetText();
}
node = recordNode->FirstChildElement("RemoteAddr");
if(node && node->GetText())
{
rec.remoteAddr = node->GetText();
}
recordList_.push_back(rec);
}
parseDone_ = true;
}
}
return *this;
}
const LiveRecordVec& GetLiveChannelHistoryResult::LiveRecordList() const
{
return recordList_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelHistoryResult.cc | C++ | apache-2.0 | 2,771 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelInfoRequest.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
GetLiveChannelInfoRequest::GetLiveChannelInfoRequest(const std::string& bucket,
const std::string& channelName):
LiveChannelRequest(bucket, channelName)
{
}
ParameterCollection GetLiveChannelInfoRequest::specialParameters() const
{
ParameterCollection collection;
collection["live"] = "";
return collection;
}
int GetLiveChannelInfoRequest::validate() const
{
return LiveChannelRequest::validate();
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelInfoRequest.cc | C++ | apache-2.0 | 1,246 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelInfoResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetLiveChannelInfoResult::GetLiveChannelInfoResult() :
OssResult(),
fragDuration_(0),
fragCount_(0)
{
}
GetLiveChannelInfoResult::GetLiveChannelInfoResult(const std::string& result):
GetLiveChannelInfoResult()
{
*this = result;
}
GetLiveChannelInfoResult::GetLiveChannelInfoResult(const std::shared_ptr<std::iostream>& result):
GetLiveChannelInfoResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetLiveChannelInfoResult& GetLiveChannelInfoResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("LiveChannelConfiguration", root->Name(), 24)) {
XMLElement *node;
node = root->FirstChildElement("Description");
if(node && node->GetText())
{
description_ = node->GetText();
}
node = root->FirstChildElement("Status");
if(node && node->GetText())
{
status_ = ToLiveChannelStatusType(node->GetText());
}
XMLElement *targetNode = root->FirstChildElement("Target");
if(targetNode)
{
node = targetNode->FirstChildElement("Type");
if(node && node->GetText())
{
channelType_ = node->GetText();
}
node = targetNode->FirstChildElement("FragDuration");
if(node && node->GetText())
{
fragDuration_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = targetNode->FirstChildElement("FragCount");
if(node && node->GetText())
{
fragCount_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = targetNode->FirstChildElement("PlaylistName");
if(node && node->GetText())
{
playListName_ = node->GetText();
}
}
parseDone_ = true;
}
}
return *this;
}
const std::string& GetLiveChannelInfoResult::Description() const
{
return description_;
}
LiveChannelStatus GetLiveChannelInfoResult::Status() const
{
return status_;
}
const std::string& GetLiveChannelInfoResult::Type() const
{
return channelType_;
}
uint64_t GetLiveChannelInfoResult::FragDuration() const
{
return fragDuration_;
}
uint64_t GetLiveChannelInfoResult::FragCount() const
{
return fragCount_;
}
const std::string& GetLiveChannelInfoResult::PlaylistName() const
{
return playListName_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelInfoResult.cc | C++ | apache-2.0 | 3,847 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelStatRequest.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
GetLiveChannelStatRequest::GetLiveChannelStatRequest(const std::string& bucket,
const std::string& channelName):
LiveChannelRequest(bucket, channelName)
{
}
ParameterCollection GetLiveChannelStatRequest::specialParameters() const
{
ParameterCollection collection;
collection["live"] = "";
collection["comp"] = "stat";
return collection;
}
int GetLiveChannelStatRequest::validate() const
{
return LiveChannelRequest::validate();
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelStatRequest.cc | C++ | apache-2.0 | 1,278 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetLiveChannelStatResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetLiveChannelStatResult::GetLiveChannelStatResult() :
OssResult(),
width_(0),
height_(0),
frameRate_(0),
videoBandWidth_(0),
sampleRate_(0),
audioBandWidth_(0)
{
}
GetLiveChannelStatResult::GetLiveChannelStatResult(const std::string& result):
GetLiveChannelStatResult()
{
*this = result;
}
GetLiveChannelStatResult::GetLiveChannelStatResult(const std::shared_ptr<std::iostream>& result):
GetLiveChannelStatResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetLiveChannelStatResult& GetLiveChannelStatResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("LiveChannelStat", root->Name(), 15)) {
XMLElement *node;
node = root->FirstChildElement("Status");
if(node && node->GetText())
{
status_ = ToLiveChannelStatusType(node->GetText());
}
node = root->FirstChildElement("ConnectedTime");
if(node && node->GetText())
{
connectedTime_ = node->GetText();
}
node = root->FirstChildElement("RemoteAddr");
if(node && node->GetText())
{
remoteAddr_ = node->GetText();
}
XMLElement *videoRoot = root->FirstChildElement("Video");
if(videoRoot)
{
node = videoRoot->FirstChildElement("Width");
if(node && node->GetText())
{
width_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = videoRoot->FirstChildElement("Height");
if(node && node->GetText())
{
height_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = videoRoot->FirstChildElement("FrameRate");
if(node && node->GetText())
{
frameRate_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = videoRoot->FirstChildElement("Bandwidth");
if(node && node->GetText())
{
videoBandWidth_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = videoRoot->FirstChildElement("Codec");
if(node && node->GetText())
{
videoCodec_ = node->GetText();
}
}
XMLElement *audioRoot = root->FirstChildElement("Audio");
if(audioRoot)
{
node = audioRoot->FirstChildElement("Bandwidth");
if(node && node->GetText())
{
audioBandWidth_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = audioRoot->FirstChildElement("SampleRate");
if(node && node->GetText())
{
sampleRate_ = std::strtoull(node->GetText(), nullptr, 10);
}
node = audioRoot->FirstChildElement("Codec");
if(node && node->GetText())
{
audioCodec_ = node->GetText();
}
}
parseDone_ = true;
}
}
return *this;
}
LiveChannelStatus GetLiveChannelStatResult::Status() const
{
return status_;
}
const std::string& GetLiveChannelStatResult::ConnectedTime() const
{
return connectedTime_;
}
const std::string& GetLiveChannelStatResult::RemoteAddr() const
{
return remoteAddr_;
}
uint32_t GetLiveChannelStatResult::Width() const
{
return width_;
}
uint32_t GetLiveChannelStatResult::Height() const
{
return height_;
}
uint64_t GetLiveChannelStatResult::FrameRate() const
{
return frameRate_;
}
uint64_t GetLiveChannelStatResult::VideoBandWidth() const
{
return videoBandWidth_;
}
const std::string& GetLiveChannelStatResult::VideoCodec() const
{
return videoCodec_;
}
uint64_t GetLiveChannelStatResult::SampleRate() const
{
return sampleRate_;
}
uint64_t GetLiveChannelStatResult::AudioBandWidth() const
{
return audioBandWidth_;
}
const std::string& GetLiveChannelStatResult::AudioCodec() const
{
return audioCodec_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetLiveChannelStatResult.cc | C++ | apache-2.0 | 5,564 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectAclRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
GetObjectAclRequest::GetObjectAclRequest(const std::string &bucket, const std::string &key)
:OssObjectRequest(bucket,key)
{
}
ParameterCollection GetObjectAclRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["acl"]="";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectAclRequest.cc | C++ | apache-2.0 | 1,107 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectAclResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetObjectAclResult::GetObjectAclResult() :
OssObjectResult()
{
}
GetObjectAclResult::GetObjectAclResult(const std::string& result):
GetObjectAclResult()
{
*this = result;
}
GetObjectAclResult::GetObjectAclResult(const std::shared_ptr<std::iostream>& result):
GetObjectAclResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetObjectAclResult::GetObjectAclResult(const HeaderCollection& headers, const std::shared_ptr<std::iostream>& result) :
OssObjectResult(headers)
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetObjectAclResult& GetObjectAclResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("AccessControlPolicy", root->Name(), 19)) {
XMLElement *node;
node = root->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
node = root->FirstChildElement("AccessControlList");
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("Grant");
if (sub_node && sub_node->GetText()) acl_ = ToAclType(sub_node->GetText());
}
owner_ = AlibabaCloud::OSS::Owner(owner_ID, owner_DisplayName);
//TODO check the result and the parse flag;
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectAclResult.cc | C++ | apache-2.0 | 2,953 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectByUrlRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include <sstream>
using namespace AlibabaCloud::OSS;
GetObjectByUrlRequest::GetObjectByUrlRequest(const std::string &url):
GetObjectByUrlRequest(url, ObjectMetaData())
{
}
GetObjectByUrlRequest::GetObjectByUrlRequest(const std::string &url, const ObjectMetaData &metaData) :
ServiceRequest(),
metaData_(metaData)
{
setPath(url);
setFlags(Flags()|REQUEST_FLAG_PARAM_IN_PATH|REQUEST_FLAG_CHECK_CRC64);
}
HeaderCollection GetObjectByUrlRequest::Headers() const
{
auto headers = metaData_.toHeaderCollection();
if (!metaData_.hasHeader(Http::DATE)) {
headers[Http::DATE] = "";
}
return headers;
}
ParameterCollection GetObjectByUrlRequest::Parameters() const
{
return ParameterCollection();
}
std::shared_ptr<std::iostream> GetObjectByUrlRequest::Body() const
{
return nullptr;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectByUrlRequest.cc | C++ | apache-2.0 | 1,566 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectMetaRequest.h>
using namespace AlibabaCloud::OSS;
ParameterCollection GetObjectMetaRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["objectMeta"] = "";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectMetaRequest.cc | C++ | apache-2.0 | 913 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
#include "ModelError.h"
#include <set>
#include <sstream>
using namespace AlibabaCloud::OSS;
GetObjectRequest::GetObjectRequest(const std::string &bucket, const std::string &key):
GetObjectRequest(bucket, key, "")
{
}
GetObjectRequest::GetObjectRequest(const std::string &bucket, const std::string &key, const std::string &process) :
OssObjectRequest(bucket, key),
rangeIsSet_(false),
process_(process),
trafficLimit_(0),
rangeIsStandardMode_(false),
userAgent_()
{
setFlags(Flags() | REQUEST_FLAG_CHECK_CRC64);
}
GetObjectRequest::GetObjectRequest(const std::string& bucket, const std::string& key,
const std::string &modifiedSince, const std::string &unmodifiedSince,
const std::vector<std::string> &matchingETags, const std::vector<std::string> &nonmatchingETags,
const std::map<std::string, std::string> &responseHeaderParameters) :
OssObjectRequest(bucket, key),
rangeIsSet_(false),
modifiedSince_(modifiedSince),
unmodifiedSince_(unmodifiedSince),
matchingETags_(matchingETags),
nonmatchingETags_(nonmatchingETags),
process_(""),
responseHeaderParameters_(responseHeaderParameters),
trafficLimit_(0),
rangeIsStandardMode_(false),
userAgent_()
{
}
void GetObjectRequest::setRange(int64_t start, int64_t end)
{
range_[0] = start;
range_[1] = end;
rangeIsSet_ = true;
rangeIsStandardMode_ = false;
}
void GetObjectRequest::setRange(int64_t start, int64_t end, bool standard)
{
range_[0] = start;
range_[1] = end;
rangeIsSet_ = true;
rangeIsStandardMode_ = standard;
}
void GetObjectRequest::setModifiedSinceConstraint(const std::string &gmt)
{
modifiedSince_ = gmt;
}
void GetObjectRequest::setUnmodifiedSinceConstraint(const std::string &gmt)
{
unmodifiedSince_ = gmt;
}
void GetObjectRequest::setMatchingETagConstraints(const std::vector<std::string> &match)
{
matchingETags_ = match;
}
void GetObjectRequest::addMatchingETagConstraint(const std::string &match)
{
matchingETags_.push_back(match);
}
void GetObjectRequest::setNonmatchingETagConstraints(const std::vector<std::string> &match)
{
nonmatchingETags_ = match;
}
void GetObjectRequest::addNonmatchingETagConstraint(const std::string &match)
{
nonmatchingETags_.push_back(match);
}
void GetObjectRequest::setProcess(const std::string &process)
{
process_ = process;
}
void GetObjectRequest::addResponseHeaders(RequestResponseHeader header, const std::string &value)
{
static const char *ResponseHeader[] = {
"response-content-type", "response-content-language",
"response-expires", "response-cache-control",
"response-content-disposition", "response-content-encoding"};
responseHeaderParameters_[ResponseHeader[header - RequestResponseHeader::ContentType]] = value;
}
void GetObjectRequest::setTrafficLimit(uint64_t value)
{
trafficLimit_ = value;
}
void GetObjectRequest::setUserAgent(const std::string& ua)
{
userAgent_ = ua;
}
std::pair<int64_t, int64_t> GetObjectRequest::Range() const
{
int64_t begin = -1;
int64_t end = -1;
if (rangeIsSet_) {
begin = range_[0];
end = range_[1];
}
return std::pair<int64_t, int64_t>(begin, end);
}
int GetObjectRequest::validate() const
{
int ret = OssObjectRequest::validate();
if (ret != 0)
return ret;
if (rangeIsSet_ && (range_[0] < 0 || range_[1] < -1 || (range_[1] > -1 && range_[1] < range_[0]) ))
return ARG_ERROR_OBJECT_RANGE_INVALID;
return 0;
}
HeaderCollection GetObjectRequest::specialHeaders() const
{
auto headers = OssObjectRequest::specialHeaders();
if (rangeIsSet_) {
std::stringstream ss;
ss << "bytes=" << range_[0] << "-";
if (range_[1] != -1) ss << range_[1];
headers[Http::RANGE] = ss.str();
if (rangeIsStandardMode_) {
headers["x-oss-range-behavior"] = "standard";
}
}
if (!modifiedSince_.empty())
{
headers["If-Modified-Since"] = modifiedSince_;
}
if (!unmodifiedSince_.empty())
{
headers["If-Unmodified-Since"] = unmodifiedSince_;
}
if (matchingETags_.size() > 0) {
std::stringstream ss;
bool first = true;
for (auto const& str : matchingETags_) {
if (!first) {
ss << ",";
}
ss << str;
first = false;
}
headers["If-Match"] = ss.str();
}
if (nonmatchingETags_.size() > 0) {
std::stringstream ss;
bool first = true;
for (auto const& str : nonmatchingETags_) {
if (!first) {
ss << ",";
}
ss << str;
first = false;
}
headers["If-None-Match"] = ss.str();
}
if (trafficLimit_ != 0) {
headers["x-oss-traffic-limit"] = std::to_string(trafficLimit_);
}
if (!userAgent_.empty()) {
headers[Http::USER_AGENT] = userAgent_;
}
return headers;
}
ParameterCollection GetObjectRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
for (auto const& param : responseHeaderParameters_) {
parameters[param.first] = param.second;
}
if (!process_.empty()) {
parameters["x-oss-process"] = process_;
}
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectRequest.cc | C++ | apache-2.0 | 6,355 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectResult.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
GetObjectResult::GetObjectResult() :
OssObjectResult()
{
}
GetObjectResult::GetObjectResult(
const std::string &bucket,
const std::string &key,
const std::shared_ptr<std::iostream> &content,
const HeaderCollection &headers):
OssObjectResult(headers),
bucket_(bucket),
key_(key),
content_(content)
{
metaData_ = headers;
std::string etag = metaData_.HttpMetaData()[Http::ETAG];
metaData_.HttpMetaData()[Http::ETAG] = TrimQuotes(etag.c_str());
}
GetObjectResult::GetObjectResult(
const std::string& bucket, const std::string& key,
const ObjectMetaData& metaData) :
bucket_(bucket),
key_(key)
{
metaData_ = metaData;
requestId_ = metaData_.HttpMetaData()["x-oss-request-id"];
versionId_ = metaData_.HttpMetaData()["x-oss-version-id"];
} | YifuLiu/AliOS-Things | components/oss/src/model/GetObjectResult.cc | C++ | apache-2.0 | 1,652 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectTaggingRequest.h>
using namespace AlibabaCloud::OSS;
GetObjectTaggingRequest::GetObjectTaggingRequest(const std::string &bucket, const std::string &key)
:OssObjectRequest(bucket, key)
{
}
ParameterCollection GetObjectTaggingRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["tagging"] = "";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectTaggingRequest.cc | C++ | apache-2.0 | 1,089 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetObjectTaggingResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetObjectTaggingResult::GetObjectTaggingResult() :
OssObjectResult()
{
}
GetObjectTaggingResult::GetObjectTaggingResult(const std::string& result):
GetObjectTaggingResult()
{
*this = result;
}
GetObjectTaggingResult::GetObjectTaggingResult(const std::shared_ptr<std::iostream>& result):
GetObjectTaggingResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetObjectTaggingResult::GetObjectTaggingResult(const HeaderCollection& headers,
const std::shared_ptr<std::iostream>& result):
OssObjectResult(headers)
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetObjectTaggingResult& GetObjectTaggingResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("Tagging", root->Name(), 7)) {
XMLElement* tagSet_node = root->FirstChildElement("TagSet");
if (tagSet_node) {
XMLElement *tag_node = tagSet_node->FirstChildElement("Tag");
for (; tag_node; tag_node = tag_node->NextSiblingElement("Tag")) {
XMLElement *subNode;
Tag tag;
//Key
subNode = tag_node->FirstChildElement("Key");
if (subNode && subNode->GetText()) {
tag.setKey(subNode->GetText());
}
//Value
subNode = tag_node->FirstChildElement("Value");
if (subNode && subNode->GetText()) {
tag.setValue(subNode->GetText());
}
tagging_.addTag(tag);
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetObjectTaggingResult.cc | C++ | apache-2.0 | 2,929 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetSymlinkRequest.h>
using namespace AlibabaCloud::OSS;
GetSymlinkRequest::GetSymlinkRequest(const std::string &bucket, const std::string &key):
OssObjectRequest(bucket, key)
{
}
ParameterCollection GetSymlinkRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["symlink"] = "";
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetSymlinkRequest.cc | C++ | apache-2.0 | 1,031 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetSymlinkResult.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
GetSymlinkResult::GetSymlinkResult():
OssObjectResult()
{
}
GetSymlinkResult::GetSymlinkResult(const std::string& symlink,
const std::string& etag) :
OssObjectResult(),
symlink_(symlink),
etag_(etag)
{
}
GetSymlinkResult::GetSymlinkResult(const HeaderCollection& headers):
OssObjectResult(headers)
{
if (headers.find("x-oss-symlink-target") != headers.end()) {
symlink_ = headers.at("x-oss-symlink-target");
}
if (headers.find(Http::ETAG) != headers.end()) {
etag_ = TrimQuotes(headers.at(Http::ETAG).c_str());
}
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetSymlinkResult.cc | C++ | apache-2.0 | 1,408 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetUserQosInfoRequest.h>
using namespace AlibabaCloud::OSS;
GetUserQosInfoRequest::GetUserQosInfoRequest() :
OssRequest()
{
}
ParameterCollection GetUserQosInfoRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["qosInfo"] = "";
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/GetUserQosInfoRequest.cc | C++ | apache-2.0 | 954 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetUserQosInfoResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
GetUserQosInfoResult::GetUserQosInfoResult() :
OssResult()
{
}
GetUserQosInfoResult::GetUserQosInfoResult(const std::string& result) :
GetUserQosInfoResult()
{
*this = result;
}
GetUserQosInfoResult::GetUserQosInfoResult(const std::shared_ptr<std::iostream>& result) :
GetUserQosInfoResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetUserQosInfoResult& GetUserQosInfoResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("QoSConfiguration", root->Name(), 16)) {
XMLElement* node;
node = root->FirstChildElement("Region");
if (node && node->GetText()) {
region_ = node->GetText();
}
node = root->FirstChildElement("TotalUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setTotalUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setIntranetUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetUploadBandwidth");
if (node && node->GetText()) {
qosInfo_.setExtranetUploadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("TotalDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setTotalDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setIntranetDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetDownloadBandwidth");
if (node && node->GetText()) {
qosInfo_.setExtranetDownloadBandwidth(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("TotalQps");
if (node && node->GetText()) {
qosInfo_.setTotalQps(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("IntranetQps");
if (node && node->GetText()) {
qosInfo_.setIntranetQps(std::strtoll(node->GetText(), nullptr, 10));
}
node = root->FirstChildElement("ExtranetQps");
if (node && node->GetText()) {
qosInfo_.setExtranetQps(std::strtoll(node->GetText(), nullptr, 10));
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetUserQosInfoResult.cc | C++ | apache-2.0 | 3,779 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetVodPlaylistRequest.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
GetVodPlaylistRequest::GetVodPlaylistRequest(const std::string& bucket,
const std::string& channelName)
:GetVodPlaylistRequest(bucket, channelName, 0, 0)
{
}
GetVodPlaylistRequest::GetVodPlaylistRequest(const std::string& bucket,
const std::string& channelName, uint64_t startTime,
uint64_t endTime)
:LiveChannelRequest(bucket, channelName),
startTime_(startTime),
endTime_(endTime)
{
}
void GetVodPlaylistRequest::setStartTime(uint64_t startTime)
{
startTime_ = startTime;
}
void GetVodPlaylistRequest::setEndTime(uint64_t endTime)
{
endTime_ = endTime;
}
int GetVodPlaylistRequest::validate() const
{
int ret = LiveChannelRequest::validate();
if(ret)
{
return ret;
}
if(startTime_ == 0 || endTime_ == 0 ||
endTime_ < startTime_ ||
endTime_ > (startTime_ + SecondsOfDay))
{
return ARG_ERROR_LIVECHANNEL_BAD_TIME_PARAM;
}
return 0;
}
ParameterCollection GetVodPlaylistRequest::specialParameters() const
{
ParameterCollection collection;
collection["startTime"] = std::to_string(startTime_);
collection["endTime"] = std::to_string(endTime_);
collection["vod"] = "";
return collection;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetVodPlaylistRequest.cc | C++ | apache-2.0 | 2,036 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/GetVodPlaylistResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <alibabacloud/oss/model/Bucket.h>
#include <alibabacloud/oss/model/Owner.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
GetVodPlaylistResult::GetVodPlaylistResult():
OssResult()
{
}
GetVodPlaylistResult::GetVodPlaylistResult(const std::string& result):
GetVodPlaylistResult()
{
*this = result;
}
GetVodPlaylistResult::GetVodPlaylistResult(const std::shared_ptr<std::iostream>& result):
GetVodPlaylistResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
GetVodPlaylistResult& GetVodPlaylistResult::operator =(const std::string& result)
{
playListContent_ = result;
parseDone_ = true;
return *this;
}
const std::string& GetVodPlaylistResult::PlaylistContent() const
{
return playListContent_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/GetVodPlaylistResult.cc | C++ | apache-2.0 | 1,570 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/InitiateMultipartUploadRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
#include <sstream>
using namespace AlibabaCloud::OSS;
InitiateMultipartUploadRequest::InitiateMultipartUploadRequest(const std::string &bucket, const std::string &key) :
InitiateMultipartUploadRequest(bucket, key, ObjectMetaData())
{
}
InitiateMultipartUploadRequest::InitiateMultipartUploadRequest(const std::string &bucket, const std::string &key,
const ObjectMetaData &metaData) :
OssObjectRequest(bucket, key),
metaData_(metaData),
encodingTypeIsSet_(false),
sequential_(false)
{
}
void InitiateMultipartUploadRequest::setEncodingType(const std::string &encodingType)
{
encodingType_ = encodingType;
encodingTypeIsSet_ = true;
}
void InitiateMultipartUploadRequest::setCacheControl(const std::string &value)
{
metaData_.addHeader(Http::CACHE_CONTROL, value);
}
void InitiateMultipartUploadRequest::setContentDisposition(const std::string &value)
{
metaData_.addHeader(Http::CONTENT_DISPOSITION, value);
}
void InitiateMultipartUploadRequest::setContentEncoding(const std::string &value)
{
metaData_.addHeader(Http::CONTENT_ENCODING, value);
}
void InitiateMultipartUploadRequest::setExpires(const std::string &value)
{
metaData_.addHeader(Http::EXPIRES, value);
}
void InitiateMultipartUploadRequest::setTagging(const std::string& value)
{
metaData_.addHeader("x-oss-tagging", value);
}
void InitiateMultipartUploadRequest::setSequential(bool value)
{
sequential_ = value;
}
ObjectMetaData &InitiateMultipartUploadRequest::MetaData()
{
return metaData_;
}
HeaderCollection InitiateMultipartUploadRequest::specialHeaders() const
{
auto headers = metaData_.toHeaderCollection();
if (headers.find(Http::CONTENT_TYPE) == headers.end()) {
headers[Http::CONTENT_TYPE] = LookupMimeType(Key());
}
auto baseHeaders = OssObjectRequest::specialHeaders();
headers.insert(baseHeaders.begin(), baseHeaders.end());
return headers;
}
ParameterCollection InitiateMultipartUploadRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["uploads"] = "";
if (encodingTypeIsSet_) {
parameters["encoding-type"] = encodingType_;
}
if (sequential_) {
parameters["sequential"] = "";
}
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/InitiateMultipartUploadRequest.cc | C++ | apache-2.0 | 3,185 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/InitiateMultipartUploadResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
InitiateMultipartUploadResult::InitiateMultipartUploadResult() :
OssResult()
{
}
InitiateMultipartUploadResult::InitiateMultipartUploadResult(const std::string& result):
InitiateMultipartUploadResult()
{
*this = result;
}
InitiateMultipartUploadResult::InitiateMultipartUploadResult(const std::shared_ptr<std::iostream>& result):
InitiateMultipartUploadResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
InitiateMultipartUploadResult& InitiateMultipartUploadResult::operator =(
const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("InitiateMultipartUploadResult", root->Name(), 29)) {
XMLElement *node;
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodingType_ = node->GetText();
//Detect encode type
bool useUrlDecode = !ToLower(encodingType_.c_str()).compare(0, 3, "url", 3);
node = root->FirstChildElement("Bucket");
if (node && node->GetText()) bucket_ = node->GetText();
node = root->FirstChildElement("Key");
if (node && node->GetText()) key_ = useUrlDecode ? UrlDecode(node->GetText()) : node->GetText();
node = root->FirstChildElement("UploadId");
if (node && node->GetText()) uploadId_ = node->GetText();
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/InitiateMultipartUploadResult.cc | C++ | apache-2.0 | 2,480 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/InputFormat.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
using namespace AlibabaCloud::OSS;
static inline std::string CSVHeader_Str(CSVHeader num)
{
static const std::string strings[] = {
"None\0", "Ignore\0", "Use\0"
};
return strings[num];
}
static inline std::string CompressionType_Str(CompressionType num)
{
static const std::string strings[] = {
"NONE\0",
"GZIP\0"
};
return strings[num];
}
static inline std::string JsonType_Str(JsonType num)
{
static const std::string strings[] = {
"DOCUMENT\0",
"LINES\0"
};
return strings[num];
}
static std::string Range_Str(const std::string rangePrefix,
bool isSet, const int64_t range[2])
{
int64_t start = 0, end = 0;
start = range[0];
end = range[1];
if (!isSet ||
(start < 0 && end < 0) ||
(start > 0 && end > 0 && start > end)) {
return "";
}
std::ostringstream ostr;
if (start < 0) {
ostr << rangePrefix << "-" << end;
}
else if (end < 0) {
ostr << rangePrefix << start << "-";
}
else {
ostr << rangePrefix << start << "-" << end;
}
std::string str = ostr.str();
return str;
}
InputFormat::InputFormat() :
compressionType_(CompressionType::NONE),lineRangeIsSet_(false), splitRangeIsSet_(false)
{
}
void InputFormat::setCompressionType(CompressionType compressionType)
{
compressionType_ = compressionType;
}
const std::string InputFormat::CompressionTypeInfo() const
{
std::string str = CompressionType_Str(compressionType_);
return str;
}
void InputFormat::setLineRange(int64_t start, int64_t end)
{
lineRange_[0] = start;
lineRange_[1] = end;
lineRangeIsSet_ = true;
splitRangeIsSet_ = false;
}
void InputFormat::setSplitRange(int64_t start, int64_t end)
{
splitRange_[0] = start;
splitRange_[1] = end;
splitRangeIsSet_ = true;
lineRangeIsSet_ = false;
}
int InputFormat::validate() const
{
if (lineRangeIsSet_ && splitRangeIsSet_) {
return ARG_ERROR_SELECT_OBJECT_RANGE_INVALID;
}
if (lineRangeIsSet_ &&
(lineRange_[0] < 0 || lineRange_[1] < -1 || (lineRange_[1] > -1 && lineRange_[1] < lineRange_[0]))) {
return ARG_ERROR_SELECT_OBJECT_LINE_RANGE_INVALID;
}
if (splitRangeIsSet_ &&
(splitRange_[0] < 0 || splitRange_[1] < -1 || (splitRange_[1] > -1 && splitRange_[1] < splitRange_[0]))) {
return ARG_ERROR_SELECT_OBJECT_SPLIT_RANGE_INVALID;
}
return 0;
}
std::string InputFormat::RangeToString() const
{
if (lineRangeIsSet_ && splitRangeIsSet_) {
return "";
}
if (lineRangeIsSet_) {
return Range_Str("line-range=", lineRangeIsSet_, lineRange_);
}
if (splitRangeIsSet_) {
return Range_Str("split-range=", splitRangeIsSet_, splitRange_);
}
return "";
}
/////////////////////////////////////////////////////////////////////////////////////////
CSVInputFormat::CSVInputFormat()
: CSVInputFormat(CSVHeader::None, "\n", ",", "\"", "#")
{}
CSVInputFormat::CSVInputFormat(CSVHeader headerInfo,
const std::string& recordDelimiter,
const std::string& fieldDelimiter,
const std::string& quoteChar,
const std::string& commentChar):
InputFormat(),
headerInfo_(headerInfo),
recordDelimiter_(recordDelimiter),
fieldDelimiter_(fieldDelimiter),
quoteChar_(quoteChar),
commentChar_(commentChar)
{}
void CSVInputFormat::setHeaderInfo(CSVHeader headerInfo)
{
headerInfo_ = headerInfo;
}
void CSVInputFormat::setCommentChar(const std::string& commentChar)
{
commentChar_ = commentChar;
}
void CSVInputFormat::setQuoteChar(const std::string& quoteChar)
{
quoteChar_ = quoteChar;
}
void CSVInputFormat::setFieldDelimiter(const std::string& fieldDelimiter)
{
fieldDelimiter_ = fieldDelimiter;
}
void CSVInputFormat::setRecordDelimiter(const std::string& recordDelimiter)
{
recordDelimiter_ = recordDelimiter;
}
CSVHeader CSVInputFormat::HeaderInfo() const
{
return headerInfo_;
}
const std::string& CSVInputFormat::RecordDelimiter() const
{
return recordDelimiter_;
}
const std::string& CSVInputFormat::FieldDelimiter() const
{
return fieldDelimiter_;
}
const std::string& CSVInputFormat::QuoteChar() const
{
return quoteChar_;
}
const std::string& CSVInputFormat::CommentChar() const
{
return commentChar_;
}
std::string CSVInputFormat::Type() const
{
return "csv";
}
std::string CSVInputFormat::toXML(int flag) const
{
std::stringstream ss;
ss << "<InputSerialization>" << std::endl;
ss << "<CompressionType>" << InputFormat::CompressionTypeInfo() << "</CompressionType>" << std::endl;
ss << "<CSV>" << std::endl;
ss << "<RecordDelimiter>" << Base64Encode(recordDelimiter_) << "</RecordDelimiter>" << std::endl;
ss << "<FieldDelimiter>" << Base64Encode(fieldDelimiter_.empty() ? "" : std::string(1, fieldDelimiter_.front())) << "</FieldDelimiter>" << std::endl;
ss << "<QuoteCharacter>" << Base64Encode(quoteChar_.empty() ? "" : std::string(1, quoteChar_.front())) << "</QuoteCharacter>" << std::endl;
if (flag == 1) {
ss << "<FileHeaderInfo>" << CSVHeader_Str(headerInfo_) << "</FileHeaderInfo>" << std::endl;
ss << "<CommentCharacter>" << Base64Encode(commentChar_.empty() ? "" : std::string(1, commentChar_.front())) << "</CommentCharacter>" << std::endl;
ss << "<Range>" << InputFormat::RangeToString() << "</Range>" << std::endl;
}
ss << "</CSV>" << std::endl;
ss << "</InputSerialization>" << std::endl;
return ss.str();
}
////////////////////////////////////////////////////////////////////////////////////////
JSONInputFormat::JSONInputFormat()
: InputFormat()
{}
JSONInputFormat::JSONInputFormat(JsonType jsonType)
: InputFormat(), jsonType_(jsonType)
{}
void JSONInputFormat::setJsonType(JsonType jsonType)
{
jsonType_ = jsonType;
}
void JSONInputFormat::setParseJsonNumberAsString(bool parseJsonNumberAsString)
{
parseJsonNumberAsString_ = parseJsonNumberAsString;
}
JsonType JSONInputFormat::JsonInfo() const
{
return jsonType_;
}
bool JSONInputFormat::ParseJsonNumberAsString() const
{
return parseJsonNumberAsString_;
}
std::string JSONInputFormat::Type() const
{
return "json";
}
std::string JSONInputFormat::toXML(int flag) const
{
std::stringstream ss;
ss << "<InputSerialization>" << std::endl;
ss << "<CompressionType>" << InputFormat::CompressionTypeInfo() << "</CompressionType>" << std::endl;
ss << "<JSON>" << std::endl;
if (flag == 1) {
ss << "<Type>" << JsonType_Str(jsonType_) << "</Type>" << std::endl;
ss << "<ParseJsonNumberAsString>" << (parseJsonNumberAsString_ ? "true" : "false") << "</ParseJsonNumberAsString>" << std::endl;
ss << "<Range>" << InputFormat::RangeToString() << "</Range>" << std::endl;
}
else {
ss << "<Type>" << "LINES" << "</Type>" << std::endl;
}
ss << "</JSON>" << std::endl;
ss << "</InputSerialization>" << std::endl;
return ss.str();
} | YifuLiu/AliOS-Things | components/oss/src/model/InputFormat.cc | C++ | apache-2.0 | 7,760 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/InventoryConfiguration.h>
#include "utils/Utils.h"
#include <alibabacloud/oss/Types.h>
#include <sstream>
using namespace AlibabaCloud::OSS;
InventoryFilter::InventoryFilter()
{
}
InventoryFilter::InventoryFilter(const std::string& prefix) :
prefix_(prefix)
{
}
InventorySSEOSS::InventorySSEOSS()
{
}
InventorySSEKMS::InventorySSEKMS()
{
}
InventorySSEKMS::InventorySSEKMS(const std::string& key) :
keyId_(key)
{
}
InventoryEncryption::InventoryEncryption() :
inventorySSEOSIsSet_(false),
inventorySSEKMSIsSet_(false)
{
}
InventoryEncryption::InventoryEncryption(const InventorySSEOSS& value) :
inventorySSEOSS_(value),
inventorySSEOSIsSet_(true),
inventorySSEKMSIsSet_(false)
{
}
InventoryEncryption::InventoryEncryption(const InventorySSEKMS& value) :
inventorySSEOSIsSet_(false),
inventorySSEKMS_(value),
inventorySSEKMSIsSet_(true)
{
}
InventoryOSSBucketDestination::InventoryOSSBucketDestination():
format_(InventoryFormat::NotSet)
{
}
InventoryConfiguration::InventoryConfiguration():
isEnabled_(false),
schedule_(InventoryFrequency::NotSet),
includedObjectVersions_(InventoryIncludedObjectVersions::NotSet)
{
}
| YifuLiu/AliOS-Things | components/oss/src/model/InventoryConfiguration.cc | C++ | apache-2.0 | 1,922 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/LifecycleRule.h>
using namespace AlibabaCloud::OSS;
LifeCycleExpiration::LifeCycleExpiration() :
LifeCycleExpiration(0)
{
}
LifeCycleExpiration::LifeCycleExpiration(uint32_t days) :
days_(days),
createdBeforeDate_()
{
}
LifeCycleExpiration::LifeCycleExpiration(const std::string &createdBeforeDate) :
days_(0),
createdBeforeDate_(createdBeforeDate)
{
}
void LifeCycleExpiration::setDays(uint32_t days)
{
days_ = days;
createdBeforeDate_.clear();
}
void LifeCycleExpiration::setCreatedBeforeDate(const std::string &date)
{
createdBeforeDate_ = date;
days_ = 0;
}
LifeCycleTransition::LifeCycleTransition(const LifeCycleExpiration& expiration, AlibabaCloud::OSS::StorageClass storageClass) :
expiration_(expiration),
storageClass_(storageClass)
{
}
void LifeCycleTransition::setExpiration(const LifeCycleExpiration &expiration)
{
expiration_ = expiration;
}
void LifeCycleTransition::setStorageClass(AlibabaCloud::OSS::StorageClass storageClass)
{
storageClass_ = storageClass;
}
LifecycleRule::LifecycleRule() :
status_(RuleStatus::Enabled),
expiredObjectDeleteMarker_(false)
{
}
bool LifecycleRule::hasExpiration() const
{
return (expiration_.Days() > 0 ||
!expiration_.CreatedBeforeDate().empty() ||
expiredObjectDeleteMarker_);
}
bool LifecycleRule::hasTransitionList() const
{
return !transitionList_.empty();
}
bool LifecycleRule::hasAbortMultipartUpload() const
{
return (abortMultipartUpload_.Days() > 0 || !abortMultipartUpload_.CreatedBeforeDate().empty());
}
bool LifecycleRule::hasNoncurrentVersionExpiration() const
{
return (noncurrentVersionExpiration_.Days() > 0);
}
bool LifecycleRule::hasNoncurrentVersionTransitionList() const
{
return !noncurrentVersionTransitionList_.empty();
}
bool LifecycleRule::operator==(const LifecycleRule& right) const
{
if (id_ != right.id_ ||
prefix_ != right.prefix_ ||
status_ != right.status_) {
return false;
}
if (expiration_.Days() != right.expiration_.Days() ||
expiration_.CreatedBeforeDate() != right.expiration_.CreatedBeforeDate()) {
return false;
}
if (abortMultipartUpload_.Days() != right.abortMultipartUpload_.Days() ||
abortMultipartUpload_.CreatedBeforeDate() != right.abortMultipartUpload_.CreatedBeforeDate()) {
return false;
}
if (transitionList_.size() != right.transitionList_.size()) {
return false;
}
auto first = transitionList_.begin();
auto Rightfirst = right.transitionList_.begin();
for (; first != transitionList_.end(); ) {
if (first->Expiration().Days() != Rightfirst->Expiration().Days() ||
first->Expiration().CreatedBeforeDate() != Rightfirst->Expiration().CreatedBeforeDate() ||
first->StorageClass() != Rightfirst->StorageClass()) {
return false;
}
first++;
Rightfirst++;
}
if (tagSet_.size() != right.tagSet_.size()) {
return false;
}
auto firstTag = tagSet_.begin();
auto RightfirstTag = right.tagSet_.begin();
for (; firstTag != tagSet_.end(); ) {
if (firstTag->Key() != RightfirstTag->Key() ||
firstTag->Value()!= RightfirstTag->Value()) {
return false;
}
firstTag++;
RightfirstTag++;
}
if (expiredObjectDeleteMarker_ != right.expiredObjectDeleteMarker_) {
return false;
}
if (noncurrentVersionExpiration_.Days() != right.noncurrentVersionExpiration_.Days() ||
noncurrentVersionExpiration_.CreatedBeforeDate() != right.noncurrentVersionExpiration_.CreatedBeforeDate()) {
return false;
}
if (noncurrentVersionTransitionList_.size() != right.noncurrentVersionTransitionList_.size()) {
return false;
}
first = noncurrentVersionTransitionList_.begin();
Rightfirst = right.noncurrentVersionTransitionList_.begin();
for (; first != noncurrentVersionTransitionList_.end(); ) {
if (first->Expiration().Days() != Rightfirst->Expiration().Days() ||
first->Expiration().CreatedBeforeDate() != Rightfirst->Expiration().CreatedBeforeDate() ||
first->StorageClass() != Rightfirst->StorageClass()) {
return false;
}
first++;
Rightfirst++;
}
return true;
}
| YifuLiu/AliOS-Things | components/oss/src/model/LifecycleRule.cc | C++ | apache-2.0 | 5,218 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListBucketInventoryConfigurationsRequest.h>
using namespace AlibabaCloud::OSS;
ListBucketInventoryConfigurationsRequest::ListBucketInventoryConfigurationsRequest(const std::string& bucket) :
OssBucketRequest(bucket)
{
}
ParameterCollection ListBucketInventoryConfigurationsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["inventory"] = "";
if (!continuationToken_.empty()) {
parameters["continuation-token"] = continuationToken_;
}
return parameters;
} | YifuLiu/AliOS-Things | components/oss/src/model/ListBucketInventoryConfigurationsRequest.cc | C++ | apache-2.0 | 1,177 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListBucketInventoryConfigurationsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
ListBucketInventoryConfigurationsResult::ListBucketInventoryConfigurationsResult() :
OssResult()
{
}
ListBucketInventoryConfigurationsResult::ListBucketInventoryConfigurationsResult(const std::string& result) :
ListBucketInventoryConfigurationsResult()
{
*this = result;
}
ListBucketInventoryConfigurationsResult::ListBucketInventoryConfigurationsResult(const std::shared_ptr<std::iostream>& result) :
ListBucketInventoryConfigurationsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListBucketInventoryConfigurationsResult& ListBucketInventoryConfigurationsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root = doc.RootElement();
if (root && !std::strncmp("ListInventoryConfigurationsResult", root->Name(), 33)) {
XMLElement* node;
node = root->FirstChildElement("InventoryConfiguration");
for (; node; node = node->NextSiblingElement("InventoryConfiguration")) {
XMLElement* conf_node;
InventoryConfiguration inventoryConfiguration;
conf_node = node->FirstChildElement("Id");
if (conf_node && conf_node->GetText()) inventoryConfiguration.setId(conf_node->GetText());
conf_node = node->FirstChildElement("IsEnabled");
if (conf_node && conf_node->GetText()) inventoryConfiguration.setIsEnabled((std::strncmp(conf_node->GetText(), "true", 4) ? false : true));
conf_node = node->FirstChildElement("Filter");
if (conf_node) {
InventoryFilter filter;
XMLElement* prefix_node = conf_node->FirstChildElement("Prefix");
if (prefix_node && prefix_node->GetText()) filter.setPrefix(prefix_node->GetText());
inventoryConfiguration.setFilter(filter);
}
conf_node = node->FirstChildElement("Destination");
if (conf_node) {
XMLElement* next_node;
next_node = conf_node->FirstChildElement("OSSBucketDestination");
if (next_node) {
XMLElement* sub_node;
InventoryOSSBucketDestination dest;
sub_node = next_node->FirstChildElement("Format");
if (sub_node && sub_node->GetText()) dest.setFormat(ToInventoryFormatType(sub_node->GetText()));
sub_node = next_node->FirstChildElement("AccountId");
if (sub_node && sub_node->GetText()) dest.setAccountId(sub_node->GetText());
sub_node = next_node->FirstChildElement("RoleArn");
if (sub_node && sub_node->GetText()) dest.setRoleArn(sub_node->GetText());
sub_node = next_node->FirstChildElement("Bucket");
if (sub_node && sub_node->GetText()) dest.setBucket(ToInventoryBucketShortName(sub_node->GetText()));
sub_node = next_node->FirstChildElement("Prefix");
if (sub_node && sub_node->GetText()) dest.setPrefix(sub_node->GetText());
sub_node = next_node->FirstChildElement("Encryption");
if (sub_node) {
InventoryEncryption encryption;
XMLElement* sse_node;
sse_node = sub_node->FirstChildElement("SSE-KMS");
if (sse_node) {
InventorySSEKMS ssekms;
XMLElement* key_node;
key_node = sse_node->FirstChildElement("KeyId");
if (key_node && key_node->GetText()) ssekms.setKeyId(key_node->GetText());
encryption.setSSEKMS(ssekms);
}
sse_node = sub_node->FirstChildElement("SSE-OSS");
if (sse_node) {
encryption.setSSEOSS(InventorySSEOSS());
}
dest.setEncryption(encryption);
}
inventoryConfiguration.setDestination(InventoryDestination(dest));
}
}
conf_node = node->FirstChildElement("Schedule");
if (conf_node) {
XMLElement* freq_node = conf_node->FirstChildElement("Frequency");
if (freq_node && freq_node->GetText()) inventoryConfiguration.setSchedule(ToInventoryFrequencyType(freq_node->GetText()));
}
conf_node = node->FirstChildElement("IncludedObjectVersions");
if (conf_node && conf_node->GetText()) inventoryConfiguration.setIncludedObjectVersions(ToInventoryIncludedObjectVersionsType(conf_node->GetText()));
conf_node = node->FirstChildElement("OptionalFields");
if (conf_node) {
InventoryOptionalFields field;
XMLElement* field_node = conf_node->FirstChildElement("Field");
for (; field_node; field_node = field_node->NextSiblingElement()) {
if (field_node->GetText())
field.push_back(ToInventoryOptionalFieldType(field_node->GetText()));
}
inventoryConfiguration.setOptionalFields(field);
}
inventoryConfigurationList_.push_back(inventoryConfiguration);
}
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) isTruncated_ = (std::strncmp(node->GetText(), "true", 4) ? false : true);
node = root->FirstChildElement("NextContinuationToken");
if (node && node->GetText()) nextContinuationToken_ = node->GetText();
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListBucketInventoryConfigurationsResult.cc | C++ | apache-2.0 | 7,031 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListBucketsRequest.h>
using namespace AlibabaCloud::OSS;
ListBucketsRequest::ListBucketsRequest() :
OssRequest(),
prefixIsSet_(false),
markerIsSet_(false),
maxKeysIsSet_(false),
tagIsSet(false)
{
}
ListBucketsRequest::ListBucketsRequest(const std::string& prefix, const std::string& marker, int maxKeys) :
OssRequest(),
prefix_(prefix), prefixIsSet_(true),
marker_(marker), markerIsSet_(true),
maxKeys_(maxKeys), maxKeysIsSet_(true),
tagIsSet(false)
{
}
ParameterCollection ListBucketsRequest::specialParameters() const
{
ParameterCollection params;
if (prefixIsSet_) params["prefix"] = prefix_;
if (markerIsSet_) params["marker"] = marker_;
if (maxKeysIsSet_) params["max-keys"] = std::to_string(maxKeys_);
if (tagIsSet) {
if (!tag_.Key().empty()) {
params["tag-key"] = tag_.Key();
if (!tag_.Value().empty()) {
params["tag-value"] = tag_.Value();
}
}
}
return params;
} | YifuLiu/AliOS-Things | components/oss/src/model/ListBucketsRequest.cc | C++ | apache-2.0 | 1,668 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListBucketsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <alibabacloud/oss/model/Bucket.h>
#include <alibabacloud/oss/model/Owner.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
ListBucketsResult::ListBucketsResult():
OssResult(),
prefix_(),
marker_(),
nextMarker_(),
isTruncated_(false),
maxKeys_()
{
}
ListBucketsResult::ListBucketsResult(const std::string& result):
ListBucketsResult()
{
*this = result;
}
ListBucketsResult::ListBucketsResult(const std::shared_ptr<std::iostream>& result):
ListBucketsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListBucketsResult& ListBucketsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListAllMyBucketsResult", root->Name(), 22)) {
XMLElement *node;
node = root->FirstChildElement("Prefix");
if (node && node->GetText()) prefix_ = node->GetText();
node = root->FirstChildElement("Marker");
if (node && node->GetText()) marker_ = node->GetText();
node = root->FirstChildElement("MaxKeys");
if (node && node->GetText()) maxKeys_ = atoi(node->GetText());
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) isTruncated_ = !std::strncmp("true", node->GetText(), 4);
node = root->FirstChildElement("NextMarker");
if (node && node->GetText()) nextMarker_ = node->GetText();
node = root->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
Owner owner(owner_ID, owner_DisplayName);
//buckets
XMLElement *buckets_node = root->FirstChildElement("Buckets");
if (buckets_node) {
XMLElement *bucket_node = buckets_node->FirstChildElement("Bucket");
for (; bucket_node; bucket_node = bucket_node->NextSiblingElement()) {
Bucket bucket;
node = bucket_node->FirstChildElement("CreationDate");
if (node && node->GetText()) bucket.creationDate_ = node->GetText();
node = bucket_node->FirstChildElement("ExtranetEndpoint");
if (node && node->GetText()) bucket.extranetEndpoint_ = node->GetText();
node = bucket_node->FirstChildElement("IntranetEndpoint");
if (node && node->GetText()) bucket.intranetEndpoint_ = node->GetText();
node = bucket_node->FirstChildElement("Location");
if (node && node->GetText()) bucket.location_ = node->GetText();
node = bucket_node->FirstChildElement("Name");
if (node && node->GetText()) bucket.name_ = node->GetText();
node = bucket_node->FirstChildElement("StorageClass");
if (node && node->GetText()) bucket.storageClass_ = ToStorageClassType(node->GetText());
bucket.owner_ = owner;
buckets_.push_back(bucket);
}
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListBucketsResult.cc | C++ | apache-2.0 | 4,524 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListLiveChannelRequest.h>
#include <sstream>
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
ListLiveChannelRequest::ListLiveChannelRequest(const std::string &bucket):
OssBucketRequest(bucket),
maxKeys_(100)
{
}
ParameterCollection ListLiveChannelRequest::specialParameters() const
{
ParameterCollection colletion;
colletion["live"] = "";
if(!marker_.empty())
{
colletion["marker"] = marker_;
}
if(!prefix_.empty())
{
colletion["prefix"] = prefix_;
}
if(0 != maxKeys_)
{
colletion["max-keys"] = std::to_string(maxKeys_);
}
return colletion;
}
int ListLiveChannelRequest::validate() const
{
if(0 == maxKeys_ || MaxListLiveChannelKeys < maxKeys_)
{
return ARG_ERROR_LIVECHANNEL_BAD_MAXKEY_PARAM;
}
return OssBucketRequest::validate();
}
void ListLiveChannelRequest::setMarker(const std::string &marker)
{
marker_ = marker;
}
void ListLiveChannelRequest::setPrefix(const std::string &prefix)
{
prefix_ = prefix;
}
void ListLiveChannelRequest::setMaxKeys(uint32_t maxKeys)
{
maxKeys_ = maxKeys;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListLiveChannelRequest.cc | C++ | apache-2.0 | 1,811 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListLiveChannelResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <alibabacloud/oss/model/Bucket.h>
#include <alibabacloud/oss/model/Owner.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
ListLiveChannelResult::ListLiveChannelResult():
OssResult(),maxKeys_(0)
{
}
ListLiveChannelResult::ListLiveChannelResult(const std::string& result):
ListLiveChannelResult()
{
*this = result;
}
ListLiveChannelResult::ListLiveChannelResult(const std::shared_ptr<std::iostream>& result):
ListLiveChannelResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListLiveChannelResult& ListLiveChannelResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListLiveChannelResult", root->Name(), 21)) {
XMLElement *node;
node = root->FirstChildElement("Prefix");
if(node && node->GetText())
{
prefix_ = node->GetText();
}
node = root->FirstChildElement("Marker");
if(node && node->GetText())
{
marker_ = node->GetText();
}
node = root->FirstChildElement("MaxKeys");
if(node && node->GetText())
{
maxKeys_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = root->FirstChildElement("IsTruncated");
if(node && node->GetText())
{
isTruncated_ = node->BoolText();
}
node = root->FirstChildElement("NextMarker");
if(node && node->GetText())
{
nextMarker_ = node->GetText();
}
XMLNode *livechannelNode = root->FirstChildElement("LiveChannel");
for(; livechannelNode; livechannelNode = livechannelNode->NextSiblingElement("LiveChannel"))
{
LiveChannelInfo info;
node = livechannelNode->FirstChildElement("Name");
if(node && node->GetText())
{
info.name = node->GetText();
}
node = livechannelNode->FirstChildElement("Description");
if(node && node->GetText())
{
info.description = node->GetText();
}
node = livechannelNode->FirstChildElement("Status");
if(node && node->GetText())
{
info.status = node->GetText();
}
node = livechannelNode->FirstChildElement("LastModified");
if(node && node->GetText())
{
info.lastModified = node->GetText();
}
XMLNode *publishNode = livechannelNode->FirstChildElement("PublishUrls");
if(publishNode)
{
node = publishNode->FirstChildElement("Url");
if(node && node->GetText())
{
info.publishUrl = node->GetText();
}
}
XMLNode *playNode = livechannelNode->FirstChildElement("PlayUrls");
if(playNode)
{
node = playNode->FirstChildElement("Url");
if(node && node->GetText())
{
info.playUrl = node->GetText();
}
}
liveChannelList_.push_back(info);
}
parseDone_ = true;
}
}
return *this;
}
const std::string& ListLiveChannelResult::Marker() const
{
return marker_;
}
uint32_t ListLiveChannelResult::MaxKeys() const
{
return maxKeys_;
}
const std::string& ListLiveChannelResult::Prefix() const
{
return prefix_;
}
const std::string& ListLiveChannelResult::NextMarker() const
{
return nextMarker_;
}
bool ListLiveChannelResult::IsTruncated() const
{
return isTruncated_;
}
const LiveChannelListInfo& ListLiveChannelResult::LiveChannelList() const
{
return liveChannelList_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListLiveChannelResult.cc | C++ | apache-2.0 | 5,223 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sstream>
#include <alibabacloud/oss/model/ListMultipartUploadsRequest.h>
#include "utils/Utils.h"
#include "ModelError.h"
#include <alibabacloud/oss/Const.h>
using namespace AlibabaCloud::OSS;
using std::stringstream;
ListMultipartUploadsRequest::ListMultipartUploadsRequest(const std::string &bucket):
OssBucketRequest(bucket),
delimiterIsSet_(false),
keyMarkerIsSet_(false),
prefixIsSet_(false),
uploadIdMarkerIsSet_(false),
encodingTypeIsSet_(false),
maxUploadsIsSet_(false),
requestPayer_(RequestPayer::NotSet)
{
}
void ListMultipartUploadsRequest::setDelimiter(const std::string &delimiter)
{
delimiter_ = delimiter;
delimiterIsSet_ = true;
}
void ListMultipartUploadsRequest::setMaxUploads(uint32_t maxUploads)
{
maxUploads_ = maxUploads > MaxUploads ? MaxUploads : maxUploads;
maxUploadsIsSet_ = true;
}
void ListMultipartUploadsRequest::setKeyMarker(const std::string &keyMarker)
{
keyMarker_ = keyMarker;
keyMarkerIsSet_ = true;
}
void ListMultipartUploadsRequest::setPrefix(const std::string &prefix)
{
prefix_ = prefix;
prefixIsSet_ = true;
}
void ListMultipartUploadsRequest::setUploadIdMarker(const std::string &uploadIdMarker)
{
uploadIdMarker_ = uploadIdMarker;
uploadIdMarkerIsSet_ = true;
}
void ListMultipartUploadsRequest::setEncodingType(const std::string &encodingType)
{
encodingType_ = encodingType;
encodingTypeIsSet_ = true;
}
void ListMultipartUploadsRequest::setRequestPayer(RequestPayer value)
{
requestPayer_ = value;
}
ParameterCollection ListMultipartUploadsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["uploads"] = "";
if(delimiterIsSet_){
parameters["delimiter"] = delimiter_;
}
if (maxUploadsIsSet_) {
parameters["max-uploads"] = std::to_string(maxUploads_);
}
if(keyMarkerIsSet_){
parameters["key-marker"] = keyMarker_;
if (uploadIdMarkerIsSet_) {
parameters["upload-id-marker"] = uploadIdMarker_;
}
}
if(prefixIsSet_){
parameters["prefix"] = prefix_;
}
if(encodingTypeIsSet_){
parameters["encoding-type"] = encodingType_;
}
return parameters;
}
HeaderCollection ListMultipartUploadsRequest::specialHeaders() const
{
HeaderCollection headers;
if (requestPayer_ == RequestPayer::Requester) {
headers["x-oss-request-payer"] = ToLower(ToRequestPayerName(RequestPayer::Requester));
}
return headers;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListMultipartUploadsRequest.cc | C++ | apache-2.0 | 3,150 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sstream>
#include <alibabacloud/oss/model/ListMultipartUploadsResult.h>
#include <alibabacloud/oss/model/Owner.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
using std::stringstream;
ListMultipartUploadsResult::ListMultipartUploadsResult() :
OssResult(),
maxUploads_(0),
isTruncated_(false)
{
}
ListMultipartUploadsResult::ListMultipartUploadsResult(
const std::string& result):
ListMultipartUploadsResult()
{
*this = result;
}
ListMultipartUploadsResult::ListMultipartUploadsResult(
const std::shared_ptr<std::iostream>& result):
ListMultipartUploadsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListMultipartUploadsResult& ListMultipartUploadsResult::operator =(
const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListMultipartUploadsResult", root->Name(), 26)) {
XMLElement *node;
node = root->FirstChildElement("Bucket");
if (node && node->GetText()) {
bucket_ = node->GetText();
}
node = root->FirstChildElement("EncodingType");
bool isUrlEncode = false;
if (node && node->GetText()) {
encodingType_ = node->GetText();
isUrlEncode = !ToLower(encodingType_.c_str()).compare(0, 3, "url", 3);
}
node = root->FirstChildElement("KeyMarker");
if(node && node->GetText())
{
keyMarker_ = isUrlEncode ? UrlDecode(node->GetText()) : node->GetText();
}
node = root->FirstChildElement("UploadIdMarker");
if(node && node->GetText())
{
uploadIdMarker_ = node->GetText();
}
node = root->FirstChildElement("NextKeyMarker");
if(node && node->GetText())
{
nextKeyMarker_ = isUrlEncode ?
UrlDecode(node->GetText()) : node->GetText();
}
node = root->FirstChildElement("NextUploadIdMarker");
if(node && node->GetText())
{
nextUploadIdMarker_ = node->GetText();
}
node = root->FirstChildElement("MaxUploads");
if(node && node->GetText())
{
maxUploads_ = std::strtoul(node->GetText(), nullptr, 10);
}
//CommonPrefixes
node = root->FirstChildElement("CommonPrefixes");
for (; node; node = node->NextSiblingElement("CommonPrefixes")) {
XMLElement *prefix_node = node->FirstChildElement("Prefix");
if (prefix_node && prefix_node->GetText()) commonPrefixes_.push_back(
(isUrlEncode ? UrlDecode(prefix_node->GetText()) : prefix_node->GetText()));
}
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) {
isTruncated_ = node->BoolText();
}
XMLElement * uploadNode = root->FirstChildElement("Upload");
for( ; uploadNode ; uploadNode = uploadNode->NextSiblingElement("Upload"))
{
MultipartUpload rec;
node = uploadNode->FirstChildElement("Key");
if(node && node->GetText())
{
rec.Key = isUrlEncode ? UrlDecode(node->GetText()) : node->GetText();
}
node = uploadNode->FirstChildElement("UploadId");
if(node && node->GetText())
{
rec.UploadId = node->GetText();
}
node = uploadNode->FirstChildElement("Initiated");
if(node && node->GetText())
{
rec.Initiated = node->GetText();
}
multipartUploadList_.push_back(rec);
}
parseDone_ = true;
}
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListMultipartUploadsResult.cc | C++ | apache-2.0 | 5,017 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListObjectVersionsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <alibabacloud/oss/model/Owner.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
ListObjectVersionsResult::ListObjectVersionsResult() :
OssResult(),
name_(),
prefix_(),
keyMarker_(),
nextKeyMarker_(),
versionIdMarker_(),
nextVersionIdMarker_(),
delimiter_(),
encodingType_(),
isTruncated_(false),
maxKeys_(),
commonPrefixes_(),
objectVersionSummarys_(),
deleteMarkerSummarys_()
{
}
ListObjectVersionsResult::ListObjectVersionsResult(const std::string& result):
ListObjectVersionsResult()
{
*this = result;
}
ListObjectVersionsResult::ListObjectVersionsResult(const std::shared_ptr<std::iostream>& result):
ListObjectVersionsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListObjectVersionsResult& ListObjectVersionsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListVersionsResult", root->Name(), 18)) {
XMLElement *node;
node = root->FirstChildElement("Name");
if (node && node->GetText()) name_ = node->GetText();
node = root->FirstChildElement("Prefix");
if (node && node->GetText()) prefix_ = node->GetText();
node = root->FirstChildElement("KeyMarker");
if (node && node->GetText()) keyMarker_ = node->GetText();
node = root->FirstChildElement("NextKeyMarker");
if (node && node->GetText()) nextKeyMarker_ = node->GetText();
node = root->FirstChildElement("VersionIdMarker");
if (node && node->GetText()) versionIdMarker_ = node->GetText();
node = root->FirstChildElement("NextVersionIdMarker");
if (node && node->GetText()) nextVersionIdMarker_ = node->GetText();
node = root->FirstChildElement("Delimiter");
if (node && node->GetText()) delimiter_ = node->GetText();
node = root->FirstChildElement("MaxKeys");
if (node && node->GetText()) maxKeys_ = atoi(node->GetText());
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) isTruncated_ = !std::strncmp("true", node->GetText(), 4);
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodingType_ = node->GetText();
//Detect encode type
bool useUrlDecode = !ToLower(encodingType_.c_str()).compare(0, 3, "url", 3);
//CommonPrefixes
node = root->FirstChildElement("CommonPrefixes");
for (; node; node = node->NextSiblingElement("CommonPrefixes")) {
XMLElement *prefix_node = node->FirstChildElement("Prefix");
if (prefix_node && prefix_node->GetText()) commonPrefixes_.push_back(
(useUrlDecode ? UrlDecode(prefix_node->GetText()) : prefix_node->GetText()));
}
//Version
XMLElement *contents_node = root->FirstChildElement("Version");
for (; contents_node; contents_node = contents_node->NextSiblingElement("Version")) {
ObjectVersionSummary content;
node = contents_node->FirstChildElement("Key");
if (node && node->GetText()) content.key_ = useUrlDecode ? UrlDecode(node->GetText()) : node->GetText();
node = contents_node->FirstChildElement("VersionId");
if (node && node->GetText()) content.versionid_ = node->GetText();
node = contents_node->FirstChildElement("IsLatest");
if (node && node->GetText()) content.isLatest_ = !std::strncmp("true", node->GetText(), 4);
node = contents_node->FirstChildElement("LastModified");
if (node && node->GetText()) content.lastModified_ = node->GetText();
node = contents_node->FirstChildElement("ETag");
if (node && node->GetText()) content.eTag_ = TrimQuotes(node->GetText());
node = contents_node->FirstChildElement("Size");
if (node && node->GetText()) content.size_ = std::atoll(node->GetText());
node = contents_node->FirstChildElement("StorageClass");
if (node && node->GetText()) content.storageClass_ = ToStorageClassType(node->GetText());
node = contents_node->FirstChildElement("Type");
if (node && node->GetText()) content.type_ = node->GetText();
node = contents_node->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
content.owner_ = Owner(owner_ID, owner_DisplayName);
objectVersionSummarys_.push_back(content);
}
//DeleteMarker
contents_node = root->FirstChildElement("DeleteMarker");
for (; contents_node; contents_node = contents_node->NextSiblingElement("DeleteMarker")) {
DeleteMarkerSummary content;
node = contents_node->FirstChildElement("Key");
if (node && node->GetText()) content.key_ = useUrlDecode ? UrlDecode(node->GetText()) : node->GetText();
node = contents_node->FirstChildElement("VersionId");
if (node && node->GetText()) content.versionid_ = node->GetText();
node = contents_node->FirstChildElement("IsLatest");
if (node && node->GetText()) content.isLatest_ = !std::strncmp("true", node->GetText(), 4);
node = contents_node->FirstChildElement("LastModified");
if (node && node->GetText()) content.lastModified_ = node->GetText();
node = contents_node->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
content.owner_ = Owner(owner_ID, owner_DisplayName);
deleteMarkerSummarys_.push_back(content);
}
//EncodingType
if (useUrlDecode) {
delimiter_ = UrlDecode(delimiter_);
keyMarker_ = UrlDecode(keyMarker_);
nextKeyMarker_ = UrlDecode(nextKeyMarker_);
prefix_ = UrlDecode(prefix_);
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListObjectVersionsResult.cc | C++ | apache-2.0 | 8,322 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListObjectsRequest.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
ParameterCollection ListObjectsRequest::specialParameters() const
{
ParameterCollection params;
if (delimiterIsSet_) params["delimiter"] = delimiter_;
if (markerIsSet_) params["marker"] = marker_;
if (maxKeysIsSet_) params["max-keys"] = std::to_string(maxKeys_);
if (prefixIsSet_) params["prefix"] = prefix_;
if (encodingTypeIsSet_) params["encoding-type"] = encodingType_;
return params;
}
HeaderCollection ListObjectsRequest::specialHeaders() const
{
HeaderCollection headers;
if (requestPayer_ == RequestPayer::Requester) {
headers["x-oss-request-payer"] = ToLower(ToRequestPayerName(RequestPayer::Requester));
}
return headers;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListObjectsRequest.cc | C++ | apache-2.0 | 1,433 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ListObjectsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include <alibabacloud/oss/model/Owner.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
ListObjectsResult::ListObjectsResult() :
OssResult(),
name_(),
prefix_(),
marker_(),
delimiter_(),
nextMarker_(),
isTruncated_(false),
maxKeys_(),
commonPrefixes_(),
objectSummarys_()
{
}
ListObjectsResult::ListObjectsResult(const std::string& result):
ListObjectsResult()
{
*this = result;
}
ListObjectsResult::ListObjectsResult(const std::shared_ptr<std::iostream>& result):
ListObjectsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListObjectsResult& ListObjectsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListBucketResult", root->Name(), 16)) {
XMLElement *node;
node = root->FirstChildElement("Name");
if (node && node->GetText()) name_ = node->GetText();
node = root->FirstChildElement("Prefix");
if (node && node->GetText()) prefix_ = node->GetText();
node = root->FirstChildElement("Marker");
if (node && node->GetText()) marker_ = node->GetText();
node = root->FirstChildElement("Delimiter");
if (node && node->GetText()) delimiter_ = node->GetText();
node = root->FirstChildElement("MaxKeys");
if (node && node->GetText()) maxKeys_ = atoi(node->GetText());
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) isTruncated_ = !std::strncmp("true", node->GetText(), 4);
node = root->FirstChildElement("NextMarker");
if (node && node->GetText()) nextMarker_ = node->GetText();
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodingType_ = node->GetText();
//Detect encode type
bool useUrlDecode = !ToLower(encodingType_.c_str()).compare(0, 3, "url", 3);
//CommonPrefixes
node = root->FirstChildElement("CommonPrefixes");
for (; node; node = node->NextSiblingElement("CommonPrefixes")) {
XMLElement *prefix_node = node->FirstChildElement("Prefix");
if (prefix_node && prefix_node->GetText()) commonPrefixes_.push_back(
(useUrlDecode ? UrlDecode(prefix_node->GetText()) : prefix_node->GetText()));
}
//Contents
XMLElement *contents_node = root->FirstChildElement("Contents");
for (; contents_node; contents_node = contents_node->NextSiblingElement("Contents")) {
ObjectSummary content;
node = contents_node->FirstChildElement("Key");
if (node && node->GetText()) content.key_ = useUrlDecode ? UrlDecode(node->GetText()) : node->GetText();
node = contents_node->FirstChildElement("LastModified");
if (node && node->GetText()) content.lastModified_ = node->GetText();
node = contents_node->FirstChildElement("ETag");
if (node && node->GetText()) content.eTag_ = TrimQuotes(node->GetText());
node = contents_node->FirstChildElement("Size");
if (node && node->GetText()) content.size_ = std::atoll(node->GetText());
node = contents_node->FirstChildElement("StorageClass");
if (node && node->GetText()) content.storageClass_ = ToStorageClassType(node->GetText());
node = contents_node->FirstChildElement("Type");
if (node && node->GetText()) content.type_ = node->GetText();
node = contents_node->FirstChildElement("Owner");
std::string owner_ID, owner_DisplayName;
if (node) {
XMLElement *sub_node;
sub_node = node->FirstChildElement("ID");
if (sub_node && sub_node->GetText()) owner_ID = sub_node->GetText();
sub_node = node->FirstChildElement("DisplayName");
if (sub_node && sub_node->GetText()) owner_DisplayName = sub_node->GetText();
}
content.owner_ = Owner(owner_ID, owner_DisplayName);
objectSummarys_.push_back(content);
}
//EncodingType
if (useUrlDecode) {
delimiter_ = UrlDecode(delimiter_);
marker_ = UrlDecode(marker_);
nextMarker_ = UrlDecode(nextMarker_);
prefix_ = UrlDecode(prefix_);
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
return *this;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListObjectsResult.cc | C++ | apache-2.0 | 5,823 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <set>
#include <sstream>
#include <alibabacloud/oss/model/ListPartsRequest.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
#include "ModelError.h"
#include <alibabacloud/oss/Const.h>
using namespace AlibabaCloud::OSS;
using std::stringstream;
ListPartsRequest::ListPartsRequest(const std::string &bucket,
const std::string &key) :
ListPartsRequest(bucket, key, std::string())
{
}
ListPartsRequest::ListPartsRequest(const std::string &bucket,
const std::string &key, const std::string &uploadId) :
OssObjectRequest(bucket, key),
uploadId_(uploadId),
maxPartsIsSet_(false),
partNumberMarkerIsSet_(false),
encodingTypeIsSet_(false)
{
}
void ListPartsRequest::setUploadId(const std::string &uploadId)
{
uploadId_ = uploadId;
}
void ListPartsRequest::setEncodingType(const std::string &str)
{
encodingType_ = str;
encodingTypeIsSet_ = true;
}
void ListPartsRequest::setMaxParts(uint32_t maxParts)
{
maxParts_ = maxParts > MaxReturnedKeys ? MaxReturnedKeys: maxParts;
maxPartsIsSet_ = true;
}
void ListPartsRequest::setPartNumberMarker(uint32_t partNumberMarker)
{
partNumberMarker_ = partNumberMarker;
partNumberMarkerIsSet_ = true;
}
ParameterCollection ListPartsRequest::specialParameters() const
{
ParameterCollection parameters;
parameters["uploadId"] = uploadId_;
if (maxPartsIsSet_) {
parameters["max-parts"] = std::to_string(maxParts_);
}
if (partNumberMarkerIsSet_) {
parameters["part-number-marker"] = std::to_string(partNumberMarker_);
}
if (encodingTypeIsSet_) {
parameters["encoding-type"] = encodingType_;
}
return parameters;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListPartsRequest.cc | C++ | apache-2.0 | 2,333 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sstream>
#include <alibabacloud/oss/model/ListPartsResult.h>
#include <external/tinyxml2/tinyxml2.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
using namespace tinyxml2;
using std::stringstream;
ListPartsResult::ListPartsResult():
OssResult(),
maxParts_(0),
partNumberMarker_(0),
nextPartNumberMarker_(0),
isTruncated_(false)
{
}
ListPartsResult::ListPartsResult(const std::string& result):
ListPartsResult()
{
*this = result;
}
ListPartsResult::ListPartsResult(const std::shared_ptr<std::iostream>& result):
ListPartsResult()
{
std::istreambuf_iterator<char> isb(*result.get()), end;
std::string str(isb, end);
*this = str;
}
ListPartsResult& ListPartsResult::operator =(const std::string& result)
{
XMLDocument doc;
XMLError xml_err;
if ((xml_err = doc.Parse(result.c_str(), result.size())) == XML_SUCCESS) {
XMLElement* root =doc.RootElement();
if (root && !std::strncmp("ListPartsResult", root->Name(), 15)) {
XMLElement *node;
node = root->FirstChildElement("EncodingType");
if (node && node->GetText()) encodingType_ = node->GetText();
//Detect encode type
bool useUrlDecode = !ToLower(encodingType_.c_str()).compare(0, 3, "url", 3);
node = root->FirstChildElement("Bucket");
if (node && node->GetText()) bucket_ = node->GetText();
node = root->FirstChildElement("Key");
if (node && node->GetText()) key_ = useUrlDecode ? UrlDecode(node->GetText()) : node->GetText();
node = root->FirstChildElement("UploadId");
if (node && node->GetText()) uploadId_ = node->GetText();
node = root->FirstChildElement("PartNumberMarker");
if(node && node->GetText())
{
partNumberMarker_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = root->FirstChildElement("NextPartNumberMarker");
if(node && node->GetText())
{
nextPartNumberMarker_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = root->FirstChildElement("MaxParts");
if (node && node->GetText())
{
maxParts_ = std::strtoul(node->GetText(), nullptr, 10);
}
node = root->FirstChildElement("IsTruncated");
if (node && node->GetText()) isTruncated_ = node->BoolText();
XMLElement * partNode = root->FirstChildElement("Part");
for( ; partNode ; partNode = partNode->NextSiblingElement("Part"))
{
Part part;
node = partNode->FirstChildElement("PartNumber");
if(node && node->GetText())
{
part.partNumber_ = std::atoi(node->GetText());
}
node = partNode->FirstChildElement("LastModified");
if(node && node->GetText()) part.lastModified_ = node->GetText();
node = partNode->FirstChildElement("ETag");
if (node && node->GetText()) part.eTag_ = TrimQuotes(node->GetText());
node = partNode->FirstChildElement("Size");
if(node && node->GetText())
{
part.size_ = std::strtoll(node->GetText(), nullptr, 10);
}
node = partNode->FirstChildElement("HashCrc64ecma");
if(node && node->GetText())
{
part.cRC64_ = std::strtoull(node->GetText(), nullptr, 10);
}
partList_.push_back(part);
}
}
//TODO check the result and the parse flag;
parseDone_ = true;
}
return *this;
}
const std::string& ListPartsResult::UploadId() const
{
return uploadId_;
}
const std::string& ListPartsResult::Key() const
{
return key_;
}
const std::string& ListPartsResult::Bucket() const
{
return bucket_;
}
const std::string& ListPartsResult::EncodingType() const
{
return encodingType_;
}
uint32_t ListPartsResult::MaxParts() const
{
return maxParts_;
}
uint32_t ListPartsResult::PartNumberMarker() const
{
return partNumberMarker_;
}
uint32_t ListPartsResult::NextPartNumberMarker() const
{
return nextPartNumberMarker_;
}
const PartList& ListPartsResult::PartList() const
{
return partList_;
}
bool ListPartsResult::IsTruncated() const
{
return isTruncated_;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ListPartsResult.cc | C++ | apache-2.0 | 5,312 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ModelError.h"
using namespace AlibabaCloud::OSS;
static const char * GetArgErrorMsg(const int code)
{
static const char * msg[] =
{
"Argument is invalid, please check.",
/*Common 1-2*/
"The bucket name is invalid. A bucket name must be comprised of lower-case characters, numbers or dash(-) with 3-63 characters long.",
"The object key is invalid. An object name should be between 1-1023 bytes long and cannot begin with '/' or '\\'",
/*CORS 3-10*/
"One bucket not allow exceed ten item of CORSRules.",
"CORSRule.AllowedOrigins should not be empty.",
"CORSRule.AllowedOrigins allowes at most one asterisk wildcard.",
"CORSRule.AllowedMethods should not be empty.",
"CORSRule.AllowedMethods only supports GET/PUT/DELETE/POST/HEAD.",
"CORSRule.AllowedHeaders allowes at most one asterisk wildcard.",
"CORSRule.ExposedHeader dose not allowe asterisk wildcard.",
"CORSRule.MaxAgeSeconds should not be less than 0 or greater than 999999999.",
/*Logging -11*/
"Invalid logging prefix.",
/*storageCapacity -12*/
"Storage capacity must greater than -1.",
/*WebSiet -13*/
"Index document must not be empty.",
"Invalid index document, must be end with.html.",
"Invalid error document, must be end with .html.",
/*iostream request body -16*/
"Request body is null.",
"Request body is in fail state. Logical error on i/o operation.",
"Request body is in bad state. Read/writing error on i/o operation.",
/*MultipartUpload -19*/
"PartList is empty.",
"PartSize should not be less than 100*1024 or greater than 5*1024*1024*1024.",
"PartNumber should not be less than 1 or greater than 10000.",
/*Lifecycle Rules -22*/
"One bucket not allow exceed one thousand item of LifecycleRules.",
"LifecycleRule should not be null or empty.",
"Only one expiration property should be specified.",
"You have a rule for a prefix, and therefore you cannot create the rule for the whole bucket.",
"Configure at least one of file and fragment lifecycle.",
/*ResumableUpload -27*/
"The path of file to upload is empty.",
"Open upload file failed.",
"The part size is less than 100KB.",
"The thread num is less than 1.",
"Checkpoint directory is not exist.",
"Parse resumable upload record failed.",
"Upload file has been modified since last upload.",
"Upload record is invalid, it has been modified.",
/*ResumableCopy -35*/
"Parse resumable copy record failed.",
"Source object has been modified since last copy.",
"Copy record is invalid, it has been modified.",
/*ResumableDownload -38*/
"Invalid range of resumable download",
"The path of file download to is empty",
"Source object has been modified since last download.",
"Parse resumable download record failed.",
"invalid range values in download record record file.",
"Range values has been modified since last download.",
"Open temp file for download failed",
/*GetObject -45*/
"The range is invalid. The start should not be less than 0 or less then the end. The end could be -1 to get the rest of the data.",
/*LiveChannel -46*/
"The status param is invalid, it must be 'enabled' or 'disabled' ",
"The channelName param is invalid, it shouldn't contain '/' and length < 1023",
"The dest bucket name is invalid",
"The live channel description is invalied, it should be shorter than 129",
"The channel type is invalid, it shoudld only be HLS",
"The live channel frag duration param is invalid, it should be [1,100]",
"The live channel frag count param is invalid, it should be [1,100]",
"The live channel play list param is invalid, it should end with '.m3u8' & length in [6,128]",
"The snapshot param is invalid, please check.",
"The time param is invalid, endTime should bigger than startTime and difference smaller than 24*60*60",
"The Max Key param is invalid, it's default valus is 100, and smaller than 1000",
/*SelectObject -57*/
"The range is invalid. It cannot set lien range and split range at the same time.",
"The line range is invalid. The start should not be less than 0 or less then the end. The end could be -1 to get the rest of the data.",
"The split range is invalid. The start should not be less than 0 or less then the end. The end could be -1 to get the rest of the data.",
"The select object expressiontype must is SQL.",
"The select object content checksum failed.",
"The request InputFormat/OutputFormat is invalid. It cannot set InputFormat or OutputFormat as nullptr.",
"The request InputFormat/OutputFormat is invalid. It cannot set InputFormat and OutputFormat in difficent type.",
/*CreateSelectObject -64*/
"The request InputFormat is invalid. It cannot set InputFormat as nullptr.",
/*Tagging -65*/
"Object tags cannot be greater than 10.",
"Object Tag key is invalid, it's length should be [1, 128].",
"Object Tag value is invalid, it's length should be less than 256.",
/*Resumable for wstring path -68*/
"Only support wstring path in windows os.",
"The type of filePath and checkpointDir should be the same, either string or wstring."
};
int index = code - ARG_ERROR_START;
int msg_size = sizeof(msg)/sizeof(msg[0]);
if (code < ARG_ERROR_START || index > msg_size) {
index = 0;
}
return msg[index];
}
const char * AlibabaCloud::OSS::GetModelErrorMsg(const int code)
{
if (code >= ARG_ERROR_START && code <= ARG_ERROR_END) {
return GetArgErrorMsg(code);
}
return "Model error, but undefined.";
}
| YifuLiu/AliOS-Things | components/oss/src/model/ModelError.cc | C++ | apache-2.0 | 6,787 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/client/Error.h>
namespace AlibabaCloud
{
namespace OSS
{
const char * GetModelErrorMsg(const int code);
/*Error For Argument Check*/
const int ARG_ERROR_BASE = ERROR_CLIENT_BASE + 1000;
const int ARG_ERROR_START = ARG_ERROR_BASE;
const int ARG_ERROR_END = ARG_ERROR_START + 999;
/*Default*/
const int ARG_ERROR_DEFAULT = ARG_ERROR_BASE + 0;
/*Common*/
const int ARG_ERROR_BUCKET_NAME = ARG_ERROR_BASE + 1;
const int ARG_ERROR_OBJECT_NAME = ARG_ERROR_BASE + 2;
/*CORS*/
const int ARG_ERROR_CORS_RULE_LIMIT = ARG_ERROR_BASE + 3;
const int ARG_ERROR_CORS_ALLOWEDORIGINS_EMPTY = ARG_ERROR_BASE + 4;
const int ARG_ERROR_CORS_ALLOWEDORIGINS_ASTERISK_COUNT = ARG_ERROR_BASE + 5;
const int ARG_ERROR_CORS_ALLOWEDMETHODS_EMPTY = ARG_ERROR_BASE + 6;
const int ARG_ERROR_CORS_ALLOWEDMETHODS_VALUE = ARG_ERROR_BASE + 7;
const int ARG_ERROR_CORS_ALLOWEDHEADERS_ASTERISK_COUNT = ARG_ERROR_BASE + 8;
const int ARG_ERROR_CORS_EXPOSEHEADERS_ASTERISK_COUNT = ARG_ERROR_BASE + 9;
const int ARG_ERROR_CORS_MAXAGESECONDS_RANGE = ARG_ERROR_BASE + 10;
/*Logging*/
const int ARG_ERROR_LOGGING_TARGETPREFIX_INVALID = ARG_ERROR_BASE + 11;
/*StorageCapacity*/
const int ARG_ERROR_STORAGECAPACITY_INVALID = ARG_ERROR_BASE + 12;
/*WebSiet*/
const int ARG_ERROR_WEBSITE_INDEX_DOCCUMENT_EMPTY = ARG_ERROR_BASE + 13;
const int ARG_ERROR_WEBSITE_INDEX_DOCCUMENT_NAME_INVALID = ARG_ERROR_BASE + 14;
const int ARG_ERROR_WEBSITE_ERROR_DOCCUMENT_NAME_INVALID = ARG_ERROR_BASE + 15;
/*iostream request body*/
const int ARG_ERROR_REQUEST_BODY_NULLPTR = ARG_ERROR_BASE + 16;
const int ARG_ERROR_REQUEST_BODY_FAIL_STATE = ARG_ERROR_BASE + 17;
const int ARG_ERROR_REQUEST_BODY_BAD_STATE = ARG_ERROR_BASE + 18;
/*MultipartUpload*/
const int ARG_ERROR_MULTIPARTUPLOAD_PARTLIST_EMPTY = ARG_ERROR_BASE + 19;
const int ARG_ERROR_MULTIPARTUPLOAD_PARTSIZE_RANGE = ARG_ERROR_BASE + 20;
const int ARG_ERROR_MULTIPARTUPLOAD_PARTNUMBER_RANGE = ARG_ERROR_BASE + 21;
/*Lifecycle Rules*/
const int ARG_ERROR_LIFECYCLE_RULE_LIMIT = ARG_ERROR_BASE + 22;
const int ARG_ERROR_LIFECYCLE_RULE_EMPTY = ARG_ERROR_BASE + 23;
const int ARG_ERROR_LIFECYCLE_RULE_EXPIRATION = ARG_ERROR_BASE + 24;
const int ARG_ERROR_LIFECYCLE_RULE_ONLY_ONE_FOR_BUCKET = ARG_ERROR_BASE + 25;
const int ARG_ERROR_LIFECYCLE_RULE_CONFIG_EMPTY = ARG_ERROR_BASE + 26;
/*Resumable Upload*/
const int ARG_ERROR_UPLOAD_FILE_PATH_EMPTY = ARG_ERROR_BASE + 27;
const int ARG_ERROR_OPEN_UPLOAD_FILE = ARG_ERROR_BASE + 28;
const int ARG_ERROR_CHECK_PART_SIZE_LOWER = ARG_ERROR_BASE + 29;
const int ARG_ERROR_CHECK_THREAD_NUM_LOWER = ARG_ERROR_BASE + 30;
const int ARG_ERROR_CHECK_POINT_DIR_NONEXIST = ARG_ERROR_BASE + 31;
const int ARG_ERROR_PARSE_UPLOAD_RECORD_FILE = ARG_ERROR_BASE + 32;
const int ARG_ERROR_UPLOAD_FILE_MODIFIED = ARG_ERROR_BASE + 33;
const int ARG_ERROR_UPLOAD_RECORD_INVALID = ARG_ERROR_BASE + 34;
/*Resumable Copy*/
const int ARG_ERROR_PARSE_COPY_RECORD_FILE = ARG_ERROR_BASE + 35;
const int ARG_ERROR_COPY_SRC_OBJECT_MODIFIED = ARG_ERROR_BASE + 36;
const int ARG_ERROR_COPY_RECORD_INVALID = ARG_ERROR_BASE + 37;
/*Resumable Download*/
const int ARG_ERROR_INVALID_RANGE = ARG_ERROR_BASE + 38;
const int ARG_ERROR_DOWNLOAD_FILE_PATH_EMPTY = ARG_ERROR_BASE + 39;
const int ARG_ERROR_DOWNLOAD_OBJECT_MODIFIED = ARG_ERROR_BASE + 40;
const int ARG_ERROR_PARSE_DOWNLOAD_RECORD_FILE = ARG_ERROR_BASE + 41;
const int ARG_ERROR_INVALID_RANGE_IN_DWONLOAD_RECORD = ARG_ERROR_BASE + 42;
const int ARG_ERROR_RANGE_HAS_BEEN_RESET = ARG_ERROR_BASE + 43;
const int ARG_ERROR_OPEN_DOWNLOAD_TEMP_FILE = ARG_ERROR_BASE + 44;
/*GetObject*/
const int ARG_ERROR_OBJECT_RANGE_INVALID = ARG_ERROR_BASE + 45;
/*LiveChannel*/
const int ARG_ERROR_LIVECHANNEL_BAD_STATUS_PARAM = ARG_ERROR_BASE + 46;
const int ARG_ERROR_LIVECHANNEL_BAD_CHANNELNAME_PARAM = ARG_ERROR_BASE + 47;
const int ARG_ERROR_LIVECHANNEL_BAD_DEST_BUCKET_PARAM = ARG_ERROR_BASE + 48;
const int ARG_ERROR_LIVECHANNEL_BAD_DESCRIPTION_PARAM = ARG_ERROR_BASE + 49;
const int ARG_ERROR_LIVECHANNEL_BAD_CHANNEL_TYPE_PARAM = ARG_ERROR_BASE + 50;
const int ARG_ERROR_LIVECHANNEL_BAD_FRAGDURATION_PARAM = ARG_ERROR_BASE + 51;
const int ARG_ERROR_LIVECHANNEL_BAD_FRAGCOUNT_PARAM = ARG_ERROR_BASE + 52;
const int ARG_ERROR_LIVECHANNEL_BAD_PALYLIST_PARAM = ARG_ERROR_BASE + 53;
const int ARG_ERROR_LIVECHANNEL_BAD_SNAPSHOT_PARAM = ARG_ERROR_BASE + 54;
const int ARG_ERROR_LIVECHANNEL_BAD_TIME_PARAM = ARG_ERROR_BASE + 55;
const int ARG_ERROR_LIVECHANNEL_BAD_MAXKEY_PARAM = ARG_ERROR_BASE + 56;
/*SelectObject*/
const int ARG_ERROR_SELECT_OBJECT_RANGE_INVALID = ARG_ERROR_BASE + 57;
const int ARG_ERROR_SELECT_OBJECT_LINE_RANGE_INVALID = ARG_ERROR_BASE + 58;
const int ARG_ERROR_SELECT_OBJECT_SPLIT_RANGE_INVALID = ARG_ERROR_BASE + 59;
const int ARG_ERROR_SELECT_OBJECT_NOT_SQL_EXPRESSION = ARG_ERROR_BASE + 60;
const int ARG_ERROR_SELECT_OBJECT_CHECK_SUM_FAILED = ARG_ERROR_BASE + 61;
const int ARG_ERROR_SELECT_OBJECT_NULL_POINT = ARG_ERROR_BASE + 62;
const int ARG_ERROR_SELECT_OBJECT_PROCESS_NOT_SAME = ARG_ERROR_BASE + 63;
/*CreateSelectObjectMeta*/
const int ARG_ERROR_CREATE_SELECT_OBJECT_META_NULL_POINT = ARG_ERROR_BASE + 64;
/*Tagging*/
const int ARG_ERROR_TAGGING_TAGS_LIMIT = ARG_ERROR_BASE + 65;
const int ARG_ERROR_TAGGING_TAG_KEY_LIMIT = ARG_ERROR_BASE + 66;
const int ARG_ERROR_TAGGING_TAG_VALUE_LIMIT = ARG_ERROR_BASE + 67;
/*Resumable for wstring path*/
const int ARG_ERROR_PATH_NOT_SUPPORT_WSTRING_TYPE = ARG_ERROR_BASE + 68;
const int ARG_ERROR_PATH_NOT_SAME_TYPE = ARG_ERROR_BASE + 69;
}
}
| YifuLiu/AliOS-Things | components/oss/src/model/ModelError.h | C++ | apache-2.0 | 6,748 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ObjectCallbackBuilder.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
ObjectCallbackBuilder::ObjectCallbackBuilder(const std::string &url, const std::string &body):
ObjectCallbackBuilder(url, body, "", Type::URL)
{
}
ObjectCallbackBuilder::ObjectCallbackBuilder(const std::string &url, const std::string &body,
const std::string &host, Type type):
callbackUrl_(url),
callbackHost_(host),
callbackBody_(body),
callbackBodyType_(type)
{
}
std::string ObjectCallbackBuilder::build()
{
if (callbackUrl_.empty() || callbackBody_.empty())
{
return "";
}
std::stringstream ss;
ss << "{";
ss << "\"callbackUrl\":\"" << callbackUrl_ << "\"";
if (!callbackHost_.empty())
{
ss << ",\"callbackHost\":\"" << callbackHost_ << "\"";
}
ss << ",\"callbackBody\":\"" << callbackBody_ << "\"";
if (callbackBodyType_ == Type::JSON)
{
ss << ",\"callbackBodyType\":\"" << "application/json" << "\"";
}
ss << "}";
return Base64Encode(ss.str());
}
bool ObjectCallbackVariableBuilder::addCallbackVariable(const std::string &key, const std::string &value)
{
if (!!key.compare(0, 2 , "x:", 2))
{
return false;
}
callbackVariable_[key] = value;
return true;
}
std::string ObjectCallbackVariableBuilder::build()
{
if (callbackVariable_.size() == 0)
{
return "";
}
std::stringstream ss;
ss << "{";
int i = 0;
for (auto const& var : callbackVariable_) {
if (i > 0) {
ss << ",";
}
ss << "\"" << var.first << "\":\"" << var.second << "\"";
i++;
}
ss << "}";
return Base64Encode(ss.str());
}
| YifuLiu/AliOS-Things | components/oss/src/model/ObjectCallbackBuilder.cc | C++ | apache-2.0 | 2,394 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ObjectMetaData.h>
#include <alibabacloud/oss/http/HttpType.h>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
static const std::string gEmpty = "";
ObjectMetaData::ObjectMetaData(const HeaderCollection& data)
{
*this = data;
}
ObjectMetaData& ObjectMetaData::operator=(const HeaderCollection& data)
{
for (auto const &header : data) {
if (!header.first.compare(0, 11, "x-oss-meta-", 11))
userMetaData_[header.first.substr(11)] = header.second;
else
metaData_[header.first] = header.second;
}
if (metaData_.find(Http::ETAG) != metaData_.end()) {
metaData_[Http::ETAG] = TrimQuotes(metaData_.at(Http::ETAG).c_str());
}
return *this;
}
const std::string &ObjectMetaData::LastModified() const
{
if (metaData_.find(Http::LAST_MODIFIED) != metaData_.end()) {
return metaData_.at(Http::LAST_MODIFIED);
}
return gEmpty;
}
const std::string &ObjectMetaData::ExpirationTime() const
{
if (metaData_.find(Http::EXPIRES) != metaData_.end()) {
return metaData_.at(Http::EXPIRES);
}
return gEmpty;
}
int64_t ObjectMetaData::ContentLength() const
{
if (metaData_.find(Http::CONTENT_LENGTH) != metaData_.end()) {
return atoll(metaData_.at(Http::CONTENT_LENGTH).c_str());
}
return -1;
}
const std::string &ObjectMetaData::ContentType() const
{
if (metaData_.find(Http::CONTENT_TYPE) != metaData_.end()) {
return metaData_.at(Http::CONTENT_TYPE);
}
return gEmpty;
}
const std::string &ObjectMetaData::ContentEncoding() const
{
if (metaData_.find(Http::CONTENT_ENCODING) != metaData_.end()) {
return metaData_.at(Http::CONTENT_ENCODING);
}
return gEmpty;
}
const std::string &ObjectMetaData::CacheControl() const
{
if (metaData_.find(Http::CACHE_CONTROL) != metaData_.end()) {
return metaData_.at(Http::CACHE_CONTROL);
}
return gEmpty;
}
const std::string &ObjectMetaData::ContentDisposition() const
{
if (metaData_.find(Http::CONTENT_DISPOSITION) != metaData_.end()) {
return metaData_.at(Http::CONTENT_DISPOSITION);
}
return gEmpty;
}
const std::string &ObjectMetaData::ETag() const
{
if (metaData_.find(Http::ETAG) != metaData_.end()) {
return metaData_.at(Http::ETAG);
}
return gEmpty;
}
const std::string &ObjectMetaData::ContentMd5() const
{
if (metaData_.find(Http::CONTENT_MD5) != metaData_.end()) {
return metaData_.at(Http::CONTENT_MD5);
}
return gEmpty;
}
uint64_t ObjectMetaData::CRC64() const
{
if (metaData_.find("x-oss-hash-crc64ecma") != metaData_.end()) {
return std::strtoull(metaData_.at("x-oss-hash-crc64ecma").c_str(), nullptr, 10);
}
return 0ULL;
}
const std::string &ObjectMetaData::ObjectType() const
{
if (metaData_.find("x-oss-object-type") != metaData_.end()) {
return metaData_.at("x-oss-object-type");
}
return gEmpty;
}
const std::string& ObjectMetaData::VersionId() const
{
if (metaData_.find("x-oss-version-id") != metaData_.end()) {
return metaData_.at("x-oss-version-id");
}
return gEmpty;
}
void ObjectMetaData::setExpirationTime(const std::string &value)
{
metaData_[Http::EXPIRES] = value;
}
void ObjectMetaData::setContentLength(int64_t value)
{
metaData_[Http::CONTENT_LENGTH] = std::to_string(value);
}
void ObjectMetaData::setContentType(const std::string &value)
{
metaData_[Http::CONTENT_TYPE] = value;
}
void ObjectMetaData::setContentEncoding(const std::string &value)
{
metaData_[Http::CONTENT_ENCODING] = value;
}
void ObjectMetaData::setCacheControl(const std::string &value)
{
metaData_[Http::CACHE_CONTROL] = value;
}
void ObjectMetaData::setContentDisposition(const std::string &value)
{
metaData_[Http::CONTENT_DISPOSITION] = value;
}
void ObjectMetaData::setETag(const std::string &value)
{
metaData_[Http::ETAG] = value;
}
void ObjectMetaData::setContentMd5(const std::string &value)
{
metaData_[Http::CONTENT_MD5] = value;
}
void ObjectMetaData::setCrc64(uint64_t value)
{
metaData_["x-oss-hash-crc64ecma"] = std::to_string(value);
}
void ObjectMetaData::addHeader(const std::string &key, const std::string &value)
{
metaData_[key] = value;
}
bool ObjectMetaData::hasHeader(const std::string& key) const
{
return (metaData_.find(key) != metaData_.end());
}
void ObjectMetaData::removeHeader(const std::string& key)
{
if (metaData_.find(key) != metaData_.end()) {
metaData_.erase(key);
}
}
MetaData &ObjectMetaData::HttpMetaData()
{
return metaData_;
}
const MetaData &ObjectMetaData::HttpMetaData() const
{
return metaData_;
}
void ObjectMetaData::addUserHeader(const std::string &key, const std::string &value)
{
userMetaData_[key] = value;
}
bool ObjectMetaData::hasUserHeader(const std::string& key) const
{
return (userMetaData_.find(key) != userMetaData_.end());
}
void ObjectMetaData::removeUserHeader(const std::string& key)
{
if (userMetaData_.find(key) != userMetaData_.end()) {
userMetaData_.erase(key);
}
}
MetaData &ObjectMetaData::UserMetaData()
{
return userMetaData_;
}
const MetaData &ObjectMetaData::UserMetaData() const
{
return userMetaData_;
}
HeaderCollection ObjectMetaData::toHeaderCollection() const
{
HeaderCollection headers;
for (auto const&header : metaData_) {
headers[header.first] = header.second;
}
for (auto const&header : userMetaData_) {
std::string key("x-oss-meta-");
key.append(header.first);
headers[key] = header.second;
}
return headers;
}
| YifuLiu/AliOS-Things | components/oss/src/model/ObjectMetaData.cc | C++ | apache-2.0 | 6,550 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/OutputFormat.h>
#include <sstream>
#include "utils/Utils.h"
using namespace AlibabaCloud::OSS;
OutputFormat::OutputFormat():
keepAllColumns_(false), outputRawData_(false),
enablePayloadCrc_(true), outputHeader_(false)
{}
void OutputFormat::setEnablePayloadCrc(bool enablePayloadCrc)
{
enablePayloadCrc_ = enablePayloadCrc;
}
void OutputFormat::setKeepAllColumns(bool keepAllColumns)
{
keepAllColumns_ = keepAllColumns;
}
void OutputFormat::setOutputHeader(bool outputHeader)
{
outputHeader_ = outputHeader;
}
void OutputFormat::setOutputRawData(bool outputRawData)
{
outputRawData_ = outputRawData;
}
bool OutputFormat::OutputRawData() const
{
return outputRawData_;
}
bool OutputFormat::KeepAllColumns() const
{
return keepAllColumns_;
}
bool OutputFormat::EnablePayloadCrc() const
{
return enablePayloadCrc_;
}
bool OutputFormat::OutputHeader() const
{
return outputHeader_;
}
int OutputFormat::validate() const
{
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////
CSVOutputFormat::CSVOutputFormat()
: CSVOutputFormat("\n", ",")
{}
CSVOutputFormat::CSVOutputFormat(
const std::string& recordDelimiter,
const std::string& fieldDelimiter)
: OutputFormat(), recordDelimiter_(recordDelimiter), fieldDelimiter_(fieldDelimiter)
{}
void CSVOutputFormat::setRecordDelimiter(const std::string& recordDelimiter)
{
recordDelimiter_ = recordDelimiter;
}
void CSVOutputFormat::setFieldDelimiter(const std::string& fieldDelimiter)
{
fieldDelimiter_ = fieldDelimiter;
}
const std::string& CSVOutputFormat::FieldDelimiter() const
{
return fieldDelimiter_;
}
const std::string& CSVOutputFormat::RecordDelimiter() const
{
return recordDelimiter_;
}
std::string CSVOutputFormat::Type() const
{
return "csv";
}
std::string CSVOutputFormat::toXML() const
{
std::stringstream ss;
ss << "<OutputSerialization>" << std::endl;
ss << "<CSV>" << std::endl;
ss << "<RecordDelimiter>" << Base64Encode(recordDelimiter_) << "</RecordDelimiter>" << std::endl;
ss << "<FieldDelimiter>" << Base64Encode(fieldDelimiter_.empty() ? "" : std::string(1, fieldDelimiter_.front())) << "</FieldDelimiter>" << std::endl;
ss << "</CSV>" << std::endl;
ss << "<KeepAllColumns>" << (OutputFormat::KeepAllColumns() ? "true" : "false") << "</KeepAllColumns>" << std::endl;
ss << "<OutputRawData>" << (OutputFormat::OutputRawData() ? "true" : "false") << "</OutputRawData>" << std::endl;
ss << "<OutputHeader>" << (OutputFormat::OutputHeader() ? "true" : "false") << "</OutputHeader>" << std::endl;
ss << "<EnablePayloadCrc>" << (OutputFormat::EnablePayloadCrc() ? "true" : "false") << "</EnablePayloadCrc>" << std::endl;
ss << "</OutputSerialization>" << std::endl;
return ss.str();
}
////////////////////////////////////////////////////////////////////////////////////////
JSONOutputFormat::JSONOutputFormat()
:JSONOutputFormat("\n")
{}
JSONOutputFormat::JSONOutputFormat(const std::string& recordDelimiter)
:OutputFormat(), recordDelimiter_(recordDelimiter)
{}
void JSONOutputFormat::setRecordDelimiter(const std::string& recordDelimiter)
{
recordDelimiter_ = recordDelimiter;
}
const std::string& JSONOutputFormat::RecordDelimiter() const
{
return recordDelimiter_;
}
std::string JSONOutputFormat::Type() const
{
return "json";
}
std::string JSONOutputFormat::toXML() const
{
std::stringstream ss;
ss << "<OutputSerialization>" << std::endl;
ss << "<JSON>" << std::endl;
ss << "<RecordDelimiter>" << Base64Encode(recordDelimiter_) << "</RecordDelimiter>" << std::endl;
ss << "</JSON>" << std::endl;
ss << "<KeepAllColumns>" << (OutputFormat::KeepAllColumns() ? "true" : "false") << "</KeepAllColumns>" << std::endl;
ss << "<OutputRawData>" << (OutputFormat::OutputRawData() ? "true" : "false") << "</OutputRawData>" << std::endl;
ss << "<OutputHeader>" << (OutputFormat::OutputHeader() ? "true" : "false") << "</OutputHeader>" << std::endl;
ss << "<EnablePayloadCrc>" << (OutputFormat::EnablePayloadCrc() ? "true" : "false") << "</EnablePayloadCrc>" << std::endl;
ss << "</OutputSerialization>" << std::endl;
return ss.str();
}
| YifuLiu/AliOS-Things | components/oss/src/model/OutputFormat.cc | C++ | apache-2.0 | 4,895 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/PostVodPlaylistRequest.h>
#include <sstream>
#include "utils/Utils.h"
#include "ModelError.h"
#include "Const.h"
using namespace AlibabaCloud::OSS;
PostVodPlaylistRequest::PostVodPlaylistRequest(const std::string& bucket,
const std::string& channelName, const std::string& playlist,
uint64_t startTime, uint64_t endTime)
:LiveChannelRequest(bucket, channelName),
playList_(playlist),
startTime_(startTime),
endTime_(endTime)
{
key_.append("/").append(playList_);
}
int PostVodPlaylistRequest::validate() const
{
int ret = LiveChannelRequest::validate();
if(ret)
{
return ret;
}
if(!IsValidPlayListName(playList_))
{
return ARG_ERROR_LIVECHANNEL_BAD_PALYLIST_PARAM;
}
if(endTime_ <= startTime_ || endTime_ > (startTime_ + SecondsOfDay))
{
return ARG_ERROR_LIVECHANNEL_BAD_TIME_PARAM;
}
return 0;
}
ParameterCollection PostVodPlaylistRequest::specialParameters() const
{
ParameterCollection collection;
collection["vod"] = "";
collection["endTime"] = std::to_string(endTime_);
collection["startTime"] = std::to_string(startTime_);
return collection;
}
void PostVodPlaylistRequest::setPlayList(const std::string &playList)
{
playList_ = playList;
}
void PostVodPlaylistRequest::setStartTime(uint64_t startTime)
{
startTime_ = startTime;
}
void PostVodPlaylistRequest::setEndTime(uint64_t endTime)
{
endTime_ = endTime;
}
| YifuLiu/AliOS-Things | components/oss/src/model/PostVodPlaylistRequest.cc | C++ | apache-2.0 | 2,122 |
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/oss/model/ProcessObjectRequest.h>
#include <sstream>
using namespace AlibabaCloud::OSS;
ProcessObjectRequest::ProcessObjectRequest(const std::string &bucket, const std::string &key):
ProcessObjectRequest(bucket, key, "")
{
}
ProcessObjectRequest::ProcessObjectRequest(const std::string &bucket, const std::string &key, const std::string &process) :
OssObjectRequest(bucket, key),
process_(process)
{
setFlags(Flags() | REQUEST_FLAG_CONTENTMD5);
}
void ProcessObjectRequest::setProcess(const std::string &process)
{
process_ = process;
}
ParameterCollection ProcessObjectRequest::specialParameters() const
{
auto parameters = OssObjectRequest::specialParameters();
parameters["x-oss-process"];
return parameters;
}
std::string ProcessObjectRequest::payload() const
{
std::stringstream ss;
ss << "x-oss-process=" << process_;
return ss.str();
}
| YifuLiu/AliOS-Things | components/oss/src/model/ProcessObjectRequest.cc | C++ | apache-2.0 | 1,548 |