Generated 2018-08-28 for Tag.

This commit is contained in:
sdk-team
2020-03-18 11:20:46 +08:00
parent 8cc0896ed4
commit 11638e1197
18 changed files with 1313 additions and 1 deletions

94
tag/CMakeLists.txt Normal file
View File

@@ -0,0 +1,94 @@
#
# 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.
#
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
set(tag_public_header
include/alibabacloud/tag/TagClient.h
include/alibabacloud/tag/TagExport.h )
set(tag_public_header_model
include/alibabacloud/tag/model/ListTagResourcesRequest.h
include/alibabacloud/tag/model/ListTagResourcesResult.h
include/alibabacloud/tag/model/TagResourcesRequest.h
include/alibabacloud/tag/model/TagResourcesResult.h
include/alibabacloud/tag/model/UntagResourcesRequest.h
include/alibabacloud/tag/model/UntagResourcesResult.h )
set(tag_src
src/TagClient.cc
src/model/ListTagResourcesRequest.cc
src/model/ListTagResourcesResult.cc
src/model/TagResourcesRequest.cc
src/model/TagResourcesResult.cc
src/model/UntagResourcesRequest.cc
src/model/UntagResourcesResult.cc )
add_library(tag ${LIB_TYPE}
${tag_public_header}
${tag_public_header_model}
${tag_src})
set_target_properties(tag
PROPERTIES
LINKER_LANGUAGE CXX
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}tag
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(tag
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_TAG_LIBRARY)
endif()
target_include_directories(tag
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(tag
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(tag
jsoncpp)
target_include_directories(tag
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(tag
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(tag
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(tag
PRIVATE /usr/include/jsoncpp)
target_link_libraries(tag
jsoncpp)
endif()
install(FILES ${tag_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/tag)
install(FILES ${tag_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/tag/model)
install(TARGETS tag
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,70 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_TAGCLIENT_H_
#define ALIBABACLOUD_TAG_TAGCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "TagExport.h"
#include "model/ListTagResourcesRequest.h"
#include "model/ListTagResourcesResult.h"
#include "model/TagResourcesRequest.h"
#include "model/TagResourcesResult.h"
#include "model/UntagResourcesRequest.h"
#include "model/UntagResourcesResult.h"
namespace AlibabaCloud
{
namespace Tag
{
class ALIBABACLOUD_TAG_EXPORT TagClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::ListTagResourcesResult> ListTagResourcesOutcome;
typedef std::future<ListTagResourcesOutcome> ListTagResourcesOutcomeCallable;
typedef std::function<void(const TagClient*, const Model::ListTagResourcesRequest&, const ListTagResourcesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListTagResourcesAsyncHandler;
typedef Outcome<Error, Model::TagResourcesResult> TagResourcesOutcome;
typedef std::future<TagResourcesOutcome> TagResourcesOutcomeCallable;
typedef std::function<void(const TagClient*, const Model::TagResourcesRequest&, const TagResourcesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TagResourcesAsyncHandler;
typedef Outcome<Error, Model::UntagResourcesResult> UntagResourcesOutcome;
typedef std::future<UntagResourcesOutcome> UntagResourcesOutcomeCallable;
typedef std::function<void(const TagClient*, const Model::UntagResourcesRequest&, const UntagResourcesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UntagResourcesAsyncHandler;
TagClient(const Credentials &credentials, const ClientConfiguration &configuration);
TagClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
TagClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~TagClient();
ListTagResourcesOutcome listTagResources(const Model::ListTagResourcesRequest &request)const;
void listTagResourcesAsync(const Model::ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ListTagResourcesOutcomeCallable listTagResourcesCallable(const Model::ListTagResourcesRequest& request) const;
TagResourcesOutcome tagResources(const Model::TagResourcesRequest &request)const;
void tagResourcesAsync(const Model::TagResourcesRequest& request, const TagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
TagResourcesOutcomeCallable tagResourcesCallable(const Model::TagResourcesRequest& request) const;
UntagResourcesOutcome untagResources(const Model::UntagResourcesRequest &request)const;
void untagResourcesAsync(const Model::UntagResourcesRequest& request, const UntagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UntagResourcesOutcomeCallable untagResourcesCallable(const Model::UntagResourcesRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_TAG_TAGCLIENT_H_

View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_TAGEXPORT_H_
#define ALIBABACLOUD_TAG_TAGEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_TAG_LIBRARY)
# define ALIBABACLOUD_TAG_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_TAG_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_TAG_EXPORT
#endif
#endif // !ALIBABACLOUD_TAG_TAGEXPORT_H_

View File

@@ -0,0 +1,75 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESREQUEST_H_
#define ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT ListTagResourcesRequest : public RpcServiceRequest
{
public:
ListTagResourcesRequest();
~ListTagResourcesRequest();
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
std::string getNextToken()const;
void setNextToken(const std::string& nextToken);
int getPageSize()const;
void setPageSize(int pageSize);
std::vector<std::string> getResourceARN()const;
void setResourceARN(const std::vector<std::string>& resourceARN);
std::string getResourceOwnerAccount()const;
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
std::string getOwnerAccount()const;
void setOwnerAccount(const std::string& ownerAccount);
long getOwnerId()const;
void setOwnerId(long ownerId);
std::string getTags()const;
void setTags(const std::string& tags);
std::string getCategory()const;
void setCategory(const std::string& category);
private:
long resourceOwnerId_;
std::string regionId_;
std::string nextToken_;
int pageSize_;
std::vector<std::string> resourceARN_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;
long ownerId_;
std::string tags_;
std::string category_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESREQUEST_H_

View File

@@ -0,0 +1,64 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESRESULT_H_
#define ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT ListTagResourcesResult : public ServiceResult
{
public:
struct TagResource
{
struct Tag
{
std::string category;
std::string value;
std::string key;
};
std::string resourceARN;
std::vector<TagResource::Tag> tags;
};
ListTagResourcesResult();
explicit ListTagResourcesResult(const std::string &payload);
~ListTagResourcesResult();
std::string getNextToken()const;
std::vector<TagResource> getTagResources()const;
protected:
void parse(const std::string &payload);
private:
std::string nextToken_;
std::vector<TagResource> tagResources_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_LISTTAGRESOURCESRESULT_H_

View File

@@ -0,0 +1,66 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_TAGRESOURCESREQUEST_H_
#define ALIBABACLOUD_TAG_MODEL_TAGRESOURCESREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT TagResourcesRequest : public RpcServiceRequest
{
public:
TagResourcesRequest();
~TagResourcesRequest();
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
std::vector<std::string> getResourceARN()const;
void setResourceARN(const std::vector<std::string>& resourceARN);
std::string getResourceOwnerAccount()const;
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
std::string getOwnerAccount()const;
void setOwnerAccount(const std::string& ownerAccount);
long getOwnerId()const;
void setOwnerId(long ownerId);
std::string getTags()const;
void setTags(const std::string& tags);
private:
long resourceOwnerId_;
std::string regionId_;
std::vector<std::string> resourceARN_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;
long ownerId_;
std::string tags_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_TAGRESOURCESREQUEST_H_

View File

@@ -0,0 +1,61 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_TAGRESOURCESRESULT_H_
#define ALIBABACLOUD_TAG_MODEL_TAGRESOURCESRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT TagResourcesResult : public ServiceResult
{
public:
struct FailedResource
{
struct Result
{
std::string message;
std::string code;
};
std::string resourceARN;
Result result;
};
TagResourcesResult();
explicit TagResourcesResult(const std::string &payload);
~TagResourcesResult();
std::vector<FailedResource> getFailedResources()const;
protected:
void parse(const std::string &payload);
private:
std::vector<FailedResource> failedResources_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_TAGRESOURCESRESULT_H_

View File

@@ -0,0 +1,66 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESREQUEST_H_
#define ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT UntagResourcesRequest : public RpcServiceRequest
{
public:
UntagResourcesRequest();
~UntagResourcesRequest();
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
std::vector<std::string> getResourceARN()const;
void setResourceARN(const std::vector<std::string>& resourceARN);
std::string getResourceOwnerAccount()const;
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
std::string getOwnerAccount()const;
void setOwnerAccount(const std::string& ownerAccount);
long getOwnerId()const;
void setOwnerId(long ownerId);
std::vector<std::string> getTagKey()const;
void setTagKey(const std::vector<std::string>& tagKey);
private:
long resourceOwnerId_;
std::string regionId_;
std::vector<std::string> resourceARN_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;
long ownerId_;
std::vector<std::string> tagKey_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESREQUEST_H_

View File

@@ -0,0 +1,61 @@
/*
* 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.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESRESULT_H_
#define ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/tag/TagExport.h>
namespace AlibabaCloud
{
namespace Tag
{
namespace Model
{
class ALIBABACLOUD_TAG_EXPORT UntagResourcesResult : public ServiceResult
{
public:
struct FailedResource
{
struct Result
{
std::string message;
std::string code;
};
std::string resourceARN;
Result result;
};
UntagResourcesResult();
explicit UntagResourcesResult(const std::string &payload);
~UntagResourcesResult();
std::vector<FailedResource> getFailedResources()const;
protected:
void parse(const std::string &payload);
private:
std::vector<FailedResource> failedResources_;
};
}
}
}
#endif // !ALIBABACLOUD_TAG_MODEL_UNTAGRESOURCESRESULT_H_

161
tag/src/TagClient.cc Normal file
View File

@@ -0,0 +1,161 @@
/*
* 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/tag/TagClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Tag;
using namespace AlibabaCloud::Tag::Model;
namespace
{
const std::string SERVICE_NAME = "Tag";
}
TagClient::TagClient(const Credentials &credentials, const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tag");
}
TagClient::TagClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tag");
}
TagClient::TagClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "tag");
}
TagClient::~TagClient()
{}
TagClient::ListTagResourcesOutcome TagClient::listTagResources(const ListTagResourcesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListTagResourcesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListTagResourcesOutcome(ListTagResourcesResult(outcome.result()));
else
return ListTagResourcesOutcome(outcome.error());
}
void TagClient::listTagResourcesAsync(const ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listTagResources(request), context);
};
asyncExecute(new Runnable(fn));
}
TagClient::ListTagResourcesOutcomeCallable TagClient::listTagResourcesCallable(const ListTagResourcesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListTagResourcesOutcome()>>(
[this, request]()
{
return this->listTagResources(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TagClient::TagResourcesOutcome TagClient::tagResources(const TagResourcesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return TagResourcesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return TagResourcesOutcome(TagResourcesResult(outcome.result()));
else
return TagResourcesOutcome(outcome.error());
}
void TagClient::tagResourcesAsync(const TagResourcesRequest& request, const TagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, tagResources(request), context);
};
asyncExecute(new Runnable(fn));
}
TagClient::TagResourcesOutcomeCallable TagClient::tagResourcesCallable(const TagResourcesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<TagResourcesOutcome()>>(
[this, request]()
{
return this->tagResources(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TagClient::UntagResourcesOutcome TagClient::untagResources(const UntagResourcesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return UntagResourcesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return UntagResourcesOutcome(UntagResourcesResult(outcome.result()));
else
return UntagResourcesOutcome(outcome.error());
}
void TagClient::untagResourcesAsync(const UntagResourcesRequest& request, const UntagResourcesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, untagResources(request), context);
};
asyncExecute(new Runnable(fn));
}
TagClient::UntagResourcesOutcomeCallable TagClient::untagResourcesCallable(const UntagResourcesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<UntagResourcesOutcome()>>(
[this, request]()
{
return this->untagResources(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,141 @@
/*
* 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/tag/model/ListTagResourcesRequest.h>
using AlibabaCloud::Tag::Model::ListTagResourcesRequest;
ListTagResourcesRequest::ListTagResourcesRequest() :
RpcServiceRequest("tag", "2018-08-28", "ListTagResources")
{
setMethod(HttpRequest::Method::Post);
}
ListTagResourcesRequest::~ListTagResourcesRequest()
{}
long ListTagResourcesRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void ListTagResourcesRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string ListTagResourcesRequest::getRegionId()const
{
return regionId_;
}
void ListTagResourcesRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string ListTagResourcesRequest::getNextToken()const
{
return nextToken_;
}
void ListTagResourcesRequest::setNextToken(const std::string& nextToken)
{
nextToken_ = nextToken;
setParameter("NextToken", nextToken);
}
int ListTagResourcesRequest::getPageSize()const
{
return pageSize_;
}
void ListTagResourcesRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setParameter("PageSize", std::to_string(pageSize));
}
std::vector<std::string> ListTagResourcesRequest::getResourceARN()const
{
return resourceARN_;
}
void ListTagResourcesRequest::setResourceARN(const std::vector<std::string>& resourceARN)
{
resourceARN_ = resourceARN;
for(int dep1 = 0; dep1!= resourceARN.size(); dep1++) {
setParameter("ResourceARN."+ std::to_string(dep1), resourceARN.at(dep1));
}
}
std::string ListTagResourcesRequest::getResourceOwnerAccount()const
{
return resourceOwnerAccount_;
}
void ListTagResourcesRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
{
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
std::string ListTagResourcesRequest::getOwnerAccount()const
{
return ownerAccount_;
}
void ListTagResourcesRequest::setOwnerAccount(const std::string& ownerAccount)
{
ownerAccount_ = ownerAccount;
setParameter("OwnerAccount", ownerAccount);
}
long ListTagResourcesRequest::getOwnerId()const
{
return ownerId_;
}
void ListTagResourcesRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}
std::string ListTagResourcesRequest::getTags()const
{
return tags_;
}
void ListTagResourcesRequest::setTags(const std::string& tags)
{
tags_ = tags;
setParameter("Tags", tags);
}
std::string ListTagResourcesRequest::getCategory()const
{
return category_;
}
void ListTagResourcesRequest::setCategory(const std::string& category)
{
category_ = category;
setParameter("Category", category);
}

View File

@@ -0,0 +1,76 @@
/*
* 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/tag/model/ListTagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Tag;
using namespace AlibabaCloud::Tag::Model;
ListTagResourcesResult::ListTagResourcesResult() :
ServiceResult()
{}
ListTagResourcesResult::ListTagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListTagResourcesResult::~ListTagResourcesResult()
{}
void ListTagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allTagResourcesNode = value["TagResources"]["TagResource"];
for (auto valueTagResourcesTagResource : allTagResourcesNode)
{
TagResource tagResourcesObject;
if(!valueTagResourcesTagResource["ResourceARN"].isNull())
tagResourcesObject.resourceARN = valueTagResourcesTagResource["ResourceARN"].asString();
auto allTagsNode = allTagResourcesNode["Tags"]["Tag"];
for (auto allTagResourcesNodeTagsTag : allTagsNode)
{
TagResource::Tag tagsObject;
if(!allTagResourcesNodeTagsTag["Key"].isNull())
tagsObject.key = allTagResourcesNodeTagsTag["Key"].asString();
if(!allTagResourcesNodeTagsTag["Value"].isNull())
tagsObject.value = allTagResourcesNodeTagsTag["Value"].asString();
if(!allTagResourcesNodeTagsTag["Category"].isNull())
tagsObject.category = allTagResourcesNodeTagsTag["Category"].asString();
tagResourcesObject.tags.push_back(tagsObject);
}
tagResources_.push_back(tagResourcesObject);
}
if(!value["NextToken"].isNull())
nextToken_ = value["NextToken"].asString();
}
std::string ListTagResourcesResult::getNextToken()const
{
return nextToken_;
}
std::vector<ListTagResourcesResult::TagResource> ListTagResourcesResult::getTagResources()const
{
return tagResources_;
}

View File

@@ -0,0 +1,108 @@
/*
* 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/tag/model/TagResourcesRequest.h>
using AlibabaCloud::Tag::Model::TagResourcesRequest;
TagResourcesRequest::TagResourcesRequest() :
RpcServiceRequest("tag", "2018-08-28", "TagResources")
{
setMethod(HttpRequest::Method::Post);
}
TagResourcesRequest::~TagResourcesRequest()
{}
long TagResourcesRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void TagResourcesRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string TagResourcesRequest::getRegionId()const
{
return regionId_;
}
void TagResourcesRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::vector<std::string> TagResourcesRequest::getResourceARN()const
{
return resourceARN_;
}
void TagResourcesRequest::setResourceARN(const std::vector<std::string>& resourceARN)
{
resourceARN_ = resourceARN;
for(int dep1 = 0; dep1!= resourceARN.size(); dep1++) {
setParameter("ResourceARN."+ std::to_string(dep1), resourceARN.at(dep1));
}
}
std::string TagResourcesRequest::getResourceOwnerAccount()const
{
return resourceOwnerAccount_;
}
void TagResourcesRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
{
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
std::string TagResourcesRequest::getOwnerAccount()const
{
return ownerAccount_;
}
void TagResourcesRequest::setOwnerAccount(const std::string& ownerAccount)
{
ownerAccount_ = ownerAccount;
setParameter("OwnerAccount", ownerAccount);
}
long TagResourcesRequest::getOwnerId()const
{
return ownerId_;
}
void TagResourcesRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}
std::string TagResourcesRequest::getTags()const
{
return tags_;
}
void TagResourcesRequest::setTags(const std::string& tags)
{
tags_ = tags;
setParameter("Tags", tags);
}

View File

@@ -0,0 +1,62 @@
/*
* 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/tag/model/TagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Tag;
using namespace AlibabaCloud::Tag::Model;
TagResourcesResult::TagResourcesResult() :
ServiceResult()
{}
TagResourcesResult::TagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TagResourcesResult::~TagResourcesResult()
{}
void TagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allFailedResourcesNode = value["FailedResources"]["FailedResource"];
for (auto valueFailedResourcesFailedResource : allFailedResourcesNode)
{
FailedResource failedResourcesObject;
if(!valueFailedResourcesFailedResource["ResourceARN"].isNull())
failedResourcesObject.resourceARN = valueFailedResourcesFailedResource["ResourceARN"].asString();
auto resultNode = value["Result"];
if(!resultNode["Code"].isNull())
failedResourcesObject.result.code = resultNode["Code"].asString();
if(!resultNode["Message"].isNull())
failedResourcesObject.result.message = resultNode["Message"].asString();
failedResources_.push_back(failedResourcesObject);
}
}
std::vector<TagResourcesResult::FailedResource> TagResourcesResult::getFailedResources()const
{
return failedResources_;
}

View File

@@ -0,0 +1,110 @@
/*
* 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/tag/model/UntagResourcesRequest.h>
using AlibabaCloud::Tag::Model::UntagResourcesRequest;
UntagResourcesRequest::UntagResourcesRequest() :
RpcServiceRequest("tag", "2018-08-28", "UntagResources")
{
setMethod(HttpRequest::Method::Post);
}
UntagResourcesRequest::~UntagResourcesRequest()
{}
long UntagResourcesRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void UntagResourcesRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string UntagResourcesRequest::getRegionId()const
{
return regionId_;
}
void UntagResourcesRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::vector<std::string> UntagResourcesRequest::getResourceARN()const
{
return resourceARN_;
}
void UntagResourcesRequest::setResourceARN(const std::vector<std::string>& resourceARN)
{
resourceARN_ = resourceARN;
for(int dep1 = 0; dep1!= resourceARN.size(); dep1++) {
setParameter("ResourceARN."+ std::to_string(dep1), resourceARN.at(dep1));
}
}
std::string UntagResourcesRequest::getResourceOwnerAccount()const
{
return resourceOwnerAccount_;
}
void UntagResourcesRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
{
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
std::string UntagResourcesRequest::getOwnerAccount()const
{
return ownerAccount_;
}
void UntagResourcesRequest::setOwnerAccount(const std::string& ownerAccount)
{
ownerAccount_ = ownerAccount;
setParameter("OwnerAccount", ownerAccount);
}
long UntagResourcesRequest::getOwnerId()const
{
return ownerId_;
}
void UntagResourcesRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}
std::vector<std::string> UntagResourcesRequest::getTagKey()const
{
return tagKey_;
}
void UntagResourcesRequest::setTagKey(const std::vector<std::string>& tagKey)
{
tagKey_ = tagKey;
for(int dep1 = 0; dep1!= tagKey.size(); dep1++) {
setParameter("TagKey."+ std::to_string(dep1), tagKey.at(dep1));
}
}

View File

@@ -0,0 +1,62 @@
/*
* 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/tag/model/UntagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Tag;
using namespace AlibabaCloud::Tag::Model;
UntagResourcesResult::UntagResourcesResult() :
ServiceResult()
{}
UntagResourcesResult::UntagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
UntagResourcesResult::~UntagResourcesResult()
{}
void UntagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allFailedResourcesNode = value["FailedResources"]["FailedResource"];
for (auto valueFailedResourcesFailedResource : allFailedResourcesNode)
{
FailedResource failedResourcesObject;
if(!valueFailedResourcesFailedResource["ResourceARN"].isNull())
failedResourcesObject.resourceARN = valueFailedResourcesFailedResource["ResourceARN"].asString();
auto resultNode = value["Result"];
if(!resultNode["Code"].isNull())
failedResourcesObject.result.code = resultNode["Code"].asString();
if(!resultNode["Message"].isNull())
failedResourcesObject.result.message = resultNode["Message"].asString();
failedResources_.push_back(failedResourcesObject);
}
}
std::vector<UntagResourcesResult::FailedResource> UntagResourcesResult::getFailedResources()const
{
return failedResources_;
}