Generated 2016-01-20 for Kms.
This commit is contained in:
@@ -21,6 +21,8 @@ set(kms_public_header
|
||||
include/alibabacloud/kms/KmsExport.h )
|
||||
|
||||
set(kms_public_header_model
|
||||
include/alibabacloud/kms/model/AdvanceEncryptRequest.h
|
||||
include/alibabacloud/kms/model/AdvanceEncryptResult.h
|
||||
include/alibabacloud/kms/model/AsymmetricDecryptRequest.h
|
||||
include/alibabacloud/kms/model/AsymmetricDecryptResult.h
|
||||
include/alibabacloud/kms/model/AsymmetricEncryptRequest.h
|
||||
@@ -208,6 +210,8 @@ set(kms_public_header_model
|
||||
|
||||
set(kms_src
|
||||
src/KmsClient.cc
|
||||
src/model/AdvanceEncryptRequest.cc
|
||||
src/model/AdvanceEncryptResult.cc
|
||||
src/model/AsymmetricDecryptRequest.cc
|
||||
src/model/AsymmetricDecryptResult.cc
|
||||
src/model/AsymmetricEncryptRequest.cc
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "KmsExport.h"
|
||||
#include "model/AdvanceEncryptRequest.h"
|
||||
#include "model/AdvanceEncryptResult.h"
|
||||
#include "model/AsymmetricDecryptRequest.h"
|
||||
#include "model/AsymmetricDecryptResult.h"
|
||||
#include "model/AsymmetricEncryptRequest.h"
|
||||
@@ -215,6 +217,9 @@ namespace AlibabaCloud
|
||||
class ALIBABACLOUD_KMS_EXPORT KmsClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::AdvanceEncryptResult> AdvanceEncryptOutcome;
|
||||
typedef std::future<AdvanceEncryptOutcome> AdvanceEncryptOutcomeCallable;
|
||||
typedef std::function<void(const KmsClient*, const Model::AdvanceEncryptRequest&, const AdvanceEncryptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AdvanceEncryptAsyncHandler;
|
||||
typedef Outcome<Error, Model::AsymmetricDecryptResult> AsymmetricDecryptOutcome;
|
||||
typedef std::future<AsymmetricDecryptOutcome> AsymmetricDecryptOutcomeCallable;
|
||||
typedef std::function<void(const KmsClient*, const Model::AsymmetricDecryptRequest&, const AsymmetricDecryptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AsymmetricDecryptAsyncHandler;
|
||||
@@ -496,6 +501,9 @@ namespace AlibabaCloud
|
||||
KmsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
KmsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~KmsClient();
|
||||
AdvanceEncryptOutcome advanceEncrypt(const Model::AdvanceEncryptRequest &request)const;
|
||||
void advanceEncryptAsync(const Model::AdvanceEncryptRequest& request, const AdvanceEncryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
AdvanceEncryptOutcomeCallable advanceEncryptCallable(const Model::AdvanceEncryptRequest& request) const;
|
||||
AsymmetricDecryptOutcome asymmetricDecrypt(const Model::AsymmetricDecryptRequest &request)const;
|
||||
void asymmetricDecryptAsync(const Model::AsymmetricDecryptRequest& request, const AsymmetricDecryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
AsymmetricDecryptOutcomeCallable asymmetricDecryptCallable(const Model::AsymmetricDecryptRequest& request) const;
|
||||
|
||||
57
kms/include/alibabacloud/kms/model/AdvanceEncryptRequest.h
Normal file
57
kms/include/alibabacloud/kms/model/AdvanceEncryptRequest.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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_ADVANCEENCRYPTREQUEST_H_
|
||||
#define ALIBABACLOUD_KMS_MODEL_ADVANCEENCRYPTREQUEST_H_
|
||||
|
||||
#include <alibabacloud/kms/KmsExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Kms {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_KMS_EXPORT AdvanceEncryptRequest : public RpcServiceRequest {
|
||||
public:
|
||||
AdvanceEncryptRequest();
|
||||
~AdvanceEncryptRequest();
|
||||
std::string getPaddingMode() const;
|
||||
void setPaddingMode(const std::string &paddingMode);
|
||||
std::string getAad() const;
|
||||
void setAad(const std::string &aad);
|
||||
std::string getKeyId() const;
|
||||
void setKeyId(const std::string &keyId);
|
||||
std::string getPlaintext() const;
|
||||
void setPlaintext(const std::string &plaintext);
|
||||
std::string getIv() const;
|
||||
void setIv(const std::string &iv);
|
||||
std::string getAlgorithm() const;
|
||||
void setAlgorithm(const std::string &algorithm);
|
||||
|
||||
private:
|
||||
std::string paddingMode_;
|
||||
std::string aad_;
|
||||
std::string keyId_;
|
||||
std::string plaintext_;
|
||||
std::string iv_;
|
||||
std::string algorithm_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Kms
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_KMS_MODEL_ADVANCEENCRYPTREQUEST_H_
|
||||
61
kms/include/alibabacloud/kms/model/AdvanceEncryptResult.h
Normal file
61
kms/include/alibabacloud/kms/model/AdvanceEncryptResult.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_KMS_MODEL_ADVANCEENCRYPTRESULT_H_
|
||||
#define ALIBABACLOUD_KMS_MODEL_ADVANCEENCRYPTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/kms/KmsExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Kms
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_KMS_EXPORT AdvanceEncryptResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
AdvanceEncryptResult();
|
||||
explicit AdvanceEncryptResult(const std::string &payload);
|
||||
~AdvanceEncryptResult();
|
||||
std::string getPaddingMode()const;
|
||||
std::string getCiphertextBlob()const;
|
||||
std::string getKeyId()const;
|
||||
std::string getKeyVersionId()const;
|
||||
std::string getAlgorithm()const;
|
||||
std::string getIv()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string paddingMode_;
|
||||
std::string ciphertextBlob_;
|
||||
std::string keyId_;
|
||||
std::string keyVersionId_;
|
||||
std::string algorithm_;
|
||||
std::string iv_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_KMS_MODEL_ADVANCEENCRYPTRESULT_H_
|
||||
@@ -51,6 +51,42 @@ KmsClient::KmsClient(const std::string & accessKeyId, const std::string & access
|
||||
KmsClient::~KmsClient()
|
||||
{}
|
||||
|
||||
KmsClient::AdvanceEncryptOutcome KmsClient::advanceEncrypt(const AdvanceEncryptRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return AdvanceEncryptOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return AdvanceEncryptOutcome(AdvanceEncryptResult(outcome.result()));
|
||||
else
|
||||
return AdvanceEncryptOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void KmsClient::advanceEncryptAsync(const AdvanceEncryptRequest& request, const AdvanceEncryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, advanceEncrypt(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
KmsClient::AdvanceEncryptOutcomeCallable KmsClient::advanceEncryptCallable(const AdvanceEncryptRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<AdvanceEncryptOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->advanceEncrypt(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
KmsClient::AsymmetricDecryptOutcome KmsClient::asymmetricDecrypt(const AsymmetricDecryptRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
81
kms/src/model/AdvanceEncryptRequest.cc
Normal file
81
kms/src/model/AdvanceEncryptRequest.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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/kms/model/AdvanceEncryptRequest.h>
|
||||
|
||||
using AlibabaCloud::Kms::Model::AdvanceEncryptRequest;
|
||||
|
||||
AdvanceEncryptRequest::AdvanceEncryptRequest()
|
||||
: RpcServiceRequest("kms", "2016-01-20", "AdvanceEncrypt") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
AdvanceEncryptRequest::~AdvanceEncryptRequest() {}
|
||||
|
||||
std::string AdvanceEncryptRequest::getPaddingMode() const {
|
||||
return paddingMode_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setPaddingMode(const std::string &paddingMode) {
|
||||
paddingMode_ = paddingMode;
|
||||
setParameter(std::string("PaddingMode"), paddingMode);
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptRequest::getAad() const {
|
||||
return aad_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setAad(const std::string &aad) {
|
||||
aad_ = aad;
|
||||
setParameter(std::string("Aad"), aad);
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptRequest::getKeyId() const {
|
||||
return keyId_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setKeyId(const std::string &keyId) {
|
||||
keyId_ = keyId;
|
||||
setParameter(std::string("KeyId"), keyId);
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptRequest::getPlaintext() const {
|
||||
return plaintext_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setPlaintext(const std::string &plaintext) {
|
||||
plaintext_ = plaintext;
|
||||
setParameter(std::string("Plaintext"), plaintext);
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptRequest::getIv() const {
|
||||
return iv_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setIv(const std::string &iv) {
|
||||
iv_ = iv;
|
||||
setParameter(std::string("Iv"), iv);
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptRequest::getAlgorithm() const {
|
||||
return algorithm_;
|
||||
}
|
||||
|
||||
void AdvanceEncryptRequest::setAlgorithm(const std::string &algorithm) {
|
||||
algorithm_ = algorithm;
|
||||
setParameter(std::string("Algorithm"), algorithm);
|
||||
}
|
||||
|
||||
86
kms/src/model/AdvanceEncryptResult.cc
Normal file
86
kms/src/model/AdvanceEncryptResult.cc
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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/kms/model/AdvanceEncryptResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Kms;
|
||||
using namespace AlibabaCloud::Kms::Model;
|
||||
|
||||
AdvanceEncryptResult::AdvanceEncryptResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
AdvanceEncryptResult::AdvanceEncryptResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
AdvanceEncryptResult::~AdvanceEncryptResult()
|
||||
{}
|
||||
|
||||
void AdvanceEncryptResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["CiphertextBlob"].isNull())
|
||||
ciphertextBlob_ = value["CiphertextBlob"].asString();
|
||||
if(!value["Algorithm"].isNull())
|
||||
algorithm_ = value["Algorithm"].asString();
|
||||
if(!value["KeyId"].isNull())
|
||||
keyId_ = value["KeyId"].asString();
|
||||
if(!value["KeyVersionId"].isNull())
|
||||
keyVersionId_ = value["KeyVersionId"].asString();
|
||||
if(!value["Iv"].isNull())
|
||||
iv_ = value["Iv"].asString();
|
||||
if(!value["PaddingMode"].isNull())
|
||||
paddingMode_ = value["PaddingMode"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getPaddingMode()const
|
||||
{
|
||||
return paddingMode_;
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getCiphertextBlob()const
|
||||
{
|
||||
return ciphertextBlob_;
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getKeyId()const
|
||||
{
|
||||
return keyId_;
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getKeyVersionId()const
|
||||
{
|
||||
return keyVersionId_;
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getAlgorithm()const
|
||||
{
|
||||
return algorithm_;
|
||||
}
|
||||
|
||||
std::string AdvanceEncryptResult::getIv()const
|
||||
{
|
||||
return iv_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user