Add kms apis.

This commit is contained in:
sdk-team
2022-07-21 08:44:47 +00:00
parent 53badb17c1
commit 63d1456017
13 changed files with 643 additions and 1 deletions

View File

@@ -663,6 +663,42 @@ VodClient::CreateUploadVideoOutcomeCallable VodClient::createUploadVideoCallable
return task->get_future();
}
VodClient::DecryptKMSDataKeyOutcome VodClient::decryptKMSDataKey(const DecryptKMSDataKeyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DecryptKMSDataKeyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DecryptKMSDataKeyOutcome(DecryptKMSDataKeyResult(outcome.result()));
else
return DecryptKMSDataKeyOutcome(outcome.error());
}
void VodClient::decryptKMSDataKeyAsync(const DecryptKMSDataKeyRequest& request, const DecryptKMSDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, decryptKMSDataKey(request), context);
};
asyncExecute(new Runnable(fn));
}
VodClient::DecryptKMSDataKeyOutcomeCallable VodClient::decryptKMSDataKeyCallable(const DecryptKMSDataKeyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DecryptKMSDataKeyOutcome()>>(
[this, request]()
{
return this->decryptKMSDataKey(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VodClient::DeleteAIImageInfosOutcome VodClient::deleteAIImageInfos(const DeleteAIImageInfosRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -2031,6 +2067,42 @@ VodClient::DetachAppPolicyFromIdentityOutcomeCallable VodClient::detachAppPolicy
return task->get_future();
}
VodClient::GenerateKMSDataKeyOutcome VodClient::generateKMSDataKey(const GenerateKMSDataKeyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GenerateKMSDataKeyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GenerateKMSDataKeyOutcome(GenerateKMSDataKeyResult(outcome.result()));
else
return GenerateKMSDataKeyOutcome(outcome.error());
}
void VodClient::generateKMSDataKeyAsync(const GenerateKMSDataKeyRequest& request, const GenerateKMSDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, generateKMSDataKey(request), context);
};
asyncExecute(new Runnable(fn));
}
VodClient::GenerateKMSDataKeyOutcomeCallable VodClient::generateKMSDataKeyCallable(const GenerateKMSDataKeyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GenerateKMSDataKeyOutcome()>>(
[this, request]()
{
return this->generateKMSDataKey(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VodClient::GetAIImageJobsOutcome VodClient::getAIImageJobs(const GetAIImageJobsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,99 @@
/*
* 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/vod/model/DecryptKMSDataKeyRequest.h>
using AlibabaCloud::Vod::Model::DecryptKMSDataKeyRequest;
DecryptKMSDataKeyRequest::DecryptKMSDataKeyRequest()
: RpcServiceRequest("vod", "2017-03-21", "DecryptKMSDataKey") {
setMethod(HttpRequest::Method::Post);
}
DecryptKMSDataKeyRequest::~DecryptKMSDataKeyRequest() {}
std::string DecryptKMSDataKeyRequest::getResourceOwnerId() const {
return resourceOwnerId_;
}
void DecryptKMSDataKeyRequest::setResourceOwnerId(const std::string &resourceOwnerId) {
resourceOwnerId_ = resourceOwnerId;
setParameter(std::string("ResourceOwnerId"), resourceOwnerId);
}
long DecryptKMSDataKeyRequest::getResourceRealOwnerId() const {
return resourceRealOwnerId_;
}
void DecryptKMSDataKeyRequest::setResourceRealOwnerId(long resourceRealOwnerId) {
resourceRealOwnerId_ = resourceRealOwnerId;
setParameter(std::string("ResourceRealOwnerId"), std::to_string(resourceRealOwnerId));
}
std::string DecryptKMSDataKeyRequest::getAccessKeyId() const {
return accessKeyId_;
}
void DecryptKMSDataKeyRequest::setAccessKeyId(const std::string &accessKeyId) {
accessKeyId_ = accessKeyId;
setParameter(std::string("AccessKeyId"), accessKeyId);
}
std::string DecryptKMSDataKeyRequest::getKmsRegionId() const {
return kmsRegionId_;
}
void DecryptKMSDataKeyRequest::setKmsRegionId(const std::string &kmsRegionId) {
kmsRegionId_ = kmsRegionId;
setParameter(std::string("KmsRegionId"), kmsRegionId);
}
std::string DecryptKMSDataKeyRequest::getCipherText() const {
return cipherText_;
}
void DecryptKMSDataKeyRequest::setCipherText(const std::string &cipherText) {
cipherText_ = cipherText;
setParameter(std::string("CipherText"), cipherText);
}
std::string DecryptKMSDataKeyRequest::getResourceOwnerAccount() const {
return resourceOwnerAccount_;
}
void DecryptKMSDataKeyRequest::setResourceOwnerAccount(const std::string &resourceOwnerAccount) {
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount);
}
std::string DecryptKMSDataKeyRequest::getOwnerAccount() const {
return ownerAccount_;
}
void DecryptKMSDataKeyRequest::setOwnerAccount(const std::string &ownerAccount) {
ownerAccount_ = ownerAccount;
setParameter(std::string("OwnerAccount"), ownerAccount);
}
std::string DecryptKMSDataKeyRequest::getOwnerId() const {
return ownerId_;
}
void DecryptKMSDataKeyRequest::setOwnerId(const std::string &ownerId) {
ownerId_ = ownerId;
setParameter(std::string("OwnerId"), ownerId);
}

View File

@@ -0,0 +1,58 @@
/*
* 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/vod/model/DecryptKMSDataKeyResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vod;
using namespace AlibabaCloud::Vod::Model;
DecryptKMSDataKeyResult::DecryptKMSDataKeyResult() :
ServiceResult()
{}
DecryptKMSDataKeyResult::DecryptKMSDataKeyResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DecryptKMSDataKeyResult::~DecryptKMSDataKeyResult()
{}
void DecryptKMSDataKeyResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["KeyId"].isNull())
keyId_ = value["KeyId"].asString();
if(!value["Plaintext"].isNull())
plaintext_ = value["Plaintext"].asString();
}
std::string DecryptKMSDataKeyResult::getPlaintext()const
{
return plaintext_;
}
std::string DecryptKMSDataKeyResult::getKeyId()const
{
return keyId_;
}

View File

@@ -0,0 +1,90 @@
/*
* 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/vod/model/GenerateKMSDataKeyRequest.h>
using AlibabaCloud::Vod::Model::GenerateKMSDataKeyRequest;
GenerateKMSDataKeyRequest::GenerateKMSDataKeyRequest()
: RpcServiceRequest("vod", "2017-03-21", "GenerateKMSDataKey") {
setMethod(HttpRequest::Method::Post);
}
GenerateKMSDataKeyRequest::~GenerateKMSDataKeyRequest() {}
std::string GenerateKMSDataKeyRequest::getResourceOwnerId() const {
return resourceOwnerId_;
}
void GenerateKMSDataKeyRequest::setResourceOwnerId(const std::string &resourceOwnerId) {
resourceOwnerId_ = resourceOwnerId;
setParameter(std::string("ResourceOwnerId"), resourceOwnerId);
}
long GenerateKMSDataKeyRequest::getResourceRealOwnerId() const {
return resourceRealOwnerId_;
}
void GenerateKMSDataKeyRequest::setResourceRealOwnerId(long resourceRealOwnerId) {
resourceRealOwnerId_ = resourceRealOwnerId;
setParameter(std::string("ResourceRealOwnerId"), std::to_string(resourceRealOwnerId));
}
std::string GenerateKMSDataKeyRequest::getAccessKeyId() const {
return accessKeyId_;
}
void GenerateKMSDataKeyRequest::setAccessKeyId(const std::string &accessKeyId) {
accessKeyId_ = accessKeyId;
setParameter(std::string("AccessKeyId"), accessKeyId);
}
std::string GenerateKMSDataKeyRequest::getKmsRegionId() const {
return kmsRegionId_;
}
void GenerateKMSDataKeyRequest::setKmsRegionId(const std::string &kmsRegionId) {
kmsRegionId_ = kmsRegionId;
setParameter(std::string("KmsRegionId"), kmsRegionId);
}
std::string GenerateKMSDataKeyRequest::getResourceOwnerAccount() const {
return resourceOwnerAccount_;
}
void GenerateKMSDataKeyRequest::setResourceOwnerAccount(const std::string &resourceOwnerAccount) {
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter(std::string("ResourceOwnerAccount"), resourceOwnerAccount);
}
std::string GenerateKMSDataKeyRequest::getOwnerAccount() const {
return ownerAccount_;
}
void GenerateKMSDataKeyRequest::setOwnerAccount(const std::string &ownerAccount) {
ownerAccount_ = ownerAccount;
setParameter(std::string("OwnerAccount"), ownerAccount);
}
std::string GenerateKMSDataKeyRequest::getOwnerId() const {
return ownerId_;
}
void GenerateKMSDataKeyRequest::setOwnerId(const std::string &ownerId) {
ownerId_ = ownerId;
setParameter(std::string("OwnerId"), ownerId);
}

View File

@@ -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.
*/
#include <alibabacloud/vod/model/GenerateKMSDataKeyResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vod;
using namespace AlibabaCloud::Vod::Model;
GenerateKMSDataKeyResult::GenerateKMSDataKeyResult() :
ServiceResult()
{}
GenerateKMSDataKeyResult::GenerateKMSDataKeyResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GenerateKMSDataKeyResult::~GenerateKMSDataKeyResult()
{}
void GenerateKMSDataKeyResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["KeyId"].isNull())
keyId_ = value["KeyId"].asString();
if(!value["CiphertextBlob"].isNull())
ciphertextBlob_ = value["CiphertextBlob"].asString();
if(!value["Plaintext"].isNull())
plaintext_ = value["Plaintext"].asString();
}
std::string GenerateKMSDataKeyResult::getCiphertextBlob()const
{
return ciphertextBlob_;
}
std::string GenerateKMSDataKeyResult::getPlaintext()const
{
return plaintext_;
}
std::string GenerateKMSDataKeyResult::getKeyId()const
{
return keyId_;
}