fix code style

This commit is contained in:
wb-hx510875
2020-07-07 11:29:47 +08:00
committed by page
parent 4332019dac
commit b5602fc4a4
52 changed files with 854 additions and 897 deletions

View File

@@ -14,75 +14,68 @@
* limitations under the License.
*/
#include <alibabacloud/core/location/LocationClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
#include <alibabacloud/core/location/LocationClient.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
namespace {
const std::string SERVICE_NAME = "Location";
const std::string ENDPOINT = "location.aliyuncs.com";
}
const std::string SERVICE_NAME = "Location";
const std::string ENDPOINT = "location.aliyuncs.com";
} // namespace
LocationClient::LocationClient(const Credentials &credentials,
const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(credentials), configuration) {
}
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(credentials),
configuration) {}
LocationClient::LocationClient(
const std::shared_ptr<CredentialsProvider>& credentialsProvider,
const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {
}
const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {}
LocationClient::LocationClient(const std::string & accessKeyId,
const std::string & accessKeySecret,
const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(accessKeyId,
accessKeySecret), configuration) {
}
LocationClient::LocationClient(const std::string &accessKeyId,
const std::string &accessKeySecret,
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(
accessKeyId, accessKeySecret),
configuration) {}
LocationClient::LocationClient(
const std::shared_ptr<Location::LocationClient>& locationClient):
RpcServiceClient(SERVICE_NAME,
locationClient->credentialsProvider(),
locationClient->configuration()) {
}
const std::shared_ptr<Location::LocationClient> &locationClient)
: RpcServiceClient(SERVICE_NAME, locationClient->credentialsProvider(),
locationClient->configuration()) {}
LocationClient::~LocationClient() {}
LocationClient::DescribeEndpointsOutcome LocationClient::describeEndpoints(
const Model::DescribeEndpointsRequest &request) const {
const Model::DescribeEndpointsRequest &request) const {
auto outcome = makeRequest(ENDPOINT, request);
if (outcome.isSuccess())
return DescribeEndpointsOutcome(
Model::DescribeEndpointsResult(outcome.result()));
Model::DescribeEndpointsResult(outcome.result()));
else
return DescribeEndpointsOutcome(outcome.error());
}
void LocationClient::describeEndpointsAsync(
const Model::DescribeEndpointsRequest& request,
const DescribeEndpointsAsyncHandler& handler,
const std::shared_ptr<const AsyncCallerContext>& context) const {
std::async(std::launch::async,
[this, request, handler, context]() {
const Model::DescribeEndpointsRequest &request,
const DescribeEndpointsAsyncHandler &handler,
const std::shared_ptr<const AsyncCallerContext> &context) const {
std::async(std::launch::async, [this, request, handler, context]() {
handler(this, request, describeEndpoints(request), context);
});
}
LocationClient::DescribeEndpointsOutcomeCallable
LocationClient::describeEndpointsCallable(
const Model::DescribeEndpointsRequest &request) const {
const Model::DescribeEndpointsRequest &request) const {
auto task = std::make_shared<std::packaged_task<DescribeEndpointsOutcome()>>(
[this, request]() {
return this->describeEndpoints(request);
});
[this, request]() { return this->describeEndpoints(request); });
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();

View File

@@ -18,9 +18,7 @@
using namespace AlibabaCloud::Location;
LocationRequest::LocationRequest(const std::string & action) :
RpcServiceRequest("location", "2015-06-12", action) {
}
LocationRequest::LocationRequest(const std::string &action)
: RpcServiceRequest("location", "2015-06-12", action) {}
LocationRequest::~LocationRequest() {
}
LocationRequest::~LocationRequest() {}

View File

@@ -19,33 +19,27 @@
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Location::Model;
DescribeEndpointsRequest::DescribeEndpointsRequest() :
LocationRequest("DescribeEndpoints")
{}
DescribeEndpointsRequest::DescribeEndpointsRequest()
: LocationRequest("DescribeEndpoints") {}
DescribeEndpointsRequest::~DescribeEndpointsRequest()
{}
DescribeEndpointsRequest::~DescribeEndpointsRequest() {}
std::string DescribeEndpointsRequest::serviceCode()const {
std::string DescribeEndpointsRequest::serviceCode() const {
return parameter("ServiceCode");
}
void DescribeEndpointsRequest::setServiceCode(const std::string & serviceCode) {
void DescribeEndpointsRequest::setServiceCode(const std::string &serviceCode) {
setParameter("ServiceCode", serviceCode);
}
std::string DescribeEndpointsRequest::id()const {
return parameter("Id");
}
std::string DescribeEndpointsRequest::id() const { return parameter("Id"); }
void DescribeEndpointsRequest::setId(const std::string & id) {
void DescribeEndpointsRequest::setId(const std::string &id) {
setParameter("Id", id);
}
std::string DescribeEndpointsRequest::type()const {
return parameter("Type");
}
std::string DescribeEndpointsRequest::type() const { return parameter("Type"); }
void DescribeEndpointsRequest::setType(const std::string & type) {
void DescribeEndpointsRequest::setType(const std::string &type) {
setParameter("Type", type);
}

View File

@@ -1,57 +1,55 @@
/*
* Copyright 1999-2019 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.
*/
* Copyright 1999-2019 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/core/sts/StsClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
#include <alibabacloud/core/sts/StsClient.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Sts;
using namespace AlibabaCloud::Sts::Model;
namespace {
const std::string SERVICE_NAME = "Sts";
const std::string ENDPOINT = "sts.aliyuncs.com";
}
const std::string SERVICE_NAME = "Sts";
const std::string ENDPOINT = "sts.aliyuncs.com";
} // namespace
StsClient::StsClient(const Credentials &credentials,
const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(credentials), configuration) {
}
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(credentials),
configuration) {}
StsClient::StsClient(
const std::shared_ptr<CredentialsProvider>& credentialsProvider,
const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {
}
const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {}
StsClient::StsClient(const std::string & accessKeyId,
const std::string & accessKeySecret,
const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(accessKeyId,
accessKeySecret), configuration) {
}
StsClient::StsClient(const std::string &accessKeyId,
const std::string &accessKeySecret,
const ClientConfiguration &configuration)
: RpcServiceClient(SERVICE_NAME,
std::make_shared<SimpleCredentialsProvider>(
accessKeyId, accessKeySecret),
configuration) {}
StsClient::~StsClient() {
}
StsClient::~StsClient() {}
StsClient::AssumeRoleOutcome StsClient::assumeRole(
const Model::AssumeRoleRequest &request)const {
StsClient::AssumeRoleOutcome
StsClient::assumeRole(const Model::AssumeRoleRequest &request) const {
auto outcome = makeRequest(ENDPOINT, request);
if (outcome.isSuccess())
@@ -60,9 +58,10 @@ StsClient::AssumeRoleOutcome StsClient::assumeRole(
return AssumeRoleOutcome(Error(outcome.error()));
}
void StsClient::assumeRoleAsync(const Model::AssumeRoleRequest & request,
const AssumeRoleAsyncHandler & handler,
const std::shared_ptr<const AsyncCallerContext>& context) const {
void StsClient::assumeRoleAsync(
const Model::AssumeRoleRequest &request,
const AssumeRoleAsyncHandler &handler,
const std::shared_ptr<const AsyncCallerContext> &context) const {
auto fn = [this, request, handler, context]() {
handler(this, request, assumeRole(request), context);
};
@@ -70,19 +69,17 @@ void StsClient::assumeRoleAsync(const Model::AssumeRoleRequest & request,
asyncExecute(new Runnable(fn));
}
StsClient::AssumeRoleOutcomeCallable StsClient::assumeRoleCallable(
const Model::AssumeRoleRequest & request) const {
StsClient::AssumeRoleOutcomeCallable
StsClient::assumeRoleCallable(const Model::AssumeRoleRequest &request) const {
auto task = std::make_shared<std::packaged_task<AssumeRoleOutcome()>>(
[this, request]() {
return this->assumeRole(request);
});
[this, request]() { return this->assumeRole(request); });
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
StsClient::GetCallerIdentityOutcome StsClient::getCallerIdentity(
const GetCallerIdentityRequest &request) const {
StsClient::GetCallerIdentityOutcome
StsClient::getCallerIdentity(const GetCallerIdentityRequest &request) const {
auto outcome = makeRequest(ENDPOINT, request);
if (outcome.isSuccess())
@@ -91,9 +88,10 @@ StsClient::GetCallerIdentityOutcome StsClient::getCallerIdentity(
return GetCallerIdentityOutcome(Error(outcome.error()));
}
void StsClient::getCallerIdentityAsync(const GetCallerIdentityRequest& request,
const GetCallerIdentityAsyncHandler& handler,
const std::shared_ptr<const AsyncCallerContext>& context) const {
void StsClient::getCallerIdentityAsync(
const GetCallerIdentityRequest &request,
const GetCallerIdentityAsyncHandler &handler,
const std::shared_ptr<const AsyncCallerContext> &context) const {
auto fn = [this, request, handler, context]() {
handler(this, request, getCallerIdentity(request), context);
};
@@ -103,11 +101,9 @@ void StsClient::getCallerIdentityAsync(const GetCallerIdentityRequest& request,
StsClient::GetCallerIdentityOutcomeCallable
StsClient::getCallerIdentityCallable(
const GetCallerIdentityRequest &request) const {
const GetCallerIdentityRequest &request) const {
auto task = std::make_shared<std::packaged_task<GetCallerIdentityOutcome()>>(
[this, request]() {
return this->getCallerIdentity(request);
});
[this, request]() { return this->getCallerIdentity(request); });
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();

View File

@@ -1,27 +1,25 @@
/*
* Copyright 1999-2019 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.
*/
* Copyright 1999-2019 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/core/sts/StsRequest.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Sts;
StsRequest::StsRequest(const std::string & action) :
RpcServiceRequest("sts", "2015-04-01", action) {
}
StsRequest::StsRequest(const std::string &action)
: RpcServiceRequest("sts", "2015-04-01", action) {}
StsRequest::~StsRequest() {
}
StsRequest::~StsRequest() {}

View File

@@ -1,18 +1,18 @@
/*
* Copyright 1999-2019 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.
*/
* Copyright 1999-2019 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/core/sts/model/AssumeRoleRequest.h>
@@ -20,27 +20,21 @@
using namespace AlibabaCloud::Sts;
using namespace AlibabaCloud::Sts::Model;
AssumeRoleRequest::AssumeRoleRequest() :
StsRequest("AssumeRole") {
AssumeRoleRequest::AssumeRoleRequest() : StsRequest("AssumeRole") {
setRoleArn("");
setRoleSessionName("");
setDurationSeconds(3600);
}
AssumeRoleRequest::~AssumeRoleRequest() {
}
AssumeRoleRequest::~AssumeRoleRequest() {}
int AssumeRoleRequest::durationSeconds() const {
return std::stoi(parameter("DurationSeconds"));
}
std::string AssumeRoleRequest::policy() const {
return parameter("Policy");
}
std::string AssumeRoleRequest::policy() const { return parameter("Policy"); }
std::string AssumeRoleRequest::roleArn() const {
return parameter("RoleArn");
}
std::string AssumeRoleRequest::roleArn() const { return parameter("RoleArn"); }
std::string AssumeRoleRequest::roleSessionName() const {
return parameter("RoleSessionName");
@@ -50,15 +44,14 @@ void AssumeRoleRequest::setDurationSeconds(int durationSeconds) {
setParameter("DurationSeconds", std::to_string(durationSeconds));
}
void AssumeRoleRequest::setPolicy(const std::string & policy) {
void AssumeRoleRequest::setPolicy(const std::string &policy) {
setParameter("Policy", policy);
}
void AssumeRoleRequest::setRoleArn(const std::string & roleArn) {
void AssumeRoleRequest::setRoleArn(const std::string &roleArn) {
setParameter("RoleArn", roleArn);
}
void AssumeRoleRequest::setRoleSessionName(
const std::string & roleSessionName) {
void AssumeRoleRequest::setRoleSessionName(const std::string &roleSessionName) {
setParameter("RoleSessionName", roleSessionName);
}

View File

@@ -25,25 +25,21 @@ AssumeRoleResult::AssumeRoleResult()
: ServiceResult(), assumedRoleUser_(), credentials_() {}
AssumeRoleResult::AssumeRoleResult(const std::string &payload)
: ServiceResult(), assumedRoleUser_(), credentials_()
{
: ServiceResult(), assumedRoleUser_(), credentials_() {
parse(payload);
}
AssumeRoleResult::~AssumeRoleResult() {}
AssumeRoleResult::AssumedRoleUser AssumeRoleResult::assumedRoleUser() const
{
AssumeRoleResult::AssumedRoleUser AssumeRoleResult::assumedRoleUser() const {
return assumedRoleUser_;
}
AssumeRoleResult::Credentials AssumeRoleResult::credentials() const
{
AssumeRoleResult::Credentials AssumeRoleResult::credentials() const {
return credentials_;
}
void AssumeRoleResult::parse(const std::string &payload)
{
void AssumeRoleResult::parse(const std::string &payload) {
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);

View File

@@ -1,18 +1,18 @@
/*
* Copyright 1999-2019 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.
*/
* Copyright 1999-2019 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/core/sts/model/GetCallerIdentityRequest.h>
@@ -20,9 +20,7 @@ using namespace AlibabaCloud;
using namespace AlibabaCloud::Sts;
using namespace AlibabaCloud::Sts::Model;
GetCallerIdentityRequest::GetCallerIdentityRequest() :
StsRequest("GetCallerIdentity") {
}
GetCallerIdentityRequest::GetCallerIdentityRequest()
: StsRequest("GetCallerIdentity") {}
GetCallerIdentityRequest::~GetCallerIdentityRequest() {
}
GetCallerIdentityRequest::~GetCallerIdentityRequest() {}