replace tab with 2 spaces in core dir

Copyright time changed to 1999-2019
This commit is contained in:
zhangzifa
2019-02-01 14:36:14 +08:00
committed by Jackson Tian
parent 138dbdc61e
commit da28515bd8
94 changed files with 2706 additions and 2704 deletions

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -21,9 +21,9 @@
namespace AlibabaCloud
{
ALIBABACLOUD_CORE_EXPORT void InitializeSdk();
ALIBABACLOUD_CORE_EXPORT bool IsSdkInitialized();
ALIBABACLOUD_CORE_EXPORT void ShutdownSdk();
ALIBABACLOUD_CORE_EXPORT void InitializeSdk();
ALIBABACLOUD_CORE_EXPORT bool IsSdkInitialized();
ALIBABACLOUD_CORE_EXPORT void ShutdownSdk();
}
#endif
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,17 +22,17 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT AsyncCallerContext
{
public:
AsyncCallerContext();
explicit AsyncCallerContext(const std::string &uuid);
virtual ~AsyncCallerContext();
std::string uuid()const;
void setUuid(const std::string &uuid);
private:
std::string uuid_;
};
class ALIBABACLOUD_CORE_EXPORT AsyncCallerContext
{
public:
AsyncCallerContext();
explicit AsyncCallerContext(const std::string &uuid);
virtual ~AsyncCallerContext();
std::string uuid()const;
void setUuid(const std::string &uuid);
private:
std::string uuid_;
};
}
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -26,24 +26,24 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT ClientConfiguration
{
public:
explicit ClientConfiguration(const std::string &regionId = "cn-hangzhou",
const NetworkProxy &proxy = NetworkProxy());
~ClientConfiguration();
class ALIBABACLOUD_CORE_EXPORT ClientConfiguration
{
public:
explicit ClientConfiguration(const std::string &regionId = "cn-hangzhou",
const NetworkProxy &proxy = NetworkProxy());
~ClientConfiguration();
std::string endpoint()const;
NetworkProxy proxy()const;
std::string regionId()const;
void setEndpoint(const std::string &endpoint);
void setProxy(const NetworkProxy &proxy);
void setRegionId(const std::string &regionId);
private:
std::string endpoint_;
NetworkProxy proxy_;
std::string regionId_;
};
std::string endpoint()const;
NetworkProxy proxy()const;
std::string regionId()const;
void setEndpoint(const std::string &endpoint);
void setProxy(const NetworkProxy &proxy);
void setRegionId(const std::string &regionId);
private:
std::string endpoint_;
NetworkProxy proxy_;
std::string regionId_;
};
}
#endif // !ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
#endif // !ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -28,36 +28,36 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT CommonClient : public CoreClient
{
public:
typedef Outcome<Error, CommonResponse> CommonResponseOutcome;
typedef std::future<CommonResponseOutcome> CommonResponseOutcomeCallable;
typedef std::function<void(const CommonClient*, const CommonRequest&, const CommonResponseOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CommonResponseAsyncHandler;
typedef Outcome<Error, std::string> JsonOutcome;
class ALIBABACLOUD_CORE_EXPORT CommonClient : public CoreClient
{
public:
typedef Outcome<Error, CommonResponse> CommonResponseOutcome;
typedef std::future<CommonResponseOutcome> CommonResponseOutcomeCallable;
typedef std::function<void(const CommonClient*, const CommonRequest&, const CommonResponseOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CommonResponseAsyncHandler;
typedef Outcome<Error, std::string> JsonOutcome;
CommonClient(const Credentials &credentials, const ClientConfiguration &configuration);
CommonClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
CommonClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~CommonClient();
CommonClient(const Credentials &credentials, const ClientConfiguration &configuration);
CommonClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
CommonClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~CommonClient();
CommonResponseOutcome commonResponse(const CommonRequest &request)const;
void commonResponseAsync(const CommonRequest& request, const CommonResponseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CommonResponseOutcomeCallable commonResponseCallable(const CommonRequest& request) const;
CommonResponseOutcome commonResponse(const CommonRequest &request)const;
void commonResponseAsync(const CommonRequest& request, const CommonResponseAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CommonResponseOutcomeCallable commonResponseCallable(const CommonRequest& request) const;
protected:
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest & msg, HttpRequest::Method method) const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
HttpRequest buildRoaHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
HttpRequest buildRpcHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
JsonOutcome makeRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
using CoreClient::asyncExecute;
private:
std::string canonicalizedQuery(const std::map <std::string, std::string> &params)const;
std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers)const;
protected:
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest & msg, HttpRequest::Method method) const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
HttpRequest buildRoaHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
HttpRequest buildRpcHttpRequest(const std::string & endpoint, const CommonRequest &msg, HttpRequest::Method method) const;
JsonOutcome makeRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
using CoreClient::asyncExecute;
private:
std::string canonicalizedQuery(const std::map <std::string, std::string> &params)const;
std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers)const;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
}
#endif // !ALIBABACLOUD_CORE_COMMONCLIENT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -24,43 +24,43 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest
{
public:
enum RequestPattern
{
RpcPattern,
RoaPattern
};
class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest
{
public:
enum RequestPattern
{
RpcPattern,
RoaPattern
};
explicit CommonRequest(RequestPattern pattern = RpcPattern);
~CommonRequest();
explicit CommonRequest(RequestPattern pattern = RpcPattern);
~CommonRequest();
std::string domain()const;
ParameterValueType headerParameter(const ParameterNameType &name)const;
ParameterCollection headerParameters()const;
HttpRequest::Method httpMethod()const;
ParameterValueType queryParameter(const ParameterNameType &name)const;
ParameterCollection queryParameters()const;
using ServiceRequest::setContent;
void setDomain(const std::string &domain);
void setHeaderParameter(const ParameterNameType &name, const ParameterValueType &value);
void setHttpMethod(HttpRequest::Method method);
void setQueryParameter(const ParameterNameType &name, const ParameterValueType &value);
using ServiceRequest::setResourcePath;
void setRequestPattern(RequestPattern pattern);
using ServiceRequest::setVersion;
using ServiceRequest::setScheme;
RequestPattern requestPattern()const;
protected:
using ServiceRequest::product;
std::string domain()const;
ParameterValueType headerParameter(const ParameterNameType &name)const;
ParameterCollection headerParameters()const;
HttpRequest::Method httpMethod()const;
ParameterValueType queryParameter(const ParameterNameType &name)const;
ParameterCollection queryParameters()const;
using ServiceRequest::setContent;
void setDomain(const std::string &domain);
void setHeaderParameter(const ParameterNameType &name, const ParameterValueType &value);
void setHttpMethod(HttpRequest::Method method);
void setQueryParameter(const ParameterNameType &name, const ParameterValueType &value);
using ServiceRequest::setResourcePath;
void setRequestPattern(RequestPattern pattern);
using ServiceRequest::setVersion;
using ServiceRequest::setScheme;
RequestPattern requestPattern()const;
protected:
using ServiceRequest::product;
private:
std::string domain_;
RequestPattern requestPattern_;
ParameterCollection queryParams_;
ParameterCollection headerParams_;
HttpRequest::Method httpMethod_;
};
private:
std::string domain_;
RequestPattern requestPattern_;
ParameterCollection queryParams_;
ParameterCollection headerParams_;
HttpRequest::Method httpMethod_;
};
}
#endif // !ALIBABACLOUD_CORE_COMMONREQUEST_H_
#endif // !ALIBABACLOUD_CORE_COMMONREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,17 +22,17 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT CommonResponse
{
public:
CommonResponse();
explicit CommonResponse(const std::string &payload);
~CommonResponse();
class ALIBABACLOUD_CORE_EXPORT CommonResponse
{
public:
CommonResponse();
explicit CommonResponse(const std::string &payload);
~CommonResponse();
std::string payload()const;
private:
std::string payload_;
std::string payload()const;
private:
std::string payload_;
};
};
}
#endif // !ALIBABACLOUD_CORE_COMMONRESPONSE_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -30,25 +30,25 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT CoreClient
{
public:
CoreClient(const std::string & servicename, const ClientConfiguration &configuration);
virtual ~CoreClient();
class ALIBABACLOUD_CORE_EXPORT CoreClient
{
public:
CoreClient(const std::string & servicename, const ClientConfiguration &configuration);
virtual ~CoreClient();
ClientConfiguration configuration()const;
std::string serviceName()const;
protected:
virtual HttpClient::HttpResponseOutcome AttemptRequest(const std::string & endpoint, const ServiceRequest &request, HttpRequest::Method method)const;
Error buildCoreError(const HttpResponse &response)const;
bool hasResponseError(const HttpResponse &response)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const = 0;
void asyncExecute(Runnable * r)const;
private:
std::string serviceName_;
ClientConfiguration configuration_;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
HttpClient *httpClient_;
};
ClientConfiguration configuration()const;
std::string serviceName()const;
protected:
virtual HttpClient::HttpResponseOutcome AttemptRequest(const std::string & endpoint, const ServiceRequest &request, HttpRequest::Method method)const;
Error buildCoreError(const HttpResponse &response)const;
bool hasResponseError(const HttpResponse &response)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const = 0;
void asyncExecute(Runnable * r)const;
private:
std::string serviceName_;
ClientConfiguration configuration_;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
HttpClient *httpClient_;
};
}
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -20,13 +20,13 @@
#include "Global.h"
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_CORE_LIBRARY)
# define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
# if defined(ALIBABACLOUD_CORE_LIBRARY)
# define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_CORE_EXPORT
# define ALIBABACLOUD_CORE_EXPORT
#endif
#endif // !ALIBABACLOUD_CORE_COREEXPORT_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,26 +22,26 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT Credentials
{
public:
Credentials(const std::string &accessKeyId,
const std::string &accessKeySecret,
const std::string &sessionToken="");
~Credentials();
class ALIBABACLOUD_CORE_EXPORT Credentials
{
public:
Credentials(const std::string &accessKeyId,
const std::string &accessKeySecret,
const std::string &sessionToken="");
~Credentials();
std::string accessKeyId () const;
std::string accessKeySecret () const;
void setAccessKeyId(const std::string &accessKeyId);
void setAccessKeySecret(const std::string &accessKeySecret);
void setSessionToken (const std::string &sessionToken);
std::string sessionToken () const;
std::string accessKeyId () const;
std::string accessKeySecret () const;
void setAccessKeyId(const std::string &accessKeyId);
void setAccessKeySecret(const std::string &accessKeySecret);
void setSessionToken (const std::string &sessionToken);
std::string sessionToken () const;
private:
std::string accessKeyId_;
std::string accessKeySecret_;
std::string sessionToken_;
};
private:
std::string accessKeyId_;
std::string accessKeySecret_;
std::string sessionToken_;
};
}
#endif // !ALIBABACLOUD_CORE_CREDENTIAL_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,15 +22,15 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT CredentialsProvider
{
public:
CredentialsProvider() = default;
virtual ~CredentialsProvider() = default;
class ALIBABACLOUD_CORE_EXPORT CredentialsProvider
{
public:
CredentialsProvider() = default;
virtual ~CredentialsProvider() = default;
virtual Credentials getCredentials() = 0;
private:
virtual Credentials getCredentials() = 0;
private:
};
};
}
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -27,52 +27,52 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT EndpointProvider : public Location::LocationClient
{
public:
typedef Outcome<Error, std::string> EndpointOutcome;
class ALIBABACLOUD_CORE_EXPORT EndpointProvider : public Location::LocationClient
{
public:
typedef Outcome<Error, std::string> EndpointOutcome;
EndpointProvider(const std::shared_ptr<Location::LocationClient>& locationClient,
const std::string regionId,
const std::string product,
const std::string serviceCode = std::string(),
int durationSeconds = 3600);
EndpointProvider(const std::shared_ptr<Location::LocationClient>& locationClient,
const std::string regionId,
const std::string product,
const std::string serviceCode = std::string(),
int durationSeconds = 3600);
EndpointProvider(
const Credentials &credentials,
const ClientConfiguration &configuration,
const std::string &regionId,
const std::string &product,
const std::string &serviceCode = std::string(),
int durationSeconds = 3600);
~EndpointProvider();
EndpointProvider(
const Credentials &credentials,
const ClientConfiguration &configuration,
const std::string &regionId,
const std::string &product,
const std::string &serviceCode = std::string(),
int durationSeconds = 3600);
~EndpointProvider();
EndpointOutcome getEndpoint();
using LocationClient::describeEndpoints;
private:
struct Product
{
std::string code;
std::string locationServiceCode;
std::string documentId;
std::map<std::string, std::string> regionalEndpoints;
std::string globalEndpoint;
std::string regionalEndpointPattern;
};
EndpointOutcome getEndpoint();
using LocationClient::describeEndpoints;
private:
struct Product
{
std::string code;
std::string locationServiceCode;
std::string documentId;
std::map<std::string, std::string> regionalEndpoints;
std::string globalEndpoint;
std::string regionalEndpointPattern;
};
EndpointOutcome loadRemoteEndpoint();
bool checkExpiry()const;
bool loadInternalProductsInfo();
std::string internalEndpoint(const std::string regionId, const std::string product);
EndpointOutcome loadRemoteEndpoint();
bool checkExpiry()const;
bool loadInternalProductsInfo();
std::string internalEndpoint(const std::string regionId, const std::string product);
std::mutex cachedMutex_;
std::string cachedEndpoint_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
std::string regionId_;
std::string product_;
std::string serviceCode_;
std::list<Product> internalProductsInfo_;
};
std::mutex cachedMutex_;
std::string cachedEndpoint_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
std::string regionId_;
std::string product_;
std::string serviceCode_;
std::list<Product> internalProductsInfo_;
};
}
#endif
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,27 +22,27 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT Error
{
public:
Error() = default;
Error(std::string code, const std::string message);
~Error() = default;
class ALIBABACLOUD_CORE_EXPORT Error
{
public:
Error() = default;
Error(std::string code, const std::string message);
~Error() = default;
std::string errorCode()const;
std::string errorMessage() const;
std::string host() const;
std::string requestId() const;
void setErrorCode(const std::string &code);
void setErrorMessage(const std::string& message);
void setHost(const std::string& host);
void setRequestId(const std::string& request);
private:
std::string errorCode_;
std::string message_;
std::string host_;
std::string requestId_;
};
std::string errorCode()const;
std::string errorMessage() const;
std::string host() const;
std::string requestId() const;
void setErrorCode(const std::string &code);
void setErrorMessage(const std::string& message);
void setHost(const std::string& host);
void setRequestId(const std::string& request);
private:
std::string errorCode_;
std::string message_;
std::string host_;
std::string requestId_;
};
}
#endif // !ALIBABACLOUD_CORE_ERROR_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -20,22 +20,22 @@
#include "Config.h"
#if defined(_WIN32)
# ifdef _MSC_VER
# pragma warning(disable : 4251)
# endif // _MSC_VER
# define ALIBABACLOUD_DECL_EXPORT __declspec(dllexport)
# define ALIBABACLOUD_DECL_IMPORT __declspec(dllimport)
# ifdef _MSC_VER
# pragma warning(disable : 4251)
# endif // _MSC_VER
# define ALIBABACLOUD_DECL_EXPORT __declspec(dllexport)
# define ALIBABACLOUD_DECL_IMPORT __declspec(dllimport)
#elif defined(__linux__)
# define ALIBABACLOUD_DECL_EXPORT __attribute__((visibility("default")))
# define ALIBABACLOUD_DECL_IMPORT __attribute__((visibility("default")))
# define ALIBABACLOUD_DECL_EXPORT __attribute__((visibility("default")))
# define ALIBABACLOUD_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if !defined(ALIBABACLOUD_DECL_EXPORT)
# define ALIBABACLOUD_DECL_EXPORT
# define ALIBABACLOUD_DECL_EXPORT
#endif
#if !defined(ALIBABACLOUD_DECL_IMPORT)
# define ALIBABACLOUD_DECL_IMPORT
# define ALIBABACLOUD_DECL_IMPORT
#endif
#endif // !ALIBABACLOUD_CORE_GLOBAL_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,14 +21,14 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT HmacSha1Signer : public Signer
{
public:
HmacSha1Signer();
~HmacSha1Signer();
class ALIBABACLOUD_CORE_EXPORT HmacSha1Signer : public Signer
{
public:
HmacSha1Signer();
~HmacSha1Signer();
virtual std::string generate(const std::string &src, const std::string &secret)const override;
};
virtual std::string generate(const std::string &src, const std::string &secret)const override;
};
}
#endif // !ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -25,19 +25,19 @@
namespace AlibabaCloud
{
class HttpClient
{
public:
typedef Outcome<Error, HttpResponse> HttpResponseOutcome;
class HttpClient
{
public:
typedef Outcome<Error, HttpResponse> HttpResponseOutcome;
HttpClient();
virtual ~HttpClient();
HttpClient();
virtual ~HttpClient();
virtual HttpResponseOutcome makeRequest(const HttpRequest &request) = 0;
NetworkProxy proxy()const;
void setProxy(const NetworkProxy &proxy);
private:
NetworkProxy proxy_;
};
virtual HttpResponseOutcome makeRequest(const HttpRequest &request) = 0;
NetworkProxy proxy()const;
void setProxy(const NetworkProxy &proxy);
private:
NetworkProxy proxy_;
};
}
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -23,60 +23,60 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT HttpMessage
{
private:
struct ALIBABACLOUD_CORE_EXPORT nocaseLess
{
bool operator() (const std::string & s1, const std::string & s2) const;
};
public:
enum KnownHeader
{
Accept,
AcceptCharset,
AcceptEncoding,
AcceptLanguage,
Authorization,
Connection,
ContentLength,
ContentMD5,
ContentType,
Date,
Host,
Server,
UserAgent
};
class ALIBABACLOUD_CORE_EXPORT HttpMessage
{
private:
struct ALIBABACLOUD_CORE_EXPORT nocaseLess
{
bool operator() (const std::string & s1, const std::string & s2) const;
};
public:
enum KnownHeader
{
Accept,
AcceptCharset,
AcceptEncoding,
AcceptLanguage,
Authorization,
Connection,
ContentLength,
ContentMD5,
ContentType,
Date,
Host,
Server,
UserAgent
};
typedef std::string HeaderNameType;
typedef std::string HeaderValueType;
typedef std::map<HeaderNameType, HeaderValueType, nocaseLess> HeaderCollection;
typedef std::string HeaderNameType;
typedef std::string HeaderValueType;
typedef std::map<HeaderNameType, HeaderValueType, nocaseLess> HeaderCollection;
HttpMessage(const HttpMessage &other);
HttpMessage(HttpMessage &&other);
HttpMessage& operator=(const HttpMessage &other);
HttpMessage& operator=(HttpMessage &&other);
virtual ~HttpMessage();
HttpMessage(const HttpMessage &other);
HttpMessage(HttpMessage &&other);
HttpMessage& operator=(const HttpMessage &other);
HttpMessage& operator=(HttpMessage &&other);
virtual ~HttpMessage();
void addHeader(const HeaderNameType &name, const HeaderValueType &value);
void addHeader(KnownHeader header, const HeaderValueType &value);
const char* body()const;
size_t bodySize()const;
bool hasBody()const;
HeaderValueType header(const HeaderNameType &name)const;
HeaderValueType header(KnownHeader header)const;
HeaderCollection headers()const;
void removeHeader(const HeaderNameType &name);
void removeHeader(KnownHeader header);
void setBody(const char *data, size_t size);
void setHeader(const HeaderNameType &name, const HeaderValueType &value);
void setHeader(KnownHeader header, const std::string &value);
protected:
HttpMessage();
private:
char *body_;
size_t bodySize_;
HeaderCollection headers_;
};
void addHeader(const HeaderNameType &name, const HeaderValueType &value);
void addHeader(KnownHeader header, const HeaderValueType &value);
const char* body()const;
size_t bodySize()const;
bool hasBody()const;
HeaderValueType header(const HeaderNameType &name)const;
HeaderValueType header(KnownHeader header)const;
HeaderCollection headers()const;
void removeHeader(const HeaderNameType &name);
void removeHeader(KnownHeader header);
void setBody(const char *data, size_t size);
void setHeader(const HeaderNameType &name, const HeaderValueType &value);
void setHeader(KnownHeader header, const std::string &value);
protected:
HttpMessage();
private:
char *body_;
size_t bodySize_;
HeaderCollection headers_;
};
}
#endif // !ALIBABACLOUD_CORE_HTTPMESSAGE_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -23,31 +23,31 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage
{
public:
enum Method
{
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Patch,
Trace
};
explicit HttpRequest(const Url &url = Url(), Method method = Get);
~HttpRequest();
class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage
{
public:
enum Method
{
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Patch,
Trace
};
explicit HttpRequest(const Url &url = Url(), Method method = Get);
~HttpRequest();
Method method()const;
void setMethod(Method method);
void setUrl(const Url &url);
Url url()const;
private:
Method method_;
Url url_;
};
Method method()const;
void setMethod(Method method);
void setUrl(const Url &url);
Url url()const;
private:
Method method_;
Url url_;
};
}
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -24,20 +24,20 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT HttpResponse : public HttpMessage
{
public:
HttpResponse();
explicit HttpResponse(const HttpRequest & request);
~HttpResponse();
class ALIBABACLOUD_CORE_EXPORT HttpResponse : public HttpMessage
{
public:
HttpResponse();
explicit HttpResponse(const HttpRequest & request);
~HttpResponse();
HttpRequest request()const;
void setStatusCode(int code);
int statusCode()const;
private:
int statusCode_;
HttpRequest request_;
};
HttpRequest request()const;
void setStatusCode(int code);
int statusCode()const;
private:
int statusCode_;
HttpRequest request_;
};
}
#endif // !ALIBABACLOUD_CORE_HTTPRESPONSE_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -21,14 +21,14 @@
namespace AlibabaCloud
{
class InstanceProfileCredentials : public BasicSessionCredentials
{
public:
InstanceProfileCredentials();
~InstanceProfileCredentials();
class InstanceProfileCredentials : public BasicSessionCredentials
{
public:
InstanceProfileCredentials();
~InstanceProfileCredentials();
private:
private:
};
};
}
#endif // !ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -27,25 +27,25 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT InstanceProfileCredentialsProvider : public CredentialsProvider, public EcsMetadataFetcher
{
public:
InstanceProfileCredentialsProvider(const std::string &roleName, int durationSeconds = 3600);
~InstanceProfileCredentialsProvider();
class ALIBABACLOUD_CORE_EXPORT InstanceProfileCredentialsProvider : public CredentialsProvider, public EcsMetadataFetcher
{
public:
InstanceProfileCredentialsProvider(const std::string &roleName, int durationSeconds = 3600);
~InstanceProfileCredentialsProvider();
std::string roleName()const;
virtual Credentials getCredentials() override;
using EcsMetadataFetcher::roleName;
using EcsMetadataFetcher::setRoleName;
using EcsMetadataFetcher::getMetadata;
private:
void loadCredentials();
bool checkExpiry()const;
std::string roleName()const;
virtual Credentials getCredentials() override;
using EcsMetadataFetcher::roleName;
using EcsMetadataFetcher::setRoleName;
using EcsMetadataFetcher::getMetadata;
private:
void loadCredentials();
bool checkExpiry()const;
std::mutex cachedMutex_;
Credentials cachedCredentials_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
};
std::mutex cachedMutex_;
Credentials cachedCredentials_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
};
}
#endif
#endif

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,38 +22,38 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT NetworkProxy
{
public:
enum Type
{
None = 0,
Http,
Socks5
};
NetworkProxy(Type type = None,
const std::string &hostName = "",
uint16_t port = 0,
const std::string &user = "",
const std::string &password = "");
~NetworkProxy();
class ALIBABACLOUD_CORE_EXPORT NetworkProxy
{
public:
enum Type
{
None = 0,
Http,
Socks5
};
NetworkProxy(Type type = None,
const std::string &hostName = "",
uint16_t port = 0,
const std::string &user = "",
const std::string &password = "");
~NetworkProxy();
std::string hostName() const;
std::string password() const;
uint16_t port() const;
void setHostName(const std::string &hostName);
void setPassword(const std::string &password);
void setPort(uint16_t port);
void setType(Type type);
void setUser(const std::string &user);
Type type() const;
std::string user() const;
private:
std::string hostName_;
std::string password_;
uint16_t port_;
Type type_;
std::string user_;
};
std::string hostName() const;
std::string password() const;
uint16_t port() const;
void setHostName(const std::string &hostName);
void setPassword(const std::string &password);
void setPort(uint16_t port);
void setType(Type type);
void setUser(const std::string &user);
Type type() const;
std::string user() const;
private:
std::string hostName_;
std::string password_;
uint16_t port_;
Type type_;
std::string user_;
};
}
#endif // !ALIBABACLOUD_CORE_NETWORKPROXY_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -21,52 +21,52 @@
namespace AlibabaCloud
{
template<typename E, typename R>
class Outcome
{
public:
Outcome() :
success_(true), e_(), r_() { }
explicit Outcome(const E &e) :
e_(e), success_(false), r_() { }
explicit Outcome(const R &r) :
r_(r), success_(true), e_() { }
Outcome(const Outcome &other) :
success_(other.success_),
e_(other.e_),
r_(other.r_)
{ }
Outcome(Outcome &&other)
{
*this = std::move(other);
}
Outcome & operator=(const Outcome &other)
{
if (this != &other) {
success_ = other.success_;
e_ = other.e_;
r_ = other.r_;
}
return *this;
}
Outcome & operator=(Outcome &&other)
{
if (this != &other)
{
success_ = other.success_;
r_ = other.r_;
e_ = other.e_;
}
return *this;
}
template<typename E, typename R>
class Outcome
{
public:
Outcome() :
success_(true), e_(), r_() { }
explicit Outcome(const E &e) :
e_(e), success_(false), r_() { }
explicit Outcome(const R &r) :
r_(r), success_(true), e_() { }
Outcome(const Outcome &other) :
success_(other.success_),
e_(other.e_),
r_(other.r_)
{ }
Outcome(Outcome &&other)
{
*this = std::move(other);
}
Outcome & operator=(const Outcome &other)
{
if (this != &other) {
success_ = other.success_;
e_ = other.e_;
r_ = other.r_;
}
return *this;
}
Outcome & operator=(Outcome &&other)
{
if (this != &other)
{
success_ = other.success_;
r_ = other.r_;
e_ = other.e_;
}
return *this;
}
bool isSuccess()const { return success_; }
E error()const { return e_; }
R result()const { return r_; }
private:
bool success_;
E e_;
R r_;
};
bool isSuccess()const { return success_; }
E error()const { return e_; }
R result()const { return r_; }
private:
bool success_;
E e_;
R r_;
};
}
#endif // !ALIBABACLOUD_CORE_OUTCOME_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -28,27 +28,27 @@
namespace AlibabaCloud
{
class RoaErrorMarshaller;
class ALIBABACLOUD_CORE_EXPORT RoaServiceClient : public CoreClient
{
public:
typedef Outcome<Error, std::string> JsonOutcome;
class RoaErrorMarshaller;
class ALIBABACLOUD_CORE_EXPORT RoaServiceClient : public CoreClient
{
public:
typedef Outcome<Error, std::string> JsonOutcome;
RoaServiceClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>());
virtual ~RoaServiceClient();
RoaServiceClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>());
virtual ~RoaServiceClient();
protected:
JsonOutcome makeRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const RoaServiceRequest &msg, HttpRequest::Method method)const;
private:
std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers)const;
std::string canonicalizedResource(const std::string &path, std::map <std::string, std::string> &params)const;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
protected:
JsonOutcome makeRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const RoaServiceRequest &msg, HttpRequest::Method method)const;
private:
std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers)const;
std::string canonicalizedResource(const std::string &path, std::map <std::string, std::string> &params)const;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
}
#endif // !ALIBABACLOUD_CORE_ROASERVICECLIENT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,15 +21,15 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT RoaServiceRequest : public ServiceRequest
{
public:
RoaServiceRequest(const std::string &product, const std::string &version);
virtual ~RoaServiceRequest();
using ServiceRequest::setParameter;
using ServiceRequest::setContent;
using ServiceRequest::parameter;
using ServiceRequest::setScheme;
};
class ALIBABACLOUD_CORE_EXPORT RoaServiceRequest : public ServiceRequest
{
public:
RoaServiceRequest(const std::string &product, const std::string &version);
virtual ~RoaServiceRequest();
using ServiceRequest::setParameter;
using ServiceRequest::setContent;
using ServiceRequest::parameter;
using ServiceRequest::setScheme;
};
}
#endif // !ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -29,34 +29,34 @@
namespace AlibabaCloud
{
class RpcErrorMarshaller;
class RpcServiceRequest;
class ALIBABACLOUD_CORE_EXPORT RpcServiceClient : public CoreClient
{
public:
typedef Outcome<Error, std::string> JsonOutcome;
class RpcErrorMarshaller;
class RpcServiceRequest;
class ALIBABACLOUD_CORE_EXPORT RpcServiceClient : public CoreClient
{
public:
typedef Outcome<Error, std::string> JsonOutcome;
RpcServiceClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>());
virtual ~RpcServiceClient();
RpcServiceClient(const std::string & servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider,
const ClientConfiguration &configuration,
const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>());
virtual ~RpcServiceClient();
std::shared_ptr<CredentialsProvider> credentialsProvider() {
return credentialsProvider_;
}
using CoreClient::configuration;
std::shared_ptr<CredentialsProvider> credentialsProvider() {
return credentialsProvider_;
}
using CoreClient::configuration;
using CoreClient::AttemptRequest;
using CoreClient::AttemptRequest;
protected:
virtual JsonOutcome makeRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const RpcServiceRequest &msg, HttpRequest::Method method)const;
private:
std::string canonicalizedQuery(const std::map <std::string, std::string> &params)const;
protected:
virtual JsonOutcome makeRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get)const;
virtual HttpRequest buildHttpRequest(const std::string & endpoint, const ServiceRequest &msg, HttpRequest::Method method)const override;
HttpRequest buildHttpRequest(const std::string & endpoint, const RpcServiceRequest &msg, HttpRequest::Method method)const;
private:
std::string canonicalizedQuery(const std::map <std::string, std::string> &params)const;
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
std::shared_ptr<CredentialsProvider> credentialsProvider_;
std::shared_ptr<Signer> signer_;
};
}
#endif // !ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,17 +21,17 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT RpcServiceRequest : public ServiceRequest
{
public:
RpcServiceRequest(const std::string &product, const std::string &version, const std::string & action);
virtual ~RpcServiceRequest();
class ALIBABACLOUD_CORE_EXPORT RpcServiceRequest : public ServiceRequest
{
public:
RpcServiceRequest(const std::string &product, const std::string &version, const std::string & action);
virtual ~RpcServiceRequest();
std::string actionName()const;
std::string actionName()const;
using ServiceRequest::setScheme;
protected:
void setActionName(const std::string &name);
protected:
void setActionName(const std::string &name);
};
};
}
#endif // !ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_
#endif // !ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,14 +22,14 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT Runnable
{
public:
explicit Runnable(const std::function<void()> f);
void run()const;
class ALIBABACLOUD_CORE_EXPORT Runnable
{
public:
explicit Runnable(const std::function<void()> f);
void run()const;
private:
std::function<void()> f_;
};
private:
std::function<void()> f_;
};
}
#endif // !ALIBABACLOUD_CORE_RUNNABLE_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -23,49 +23,49 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT ServiceRequest
{
public:
typedef std::string ParameterNameType;
typedef std::string ParameterValueType;
typedef std::map<ParameterNameType, ParameterValueType> ParameterCollection;
class ALIBABACLOUD_CORE_EXPORT ServiceRequest
{
public:
typedef std::string ParameterNameType;
typedef std::string ParameterValueType;
typedef std::map<ParameterNameType, ParameterValueType> ParameterCollection;
virtual ~ServiceRequest();
virtual ~ServiceRequest();
const char* content()const;
size_t contentSize()const;
bool hasContent()const;
ParameterCollection parameters()const;
std::string product()const;
std::string resourcePath()const;
std::string version()const;
std::string scheme()const;
protected:
ServiceRequest(const std::string &product, const std::string &version);
ServiceRequest(const ServiceRequest &other);
ServiceRequest(ServiceRequest &&other);
ServiceRequest& operator=(const ServiceRequest &other);
ServiceRequest& operator=(ServiceRequest &&other);
const char* content()const;
size_t contentSize()const;
bool hasContent()const;
ParameterCollection parameters()const;
std::string product()const;
std::string resourcePath()const;
std::string version()const;
std::string scheme()const;
protected:
ServiceRequest(const std::string &product, const std::string &version);
ServiceRequest(const ServiceRequest &other);
ServiceRequest(ServiceRequest &&other);
ServiceRequest& operator=(const ServiceRequest &other);
ServiceRequest& operator=(ServiceRequest &&other);
void addParameter(const ParameterNameType &name, const ParameterValueType &value);
ParameterValueType parameter(const ParameterNameType &name)const;
void removeParameter(const ParameterNameType &name);
void setContent(const char *data, size_t size);
void setParameter(const ParameterNameType &name, const ParameterValueType &value);
void setParameters(const ParameterCollection &params);
void setResourcePath(const std::string &path);
void setProduct(const std::string &product);
void setVersion(const std::string &version);
void setScheme(const std::string scheme);
private:
char *content_;
size_t contentSize_;
ParameterCollection params_;
std::string product_;
std::string resourcePath_;
std::string version_;
std::string scheme_;
};
void addParameter(const ParameterNameType &name, const ParameterValueType &value);
ParameterValueType parameter(const ParameterNameType &name)const;
void removeParameter(const ParameterNameType &name);
void setContent(const char *data, size_t size);
void setParameter(const ParameterNameType &name, const ParameterValueType &value);
void setParameters(const ParameterCollection &params);
void setResourcePath(const std::string &path);
void setProduct(const std::string &product);
void setVersion(const std::string &version);
void setScheme(const std::string scheme);
private:
char *content_;
size_t contentSize_;
ParameterCollection params_;
std::string product_;
std::string resourcePath_;
std::string version_;
std::string scheme_;
};
}
#endif // !ALIBABACLOUD_CORE_SERVICEREQUEST_H_
#endif // !ALIBABACLOUD_CORE_SERVICEREQUEST_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,19 +22,19 @@
namespace AlibabaCloud
{
class PayloadReader;
class ALIBABACLOUD_CORE_EXPORT ServiceResult
{
public:
ServiceResult();
virtual ~ServiceResult();
class PayloadReader;
class ALIBABACLOUD_CORE_EXPORT ServiceResult
{
public:
ServiceResult();
virtual ~ServiceResult();
std::string requestId()const;
protected:
void setRequestId(const std::string &requestId);
private:
std::string requestId_;
};
std::string requestId()const;
protected:
void setRequestId(const std::string &requestId);
private:
std::string requestId_;
};
}
#endif // !ALIBABACLOUD_CORE_SERVICERESULT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,25 +22,25 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT Signer
{
public:
enum Type
{
HmacSha1,
};
virtual ~Signer();
class ALIBABACLOUD_CORE_EXPORT Signer
{
public:
enum Type
{
HmacSha1,
};
virtual ~Signer();
virtual std::string generate(const std::string &src, const std::string &secret)const = 0;
std::string name()const;
Type type() const;
std::string version()const;
protected:
Signer(Type type, const std::string &name, const std::string &version = "1.0");
private:
std::string name_;
std::string version_;
Type type_;
};
virtual std::string generate(const std::string &src, const std::string &secret)const = 0;
std::string name()const;
Type type() const;
std::string version()const;
protected:
Signer(Type type, const std::string &name, const std::string &version = "1.0");
private:
std::string name_;
std::string version_;
Type type_;
};
}
#endif // !ALIBABACLOUD_CORE_SIGNER_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -21,17 +21,17 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT SimpleCredentialsProvider : public CredentialsProvider
{
public:
SimpleCredentialsProvider(const Credentials &credentials);
SimpleCredentialsProvider(const std::string &accessKeyId,
const std::string &accessKeySecret);
~SimpleCredentialsProvider();
class ALIBABACLOUD_CORE_EXPORT SimpleCredentialsProvider : public CredentialsProvider
{
public:
SimpleCredentialsProvider(const Credentials &credentials);
SimpleCredentialsProvider(const std::string &accessKeyId,
const std::string &accessKeySecret);
~SimpleCredentialsProvider();
virtual Credentials getCredentials() override;
private:
Credentials credentials_;
};
virtual Credentials getCredentials() override;
private:
Credentials credentials_;
};
}
#endif // !ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -24,31 +24,31 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT StsAssumeRoleCredentialsProvider : public CredentialsProvider, public Sts::StsClient
{
public:
StsAssumeRoleCredentialsProvider(
const Credentials &credentials,
const ClientConfiguration &configuration,
const std::string &roleArn,
const std::string &roleSessionName,
const std::string &policy = "",
int durationSeconds = 3600);
~StsAssumeRoleCredentialsProvider();
class ALIBABACLOUD_CORE_EXPORT StsAssumeRoleCredentialsProvider : public CredentialsProvider, public Sts::StsClient
{
public:
StsAssumeRoleCredentialsProvider(
const Credentials &credentials,
const ClientConfiguration &configuration,
const std::string &roleArn,
const std::string &roleSessionName,
const std::string &policy = "",
int durationSeconds = 3600);
~StsAssumeRoleCredentialsProvider();
virtual Credentials getCredentials() override;
using StsClient::assumeRole;
private:
void loadCredentials();
bool checkExpiry()const;
virtual Credentials getCredentials() override;
using StsClient::assumeRole;
private:
void loadCredentials();
bool checkExpiry()const;
std::mutex cachedMutex_;
Credentials cachedCredentials_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
std::string policy_;
std::string roleArn_;
std::string roleSessionName_;
};
std::mutex cachedMutex_;
Credentials cachedCredentials_;
int durationSeconds_;
std::chrono::system_clock::time_point expiry_;
std::string policy_;
std::string roleArn_;
std::string roleSessionName_;
};
}
#endif // !ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
#endif // !ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* 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.
@@ -22,54 +22,54 @@
namespace AlibabaCloud
{
class ALIBABACLOUD_CORE_EXPORT Url
{
public:
explicit Url(const std::string &url = "");
Url(const Url &other) = default;
Url(Url &&other) = default;
~Url();
Url & operator=(const Url &url) = default;
Url & operator=(Url &&other) = default;
bool operator==(const Url &url) const;
bool operator!=(const Url &url) const;
class ALIBABACLOUD_CORE_EXPORT Url
{
public:
explicit Url(const std::string &url = "");
Url(const Url &other) = default;
Url(Url &&other) = default;
~Url();
Url & operator=(const Url &url) = default;
Url & operator=(Url &&other) = default;
bool operator==(const Url &url) const;
bool operator!=(const Url &url) const;
std::string authority() const;
void clear();
std::string fragment() const;
void fromString(const std::string &url);
bool hasFragment() const;
bool hasQuery() const;
std::string host()const;
bool isEmpty() const;
bool isValid() const;
int port()const;
std::string password() const;
std::string path() const;
std::string query() const;
std::string scheme() const;
void setAuthority(const std::string &authority);
void setFragment(const std::string &fragment);
void setHost(const std::string &host);
void setPassword(const std::string &password);
void setPath(const std::string &path);
void setPort(int port);
void setQuery(const std::string &query);
void setScheme(const std::string &scheme);
void setUserInfo(const std::string &userInfo);
void setUserName(const std::string &userName);
std::string toString()const;
std::string userInfo() const;
std::string userName() const;
private:
std::string scheme_;
std::string userName_;
std::string password_;
std::string host_;
std::string path_;
int port_;
std::string query_;
std::string fragment_;
};
std::string authority() const;
void clear();
std::string fragment() const;
void fromString(const std::string &url);
bool hasFragment() const;
bool hasQuery() const;
std::string host()const;
bool isEmpty() const;
bool isValid() const;
int port()const;
std::string password() const;
std::string path() const;
std::string query() const;
std::string scheme() const;
void setAuthority(const std::string &authority);
void setFragment(const std::string &fragment);
void setHost(const std::string &host);
void setPassword(const std::string &password);
void setPath(const std::string &path);
void setPort(int port);
void setQuery(const std::string &query);
void setScheme(const std::string &scheme);
void setUserInfo(const std::string &userInfo);
void setUserName(const std::string &userName);
std::string toString()const;
std::string userInfo() const;
std::string userName() const;
private:
std::string scheme_;
std::string userName_;
std::string password_;
std::string host_;
std::string path_;
int port_;
std::string query_;
std::string fragment_;
};
}
#endif // !ALIBABACLOUD_CORE_URL_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -25,27 +25,27 @@
namespace AlibabaCloud
{
namespace Location
{
class ALIBABACLOUD_CORE_EXPORT LocationClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::DescribeEndpointsResult> DescribeEndpointsOutcome;
typedef std::future<DescribeEndpointsOutcome> DescribeEndpointsOutcomeCallable;
typedef std::function<void(const LocationClient*, const Model::DescribeEndpointsRequest&, const DescribeEndpointsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeEndpointsAsyncHandler;
namespace Location
{
class ALIBABACLOUD_CORE_EXPORT LocationClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::DescribeEndpointsResult> DescribeEndpointsOutcome;
typedef std::future<DescribeEndpointsOutcome> DescribeEndpointsOutcomeCallable;
typedef std::function<void(const LocationClient*, const Model::DescribeEndpointsRequest&, const DescribeEndpointsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeEndpointsAsyncHandler;
LocationClient(const Credentials &credentials, const ClientConfiguration &configuration);
LocationClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
LocationClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
LocationClient(const std::shared_ptr<Location::LocationClient>& locationClient);
~LocationClient();
virtual DescribeEndpointsOutcome describeEndpoints(const Model::DescribeEndpointsRequest &request)const;
void describeEndpointsAsync(const Model::DescribeEndpointsRequest& request, const DescribeEndpointsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DescribeEndpointsOutcomeCallable describeEndpointsCallable(const Model::DescribeEndpointsRequest& request) const;
using RpcServiceClient::makeRequest;
using RpcServiceClient::configuration;
};
}
LocationClient(const Credentials &credentials, const ClientConfiguration &configuration);
LocationClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
LocationClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
LocationClient(const std::shared_ptr<Location::LocationClient>& locationClient);
~LocationClient();
virtual DescribeEndpointsOutcome describeEndpoints(const Model::DescribeEndpointsRequest &request)const;
void describeEndpointsAsync(const Model::DescribeEndpointsRequest& request, const DescribeEndpointsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DescribeEndpointsOutcomeCallable describeEndpointsCallable(const Model::DescribeEndpointsRequest& request) const;
using RpcServiceClient::makeRequest;
using RpcServiceClient::configuration;
};
}
}
#endif // !ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
/*
* 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.
@@ -21,18 +21,18 @@
namespace AlibabaCloud
{
namespace Location
{
class ALIBABACLOUD_CORE_EXPORT LocationRequest : public RpcServiceRequest
{
public:
explicit LocationRequest(const std::string & action);
virtual ~LocationRequest();
namespace Location
{
class ALIBABACLOUD_CORE_EXPORT LocationRequest : public RpcServiceRequest
{
public:
explicit LocationRequest(const std::string & action);
virtual ~LocationRequest();
private:
private:
};
}
};
}
}
#endif // !ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_
#endif // !ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,25 +22,25 @@
namespace AlibabaCloud
{
namespace Location
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsRequest : public LocationRequest
{
public:
DescribeEndpointsRequest();
~DescribeEndpointsRequest();
namespace Location
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsRequest : public LocationRequest
{
public:
DescribeEndpointsRequest();
~DescribeEndpointsRequest();
std::string serviceCode()const;
void setServiceCode(const std::string& serviceCode);
std::string id()const;
void setId(const std::string& id);
std::string type()const;
void setType(const std::string& type);
std::string serviceCode()const;
void setServiceCode(const std::string& serviceCode);
std::string id()const;
void setId(const std::string& id);
std::string type()const;
void setType(const std::string& type);
};
}
}
};
}
}
}
#endif // !ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -24,41 +24,41 @@
namespace AlibabaCloud
{
namespace Location
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsResult : public ServiceResult
{
public:
struct Endpoint
{
std::string endpoint;
std::string id;
std::string namespace_;
std::string serivceCode;
std::string type;
std::vector<std::string> protocols;
};
namespace Location
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsResult : public ServiceResult
{
public:
struct Endpoint
{
std::string endpoint;
std::string id;
std::string namespace_;
std::string serivceCode;
std::string type;
std::vector<std::string> protocols;
};
DescribeEndpointsResult();
explicit DescribeEndpointsResult(const std::string &payload);
~DescribeEndpointsResult();
DescribeEndpointsResult();
explicit DescribeEndpointsResult(const std::string &payload);
~DescribeEndpointsResult();
std::vector<Endpoint> endpoints()const;
void setEndpoints(const std::vector<Endpoint> &endpoints);
std::vector<Endpoint> endpoints()const;
void setEndpoints(const std::vector<Endpoint> &endpoints);
bool success()const;
void setSuccess(const bool &success);
bool success()const;
void setSuccess(const bool &success);
protected:
void parse(const std::string &payload);
private:
std::vector<Endpoint> endpoints_;
bool success_;
protected:
void parse(const std::string &payload);
private:
std::vector<Endpoint> endpoints_;
bool success_;
};
}
}
};
}
}
}
#endif // !ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_
#endif // !ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -27,33 +27,33 @@
namespace AlibabaCloud
{
namespace Sts
{
class ALIBABACLOUD_CORE_EXPORT StsClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::AssumeRoleResult> AssumeRoleOutcome;
typedef std::future<AssumeRoleOutcome> AssumeRoleOutcomeCallable;
typedef std::function<void(const StsClient*, const Model::AssumeRoleRequest&, const AssumeRoleOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AssumeRoleAsyncHandler;
namespace Sts
{
class ALIBABACLOUD_CORE_EXPORT StsClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::AssumeRoleResult> AssumeRoleOutcome;
typedef std::future<AssumeRoleOutcome> AssumeRoleOutcomeCallable;
typedef std::function<void(const StsClient*, const Model::AssumeRoleRequest&, const AssumeRoleOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> AssumeRoleAsyncHandler;
typedef Outcome<Error, Model::GetCallerIdentityResult> GetCallerIdentityOutcome;
typedef std::future<GetCallerIdentityOutcome> GetCallerIdentityOutcomeCallable;
typedef std::function<void(const StsClient*, const Model::GetCallerIdentityRequest&, const GetCallerIdentityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetCallerIdentityAsyncHandler;
typedef Outcome<Error, Model::GetCallerIdentityResult> GetCallerIdentityOutcome;
typedef std::future<GetCallerIdentityOutcome> GetCallerIdentityOutcomeCallable;
typedef std::function<void(const StsClient*, const Model::GetCallerIdentityRequest&, const GetCallerIdentityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetCallerIdentityAsyncHandler;
StsClient(const Credentials &credentials, const ClientConfiguration &configuration);
StsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
StsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~StsClient();
StsClient(const Credentials &credentials, const ClientConfiguration &configuration);
StsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
StsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~StsClient();
virtual AssumeRoleOutcome assumeRole(const Model::AssumeRoleRequest &request)const;
void assumeRoleAsync(const Model::AssumeRoleRequest& request, const AssumeRoleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
AssumeRoleOutcomeCallable assumeRoleCallable(const Model::AssumeRoleRequest& request) const;
GetCallerIdentityOutcome getCallerIdentity(const Model::GetCallerIdentityRequest &request)const;
void getCallerIdentityAsync(const Model::GetCallerIdentityRequest& request, const GetCallerIdentityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetCallerIdentityOutcomeCallable getCallerIdentityCallable(const Model::GetCallerIdentityRequest& request) const;
using RpcServiceClient::makeRequest;
};
}
virtual AssumeRoleOutcome assumeRole(const Model::AssumeRoleRequest &request)const;
void assumeRoleAsync(const Model::AssumeRoleRequest& request, const AssumeRoleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
AssumeRoleOutcomeCallable assumeRoleCallable(const Model::AssumeRoleRequest& request) const;
GetCallerIdentityOutcome getCallerIdentity(const Model::GetCallerIdentityRequest &request)const;
void getCallerIdentityAsync(const Model::GetCallerIdentityRequest& request, const GetCallerIdentityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetCallerIdentityOutcomeCallable getCallerIdentityCallable(const Model::GetCallerIdentityRequest& request) const;
using RpcServiceClient::makeRequest;
};
}
}
#endif // !ALIBABACLOUD_CORE_STS_STSCLIENT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,18 +21,18 @@
namespace AlibabaCloud
{
namespace Sts
{
class ALIBABACLOUD_CORE_EXPORT StsRequest : public RpcServiceRequest
{
public:
explicit StsRequest(const std::string & action);
virtual ~StsRequest();
namespace Sts
{
class ALIBABACLOUD_CORE_EXPORT StsRequest : public RpcServiceRequest
{
public:
explicit StsRequest(const std::string & action);
virtual ~StsRequest();
private:
private:
};
}
};
}
}
#endif // !ALIBABACLOUD_CORE_STS_STSSERVICEREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,26 +22,26 @@
namespace AlibabaCloud
{
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT AssumeRoleRequest : public StsRequest
{
public:
AssumeRoleRequest();
~AssumeRoleRequest();
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT AssumeRoleRequest : public StsRequest
{
public:
AssumeRoleRequest();
~AssumeRoleRequest();
int durationSeconds()const;
std::string policy()const;
std::string roleArn()const;
std::string roleSessionName()const;
void setDurationSeconds(int durationSeconds);
void setPolicy(const std::string &policy);
void setRoleArn(const std::string & roleArn);
void setRoleSessionName(const std::string & roleSessionName);
};
}
}
int durationSeconds()const;
std::string policy()const;
std::string roleArn()const;
std::string roleSessionName()const;
void setDurationSeconds(int durationSeconds);
void setPolicy(const std::string &policy);
void setRoleArn(const std::string & roleArn);
void setRoleSessionName(const std::string & roleSessionName);
};
}
}
}
#endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,39 +21,39 @@
namespace AlibabaCloud
{
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT AssumeRoleResult : public ServiceResult
{
public:
struct AssumedRoleUser
{
std::string arn;
std::string assumedRoleId;
};
struct Credentials
{
std::string accessKeyId;
std::string accessKeySecret;
std::string expiration;
std::string securityToken;
};
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT AssumeRoleResult : public ServiceResult
{
public:
struct AssumedRoleUser
{
std::string arn;
std::string assumedRoleId;
};
struct Credentials
{
std::string accessKeyId;
std::string accessKeySecret;
std::string expiration;
std::string securityToken;
};
AssumeRoleResult();
explicit AssumeRoleResult(const std::string &payload);
~AssumeRoleResult();
AssumeRoleResult();
explicit AssumeRoleResult(const std::string &payload);
~AssumeRoleResult();
AssumedRoleUser assumedRoleUser()const;
Credentials credentials()const;
private:
void parse(const std::string &payload);
AssumedRoleUser assumedRoleUser()const;
Credentials credentials()const;
private:
void parse(const std::string &payload);
AssumedRoleUser assumedRoleUser_;
Credentials credentials_;
};
}
}
AssumedRoleUser assumedRoleUser_;
Credentials credentials_;
};
}
}
}
#endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -22,20 +22,20 @@
namespace AlibabaCloud
{
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityRequest : public StsRequest
{
public:
GetCallerIdentityRequest();
~GetCallerIdentityRequest();
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityRequest : public StsRequest
{
public:
GetCallerIdentityRequest();
~GetCallerIdentityRequest();
private:
private:
};
}
}
};
}
}
}
#endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
* 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.
@@ -21,29 +21,29 @@
namespace AlibabaCloud
{
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityResult : public ServiceResult
{
public:
GetCallerIdentityResult();
explicit GetCallerIdentityResult(const std::string &payload);
~GetCallerIdentityResult();
namespace Sts
{
namespace Model
{
class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityResult : public ServiceResult
{
public:
GetCallerIdentityResult();
explicit GetCallerIdentityResult(const std::string &payload);
~GetCallerIdentityResult();
std::string accountId();
std::string arn()const;
std::string userId()const;
private:
void parse(const std::string &payload);
std::string accountId();
std::string arn()const;
std::string userId()const;
private:
void parse(const std::string &payload);
std::string accountId_;
std::string arn_;
std::string userId_;
};
}
}
std::string accountId_;
std::string arn_;
std::string userId_;
};
}
}
}
#endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_