fix code style
This commit is contained in:
@@ -30,6 +30,6 @@ const long kDefaultReadTimeout = 10000;
|
||||
ALIBABACLOUD_CORE_EXPORT void InitializeSdk();
|
||||
ALIBABACLOUD_CORE_EXPORT bool IsSdkInitialized();
|
||||
ALIBABACLOUD_CORE_EXPORT void ShutdownSdk();
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT AsyncCallerContext {
|
||||
public:
|
||||
public:
|
||||
AsyncCallerContext();
|
||||
explicit AsyncCallerContext(const std::string &uuid);
|
||||
virtual ~AsyncCallerContext();
|
||||
|
||||
std::string uuid()const;
|
||||
std::string uuid() const;
|
||||
void setUuid(const std::string &uuid);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string uuid_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_
|
||||
|
||||
@@ -17,23 +17,23 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "CredentialsProvider.h"
|
||||
#include "CoreExport.h"
|
||||
#include "CredentialsProvider.h"
|
||||
#include "NetworkProxy.h"
|
||||
#include "Signer.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT ClientConfiguration {
|
||||
public:
|
||||
public:
|
||||
explicit ClientConfiguration(const std::string ®ionId = "cn-hangzhou",
|
||||
const NetworkProxy &proxy = NetworkProxy());
|
||||
const NetworkProxy &proxy = NetworkProxy());
|
||||
~ClientConfiguration();
|
||||
|
||||
std::string endpoint()const;
|
||||
NetworkProxy proxy()const;
|
||||
std::string regionId()const;
|
||||
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 ®ionId);
|
||||
@@ -46,7 +46,7 @@ class ALIBABACLOUD_CORE_EXPORT ClientConfiguration {
|
||||
bool rejectUnauthorized() const;
|
||||
void setRejectUnauthorized(const bool rejectUnauthorized);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string endpoint_;
|
||||
NetworkProxy proxy_;
|
||||
std::string regionId_;
|
||||
@@ -54,6 +54,6 @@ class ALIBABACLOUD_CORE_EXPORT ClientConfiguration {
|
||||
long readTimeout_;
|
||||
bool rejectUnauthorized_ = true;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
|
||||
|
||||
@@ -1,77 +1,81 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_
|
||||
|
||||
#include "AsyncCallerContext.h"
|
||||
#include "ClientConfiguration.h"
|
||||
#include "CommonRequest.h"
|
||||
#include "CommonResponse.h"
|
||||
#include "CoreClient.h"
|
||||
#include "CoreExport.h"
|
||||
#include "CredentialsProvider.h"
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "AsyncCallerContext.h"
|
||||
#include "ClientConfiguration.h"
|
||||
#include "CoreExport.h"
|
||||
#include "CoreClient.h"
|
||||
#include "CommonRequest.h"
|
||||
#include "CommonResponse.h"
|
||||
#include "CredentialsProvider.h"
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT CommonClient : public CoreClient {
|
||||
public:
|
||||
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 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);
|
||||
const ClientConfiguration &configuration);
|
||||
CommonClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider,
|
||||
const ClientConfiguration &configuration);
|
||||
const ClientConfiguration &configuration);
|
||||
CommonClient(const std::string &accessKeyId,
|
||||
const std::string &accessKeySecret,
|
||||
const ClientConfiguration &configuration);
|
||||
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;
|
||||
void commonResponseAsync(
|
||||
const CommonRequest &request, const CommonResponseAsyncHandler &handler,
|
||||
const std::shared_ptr<const AsyncCallerContext> &context = nullptr) const;
|
||||
CommonResponseOutcomeCallable
|
||||
commonResponseCallable(const CommonRequest &request) const;
|
||||
|
||||
protected:
|
||||
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;
|
||||
protected:
|
||||
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:
|
||||
private:
|
||||
std::shared_ptr<CredentialsProvider> credentialsProvider_;
|
||||
std::shared_ptr<Signer> signer_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include "ServiceRequest.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "ServiceRequest.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest {
|
||||
public:
|
||||
enum RequestPattern {
|
||||
RpcPattern,
|
||||
RoaPattern
|
||||
};
|
||||
public:
|
||||
enum RequestPattern { RpcPattern, RoaPattern };
|
||||
|
||||
explicit CommonRequest(RequestPattern pattern = RpcPattern);
|
||||
~CommonRequest();
|
||||
@@ -42,25 +39,25 @@ class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest {
|
||||
using ServiceRequest::setContent;
|
||||
void setDomain(const std::string &domain);
|
||||
void setHeaderParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
const ParameterValueType &value);
|
||||
void setHttpMethod(HttpRequest::Method method);
|
||||
void setQueryParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
const ParameterValueType &value);
|
||||
using ServiceRequest::setResourcePath;
|
||||
void setRequestPattern(RequestPattern pattern);
|
||||
using ServiceRequest::setVersion;
|
||||
using ServiceRequest::setScheme;
|
||||
using ServiceRequest::setVersion;
|
||||
RequestPattern requestPattern() const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
using ServiceRequest::product;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string domain_;
|
||||
RequestPattern requestPattern_;
|
||||
ParameterCollection queryParams_;
|
||||
ParameterCollection headerParams_;
|
||||
HttpRequest::Method httpMethod_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT CommonResponse {
|
||||
public:
|
||||
public:
|
||||
CommonResponse();
|
||||
explicit CommonResponse(const std::string &payload);
|
||||
~CommonResponse();
|
||||
|
||||
std::string payload()const;
|
||||
std::string payload() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string payload_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_
|
||||
|
||||
@@ -17,43 +17,44 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "ClientConfiguration.h"
|
||||
#include "CoreExport.h"
|
||||
#include "HttpClient.h"
|
||||
#include "HttpResponse.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "HttpResponse.h"
|
||||
#include "Outcome.h"
|
||||
#include "ServiceRequest.h"
|
||||
#include "Runnable.h"
|
||||
#include "ServiceRequest.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT CoreClient {
|
||||
public:
|
||||
CoreClient(const std::string & servicename,
|
||||
const ClientConfiguration &configuration);
|
||||
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;
|
||||
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:
|
||||
private:
|
||||
std::string serviceName_;
|
||||
ClientConfiguration configuration_;
|
||||
std::shared_ptr<CredentialsProvider> credentialsProvider_;
|
||||
HttpClient *httpClient_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_
|
||||
|
||||
@@ -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
|
||||
#define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
#endif
|
||||
#else
|
||||
#define ALIBABACLOUD_CORE_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COREEXPORT_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COREEXPORT_H_
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT Credentials {
|
||||
public:
|
||||
public:
|
||||
Credentials(const std::string &accessKeyId,
|
||||
const std::string &accessKeySecret,
|
||||
const std::string &sessionToken = "");
|
||||
const std::string &accessKeySecret,
|
||||
const std::string &sessionToken = "");
|
||||
~Credentials();
|
||||
|
||||
std::string accessKeyId() const;
|
||||
@@ -35,11 +35,11 @@ class ALIBABACLOUD_CORE_EXPORT Credentials {
|
||||
void setSessionToken(const std::string &sessionToken);
|
||||
std::string sessionToken() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string accessKeyId_;
|
||||
std::string accessKeySecret_;
|
||||
std::string sessionToken_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT CredentialsProvider {
|
||||
public:
|
||||
public:
|
||||
CredentialsProvider() = default;
|
||||
virtual ~CredentialsProvider() = default;
|
||||
virtual ~CredentialsProvider() = default;
|
||||
virtual Credentials getCredentials() = 0;
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALSPROVIDER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALSPROVIDER_H_
|
||||
|
||||
@@ -1,63 +1,60 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_
|
||||
|
||||
#include <alibabacloud/core/location/LocationClient.h>
|
||||
#include <alibabacloud/core/CoreClient.h>
|
||||
#include <string>
|
||||
#include <alibabacloud/core/location/LocationClient.h>
|
||||
#include <chrono>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT EndpointProvider :
|
||||
public Location::LocationClient {
|
||||
public:
|
||||
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);
|
||||
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 ®ionId,
|
||||
const std::string &product,
|
||||
const std::string &serviceCode = std::string(),
|
||||
int durationSeconds = 3600);
|
||||
EndpointProvider(const Credentials &credentials,
|
||||
const ClientConfiguration &configuration,
|
||||
const std::string ®ionId, const std::string &product,
|
||||
const std::string &serviceCode = std::string(),
|
||||
int durationSeconds = 3600);
|
||||
~EndpointProvider();
|
||||
|
||||
EndpointOutcome getEndpoint();
|
||||
using LocationClient::describeEndpoints;
|
||||
|
||||
private:
|
||||
private:
|
||||
EndpointOutcome loadRemoteEndpoint();
|
||||
bool checkExpiry()const;
|
||||
bool checkExpiry() const;
|
||||
|
||||
bool loadLocalProductsInfo();
|
||||
std::string localEndpoint(const std::string regionId,
|
||||
const std::string product);
|
||||
const std::string product);
|
||||
|
||||
std::mutex cachedMutex_;
|
||||
std::string cachedEndpoint_;
|
||||
@@ -67,5 +64,5 @@ class ALIBABACLOUD_CORE_EXPORT EndpointProvider :
|
||||
std::string product_;
|
||||
std::string serviceCode_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT Error {
|
||||
public:
|
||||
public:
|
||||
Error() = default;
|
||||
Error(std::string code, const std::string message);
|
||||
~Error() = default;
|
||||
@@ -33,18 +33,18 @@ class ALIBABACLOUD_CORE_EXPORT Error {
|
||||
std::string requestId() const;
|
||||
std::string detail() 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);
|
||||
void setDetail(const std::string& detail);
|
||||
void setErrorMessage(const std::string &message);
|
||||
void setHost(const std::string &host);
|
||||
void setRequestId(const std::string &request);
|
||||
void setDetail(const std::string &detail);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string errorCode_;
|
||||
std::string message_;
|
||||
std::string host_;
|
||||
std::string requestId_;
|
||||
std::string detail_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_
|
||||
|
||||
@@ -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 // CORE_INCLUDE_ALIBABACLOUD_CORE_GLOBAL_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_GLOBAL_H_
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT HmacSha1Signer : public Signer {
|
||||
public:
|
||||
public:
|
||||
HmacSha1Signer();
|
||||
~HmacSha1Signer();
|
||||
|
||||
std::string generate(const std::string &src,
|
||||
const std::string &secret) const override;
|
||||
const std::string &secret) const override;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_
|
||||
|
||||
@@ -17,29 +17,29 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_
|
||||
|
||||
#include <alibabacloud/core/Error.h>
|
||||
#include <alibabacloud/core/HttpRequest.h>
|
||||
#include <alibabacloud/core/HttpResponse.h>
|
||||
#include <alibabacloud/core/NetworkProxy.h>
|
||||
#include <alibabacloud/core/Outcome.h>
|
||||
#include <alibabacloud/core/Error.h>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class HttpClient {
|
||||
public:
|
||||
public:
|
||||
typedef Outcome<Error, HttpResponse> HttpResponseOutcome;
|
||||
|
||||
HttpClient();
|
||||
virtual ~HttpClient();
|
||||
|
||||
virtual HttpResponseOutcome makeRequest(const HttpRequest &request) = 0;
|
||||
NetworkProxy proxy()const;
|
||||
NetworkProxy proxy() const;
|
||||
void setProxy(const NetworkProxy &proxy);
|
||||
bool rejectUnauthorized()const;
|
||||
bool rejectUnauthorized() const;
|
||||
void setRejectUnauthorized(const bool &rejectUnauthorized);
|
||||
|
||||
private:
|
||||
private:
|
||||
NetworkProxy proxy_;
|
||||
bool rejectUnauthorized_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_
|
||||
|
||||
#include "CoreExport.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT HttpMessage {
|
||||
private:
|
||||
private:
|
||||
struct ALIBABACLOUD_CORE_EXPORT nocaseLess {
|
||||
bool operator() (const std::string & s1, const std::string & s2) const;
|
||||
bool operator()(const std::string &s1, const std::string &s2) const;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
enum KnownHeader {
|
||||
Accept,
|
||||
AcceptCharset,
|
||||
@@ -52,31 +52,31 @@ class ALIBABACLOUD_CORE_EXPORT HttpMessage {
|
||||
|
||||
HttpMessage(const HttpMessage &other);
|
||||
HttpMessage(HttpMessage &&other);
|
||||
HttpMessage& operator=(const HttpMessage &other);
|
||||
HttpMessage& operator=(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;
|
||||
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;
|
||||
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:
|
||||
protected:
|
||||
HttpMessage();
|
||||
|
||||
private:
|
||||
private:
|
||||
char *body_;
|
||||
size_t bodySize_;
|
||||
HeaderCollection headers_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_
|
||||
|
||||
@@ -17,41 +17,31 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include "HttpMessage.h"
|
||||
#include "Url.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage {
|
||||
public:
|
||||
enum Method {
|
||||
Get,
|
||||
Head,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Connect,
|
||||
Options,
|
||||
Patch,
|
||||
Trace
|
||||
};
|
||||
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;
|
||||
Method method() const;
|
||||
void setMethod(Method method);
|
||||
void setUrl(const Url &url);
|
||||
Url url()const;
|
||||
Url url() const;
|
||||
long connectTimeout() const;
|
||||
long readTimeout() const;
|
||||
void setConnectTimeout(const long connectTimeout);
|
||||
void setReadTimeout(const long readTimeout);
|
||||
|
||||
private:
|
||||
private:
|
||||
Method method_;
|
||||
Url url_;
|
||||
long connectTimeout_;
|
||||
long readTimeout_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
|
||||
|
||||
@@ -17,26 +17,26 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include "HttpMessage.h"
|
||||
#include "HttpRequest.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT HttpResponse : public HttpMessage {
|
||||
public:
|
||||
public:
|
||||
HttpResponse();
|
||||
explicit HttpResponse(const HttpRequest & request);
|
||||
explicit HttpResponse(const HttpRequest &request);
|
||||
~HttpResponse();
|
||||
|
||||
HttpRequest request()const;
|
||||
HttpRequest request() const;
|
||||
void setStatusCode(int code);
|
||||
int statusCode()const;
|
||||
int statusCode() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
int statusCode_;
|
||||
HttpRequest request_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class InstanceProfileCredentials : public BasicSessionCredentials {
|
||||
public:
|
||||
public:
|
||||
InstanceProfileCredentials();
|
||||
~InstanceProfileCredentials();
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_
|
||||
|
||||
@@ -17,36 +17,37 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_
|
||||
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "CredentialsProvider.h"
|
||||
#include "Credentials.h"
|
||||
#include "../src/EcsMetadataFetcher.h"
|
||||
#include "Credentials.h"
|
||||
#include "CredentialsProvider.h"
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT InstanceProfileCredentialsProvider :
|
||||
public CredentialsProvider, public EcsMetadataFetcher {
|
||||
public:
|
||||
class ALIBABACLOUD_CORE_EXPORT InstanceProfileCredentialsProvider
|
||||
: public CredentialsProvider,
|
||||
public EcsMetadataFetcher {
|
||||
public:
|
||||
InstanceProfileCredentialsProvider(const std::string &roleName,
|
||||
int durationSeconds = 3600);
|
||||
int durationSeconds = 3600);
|
||||
~InstanceProfileCredentialsProvider();
|
||||
|
||||
std::string roleName()const;
|
||||
std::string roleName() const;
|
||||
Credentials getCredentials() override;
|
||||
using EcsMetadataFetcher::getMetadata;
|
||||
using EcsMetadataFetcher::roleName;
|
||||
using EcsMetadataFetcher::setRoleName;
|
||||
using EcsMetadataFetcher::getMetadata;
|
||||
|
||||
private:
|
||||
private:
|
||||
void loadCredentials();
|
||||
bool checkExpiry()const;
|
||||
bool checkExpiry() const;
|
||||
|
||||
std::mutex cachedMutex_;
|
||||
Credentials cachedCredentials_;
|
||||
int durationSeconds_;
|
||||
std::chrono::system_clock::time_point expiry_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_
|
||||
|
||||
@@ -17,26 +17,20 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
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 = "");
|
||||
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;
|
||||
std::string hostName() const;
|
||||
std::string password() const;
|
||||
uint16_t port() const;
|
||||
void setHostName(const std::string &hostName);
|
||||
void setPassword(const std::string &password);
|
||||
@@ -44,14 +38,14 @@ class ALIBABACLOUD_CORE_EXPORT NetworkProxy {
|
||||
void setType(Type type);
|
||||
void setUser(const std::string &user);
|
||||
Type type() const;
|
||||
std::string user() const;
|
||||
std::string user() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string hostName_;
|
||||
std::string password_;
|
||||
uint16_t port_;
|
||||
Type type_;
|
||||
std::string user_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
|
||||
|
||||
@@ -20,24 +20,15 @@
|
||||
#include <utility>
|
||||
|
||||
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) {
|
||||
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_;
|
||||
@@ -45,7 +36,7 @@ class Outcome {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
Outcome & operator=(Outcome &&other) {
|
||||
Outcome &operator=(Outcome &&other) {
|
||||
if (this != &other) {
|
||||
success_ = other.success_;
|
||||
r_ = other.r_;
|
||||
@@ -54,14 +45,14 @@ class Outcome {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool isSuccess()const { return success_; }
|
||||
E error()const { return e_; }
|
||||
R result()const { return r_; }
|
||||
bool isSuccess() const { return success_; }
|
||||
E error() const { return e_; }
|
||||
R result() const { return r_; }
|
||||
|
||||
private:
|
||||
private:
|
||||
bool success_;
|
||||
E e_;
|
||||
R r_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_OUTCOME_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_OUTCOME_H_
|
||||
|
||||
@@ -17,39 +17,43 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "CoreClient.h"
|
||||
#include "CredentialsProvider.h"
|
||||
#include "HmacSha1Signer.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "RoaServiceRequest.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class RoaErrorMarshaller;
|
||||
class ALIBABACLOUD_CORE_EXPORT RoaServiceClient : public CoreClient {
|
||||
public:
|
||||
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>());
|
||||
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;
|
||||
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;
|
||||
protected:
|
||||
JsonOutcome
|
||||
makeRequest(const std::string &endpoint, const RoaServiceRequest &msg,
|
||||
HttpRequest::Method method = HttpRequest::Method::Get) const;
|
||||
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:
|
||||
private:
|
||||
std::shared_ptr<CredentialsProvider> credentialsProvider_;
|
||||
std::shared_ptr<Signer> signer_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT RoaServiceRequest : public ServiceRequest {
|
||||
public:
|
||||
public:
|
||||
RoaServiceRequest(const std::string &product, const std::string &version);
|
||||
virtual ~RoaServiceRequest();
|
||||
using ServiceRequest::setParameter;
|
||||
using ServiceRequest::setContent;
|
||||
using ServiceRequest::parameter;
|
||||
using ServiceRequest::setScheme;
|
||||
using ServiceRequest::setResourcePath;
|
||||
using ServiceRequest::setContent;
|
||||
using ServiceRequest::setMethod;
|
||||
using ServiceRequest::setParameter;
|
||||
using ServiceRequest::setResourcePath;
|
||||
using ServiceRequest::setScheme;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_
|
||||
|
||||
@@ -17,47 +17,51 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "CoreClient.h"
|
||||
#include "CredentialsProvider.h"
|
||||
#include "HmacSha1Signer.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "RpcServiceRequest.h"
|
||||
#include "Outcome.h"
|
||||
#include "RpcServiceRequest.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class RpcErrorMarshaller;
|
||||
class RpcServiceRequest;
|
||||
class ALIBABACLOUD_CORE_EXPORT RpcServiceClient : public CoreClient {
|
||||
public:
|
||||
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>());
|
||||
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;
|
||||
using CoreClient::AttemptRequest;
|
||||
using CoreClient::configuration;
|
||||
|
||||
protected:
|
||||
virtual JsonOutcome makeRequest(const std::string &endpoint,
|
||||
const RpcServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get) const;
|
||||
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;
|
||||
protected:
|
||||
virtual JsonOutcome
|
||||
makeRequest(const std::string &endpoint, const RpcServiceRequest &msg,
|
||||
HttpRequest::Method method = HttpRequest::Method::Get) const;
|
||||
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:
|
||||
private:
|
||||
std::shared_ptr<CredentialsProvider> credentialsProvider_;
|
||||
std::shared_ptr<Signer> signer_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_
|
||||
|
||||
@@ -22,17 +22,17 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT RpcServiceRequest : public ServiceRequest {
|
||||
public:
|
||||
public:
|
||||
RpcServiceRequest(const std::string &product, const std::string &version,
|
||||
const std::string & action);
|
||||
const std::string &action);
|
||||
virtual ~RpcServiceRequest();
|
||||
|
||||
std::string actionName()const;
|
||||
std::string actionName() const;
|
||||
using ServiceRequest::setMethod;
|
||||
using ServiceRequest::setScheme;
|
||||
|
||||
protected:
|
||||
void setActionName(const std::string &name);
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_
|
||||
|
||||
#include <functional>
|
||||
#include "CoreExport.h"
|
||||
#include <functional>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT Runnable {
|
||||
public:
|
||||
public:
|
||||
explicit Runnable(const std::function<void()> f);
|
||||
void run()const;
|
||||
void run() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::function<void()> f_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
|
||||
|
||||
#include "CoreExport.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "Url.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "HttpRequest.h"
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
|
||||
@@ -47,11 +47,13 @@ public:
|
||||
void setConnectTimeout(const long connectTimeout);
|
||||
void setReadTimeout(const long readTimeout);
|
||||
void setMethod(const HttpRequest::Method method);
|
||||
void setHeader(const ParameterNameType &name, const ParameterValueType &value);
|
||||
void setHeader(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
ParameterValueType getHeader(const ParameterNameType &name);
|
||||
void removeHeader(const ParameterNameType &name);
|
||||
ParameterCollection headers() const;
|
||||
void setBodyParameter(const ParameterNameType &name, const ParameterValueType &value);
|
||||
void setBodyParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
|
||||
protected:
|
||||
ServiceRequest(const std::string &product, const std::string &version);
|
||||
@@ -73,7 +75,8 @@ protected:
|
||||
const ParameterValueType &value);
|
||||
|
||||
void setParameters(const ParameterCollection ¶ms);
|
||||
void setJsonParameters(const ParameterNameType &name, const ParameterCollection ¶ms);
|
||||
void setJsonParameters(const ParameterNameType &name,
|
||||
const ParameterCollection ¶ms);
|
||||
void setResourcePath(const std::string &path);
|
||||
void setProduct(const std::string &product);
|
||||
void setVersion(const std::string &version);
|
||||
|
||||
@@ -17,23 +17,23 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class PayloadReader;
|
||||
class ALIBABACLOUD_CORE_EXPORT ServiceResult {
|
||||
public:
|
||||
public:
|
||||
ServiceResult();
|
||||
virtual ~ServiceResult();
|
||||
std::string requestId()const;
|
||||
std::string requestId() const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void setRequestId(const std::string &requestId);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string requestId_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_
|
||||
|
||||
@@ -17,31 +17,31 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_
|
||||
|
||||
#include <string>
|
||||
#include "CoreExport.h"
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT Signer {
|
||||
public:
|
||||
public:
|
||||
enum Type {
|
||||
HmacSha1,
|
||||
};
|
||||
virtual ~Signer();
|
||||
|
||||
virtual std::string generate(const std::string &src,
|
||||
const std::string &secret)const = 0;
|
||||
std::string name()const;
|
||||
const std::string &secret) const = 0;
|
||||
std::string name() const;
|
||||
Type type() const;
|
||||
std::string version()const;
|
||||
std::string version() const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
Signer(Type type, const std::string &name,
|
||||
const std::string &version = "1.0");
|
||||
const std::string &version = "1.0");
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string name_;
|
||||
std::string version_;
|
||||
Type type_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT SimpleCredentialsProvider
|
||||
: public CredentialsProvider {
|
||||
public:
|
||||
public:
|
||||
explicit SimpleCredentialsProvider(const Credentials &credentials);
|
||||
SimpleCredentialsProvider(const std::string &accessKeyId,
|
||||
const std::string &accessKeySecret);
|
||||
const std::string &accessKeySecret);
|
||||
~SimpleCredentialsProvider();
|
||||
|
||||
Credentials getCredentials() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
Credentials credentials_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
|
||||
@@ -25,23 +25,23 @@
|
||||
|
||||
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);
|
||||
: 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();
|
||||
|
||||
Credentials getCredentials() override;
|
||||
using StsClient::assumeRole;
|
||||
|
||||
private:
|
||||
private:
|
||||
void loadCredentials();
|
||||
bool checkExpiry()const;
|
||||
bool checkExpiry() const;
|
||||
|
||||
std::mutex cachedMutex_;
|
||||
Credentials cachedCredentials_;
|
||||
@@ -51,5 +51,5 @@ class ALIBABACLOUD_CORE_EXPORT StsAssumeRoleCredentialsProvider
|
||||
std::string roleArn_;
|
||||
std::string roleSessionName_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT Url {
|
||||
public:
|
||||
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;
|
||||
Url &operator=(const Url &url) = default;
|
||||
Url &operator=(Url &&other) = default;
|
||||
bool operator==(const Url &url) const;
|
||||
bool operator!=(const Url &url) const;
|
||||
|
||||
@@ -38,11 +38,11 @@ class ALIBABACLOUD_CORE_EXPORT Url {
|
||||
void fromString(const std::string &url);
|
||||
bool hasFragment() const;
|
||||
bool hasQuery() const;
|
||||
std::string host()const;
|
||||
std::string host() const;
|
||||
bool isEmpty() const;
|
||||
bool isValid() const;
|
||||
int port()const;
|
||||
std::string password() const;
|
||||
int port() const;
|
||||
std::string password() const;
|
||||
std::string path() const;
|
||||
std::string query() const;
|
||||
std::string scheme() const;
|
||||
@@ -58,9 +58,9 @@ class ALIBABACLOUD_CORE_EXPORT Url {
|
||||
void setUserName(const std::string &userName);
|
||||
std::string toString() const;
|
||||
std::string userInfo() const;
|
||||
std::string userName() const;
|
||||
std::string userName() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string scheme_;
|
||||
std::string userName_;
|
||||
std::string password_;
|
||||
@@ -70,5 +70,5 @@ class ALIBABACLOUD_CORE_EXPORT Url {
|
||||
std::string query_;
|
||||
std::string fragment_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_URL_H_
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_URL_H_
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace AlibabaCloud {
|
||||
std::string ComputeContentMD5(const char *data, size_t size);
|
||||
std::string GenerateUuid();
|
||||
std::string HttpMethodToString(HttpRequest::Method method);
|
||||
|
||||
@@ -17,50 +17,51 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_
|
||||
|
||||
#include "model/DescribeEndpointsRequest.h"
|
||||
#include "model/DescribeEndpointsResult.h"
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "model/DescribeEndpointsRequest.h"
|
||||
#include "model/DescribeEndpointsResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Location {
|
||||
class ALIBABACLOUD_CORE_EXPORT LocationClient : public RpcServiceClient {
|
||||
public:
|
||||
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>&)>
|
||||
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);
|
||||
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);
|
||||
const std::string &accessKeySecret,
|
||||
const ClientConfiguration &configuration);
|
||||
LocationClient(
|
||||
const std::shared_ptr<Location::LocationClient>& 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;
|
||||
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;
|
||||
const Model::DescribeEndpointsRequest &request) const;
|
||||
using RpcServiceClient::configuration;
|
||||
using RpcServiceClient::makeRequest;
|
||||
};
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
namespace AlibabaCloud {
|
||||
namespace Location {
|
||||
class ALIBABACLOUD_CORE_EXPORT LocationRequest : public RpcServiceRequest {
|
||||
public:
|
||||
explicit LocationRequest(const std::string & action);
|
||||
public:
|
||||
explicit LocationRequest(const std::string &action);
|
||||
virtual ~LocationRequest();
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_
|
||||
|
||||
@@ -25,18 +25,18 @@ namespace Location {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsRequest
|
||||
: public LocationRequest {
|
||||
public:
|
||||
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);
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_
|
||||
} // namespace Model
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Location {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsResult : public ServiceResult {
|
||||
public:
|
||||
public:
|
||||
struct Endpoint {
|
||||
std::string endpoint;
|
||||
std::string id;
|
||||
@@ -40,20 +40,20 @@ class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsResult : public ServiceResult {
|
||||
explicit DescribeEndpointsResult(const std::string &payload);
|
||||
~DescribeEndpointsResult();
|
||||
|
||||
std::vector<Endpoint> endpoints()const;
|
||||
std::vector<Endpoint> endpoints() const;
|
||||
void setEndpoints(const std::vector<Endpoint> &endpoints);
|
||||
|
||||
bool success()const;
|
||||
bool success() const;
|
||||
void setSuccess(const bool &success);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<Endpoint> endpoints_;
|
||||
bool success_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_
|
||||
} // namespace Model
|
||||
} // namespace Location
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_
|
||||
|
||||
@@ -1,77 +1,81 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_
|
||||
|
||||
#include "model/AssumeRoleRequest.h"
|
||||
#include "model/AssumeRoleResult.h"
|
||||
#include "model/GetCallerIdentityRequest.h"
|
||||
#include "model/GetCallerIdentityResult.h"
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "model/AssumeRoleRequest.h"
|
||||
#include "model/AssumeRoleResult.h"
|
||||
#include "model/GetCallerIdentityRequest.h"
|
||||
#include "model/GetCallerIdentityResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Sts {
|
||||
class ALIBABACLOUD_CORE_EXPORT StsClient : public RpcServiceClient {
|
||||
public:
|
||||
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 std::function<void(const StsClient *,
|
||||
const Model::AssumeRoleRequest &,
|
||||
const AssumeRoleOutcome &,
|
||||
const std::shared_ptr<const AsyncCallerContext> &)>
|
||||
AssumeRoleAsyncHandler;
|
||||
|
||||
typedef Outcome<Error, Model::GetCallerIdentityResult>
|
||||
GetCallerIdentityOutcome;
|
||||
GetCallerIdentityOutcome;
|
||||
typedef std::future<GetCallerIdentityOutcome>
|
||||
GetCallerIdentityOutcomeCallable;
|
||||
typedef std::function<void(const StsClient*,
|
||||
const Model::GetCallerIdentityRequest&, const GetCallerIdentityOutcome&,
|
||||
const std::shared_ptr<const AsyncCallerContext>&)>
|
||||
GetCallerIdentityAsyncHandler;
|
||||
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);
|
||||
const ClientConfiguration &configuration);
|
||||
StsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider,
|
||||
const ClientConfiguration &configuration);
|
||||
const ClientConfiguration &configuration);
|
||||
StsClient(const std::string &accessKeyId, const std::string &accessKeySecret,
|
||||
const ClientConfiguration &configuration);
|
||||
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;
|
||||
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;
|
||||
const Model::GetCallerIdentityRequest &request) const;
|
||||
using RpcServiceClient::makeRequest;
|
||||
};
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_
|
||||
@@ -23,13 +23,13 @@
|
||||
namespace AlibabaCloud {
|
||||
namespace Sts {
|
||||
class ALIBABACLOUD_CORE_EXPORT StsRequest : public RpcServiceRequest {
|
||||
public:
|
||||
explicit StsRequest(const std::string & action);
|
||||
public:
|
||||
explicit StsRequest(const std::string &action);
|
||||
virtual ~StsRequest();
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_
|
||||
#define ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <alibabacloud/core/sts/StsRequest.h>
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_
|
||||
#define ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_
|
||||
@@ -20,34 +20,35 @@
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
|
||||
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;
|
||||
|
||||
AssumedRoleUser assumedRoleUser_;
|
||||
Credentials credentials_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
void parse(const std::string &payload);
|
||||
|
||||
AssumedRoleUser assumedRoleUser_;
|
||||
Credentials credentials_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_
|
||||
#define ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <alibabacloud/core/sts/StsRequest.h>
|
||||
#include <string>
|
||||
|
||||
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:
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_
|
||||
#define ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_
|
||||
@@ -20,26 +20,27 @@
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
|
||||
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;
|
||||
|
||||
std::string accountId_;
|
||||
std::string arn_;
|
||||
std::string userId_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
void parse(const std::string &payload);
|
||||
|
||||
std::string accountId_;
|
||||
std::string arn_;
|
||||
std::string userId_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Sts
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
Reference in New Issue
Block a user