diff --git a/CHANGELOG b/CHANGELOG index 8f0411cb6..ea7a86023 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2022-07-21 Version: 1.36.1195 +- Support PreConfigRule. + 2022-07-21 Version: 1.36.1194 - Add kms apis. diff --git a/VERSION b/VERSION index dad6ff7d2..0cc2824c0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1194 \ No newline at end of file +1.36.1195 \ No newline at end of file diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 06da31b41..ebeba8421 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -181,6 +181,8 @@ set(config_public_header_model include/alibabacloud/config/model/ListRemediationsResult.h include/alibabacloud/config/model/ListResourceEvaluationResultsRequest.h include/alibabacloud/config/model/ListResourceEvaluationResultsResult.h + include/alibabacloud/config/model/ListTagResourcesRequest.h + include/alibabacloud/config/model/ListTagResourcesResult.h include/alibabacloud/config/model/RevertAggregateEvaluationResultsRequest.h include/alibabacloud/config/model/RevertAggregateEvaluationResultsResult.h include/alibabacloud/config/model/RevertEvaluationResultsRequest.h @@ -191,6 +193,10 @@ set(config_public_header_model include/alibabacloud/config/model/StartAggregateRemediationResult.h include/alibabacloud/config/model/StartRemediationRequest.h include/alibabacloud/config/model/StartRemediationResult.h + include/alibabacloud/config/model/TagResourcesRequest.h + include/alibabacloud/config/model/TagResourcesResult.h + include/alibabacloud/config/model/UntagResourcesRequest.h + include/alibabacloud/config/model/UntagResourcesResult.h include/alibabacloud/config/model/UpdateAggregateCompliancePackRequest.h include/alibabacloud/config/model/UpdateAggregateCompliancePackResult.h include/alibabacloud/config/model/UpdateAggregateConfigDeliveryChannelRequest.h @@ -370,6 +376,8 @@ set(config_src src/model/ListRemediationsResult.cc src/model/ListResourceEvaluationResultsRequest.cc src/model/ListResourceEvaluationResultsResult.cc + src/model/ListTagResourcesRequest.cc + src/model/ListTagResourcesResult.cc src/model/RevertAggregateEvaluationResultsRequest.cc src/model/RevertAggregateEvaluationResultsResult.cc src/model/RevertEvaluationResultsRequest.cc @@ -380,6 +388,10 @@ set(config_src src/model/StartAggregateRemediationResult.cc src/model/StartRemediationRequest.cc src/model/StartRemediationResult.cc + src/model/TagResourcesRequest.cc + src/model/TagResourcesResult.cc + src/model/UntagResourcesRequest.cc + src/model/UntagResourcesResult.cc src/model/UpdateAggregateCompliancePackRequest.cc src/model/UpdateAggregateCompliancePackResult.cc src/model/UpdateAggregateConfigDeliveryChannelRequest.cc diff --git a/config/include/alibabacloud/config/ConfigClient.h b/config/include/alibabacloud/config/ConfigClient.h index 095c29f98..520fe4820 100644 --- a/config/include/alibabacloud/config/ConfigClient.h +++ b/config/include/alibabacloud/config/ConfigClient.h @@ -182,6 +182,8 @@ #include "model/ListRemediationsResult.h" #include "model/ListResourceEvaluationResultsRequest.h" #include "model/ListResourceEvaluationResultsResult.h" +#include "model/ListTagResourcesRequest.h" +#include "model/ListTagResourcesResult.h" #include "model/RevertAggregateEvaluationResultsRequest.h" #include "model/RevertAggregateEvaluationResultsResult.h" #include "model/RevertEvaluationResultsRequest.h" @@ -192,6 +194,10 @@ #include "model/StartAggregateRemediationResult.h" #include "model/StartRemediationRequest.h" #include "model/StartRemediationResult.h" +#include "model/TagResourcesRequest.h" +#include "model/TagResourcesResult.h" +#include "model/UntagResourcesRequest.h" +#include "model/UntagResourcesResult.h" #include "model/UpdateAggregateCompliancePackRequest.h" #include "model/UpdateAggregateCompliancePackResult.h" #include "model/UpdateAggregateConfigDeliveryChannelRequest.h" @@ -457,6 +463,9 @@ namespace AlibabaCloud typedef Outcome ListResourceEvaluationResultsOutcome; typedef std::future ListResourceEvaluationResultsOutcomeCallable; typedef std::function&)> ListResourceEvaluationResultsAsyncHandler; + typedef Outcome ListTagResourcesOutcome; + typedef std::future ListTagResourcesOutcomeCallable; + typedef std::function&)> ListTagResourcesAsyncHandler; typedef Outcome RevertAggregateEvaluationResultsOutcome; typedef std::future RevertAggregateEvaluationResultsOutcomeCallable; typedef std::function&)> RevertAggregateEvaluationResultsAsyncHandler; @@ -472,6 +481,12 @@ namespace AlibabaCloud typedef Outcome StartRemediationOutcome; typedef std::future StartRemediationOutcomeCallable; typedef std::function&)> StartRemediationAsyncHandler; + typedef Outcome TagResourcesOutcome; + typedef std::future TagResourcesOutcomeCallable; + typedef std::function&)> TagResourcesAsyncHandler; + typedef Outcome UntagResourcesOutcome; + typedef std::future UntagResourcesOutcomeCallable; + typedef std::function&)> UntagResourcesAsyncHandler; typedef Outcome UpdateAggregateCompliancePackOutcome; typedef std::future UpdateAggregateCompliancePackOutcomeCallable; typedef std::function&)> UpdateAggregateCompliancePackAsyncHandler; @@ -741,6 +756,9 @@ namespace AlibabaCloud ListResourceEvaluationResultsOutcome listResourceEvaluationResults(const Model::ListResourceEvaluationResultsRequest &request)const; void listResourceEvaluationResultsAsync(const Model::ListResourceEvaluationResultsRequest& request, const ListResourceEvaluationResultsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListResourceEvaluationResultsOutcomeCallable listResourceEvaluationResultsCallable(const Model::ListResourceEvaluationResultsRequest& request) const; + ListTagResourcesOutcome listTagResources(const Model::ListTagResourcesRequest &request)const; + void listTagResourcesAsync(const Model::ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListTagResourcesOutcomeCallable listTagResourcesCallable(const Model::ListTagResourcesRequest& request) const; RevertAggregateEvaluationResultsOutcome revertAggregateEvaluationResults(const Model::RevertAggregateEvaluationResultsRequest &request)const; void revertAggregateEvaluationResultsAsync(const Model::RevertAggregateEvaluationResultsRequest& request, const RevertAggregateEvaluationResultsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RevertAggregateEvaluationResultsOutcomeCallable revertAggregateEvaluationResultsCallable(const Model::RevertAggregateEvaluationResultsRequest& request) const; @@ -756,6 +774,12 @@ namespace AlibabaCloud StartRemediationOutcome startRemediation(const Model::StartRemediationRequest &request)const; void startRemediationAsync(const Model::StartRemediationRequest& request, const StartRemediationAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; StartRemediationOutcomeCallable startRemediationCallable(const Model::StartRemediationRequest& request) const; + TagResourcesOutcome tagResources(const Model::TagResourcesRequest &request)const; + void tagResourcesAsync(const Model::TagResourcesRequest& request, const TagResourcesAsyncHandler& handler, const std::shared_ptr& 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& context = nullptr) const; + UntagResourcesOutcomeCallable untagResourcesCallable(const Model::UntagResourcesRequest& request) const; UpdateAggregateCompliancePackOutcome updateAggregateCompliancePack(const Model::UpdateAggregateCompliancePackRequest &request)const; void updateAggregateCompliancePackAsync(const Model::UpdateAggregateCompliancePackRequest& request, const UpdateAggregateCompliancePackAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; UpdateAggregateCompliancePackOutcomeCallable updateAggregateCompliancePackCallable(const Model::UpdateAggregateCompliancePackRequest& request) const; diff --git a/config/include/alibabacloud/config/model/ListAggregateConfigRulesRequest.h b/config/include/alibabacloud/config/model/ListAggregateConfigRulesRequest.h index 91ae78d5e..1852fd132 100644 --- a/config/include/alibabacloud/config/model/ListAggregateConfigRulesRequest.h +++ b/config/include/alibabacloud/config/model/ListAggregateConfigRulesRequest.h @@ -28,6 +28,10 @@ namespace Config { namespace Model { class ALIBABACLOUD_CONFIG_EXPORT ListAggregateConfigRulesRequest : public RpcServiceRequest { public: + struct Tag { + std::string value; + std::string key; + }; ListAggregateConfigRulesRequest(); ~ListAggregateConfigRulesRequest(); bool getFilterInCompliancePack() const; @@ -46,6 +50,8 @@ public: void setPageSize(int pageSize); std::string getCompliancePackId() const; void setCompliancePackId(const std::string &compliancePackId); + Tag getTag() const; + void setTag(const Tag &tag); std::string getComplianceType() const; void setComplianceType(const std::string &complianceType); int getRiskLevel() const; @@ -62,6 +68,7 @@ private: int pageNumber_; int pageSize_; std::string compliancePackId_; + Tag tag_; std::string complianceType_; int riskLevel_; std::string configRuleName_; diff --git a/config/include/alibabacloud/config/model/ListAggregateConfigRulesResult.h b/config/include/alibabacloud/config/model/ListAggregateConfigRulesResult.h index 3d4c3e640..7cff2afd3 100644 --- a/config/include/alibabacloud/config/model/ListAggregateConfigRulesResult.h +++ b/config/include/alibabacloud/config/model/ListAggregateConfigRulesResult.h @@ -51,18 +51,24 @@ namespace AlibabaCloud std::string creatorName; std::string aggregatorId; }; - std::string configRuleId; + struct Tag + { + std::string value; + std::string key; + }; long accountId; std::string description; Compliance compliance; - std::string configRuleArn; - std::string automationType; std::string sourceOwner; CreateBy createBy; std::string sourceIdentifier; + std::string configRuleState; + std::string configRuleId; + std::string configRuleArn; + std::string automationType; std::string configRuleName; int riskLevel; - std::string configRuleState; + std::vector tags; }; long totalCount; int pageSize; diff --git a/config/include/alibabacloud/config/model/ListTagResourcesRequest.h b/config/include/alibabacloud/config/model/ListTagResourcesRequest.h new file mode 100644 index 000000000..1205a0239 --- /dev/null +++ b/config/include/alibabacloud/config/model/ListTagResourcesRequest.h @@ -0,0 +1,54 @@ +/* + * 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_CONFIG_MODEL_LISTTAGRESOURCESREQUEST_H_ +#define ALIBABACLOUD_CONFIG_MODEL_LISTTAGRESOURCESREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Config { +namespace Model { +class ALIBABACLOUD_CONFIG_EXPORT ListTagResourcesRequest : public RpcServiceRequest { +public: + ListTagResourcesRequest(); + ~ListTagResourcesRequest(); + std::vector getResourceId() const; + void setResourceId(const std::vector &resourceId); + std::string getResourceType() const; + void setResourceType(const std::string &resourceType); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); + std::string getNextToken() const; + void setNextToken(const std::string &nextToken); + std::string getTag() const; + void setTag(const std::string &tag); + +private: + std::vector resourceId_; + std::string resourceType_; + std::string regionId_; + std::string nextToken_; + std::string tag_; +}; +} // namespace Model +} // namespace Config +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_CONFIG_MODEL_LISTTAGRESOURCESREQUEST_H_ diff --git a/config/include/alibabacloud/config/model/ListTagResourcesResult.h b/config/include/alibabacloud/config/model/ListTagResourcesResult.h new file mode 100644 index 000000000..14ba71240 --- /dev/null +++ b/config/include/alibabacloud/config/model/ListTagResourcesResult.h @@ -0,0 +1,60 @@ +/* + * 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_CONFIG_MODEL_LISTTAGRESOURCESRESULT_H_ +#define ALIBABACLOUD_CONFIG_MODEL_LISTTAGRESOURCESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Config + { + namespace Model + { + class ALIBABACLOUD_CONFIG_EXPORT ListTagResourcesResult : public ServiceResult + { + public: + struct TagResource + { + std::string resourceId; + std::string tagKey; + std::string resourceType; + std::string tagValue; + }; + + + ListTagResourcesResult(); + explicit ListTagResourcesResult(const std::string &payload); + ~ListTagResourcesResult(); + std::string getNextToken()const; + std::vector getTagResources()const; + + protected: + void parse(const std::string &payload); + private: + std::string nextToken_; + std::vector tagResources_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CONFIG_MODEL_LISTTAGRESOURCESRESULT_H_ \ No newline at end of file diff --git a/config/include/alibabacloud/config/model/TagResourcesRequest.h b/config/include/alibabacloud/config/model/TagResourcesRequest.h new file mode 100644 index 000000000..f2c9912a0 --- /dev/null +++ b/config/include/alibabacloud/config/model/TagResourcesRequest.h @@ -0,0 +1,51 @@ +/* + * 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_CONFIG_MODEL_TAGRESOURCESREQUEST_H_ +#define ALIBABACLOUD_CONFIG_MODEL_TAGRESOURCESREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Config { +namespace Model { +class ALIBABACLOUD_CONFIG_EXPORT TagResourcesRequest : public RpcServiceRequest { +public: + TagResourcesRequest(); + ~TagResourcesRequest(); + std::vector getResourceId() const; + void setResourceId(const std::vector &resourceId); + std::string getResourceType() const; + void setResourceType(const std::string &resourceType); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); + std::string getTag() const; + void setTag(const std::string &tag); + +private: + std::vector resourceId_; + std::string resourceType_; + std::string regionId_; + std::string tag_; +}; +} // namespace Model +} // namespace Config +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_CONFIG_MODEL_TAGRESOURCESREQUEST_H_ diff --git a/config/include/alibabacloud/config/model/TagResourcesResult.h b/config/include/alibabacloud/config/model/TagResourcesResult.h new file mode 100644 index 000000000..7bd951315 --- /dev/null +++ b/config/include/alibabacloud/config/model/TagResourcesResult.h @@ -0,0 +1,49 @@ +/* + * 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_CONFIG_MODEL_TAGRESOURCESRESULT_H_ +#define ALIBABACLOUD_CONFIG_MODEL_TAGRESOURCESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Config + { + namespace Model + { + class ALIBABACLOUD_CONFIG_EXPORT TagResourcesResult : public ServiceResult + { + public: + + + TagResourcesResult(); + explicit TagResourcesResult(const std::string &payload); + ~TagResourcesResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_CONFIG_MODEL_TAGRESOURCESRESULT_H_ \ No newline at end of file diff --git a/config/include/alibabacloud/config/model/UntagResourcesRequest.h b/config/include/alibabacloud/config/model/UntagResourcesRequest.h new file mode 100644 index 000000000..ccb192cf9 --- /dev/null +++ b/config/include/alibabacloud/config/model/UntagResourcesRequest.h @@ -0,0 +1,54 @@ +/* + * 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_CONFIG_MODEL_UNTAGRESOURCESREQUEST_H_ +#define ALIBABACLOUD_CONFIG_MODEL_UNTAGRESOURCESREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Config { +namespace Model { +class ALIBABACLOUD_CONFIG_EXPORT UntagResourcesRequest : public RpcServiceRequest { +public: + UntagResourcesRequest(); + ~UntagResourcesRequest(); + bool getAll() const; + void setAll(bool all); + std::vector getResourceId() const; + void setResourceId(const std::vector &resourceId); + std::string getResourceType() const; + void setResourceType(const std::string &resourceType); + std::string getRegionId() const; + void setRegionId(const std::string ®ionId); + std::vector getTagKey() const; + void setTagKey(const std::vector &tagKey); + +private: + bool all_; + std::vector resourceId_; + std::string resourceType_; + std::string regionId_; + std::vector tagKey_; +}; +} // namespace Model +} // namespace Config +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_CONFIG_MODEL_UNTAGRESOURCESREQUEST_H_ diff --git a/config/include/alibabacloud/config/model/UntagResourcesResult.h b/config/include/alibabacloud/config/model/UntagResourcesResult.h new file mode 100644 index 000000000..a33c3692c --- /dev/null +++ b/config/include/alibabacloud/config/model/UntagResourcesResult.h @@ -0,0 +1,49 @@ +/* + * 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_CONFIG_MODEL_UNTAGRESOURCESRESULT_H_ +#define ALIBABACLOUD_CONFIG_MODEL_UNTAGRESOURCESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Config + { + namespace Model + { + class ALIBABACLOUD_CONFIG_EXPORT UntagResourcesResult : public ServiceResult + { + public: + + + UntagResourcesResult(); + explicit UntagResourcesResult(const std::string &payload); + ~UntagResourcesResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_CONFIG_MODEL_UNTAGRESOURCESRESULT_H_ \ No newline at end of file diff --git a/config/src/ConfigClient.cc b/config/src/ConfigClient.cc index a93743575..1947cc29a 100644 --- a/config/src/ConfigClient.cc +++ b/config/src/ConfigClient.cc @@ -2931,6 +2931,42 @@ ConfigClient::ListResourceEvaluationResultsOutcomeCallable ConfigClient::listRes return task->get_future(); } +ConfigClient::ListTagResourcesOutcome ConfigClient::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 ConfigClient::listTagResourcesAsync(const ListTagResourcesRequest& request, const ListTagResourcesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listTagResources(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ConfigClient::ListTagResourcesOutcomeCallable ConfigClient::listTagResourcesCallable(const ListTagResourcesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listTagResources(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ConfigClient::RevertAggregateEvaluationResultsOutcome ConfigClient::revertAggregateEvaluationResults(const RevertAggregateEvaluationResultsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -3111,6 +3147,78 @@ ConfigClient::StartRemediationOutcomeCallable ConfigClient::startRemediationCall return task->get_future(); } +ConfigClient::TagResourcesOutcome ConfigClient::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 ConfigClient::tagResourcesAsync(const TagResourcesRequest& request, const TagResourcesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, tagResources(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ConfigClient::TagResourcesOutcomeCallable ConfigClient::tagResourcesCallable(const TagResourcesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->tagResources(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +ConfigClient::UntagResourcesOutcome ConfigClient::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 ConfigClient::untagResourcesAsync(const UntagResourcesRequest& request, const UntagResourcesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, untagResources(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ConfigClient::UntagResourcesOutcomeCallable ConfigClient::untagResourcesCallable(const UntagResourcesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->untagResources(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ConfigClient::UpdateAggregateCompliancePackOutcome ConfigClient::updateAggregateCompliancePack(const UpdateAggregateCompliancePackRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/config/src/model/ListAggregateConfigRulesRequest.cc b/config/src/model/ListAggregateConfigRulesRequest.cc index 8a0199fa0..dba5c0d1a 100644 --- a/config/src/model/ListAggregateConfigRulesRequest.cc +++ b/config/src/model/ListAggregateConfigRulesRequest.cc @@ -97,6 +97,16 @@ void ListAggregateConfigRulesRequest::setCompliancePackId(const std::string &com setParameter(std::string("CompliancePackId"), compliancePackId); } +ListAggregateConfigRulesRequest::Tag ListAggregateConfigRulesRequest::getTag() const { + return tag_; +} + +void ListAggregateConfigRulesRequest::setTag(const ListAggregateConfigRulesRequest::Tag &tag) { + tag_ = tag; + setParameter(std::string("Tag") + ".Value", tag.value); + setParameter(std::string("Tag") + ".Key", tag.key); +} + std::string ListAggregateConfigRulesRequest::getComplianceType() const { return complianceType_; } diff --git a/config/src/model/ListAggregateConfigRulesResult.cc b/config/src/model/ListAggregateConfigRulesResult.cc index 4e7f0f880..0bf4a1f45 100644 --- a/config/src/model/ListAggregateConfigRulesResult.cc +++ b/config/src/model/ListAggregateConfigRulesResult.cc @@ -70,6 +70,16 @@ void ListAggregateConfigRulesResult::parse(const std::string &payload) configRuleObject.configRuleName = configRulesNodeConfigRuleListConfigRule["ConfigRuleName"].asString(); if(!configRulesNodeConfigRuleListConfigRule["ConfigRuleId"].isNull()) configRuleObject.configRuleId = configRulesNodeConfigRuleListConfigRule["ConfigRuleId"].asString(); + auto allTagsNode = configRulesNodeConfigRuleListConfigRule["Tags"]["tag"]; + for (auto configRulesNodeConfigRuleListConfigRuleTagstag : allTagsNode) + { + ConfigRules::ConfigRule::Tag tagsObject; + if(!configRulesNodeConfigRuleListConfigRuleTagstag["Key"].isNull()) + tagsObject.key = configRulesNodeConfigRuleListConfigRuleTagstag["Key"].asString(); + if(!configRulesNodeConfigRuleListConfigRuleTagstag["Value"].isNull()) + tagsObject.value = configRulesNodeConfigRuleListConfigRuleTagstag["Value"].asString(); + configRuleObject.tags.push_back(tagsObject); + } auto complianceNode = value["Compliance"]; if(!complianceNode["ComplianceType"].isNull()) configRuleObject.compliance.complianceType = complianceNode["ComplianceType"].asString(); diff --git a/config/src/model/ListTagResourcesRequest.cc b/config/src/model/ListTagResourcesRequest.cc new file mode 100644 index 000000000..e787f6a6a --- /dev/null +++ b/config/src/model/ListTagResourcesRequest.cc @@ -0,0 +1,71 @@ +/* + * 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 + +using AlibabaCloud::Config::Model::ListTagResourcesRequest; + +ListTagResourcesRequest::ListTagResourcesRequest() + : RpcServiceRequest("config", "2020-09-07", "ListTagResources") { + setMethod(HttpRequest::Method::Post); +} + +ListTagResourcesRequest::~ListTagResourcesRequest() {} + +std::vector ListTagResourcesRequest::getResourceId() const { + return resourceId_; +} + +void ListTagResourcesRequest::setResourceId(const std::vector &resourceId) { + resourceId_ = resourceId; +} + +std::string ListTagResourcesRequest::getResourceType() const { + return resourceType_; +} + +void ListTagResourcesRequest::setResourceType(const std::string &resourceType) { + resourceType_ = resourceType; + setBodyParameter(std::string("ResourceType"), resourceType); +} + +std::string ListTagResourcesRequest::getRegionId() const { + return regionId_; +} + +void ListTagResourcesRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setBodyParameter(std::string("RegionId"), regionId); +} + +std::string ListTagResourcesRequest::getNextToken() const { + return nextToken_; +} + +void ListTagResourcesRequest::setNextToken(const std::string &nextToken) { + nextToken_ = nextToken; + setBodyParameter(std::string("NextToken"), nextToken); +} + +std::string ListTagResourcesRequest::getTag() const { + return tag_; +} + +void ListTagResourcesRequest::setTag(const std::string &tag) { + tag_ = tag; + setBodyParameter(std::string("Tag"), tag); +} + diff --git a/config/src/model/ListTagResourcesResult.cc b/config/src/model/ListTagResourcesResult.cc new file mode 100644 index 000000000..3c3edcf3a --- /dev/null +++ b/config/src/model/ListTagResourcesResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Config; +using namespace AlibabaCloud::Config::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["TagKey"].isNull()) + tagResourcesObject.tagKey = valueTagResourcesTagResource["TagKey"].asString(); + if(!valueTagResourcesTagResource["TagValue"].isNull()) + tagResourcesObject.tagValue = valueTagResourcesTagResource["TagValue"].asString(); + if(!valueTagResourcesTagResource["ResourceId"].isNull()) + tagResourcesObject.resourceId = valueTagResourcesTagResource["ResourceId"].asString(); + if(!valueTagResourcesTagResource["ResourceType"].isNull()) + tagResourcesObject.resourceType = valueTagResourcesTagResource["ResourceType"].asString(); + tagResources_.push_back(tagResourcesObject); + } + if(!value["NextToken"].isNull()) + nextToken_ = value["NextToken"].asString(); + +} + +std::string ListTagResourcesResult::getNextToken()const +{ + return nextToken_; +} + +std::vector ListTagResourcesResult::getTagResources()const +{ + return tagResources_; +} + diff --git a/config/src/model/TagResourcesRequest.cc b/config/src/model/TagResourcesRequest.cc new file mode 100644 index 000000000..20c5af75e --- /dev/null +++ b/config/src/model/TagResourcesRequest.cc @@ -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 + +using AlibabaCloud::Config::Model::TagResourcesRequest; + +TagResourcesRequest::TagResourcesRequest() + : RpcServiceRequest("config", "2020-09-07", "TagResources") { + setMethod(HttpRequest::Method::Post); +} + +TagResourcesRequest::~TagResourcesRequest() {} + +std::vector TagResourcesRequest::getResourceId() const { + return resourceId_; +} + +void TagResourcesRequest::setResourceId(const std::vector &resourceId) { + resourceId_ = resourceId; +} + +std::string TagResourcesRequest::getResourceType() const { + return resourceType_; +} + +void TagResourcesRequest::setResourceType(const std::string &resourceType) { + resourceType_ = resourceType; + setBodyParameter(std::string("ResourceType"), resourceType); +} + +std::string TagResourcesRequest::getRegionId() const { + return regionId_; +} + +void TagResourcesRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setBodyParameter(std::string("RegionId"), regionId); +} + +std::string TagResourcesRequest::getTag() const { + return tag_; +} + +void TagResourcesRequest::setTag(const std::string &tag) { + tag_ = tag; + setBodyParameter(std::string("Tag"), tag); +} + diff --git a/config/src/model/TagResourcesResult.cc b/config/src/model/TagResourcesResult.cc new file mode 100644 index 000000000..20787b1a5 --- /dev/null +++ b/config/src/model/TagResourcesResult.cc @@ -0,0 +1,44 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Config; +using namespace AlibabaCloud::Config::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()); + +} + diff --git a/config/src/model/UntagResourcesRequest.cc b/config/src/model/UntagResourcesRequest.cc new file mode 100644 index 000000000..925622b24 --- /dev/null +++ b/config/src/model/UntagResourcesRequest.cc @@ -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. + */ + +#include + +using AlibabaCloud::Config::Model::UntagResourcesRequest; + +UntagResourcesRequest::UntagResourcesRequest() + : RpcServiceRequest("config", "2020-09-07", "UntagResources") { + setMethod(HttpRequest::Method::Post); +} + +UntagResourcesRequest::~UntagResourcesRequest() {} + +bool UntagResourcesRequest::getAll() const { + return all_; +} + +void UntagResourcesRequest::setAll(bool all) { + all_ = all; + setBodyParameter(std::string("All"), all ? "true" : "false"); +} + +std::vector UntagResourcesRequest::getResourceId() const { + return resourceId_; +} + +void UntagResourcesRequest::setResourceId(const std::vector &resourceId) { + resourceId_ = resourceId; +} + +std::string UntagResourcesRequest::getResourceType() const { + return resourceType_; +} + +void UntagResourcesRequest::setResourceType(const std::string &resourceType) { + resourceType_ = resourceType; + setBodyParameter(std::string("ResourceType"), resourceType); +} + +std::string UntagResourcesRequest::getRegionId() const { + return regionId_; +} + +void UntagResourcesRequest::setRegionId(const std::string ®ionId) { + regionId_ = regionId; + setBodyParameter(std::string("RegionId"), regionId); +} + +std::vector UntagResourcesRequest::getTagKey() const { + return tagKey_; +} + +void UntagResourcesRequest::setTagKey(const std::vector &tagKey) { + tagKey_ = tagKey; +} + diff --git a/config/src/model/UntagResourcesResult.cc b/config/src/model/UntagResourcesResult.cc new file mode 100644 index 000000000..7aafa93e2 --- /dev/null +++ b/config/src/model/UntagResourcesResult.cc @@ -0,0 +1,44 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Config; +using namespace AlibabaCloud::Config::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()); + +} +