Add organizaition security center API.
This commit is contained in:
@@ -1167,6 +1167,42 @@ CodeupClient::GetMergeRequestSettingOutcomeCallable CodeupClient::getMergeReques
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::GetOrganizationSecurityCenterStatusOutcome CodeupClient::getOrganizationSecurityCenterStatus(const GetOrganizationSecurityCenterStatusRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetOrganizationSecurityCenterStatusOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetOrganizationSecurityCenterStatusOutcome(GetOrganizationSecurityCenterStatusResult(outcome.result()));
|
||||
else
|
||||
return GetOrganizationSecurityCenterStatusOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CodeupClient::getOrganizationSecurityCenterStatusAsync(const GetOrganizationSecurityCenterStatusRequest& request, const GetOrganizationSecurityCenterStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getOrganizationSecurityCenterStatus(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CodeupClient::GetOrganizationSecurityCenterStatusOutcomeCallable CodeupClient::getOrganizationSecurityCenterStatusCallable(const GetOrganizationSecurityCenterStatusRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetOrganizationSecurityCenterStatusOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getOrganizationSecurityCenterStatus(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::GetProjectMemberOutcome CodeupClient::getProjectMember(const GetProjectMemberRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -1527,6 +1563,42 @@ CodeupClient::ListMergeRequestsOutcomeCallable CodeupClient::listMergeRequestsCa
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::ListOrganizationSecurityScoresOutcome CodeupClient::listOrganizationSecurityScores(const ListOrganizationSecurityScoresRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListOrganizationSecurityScoresOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListOrganizationSecurityScoresOutcome(ListOrganizationSecurityScoresResult(outcome.result()));
|
||||
else
|
||||
return ListOrganizationSecurityScoresOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CodeupClient::listOrganizationSecurityScoresAsync(const ListOrganizationSecurityScoresRequest& request, const ListOrganizationSecurityScoresAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listOrganizationSecurityScores(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CodeupClient::ListOrganizationSecurityScoresOutcomeCallable CodeupClient::listOrganizationSecurityScoresCallable(const ListOrganizationSecurityScoresRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListOrganizationSecurityScoresOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listOrganizationSecurityScores(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CodeupClient::ListOrganizationsOutcome CodeupClient::listOrganizations(const ListOrganizationsRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -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/GetOrganizationSecurityCenterStatusRequest.h>
|
||||
|
||||
using AlibabaCloud::Codeup::Model::GetOrganizationSecurityCenterStatusRequest;
|
||||
|
||||
GetOrganizationSecurityCenterStatusRequest::GetOrganizationSecurityCenterStatusRequest() :
|
||||
RoaServiceRequest("codeup", "2020-04-14")
|
||||
{
|
||||
setResourcePath("/api/v4/organization/security/status");
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
GetOrganizationSecurityCenterStatusRequest::~GetOrganizationSecurityCenterStatusRequest()
|
||||
{}
|
||||
|
||||
std::string GetOrganizationSecurityCenterStatusRequest::getAccessToken()const
|
||||
{
|
||||
return accessToken_;
|
||||
}
|
||||
|
||||
void GetOrganizationSecurityCenterStatusRequest::setAccessToken(const std::string& accessToken)
|
||||
{
|
||||
accessToken_ = accessToken;
|
||||
setParameter("AccessToken", accessToken);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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/GetOrganizationSecurityCenterStatusResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Codeup;
|
||||
using namespace AlibabaCloud::Codeup::Model;
|
||||
|
||||
GetOrganizationSecurityCenterStatusResult::GetOrganizationSecurityCenterStatusResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetOrganizationSecurityCenterStatusResult::GetOrganizationSecurityCenterStatusResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetOrganizationSecurityCenterStatusResult::~GetOrganizationSecurityCenterStatusResult()
|
||||
{}
|
||||
|
||||
void GetOrganizationSecurityCenterStatusResult::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["Enable"].isNull())
|
||||
result_.enable = resultNode["Enable"].asString() == "true";
|
||||
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 GetOrganizationSecurityCenterStatusResult::getErrorCode()const
|
||||
{
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
std::string GetOrganizationSecurityCenterStatusResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
bool GetOrganizationSecurityCenterStatusResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
GetOrganizationSecurityCenterStatusResult::Result GetOrganizationSecurityCenterStatusResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
41
codeup/src/model/ListOrganizationSecurityScoresRequest.cc
Normal file
41
codeup/src/model/ListOrganizationSecurityScoresRequest.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/ListOrganizationSecurityScoresRequest.h>
|
||||
|
||||
using AlibabaCloud::Codeup::Model::ListOrganizationSecurityScoresRequest;
|
||||
|
||||
ListOrganizationSecurityScoresRequest::ListOrganizationSecurityScoresRequest() :
|
||||
RoaServiceRequest("codeup", "2020-04-14")
|
||||
{
|
||||
setResourcePath("/api/v4/organization/security/scores");
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
ListOrganizationSecurityScoresRequest::~ListOrganizationSecurityScoresRequest()
|
||||
{}
|
||||
|
||||
std::string ListOrganizationSecurityScoresRequest::getAccessToken()const
|
||||
{
|
||||
return accessToken_;
|
||||
}
|
||||
|
||||
void ListOrganizationSecurityScoresRequest::setAccessToken(const std::string& accessToken)
|
||||
{
|
||||
accessToken_ = accessToken;
|
||||
setParameter("AccessToken", accessToken);
|
||||
}
|
||||
|
||||
91
codeup/src/model/ListOrganizationSecurityScoresResult.cc
Normal file
91
codeup/src/model/ListOrganizationSecurityScoresResult.cc
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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/ListOrganizationSecurityScoresResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Codeup;
|
||||
using namespace AlibabaCloud::Codeup::Model;
|
||||
|
||||
ListOrganizationSecurityScoresResult::ListOrganizationSecurityScoresResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ListOrganizationSecurityScoresResult::ListOrganizationSecurityScoresResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ListOrganizationSecurityScoresResult::~ListOrganizationSecurityScoresResult()
|
||||
{}
|
||||
|
||||
void ListOrganizationSecurityScoresResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allResultNode = value["Result"]["ResultItem"];
|
||||
for (auto valueResultResultItem : allResultNode)
|
||||
{
|
||||
ResultItem resultObject;
|
||||
if(!valueResultResultItem["Enable"].isNull())
|
||||
resultObject.enable = valueResultResultItem["Enable"].asString() == "true";
|
||||
if(!valueResultResultItem["Id"].isNull())
|
||||
resultObject.id = std::stol(valueResultResultItem["Id"].asString());
|
||||
if(!valueResultResultItem["OrganizationId"].isNull())
|
||||
resultObject.organizationId = valueResultResultItem["OrganizationId"].asString();
|
||||
auto organizationSecurityScoreNode = value["OrganizationSecurityScore"];
|
||||
if(!organizationSecurityScoreNode["AuthorityControlScore"].isNull())
|
||||
resultObject.organizationSecurityScore.authorityControlScore = std::stoi(organizationSecurityScoreNode["AuthorityControlScore"].asString());
|
||||
if(!organizationSecurityScoreNode["CodeContentScore"].isNull())
|
||||
resultObject.organizationSecurityScore.codeContentScore = std::stoi(organizationSecurityScoreNode["CodeContentScore"].asString());
|
||||
if(!organizationSecurityScoreNode["MemberBehaviorScore"].isNull())
|
||||
resultObject.organizationSecurityScore.memberBehaviorScore = std::stoi(organizationSecurityScoreNode["MemberBehaviorScore"].asString());
|
||||
if(!organizationSecurityScoreNode["Level"].isNull())
|
||||
resultObject.organizationSecurityScore.level = organizationSecurityScoreNode["Level"].asString();
|
||||
result_.push_back(resultObject);
|
||||
}
|
||||
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 ListOrganizationSecurityScoresResult::getErrorCode()const
|
||||
{
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
std::string ListOrganizationSecurityScoresResult::getErrorMessage()const
|
||||
{
|
||||
return errorMessage_;
|
||||
}
|
||||
|
||||
bool ListOrganizationSecurityScoresResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
std::vector<ListOrganizationSecurityScoresResult::ResultItem> ListOrganizationSecurityScoresResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user