diff --git a/VERSION b/VERSION index 5c702a7c8..9753bc56b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1588 \ No newline at end of file +1.36.1589 \ No newline at end of file diff --git a/resourcecenter/CMakeLists.txt b/resourcecenter/CMakeLists.txt index 8a3819852..681df0286 100644 --- a/resourcecenter/CMakeLists.txt +++ b/resourcecenter/CMakeLists.txt @@ -37,6 +37,8 @@ set(resourcecenter_public_header_model include/alibabacloud/resourcecenter/model/GetResourceCenterServiceStatusResult.h include/alibabacloud/resourcecenter/model/GetResourceConfigurationRequest.h include/alibabacloud/resourcecenter/model/GetResourceConfigurationResult.h + include/alibabacloud/resourcecenter/model/GetResourceCountsRequest.h + include/alibabacloud/resourcecenter/model/GetResourceCountsResult.h include/alibabacloud/resourcecenter/model/ListMultiAccountResourceGroupsRequest.h include/alibabacloud/resourcecenter/model/ListMultiAccountResourceGroupsResult.h include/alibabacloud/resourcecenter/model/ListMultiAccountTagKeysRequest.h @@ -72,6 +74,8 @@ set(resourcecenter_src src/model/GetResourceCenterServiceStatusResult.cc src/model/GetResourceConfigurationRequest.cc src/model/GetResourceConfigurationResult.cc + src/model/GetResourceCountsRequest.cc + src/model/GetResourceCountsResult.cc src/model/ListMultiAccountResourceGroupsRequest.cc src/model/ListMultiAccountResourceGroupsResult.cc src/model/ListMultiAccountTagKeysRequest.cc diff --git a/resourcecenter/include/alibabacloud/resourcecenter/ResourceCenterClient.h b/resourcecenter/include/alibabacloud/resourcecenter/ResourceCenterClient.h index 32b7474a0..2e0750297 100644 --- a/resourcecenter/include/alibabacloud/resourcecenter/ResourceCenterClient.h +++ b/resourcecenter/include/alibabacloud/resourcecenter/ResourceCenterClient.h @@ -38,6 +38,8 @@ #include "model/GetResourceCenterServiceStatusResult.h" #include "model/GetResourceConfigurationRequest.h" #include "model/GetResourceConfigurationResult.h" +#include "model/GetResourceCountsRequest.h" +#include "model/GetResourceCountsResult.h" #include "model/ListMultiAccountResourceGroupsRequest.h" #include "model/ListMultiAccountResourceGroupsResult.h" #include "model/ListMultiAccountTagKeysRequest.h" @@ -87,6 +89,9 @@ namespace AlibabaCloud typedef Outcome GetResourceConfigurationOutcome; typedef std::future GetResourceConfigurationOutcomeCallable; typedef std::function&)> GetResourceConfigurationAsyncHandler; + typedef Outcome GetResourceCountsOutcome; + typedef std::future GetResourceCountsOutcomeCallable; + typedef std::function&)> GetResourceCountsAsyncHandler; typedef Outcome ListMultiAccountResourceGroupsOutcome; typedef std::future ListMultiAccountResourceGroupsOutcomeCallable; typedef std::function&)> ListMultiAccountResourceGroupsAsyncHandler; @@ -140,6 +145,9 @@ namespace AlibabaCloud GetResourceConfigurationOutcome getResourceConfiguration(const Model::GetResourceConfigurationRequest &request)const; void getResourceConfigurationAsync(const Model::GetResourceConfigurationRequest& request, const GetResourceConfigurationAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetResourceConfigurationOutcomeCallable getResourceConfigurationCallable(const Model::GetResourceConfigurationRequest& request) const; + GetResourceCountsOutcome getResourceCounts(const Model::GetResourceCountsRequest &request)const; + void getResourceCountsAsync(const Model::GetResourceCountsRequest& request, const GetResourceCountsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetResourceCountsOutcomeCallable getResourceCountsCallable(const Model::GetResourceCountsRequest& request) const; ListMultiAccountResourceGroupsOutcome listMultiAccountResourceGroups(const Model::ListMultiAccountResourceGroupsRequest &request)const; void listMultiAccountResourceGroupsAsync(const Model::ListMultiAccountResourceGroupsRequest& request, const ListMultiAccountResourceGroupsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListMultiAccountResourceGroupsOutcomeCallable listMultiAccountResourceGroupsCallable(const Model::ListMultiAccountResourceGroupsRequest& request) const; diff --git a/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsRequest.h b/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsRequest.h new file mode 100644 index 000000000..3ed3da8a3 --- /dev/null +++ b/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsRequest.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_RESOURCECENTER_MODEL_GETRESOURCECOUNTSREQUEST_H_ +#define ALIBABACLOUD_RESOURCECENTER_MODEL_GETRESOURCECOUNTSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace ResourceCenter { +namespace Model { +class ALIBABACLOUD_RESOURCECENTER_EXPORT GetResourceCountsRequest : public RpcServiceRequest { +public: + struct Filter { + std::string matchType; + std::string key; + }; + GetResourceCountsRequest(); + ~GetResourceCountsRequest(); + std::vector getFilter() const; + void setFilter(const std::vector &filter); + std::string getGroupByKey() const; + void setGroupByKey(const std::string &groupByKey); + +private: + std::vector filter_; + std::string groupByKey_; +}; +} // namespace Model +} // namespace ResourceCenter +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_RESOURCECENTER_MODEL_GETRESOURCECOUNTSREQUEST_H_ diff --git a/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsResult.h b/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsResult.h new file mode 100644 index 000000000..5dc427d1a --- /dev/null +++ b/resourcecenter/include/alibabacloud/resourcecenter/model/GetResourceCountsResult.h @@ -0,0 +1,65 @@ +/* + * 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_RESOURCECENTER_MODEL_GETRESOURCECOUNTSRESULT_H_ +#define ALIBABACLOUD_RESOURCECENTER_MODEL_GETRESOURCECOUNTSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ResourceCenter + { + namespace Model + { + class ALIBABACLOUD_RESOURCECENTER_EXPORT GetResourceCountsResult : public ServiceResult + { + public: + struct Filter + { + std::vector values; + std::string key; + }; + struct ResourceCount + { + std::string groupName; + long count; + }; + + + GetResourceCountsResult(); + explicit GetResourceCountsResult(const std::string &payload); + ~GetResourceCountsResult(); + std::vector getFilters()const; + std::string getGroupByKey()const; + std::vector getResourceCounts()const; + + protected: + void parse(const std::string &payload); + private: + std::vector filters_; + std::string groupByKey_; + std::vector resourceCounts_; + + }; + } + } +} +#endif // !ALIBABACLOUD_RESOURCECENTER_MODEL_GETRESOURCECOUNTSRESULT_H_ \ No newline at end of file diff --git a/resourcecenter/include/alibabacloud/resourcecenter/model/ListResourceTypesRequest.h b/resourcecenter/include/alibabacloud/resourcecenter/model/ListResourceTypesRequest.h index 0c7af9943..93fb110c6 100644 --- a/resourcecenter/include/alibabacloud/resourcecenter/model/ListResourceTypesRequest.h +++ b/resourcecenter/include/alibabacloud/resourcecenter/model/ListResourceTypesRequest.h @@ -34,12 +34,15 @@ public: void setQuery(const std::vector &query); std::string getResourceType() const; void setResourceType(const std::string &resourceType); + std::string getScene() const; + void setScene(const std::string &scene); std::string getAcceptLanguage() const; void setAcceptLanguage(const std::string &acceptLanguage); private: std::vector query_; std::string resourceType_; + std::string scene_; std::string acceptLanguage_; }; } // namespace Model diff --git a/resourcecenter/src/ResourceCenterClient.cc b/resourcecenter/src/ResourceCenterClient.cc index ae8122cbb..96795e0e9 100644 --- a/resourcecenter/src/ResourceCenterClient.cc +++ b/resourcecenter/src/ResourceCenterClient.cc @@ -339,6 +339,42 @@ ResourceCenterClient::GetResourceConfigurationOutcomeCallable ResourceCenterClie return task->get_future(); } +ResourceCenterClient::GetResourceCountsOutcome ResourceCenterClient::getResourceCounts(const GetResourceCountsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetResourceCountsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetResourceCountsOutcome(GetResourceCountsResult(outcome.result())); + else + return GetResourceCountsOutcome(outcome.error()); +} + +void ResourceCenterClient::getResourceCountsAsync(const GetResourceCountsRequest& request, const GetResourceCountsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getResourceCounts(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ResourceCenterClient::GetResourceCountsOutcomeCallable ResourceCenterClient::getResourceCountsCallable(const GetResourceCountsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getResourceCounts(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ResourceCenterClient::ListMultiAccountResourceGroupsOutcome ResourceCenterClient::listMultiAccountResourceGroups(const ListMultiAccountResourceGroupsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/resourcecenter/src/model/GetResourceCountsRequest.cc b/resourcecenter/src/model/GetResourceCountsRequest.cc new file mode 100644 index 000000000..c68bf551d --- /dev/null +++ b/resourcecenter/src/model/GetResourceCountsRequest.cc @@ -0,0 +1,50 @@ +/* + * 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::ResourceCenter::Model::GetResourceCountsRequest; + +GetResourceCountsRequest::GetResourceCountsRequest() + : RpcServiceRequest("resourcecenter", "2022-12-01", "GetResourceCounts") { + setMethod(HttpRequest::Method::Post); +} + +GetResourceCountsRequest::~GetResourceCountsRequest() {} + +std::vector GetResourceCountsRequest::getFilter() const { + return filter_; +} + +void GetResourceCountsRequest::setFilter(const std::vector &filter) { + filter_ = filter; + for(int dep1 = 0; dep1 != filter.size(); dep1++) { + auto filterObj = filter.at(dep1); + std::string filterObjStr = std::string("Filter") + "." + std::to_string(dep1 + 1); + setParameter(filterObjStr + ".MatchType", filterObj.matchType); + setParameter(filterObjStr + ".Key", filterObj.key); + } +} + +std::string GetResourceCountsRequest::getGroupByKey() const { + return groupByKey_; +} + +void GetResourceCountsRequest::setGroupByKey(const std::string &groupByKey) { + groupByKey_ = groupByKey; + setParameter(std::string("GroupByKey"), groupByKey); +} + diff --git a/resourcecenter/src/model/GetResourceCountsResult.cc b/resourcecenter/src/model/GetResourceCountsResult.cc new file mode 100644 index 000000000..e7b8dbe99 --- /dev/null +++ b/resourcecenter/src/model/GetResourceCountsResult.cc @@ -0,0 +1,82 @@ +/* + * 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::ResourceCenter; +using namespace AlibabaCloud::ResourceCenter::Model; + +GetResourceCountsResult::GetResourceCountsResult() : + ServiceResult() +{} + +GetResourceCountsResult::GetResourceCountsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetResourceCountsResult::~GetResourceCountsResult() +{} + +void GetResourceCountsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allFiltersNode = value["Filters"]["Filter"]; + for (auto valueFiltersFilter : allFiltersNode) + { + Filter filtersObject; + if(!valueFiltersFilter["Key"].isNull()) + filtersObject.key = valueFiltersFilter["Key"].asString(); + auto allValues = value["Values"]["Value"]; + for (auto value : allValues) + filtersObject.values.push_back(value.asString()); + filters_.push_back(filtersObject); + } + auto allResourceCountsNode = value["ResourceCounts"]["ResourceCount"]; + for (auto valueResourceCountsResourceCount : allResourceCountsNode) + { + ResourceCount resourceCountsObject; + if(!valueResourceCountsResourceCount["GroupName"].isNull()) + resourceCountsObject.groupName = valueResourceCountsResourceCount["GroupName"].asString(); + if(!valueResourceCountsResourceCount["Count"].isNull()) + resourceCountsObject.count = std::stol(valueResourceCountsResourceCount["Count"].asString()); + resourceCounts_.push_back(resourceCountsObject); + } + if(!value["GroupByKey"].isNull()) + groupByKey_ = value["GroupByKey"].asString(); + +} + +std::vector GetResourceCountsResult::getFilters()const +{ + return filters_; +} + +std::string GetResourceCountsResult::getGroupByKey()const +{ + return groupByKey_; +} + +std::vector GetResourceCountsResult::getResourceCounts()const +{ + return resourceCounts_; +} + diff --git a/resourcecenter/src/model/ListResourceTypesRequest.cc b/resourcecenter/src/model/ListResourceTypesRequest.cc index d0061c8ab..5a2c890cb 100644 --- a/resourcecenter/src/model/ListResourceTypesRequest.cc +++ b/resourcecenter/src/model/ListResourceTypesRequest.cc @@ -42,6 +42,15 @@ void ListResourceTypesRequest::setResourceType(const std::string &resourceType) setParameter(std::string("ResourceType"), resourceType); } +std::string ListResourceTypesRequest::getScene() const { + return scene_; +} + +void ListResourceTypesRequest::setScene(const std::string &scene) { + scene_ = scene; + setParameter(std::string("Scene"), scene); +} + std::string ListResourceTypesRequest::getAcceptLanguage() const { return acceptLanguage_; }