diff --git a/CHANGELOG b/CHANGELOG index 6ebc0d2ba..1e2b4fb3e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2020-09-28 Version: patch +- Support filtering keys and secrets. +- Support opening KMS service and describing service status by API. +- Add a prefix limitation for SecretName. + 2020-09-27 Version: patch - Update domain API. diff --git a/kms/CMakeLists.txt b/kms/CMakeLists.txt index f9e07c8ce..fd5c01da2 100644 --- a/kms/CMakeLists.txt +++ b/kms/CMakeLists.txt @@ -47,6 +47,8 @@ set(kms_public_header_model include/alibabacloud/kms/model/DeleteKeyMaterialResult.h include/alibabacloud/kms/model/DeleteSecretRequest.h include/alibabacloud/kms/model/DeleteSecretResult.h + include/alibabacloud/kms/model/DescribeAccountKmsStatusRequest.h + include/alibabacloud/kms/model/DescribeAccountKmsStatusResult.h include/alibabacloud/kms/model/DescribeKeyRequest.h include/alibabacloud/kms/model/DescribeKeyResult.h include/alibabacloud/kms/model/DescribeKeyVersionRequest.h @@ -95,6 +97,8 @@ set(kms_public_header_model include/alibabacloud/kms/model/ListSecretVersionIdsResult.h include/alibabacloud/kms/model/ListSecretsRequest.h include/alibabacloud/kms/model/ListSecretsResult.h + include/alibabacloud/kms/model/OpenKmsServiceRequest.h + include/alibabacloud/kms/model/OpenKmsServiceResult.h include/alibabacloud/kms/model/PutSecretValueRequest.h include/alibabacloud/kms/model/PutSecretValueResult.h include/alibabacloud/kms/model/ReEncryptRequest.h @@ -146,6 +150,8 @@ set(kms_src src/model/DeleteKeyMaterialResult.cc src/model/DeleteSecretRequest.cc src/model/DeleteSecretResult.cc + src/model/DescribeAccountKmsStatusRequest.cc + src/model/DescribeAccountKmsStatusResult.cc src/model/DescribeKeyRequest.cc src/model/DescribeKeyResult.cc src/model/DescribeKeyVersionRequest.cc @@ -194,6 +200,8 @@ set(kms_src src/model/ListSecretVersionIdsResult.cc src/model/ListSecretsRequest.cc src/model/ListSecretsResult.cc + src/model/OpenKmsServiceRequest.cc + src/model/OpenKmsServiceResult.cc src/model/PutSecretValueRequest.cc src/model/PutSecretValueResult.cc src/model/ReEncryptRequest.cc diff --git a/kms/include/alibabacloud/kms/KmsClient.h b/kms/include/alibabacloud/kms/KmsClient.h index c7f8564f5..43d9057bd 100644 --- a/kms/include/alibabacloud/kms/KmsClient.h +++ b/kms/include/alibabacloud/kms/KmsClient.h @@ -48,6 +48,8 @@ #include "model/DeleteKeyMaterialResult.h" #include "model/DeleteSecretRequest.h" #include "model/DeleteSecretResult.h" +#include "model/DescribeAccountKmsStatusRequest.h" +#include "model/DescribeAccountKmsStatusResult.h" #include "model/DescribeKeyRequest.h" #include "model/DescribeKeyResult.h" #include "model/DescribeKeyVersionRequest.h" @@ -96,6 +98,8 @@ #include "model/ListSecretVersionIdsResult.h" #include "model/ListSecretsRequest.h" #include "model/ListSecretsResult.h" +#include "model/OpenKmsServiceRequest.h" +#include "model/OpenKmsServiceResult.h" #include "model/PutSecretValueRequest.h" #include "model/PutSecretValueResult.h" #include "model/ReEncryptRequest.h" @@ -166,6 +170,9 @@ namespace AlibabaCloud typedef Outcome DeleteSecretOutcome; typedef std::future DeleteSecretOutcomeCallable; typedef std::function&)> DeleteSecretAsyncHandler; + typedef Outcome DescribeAccountKmsStatusOutcome; + typedef std::future DescribeAccountKmsStatusOutcomeCallable; + typedef std::function&)> DescribeAccountKmsStatusAsyncHandler; typedef Outcome DescribeKeyOutcome; typedef std::future DescribeKeyOutcomeCallable; typedef std::function&)> DescribeKeyAsyncHandler; @@ -238,6 +245,9 @@ namespace AlibabaCloud typedef Outcome ListSecretsOutcome; typedef std::future ListSecretsOutcomeCallable; typedef std::function&)> ListSecretsAsyncHandler; + typedef Outcome OpenKmsServiceOutcome; + typedef std::future OpenKmsServiceOutcomeCallable; + typedef std::function&)> OpenKmsServiceAsyncHandler; typedef Outcome PutSecretValueOutcome; typedef std::future PutSecretValueOutcomeCallable; typedef std::function&)> PutSecretValueAsyncHandler; @@ -315,6 +325,9 @@ namespace AlibabaCloud DeleteSecretOutcome deleteSecret(const Model::DeleteSecretRequest &request)const; void deleteSecretAsync(const Model::DeleteSecretRequest& request, const DeleteSecretAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DeleteSecretOutcomeCallable deleteSecretCallable(const Model::DeleteSecretRequest& request) const; + DescribeAccountKmsStatusOutcome describeAccountKmsStatus(const Model::DescribeAccountKmsStatusRequest &request)const; + void describeAccountKmsStatusAsync(const Model::DescribeAccountKmsStatusRequest& request, const DescribeAccountKmsStatusAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DescribeAccountKmsStatusOutcomeCallable describeAccountKmsStatusCallable(const Model::DescribeAccountKmsStatusRequest& request) const; DescribeKeyOutcome describeKey(const Model::DescribeKeyRequest &request)const; void describeKeyAsync(const Model::DescribeKeyRequest& request, const DescribeKeyAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DescribeKeyOutcomeCallable describeKeyCallable(const Model::DescribeKeyRequest& request) const; @@ -387,6 +400,9 @@ namespace AlibabaCloud ListSecretsOutcome listSecrets(const Model::ListSecretsRequest &request)const; void listSecretsAsync(const Model::ListSecretsRequest& request, const ListSecretsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListSecretsOutcomeCallable listSecretsCallable(const Model::ListSecretsRequest& request) const; + OpenKmsServiceOutcome openKmsService(const Model::OpenKmsServiceRequest &request)const; + void openKmsServiceAsync(const Model::OpenKmsServiceRequest& request, const OpenKmsServiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + OpenKmsServiceOutcomeCallable openKmsServiceCallable(const Model::OpenKmsServiceRequest& request) const; PutSecretValueOutcome putSecretValue(const Model::PutSecretValueRequest &request)const; void putSecretValueAsync(const Model::PutSecretValueRequest& request, const PutSecretValueAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; PutSecretValueOutcomeCallable putSecretValueCallable(const Model::PutSecretValueRequest& request) const; diff --git a/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusRequest.h b/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusRequest.h new file mode 100644 index 000000000..cb8444b03 --- /dev/null +++ b/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusRequest.h @@ -0,0 +1,45 @@ +/* + * 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_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSREQUEST_H_ +#define ALIBABACLOUD_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Kms + { + namespace Model + { + class ALIBABACLOUD_KMS_EXPORT DescribeAccountKmsStatusRequest : public RpcServiceRequest + { + + public: + DescribeAccountKmsStatusRequest(); + ~DescribeAccountKmsStatusRequest(); + + + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSREQUEST_H_ \ No newline at end of file diff --git a/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusResult.h b/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusResult.h new file mode 100644 index 000000000..8ddfaed18 --- /dev/null +++ b/kms/include/alibabacloud/kms/model/DescribeAccountKmsStatusResult.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_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSRESULT_H_ +#define ALIBABACLOUD_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Kms + { + namespace Model + { + class ALIBABACLOUD_KMS_EXPORT DescribeAccountKmsStatusResult : public ServiceResult + { + public: + + + DescribeAccountKmsStatusResult(); + explicit DescribeAccountKmsStatusResult(const std::string &payload); + ~DescribeAccountKmsStatusResult(); + std::string getAccountStatus()const; + + protected: + void parse(const std::string &payload); + private: + std::string accountStatus_; + + }; + } + } +} +#endif // !ALIBABACLOUD_KMS_MODEL_DESCRIBEACCOUNTKMSSTATUSRESULT_H_ \ No newline at end of file diff --git a/kms/include/alibabacloud/kms/model/ListKeysRequest.h b/kms/include/alibabacloud/kms/model/ListKeysRequest.h index d80c5cceb..bf55fa67e 100644 --- a/kms/include/alibabacloud/kms/model/ListKeysRequest.h +++ b/kms/include/alibabacloud/kms/model/ListKeysRequest.h @@ -37,11 +37,14 @@ namespace AlibabaCloud int getPageSize()const; void setPageSize(int pageSize); + std::string getFilters()const; + void setFilters(const std::string& filters); int getPageNumber()const; void setPageNumber(int pageNumber); private: int pageSize_; + std::string filters_; int pageNumber_; }; diff --git a/kms/include/alibabacloud/kms/model/ListSecretsRequest.h b/kms/include/alibabacloud/kms/model/ListSecretsRequest.h index b0c0cba02..6efa7313b 100644 --- a/kms/include/alibabacloud/kms/model/ListSecretsRequest.h +++ b/kms/include/alibabacloud/kms/model/ListSecretsRequest.h @@ -37,6 +37,8 @@ namespace AlibabaCloud int getPageSize()const; void setPageSize(int pageSize); + std::string getFilters()const; + void setFilters(const std::string& filters); std::string getFetchTags()const; void setFetchTags(const std::string& fetchTags); int getPageNumber()const; @@ -44,6 +46,7 @@ namespace AlibabaCloud private: int pageSize_; + std::string filters_; std::string fetchTags_; int pageNumber_; diff --git a/kms/include/alibabacloud/kms/model/OpenKmsServiceRequest.h b/kms/include/alibabacloud/kms/model/OpenKmsServiceRequest.h new file mode 100644 index 000000000..188710e1b --- /dev/null +++ b/kms/include/alibabacloud/kms/model/OpenKmsServiceRequest.h @@ -0,0 +1,45 @@ +/* + * 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_KMS_MODEL_OPENKMSSERVICEREQUEST_H_ +#define ALIBABACLOUD_KMS_MODEL_OPENKMSSERVICEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Kms + { + namespace Model + { + class ALIBABACLOUD_KMS_EXPORT OpenKmsServiceRequest : public RpcServiceRequest + { + + public: + OpenKmsServiceRequest(); + ~OpenKmsServiceRequest(); + + + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_KMS_MODEL_OPENKMSSERVICEREQUEST_H_ \ No newline at end of file diff --git a/kms/include/alibabacloud/kms/model/OpenKmsServiceResult.h b/kms/include/alibabacloud/kms/model/OpenKmsServiceResult.h new file mode 100644 index 000000000..f48c7e4b6 --- /dev/null +++ b/kms/include/alibabacloud/kms/model/OpenKmsServiceResult.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_KMS_MODEL_OPENKMSSERVICERESULT_H_ +#define ALIBABACLOUD_KMS_MODEL_OPENKMSSERVICERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Kms + { + namespace Model + { + class ALIBABACLOUD_KMS_EXPORT OpenKmsServiceResult : public ServiceResult + { + public: + + + OpenKmsServiceResult(); + explicit OpenKmsServiceResult(const std::string &payload); + ~OpenKmsServiceResult(); + + protected: + void parse(const std::string &payload); + private: + + }; + } + } +} +#endif // !ALIBABACLOUD_KMS_MODEL_OPENKMSSERVICERESULT_H_ \ No newline at end of file diff --git a/kms/src/KmsClient.cc b/kms/src/KmsClient.cc index fcddd259a..2e42adb0e 100644 --- a/kms/src/KmsClient.cc +++ b/kms/src/KmsClient.cc @@ -31,21 +31,21 @@ KmsClient::KmsClient(const Credentials &credentials, const ClientConfiguration & RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) { auto locationClient = std::make_shared(credentials, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms"); } KmsClient::KmsClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) { auto locationClient = std::make_shared(credentialsProvider, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms"); } KmsClient::KmsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) { auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "kms"); } KmsClient::~KmsClient() @@ -519,6 +519,42 @@ KmsClient::DeleteSecretOutcomeCallable KmsClient::deleteSecretCallable(const Del return task->get_future(); } +KmsClient::DescribeAccountKmsStatusOutcome KmsClient::describeAccountKmsStatus(const DescribeAccountKmsStatusRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DescribeAccountKmsStatusOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DescribeAccountKmsStatusOutcome(DescribeAccountKmsStatusResult(outcome.result())); + else + return DescribeAccountKmsStatusOutcome(outcome.error()); +} + +void KmsClient::describeAccountKmsStatusAsync(const DescribeAccountKmsStatusRequest& request, const DescribeAccountKmsStatusAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, describeAccountKmsStatus(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +KmsClient::DescribeAccountKmsStatusOutcomeCallable KmsClient::describeAccountKmsStatusCallable(const DescribeAccountKmsStatusRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->describeAccountKmsStatus(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + KmsClient::DescribeKeyOutcome KmsClient::describeKey(const DescribeKeyRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -1383,6 +1419,42 @@ KmsClient::ListSecretsOutcomeCallable KmsClient::listSecretsCallable(const ListS return task->get_future(); } +KmsClient::OpenKmsServiceOutcome KmsClient::openKmsService(const OpenKmsServiceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return OpenKmsServiceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return OpenKmsServiceOutcome(OpenKmsServiceResult(outcome.result())); + else + return OpenKmsServiceOutcome(outcome.error()); +} + +void KmsClient::openKmsServiceAsync(const OpenKmsServiceRequest& request, const OpenKmsServiceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, openKmsService(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +KmsClient::OpenKmsServiceOutcomeCallable KmsClient::openKmsServiceCallable(const OpenKmsServiceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->openKmsService(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + KmsClient::PutSecretValueOutcome KmsClient::putSecretValue(const PutSecretValueRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/kms/src/model/DescribeAccountKmsStatusRequest.cc b/kms/src/model/DescribeAccountKmsStatusRequest.cc new file mode 100644 index 000000000..4e74db11c --- /dev/null +++ b/kms/src/model/DescribeAccountKmsStatusRequest.cc @@ -0,0 +1,29 @@ +/* + * 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::Kms::Model::DescribeAccountKmsStatusRequest; + +DescribeAccountKmsStatusRequest::DescribeAccountKmsStatusRequest() : + RpcServiceRequest("kms", "2016-01-20", "DescribeAccountKmsStatus") +{ + setMethod(HttpRequest::Method::Post); +} + +DescribeAccountKmsStatusRequest::~DescribeAccountKmsStatusRequest() +{} + diff --git a/kms/src/model/DescribeAccountKmsStatusResult.cc b/kms/src/model/DescribeAccountKmsStatusResult.cc new file mode 100644 index 000000000..ddb4a42ab --- /dev/null +++ b/kms/src/model/DescribeAccountKmsStatusResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Kms; +using namespace AlibabaCloud::Kms::Model; + +DescribeAccountKmsStatusResult::DescribeAccountKmsStatusResult() : + ServiceResult() +{} + +DescribeAccountKmsStatusResult::DescribeAccountKmsStatusResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DescribeAccountKmsStatusResult::~DescribeAccountKmsStatusResult() +{} + +void DescribeAccountKmsStatusResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["AccountStatus"].isNull()) + accountStatus_ = value["AccountStatus"].asString(); + +} + +std::string DescribeAccountKmsStatusResult::getAccountStatus()const +{ + return accountStatus_; +} + diff --git a/kms/src/model/ListKeysRequest.cc b/kms/src/model/ListKeysRequest.cc index 9c6c380e8..33fd21cf9 100644 --- a/kms/src/model/ListKeysRequest.cc +++ b/kms/src/model/ListKeysRequest.cc @@ -38,6 +38,17 @@ void ListKeysRequest::setPageSize(int pageSize) setParameter("PageSize", std::to_string(pageSize)); } +std::string ListKeysRequest::getFilters()const +{ + return filters_; +} + +void ListKeysRequest::setFilters(const std::string& filters) +{ + filters_ = filters; + setParameter("Filters", filters); +} + int ListKeysRequest::getPageNumber()const { return pageNumber_; diff --git a/kms/src/model/ListKeysResult.cc b/kms/src/model/ListKeysResult.cc index 142c0333b..3acc2a05d 100644 --- a/kms/src/model/ListKeysResult.cc +++ b/kms/src/model/ListKeysResult.cc @@ -43,18 +43,18 @@ void ListKeysResult::parse(const std::string &payload) for (auto valueKeysKey : allKeysNode) { Key keysObject; - if(!valueKeysKey["KeyId"].isNull()) - keysObject.keyId = valueKeysKey["KeyId"].asString(); if(!valueKeysKey["KeyArn"].isNull()) keysObject.keyArn = valueKeysKey["KeyArn"].asString(); + if(!valueKeysKey["KeyId"].isNull()) + keysObject.keyId = valueKeysKey["KeyId"].asString(); keys_.push_back(keysObject); } - if(!value["TotalCount"].isNull()) - totalCount_ = std::stoi(value["TotalCount"].asString()); if(!value["PageNumber"].isNull()) pageNumber_ = std::stoi(value["PageNumber"].asString()); if(!value["PageSize"].isNull()) pageSize_ = std::stoi(value["PageSize"].asString()); + if(!value["TotalCount"].isNull()) + totalCount_ = std::stoi(value["TotalCount"].asString()); } diff --git a/kms/src/model/ListSecretsRequest.cc b/kms/src/model/ListSecretsRequest.cc index e3d1b8a42..90221d2cc 100644 --- a/kms/src/model/ListSecretsRequest.cc +++ b/kms/src/model/ListSecretsRequest.cc @@ -38,6 +38,17 @@ void ListSecretsRequest::setPageSize(int pageSize) setParameter("PageSize", std::to_string(pageSize)); } +std::string ListSecretsRequest::getFilters()const +{ + return filters_; +} + +void ListSecretsRequest::setFilters(const std::string& filters) +{ + filters_ = filters; + setParameter("Filters", filters); +} + std::string ListSecretsRequest::getFetchTags()const { return fetchTags_; diff --git a/kms/src/model/ListSecretsResult.cc b/kms/src/model/ListSecretsResult.cc index 90c0e3aae..ba5e045bc 100644 --- a/kms/src/model/ListSecretsResult.cc +++ b/kms/src/model/ListSecretsResult.cc @@ -43,14 +43,14 @@ void ListSecretsResult::parse(const std::string &payload) for (auto valueSecretListSecret : allSecretListNode) { Secret secretListObject; - if(!valueSecretListSecret["SecretName"].isNull()) - secretListObject.secretName = valueSecretListSecret["SecretName"].asString(); if(!valueSecretListSecret["CreateTime"].isNull()) secretListObject.createTime = valueSecretListSecret["CreateTime"].asString(); - if(!valueSecretListSecret["UpdateTime"].isNull()) - secretListObject.updateTime = valueSecretListSecret["UpdateTime"].asString(); if(!valueSecretListSecret["PlannedDeleteTime"].isNull()) secretListObject.plannedDeleteTime = valueSecretListSecret["PlannedDeleteTime"].asString(); + if(!valueSecretListSecret["SecretName"].isNull()) + secretListObject.secretName = valueSecretListSecret["SecretName"].asString(); + if(!valueSecretListSecret["UpdateTime"].isNull()) + secretListObject.updateTime = valueSecretListSecret["UpdateTime"].asString(); auto allTagsNode = allSecretListNode["Tags"]["Tag"]; for (auto allSecretListNodeTagsTag : allTagsNode) { diff --git a/kms/src/model/OpenKmsServiceRequest.cc b/kms/src/model/OpenKmsServiceRequest.cc new file mode 100644 index 000000000..101f43730 --- /dev/null +++ b/kms/src/model/OpenKmsServiceRequest.cc @@ -0,0 +1,29 @@ +/* + * 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::Kms::Model::OpenKmsServiceRequest; + +OpenKmsServiceRequest::OpenKmsServiceRequest() : + RpcServiceRequest("kms", "2016-01-20", "OpenKmsService") +{ + setMethod(HttpRequest::Method::Post); +} + +OpenKmsServiceRequest::~OpenKmsServiceRequest() +{} + diff --git a/kms/src/model/OpenKmsServiceResult.cc b/kms/src/model/OpenKmsServiceResult.cc new file mode 100644 index 000000000..1e6b0ad89 --- /dev/null +++ b/kms/src/model/OpenKmsServiceResult.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::Kms; +using namespace AlibabaCloud::Kms::Model; + +OpenKmsServiceResult::OpenKmsServiceResult() : + ServiceResult() +{} + +OpenKmsServiceResult::OpenKmsServiceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +OpenKmsServiceResult::~OpenKmsServiceResult() +{} + +void OpenKmsServiceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + +} +