Add CreateSshKey OpenAPI.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2021-06-11 Version: 1.36.783
|
||||
- Add CreateSshKey OpenAPI.
|
||||
|
||||
2021-06-10 Version: 1.36.782
|
||||
- Support SQLReview Order API.
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ set(codeup_public_header_model
|
||||
include/alibabacloud/codeup/model/CreateRepositoryGroupResult.h
|
||||
include/alibabacloud/codeup/model/CreateRepositoryProtectedBranchRequest.h
|
||||
include/alibabacloud/codeup/model/CreateRepositoryProtectedBranchResult.h
|
||||
include/alibabacloud/codeup/model/CreateSshKeyRequest.h
|
||||
include/alibabacloud/codeup/model/CreateSshKeyResult.h
|
||||
include/alibabacloud/codeup/model/CreateTagRequest.h
|
||||
include/alibabacloud/codeup/model/CreateTagResult.h
|
||||
include/alibabacloud/codeup/model/DeleteBranchRequest.h
|
||||
@@ -174,6 +176,8 @@ set(codeup_src
|
||||
src/model/CreateRepositoryGroupResult.cc
|
||||
src/model/CreateRepositoryProtectedBranchRequest.cc
|
||||
src/model/CreateRepositoryProtectedBranchResult.cc
|
||||
src/model/CreateSshKeyRequest.cc
|
||||
src/model/CreateSshKeyResult.cc
|
||||
src/model/CreateTagRequest.cc
|
||||
src/model/CreateTagResult.cc
|
||||
src/model/DeleteBranchRequest.cc
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "model/CreateRepositoryGroupResult.h"
|
||||
#include "model/CreateRepositoryProtectedBranchRequest.h"
|
||||
#include "model/CreateRepositoryProtectedBranchResult.h"
|
||||
#include "model/CreateSshKeyRequest.h"
|
||||
#include "model/CreateSshKeyResult.h"
|
||||
#include "model/CreateTagRequest.h"
|
||||
#include "model/CreateTagResult.h"
|
||||
#include "model/DeleteBranchRequest.h"
|
||||
@@ -193,6 +195,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::CreateRepositoryProtectedBranchResult> CreateRepositoryProtectedBranchOutcome;
|
||||
typedef std::future<CreateRepositoryProtectedBranchOutcome> CreateRepositoryProtectedBranchOutcomeCallable;
|
||||
typedef std::function<void(const CodeupClient*, const Model::CreateRepositoryProtectedBranchRequest&, const CreateRepositoryProtectedBranchOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateRepositoryProtectedBranchAsyncHandler;
|
||||
typedef Outcome<Error, Model::CreateSshKeyResult> CreateSshKeyOutcome;
|
||||
typedef std::future<CreateSshKeyOutcome> CreateSshKeyOutcomeCallable;
|
||||
typedef std::function<void(const CodeupClient*, const Model::CreateSshKeyRequest&, const CreateSshKeyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateSshKeyAsyncHandler;
|
||||
typedef Outcome<Error, Model::CreateTagResult> CreateTagOutcome;
|
||||
typedef std::future<CreateTagOutcome> CreateTagOutcomeCallable;
|
||||
typedef std::function<void(const CodeupClient*, const Model::CreateTagRequest&, const CreateTagOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateTagAsyncHandler;
|
||||
@@ -387,6 +392,9 @@ namespace AlibabaCloud
|
||||
CreateRepositoryProtectedBranchOutcome createRepositoryProtectedBranch(const Model::CreateRepositoryProtectedBranchRequest &request)const;
|
||||
void createRepositoryProtectedBranchAsync(const Model::CreateRepositoryProtectedBranchRequest& request, const CreateRepositoryProtectedBranchAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CreateRepositoryProtectedBranchOutcomeCallable createRepositoryProtectedBranchCallable(const Model::CreateRepositoryProtectedBranchRequest& request) const;
|
||||
CreateSshKeyOutcome createSshKey(const Model::CreateSshKeyRequest &request)const;
|
||||
void createSshKeyAsync(const Model::CreateSshKeyRequest& request, const CreateSshKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CreateSshKeyOutcomeCallable createSshKeyCallable(const Model::CreateSshKeyRequest& request) const;
|
||||
CreateTagOutcome createTag(const Model::CreateTagRequest &request)const;
|
||||
void createTagAsync(const Model::CreateTagRequest& request, const CreateTagAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CreateTagOutcomeCallable createTagCallable(const Model::CreateTagRequest& request) const;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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_CODEUP_MODEL_CREATESSHKEYREQUEST_H_
|
||||
#define ALIBABACLOUD_CODEUP_MODEL_CREATESSHKEYREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RoaServiceRequest.h>
|
||||
#include <alibabacloud/codeup/CodeupExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Codeup
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CODEUP_EXPORT CreateSshKeyRequest : public RoaServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
CreateSshKeyRequest();
|
||||
~CreateSshKeyRequest();
|
||||
|
||||
std::string getAccessToken()const;
|
||||
void setAccessToken(const std::string& accessToken);
|
||||
|
||||
private:
|
||||
std::string accessToken_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CODEUP_MODEL_CREATESSHKEYREQUEST_H_
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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_CODEUP_MODEL_CREATESSHKEYRESULT_H_
|
||||
#define ALIBABACLOUD_CODEUP_MODEL_CREATESSHKEYRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/codeup/CodeupExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Codeup
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CODEUP_EXPORT CreateSshKeyResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Result
|
||||
{
|
||||
std::string createdAt;
|
||||
std::string fingerPrint;
|
||||
std::string title;
|
||||
long id;
|
||||
std::string keyScope;
|
||||
std::string key;
|
||||
};
|
||||
|
||||
|
||||
CreateSshKeyResult();
|
||||
explicit CreateSshKeyResult(const std::string &payload);
|
||||
~CreateSshKeyResult();
|
||||
std::string getErrorCode()const;
|
||||
std::string getErrorMessage()const;
|
||||
bool getSuccess()const;
|
||||
Result getResult()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string errorCode_;
|
||||
std::string errorMessage_;
|
||||
bool success_;
|
||||
Result result_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CODEUP_MODEL_CREATESSHKEYRESULT_H_
|
||||
@@ -483,6 +483,42 @@ CodeupClient::CreateRepositoryProtectedBranchOutcomeCallable CodeupClient::creat
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::CreateSshKeyOutcome CodeupClient::createSshKey(const CreateSshKeyRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return CreateSshKeyOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return CreateSshKeyOutcome(CreateSshKeyResult(outcome.result()));
|
||||
else
|
||||
return CreateSshKeyOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CodeupClient::createSshKeyAsync(const CreateSshKeyRequest& request, const CreateSshKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, createSshKey(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CodeupClient::CreateSshKeyOutcomeCallable CodeupClient::createSshKeyCallable(const CreateSshKeyRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<CreateSshKeyOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->createSshKey(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::CreateTagOutcome CodeupClient::createTag(const CreateTagRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
41
codeup/src/model/CreateSshKeyRequest.cc
Normal file
41
codeup/src/model/CreateSshKeyRequest.cc
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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/codeup/model/CreateSshKeyRequest.h>
|
||||
|
||||
using AlibabaCloud::Codeup::Model::CreateSshKeyRequest;
|
||||
|
||||
CreateSshKeyRequest::CreateSshKeyRequest() :
|
||||
RoaServiceRequest("codeup", "2020-04-14")
|
||||
{
|
||||
setResourcePath("/api/v3/user/keys");
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
CreateSshKeyRequest::~CreateSshKeyRequest()
|
||||
{}
|
||||
|
||||
std::string CreateSshKeyRequest::getAccessToken()const
|
||||
{
|
||||
return accessToken_;
|
||||
}
|
||||
|
||||
void CreateSshKeyRequest::setAccessToken(const std::string& accessToken)
|
||||
{
|
||||
accessToken_ = accessToken;
|
||||
setParameter("AccessToken", accessToken);
|
||||
}
|
||||
|
||||
83
codeup/src/model/CreateSshKeyResult.cc
Normal file
83
codeup/src/model/CreateSshKeyResult.cc
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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/codeup/model/CreateSshKeyResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Codeup;
|
||||
using namespace AlibabaCloud::Codeup::Model;
|
||||
|
||||
CreateSshKeyResult::CreateSshKeyResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
CreateSshKeyResult::CreateSshKeyResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
CreateSshKeyResult::~CreateSshKeyResult()
|
||||
{}
|
||||
|
||||
void CreateSshKeyResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto resultNode = value["Result"];
|
||||
if(!resultNode["CreatedAt"].isNull())
|
||||
result_.createdAt = resultNode["CreatedAt"].asString();
|
||||
if(!resultNode["FingerPrint"].isNull())
|
||||
result_.fingerPrint = resultNode["FingerPrint"].asString();
|
||||
if(!resultNode["Id"].isNull())
|
||||
result_.id = std::stol(resultNode["Id"].asString());
|
||||
if(!resultNode["Key"].isNull())
|
||||
result_.key = resultNode["Key"].asString();
|
||||
if(!resultNode["KeyScope"].isNull())
|
||||
result_.keyScope = resultNode["KeyScope"].asString();
|
||||
if(!resultNode["Title"].isNull())
|
||||
result_.title = resultNode["Title"].asString();
|
||||
if(!value["ErrorCode"].isNull())
|
||||
errorCode_ = value["ErrorCode"].asString();
|
||||
if(!value["ErrorMessage"].isNull())
|
||||
errorMessage_ = value["ErrorMessage"].asString();
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
|
||||
}
|
||||
|
||||
std::string CreateSshKeyResult::getErrorCode()const
|
||||
{
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
std::string CreateSshKeyResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
bool CreateSshKeyResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
CreateSshKeyResult::Result CreateSshKeyResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user