AWS SDK for C++  0.14.3
AWS SDK for C++
STSClient.h
Go to the documentation of this file.
1 /*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 #pragma once
16 #include <aws/sts/STS_EXPORTS.h>
17 #include <aws/sts/STSErrors.h>
32 #include <future>
33 #include <functional>
34 
35 namespace Aws
36 {
37 
38 namespace Http
39 {
40  class HttpClient;
41  class HttpClientFactory;
42 } // namespace Http
43 
44 namespace Utils
45 {
46  template< typename R, typename E> class Outcome;
47 
48 namespace Threading
49 {
50  class Executor;
51 } // namespace Threading
52 
53 namespace Xml
54 {
55  class XmlDocument;
56 } // namespace Xml
57 } // namespace Utils
58 
59 namespace Auth
60 {
61  class AWSCredentials;
62  class AWSCredentialsProvider;
63 } // namespace Auth
64 
65 namespace Client
66 {
67  class RetryStrategy;
68 } // namespace Client
69 
70 namespace STS
71 {
72 
73 namespace Model
74 {
75  class AssumeRoleRequest;
76  class AssumeRoleWithSAMLRequest;
77  class AssumeRoleWithWebIdentityRequest;
78  class DecodeAuthorizationMessageRequest;
79  class GetCallerIdentityRequest;
80  class GetFederationTokenRequest;
82 
90 
91  typedef std::future<AssumeRoleOutcome> AssumeRoleOutcomeCallable;
92  typedef std::future<AssumeRoleWithSAMLOutcome> AssumeRoleWithSAMLOutcomeCallable;
93  typedef std::future<AssumeRoleWithWebIdentityOutcome> AssumeRoleWithWebIdentityOutcomeCallable;
94  typedef std::future<DecodeAuthorizationMessageOutcome> DecodeAuthorizationMessageOutcomeCallable;
95  typedef std::future<GetCallerIdentityOutcome> GetCallerIdentityOutcomeCallable;
96  typedef std::future<GetFederationTokenOutcome> GetFederationTokenOutcomeCallable;
97  typedef std::future<GetSessionTokenOutcome> GetSessionTokenOutcomeCallable;
98 } // namespace Model
99 
100  class STSClient;
101 
102  typedef std::function<void(const STSClient*, const Model::AssumeRoleRequest&, const Model::AssumeRoleOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > AssumeRoleResponseReceivedHandler;
103  typedef std::function<void(const STSClient*, const Model::AssumeRoleWithSAMLRequest&, const Model::AssumeRoleWithSAMLOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > AssumeRoleWithSAMLResponseReceivedHandler;
104  typedef std::function<void(const STSClient*, const Model::AssumeRoleWithWebIdentityRequest&, const Model::AssumeRoleWithWebIdentityOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > AssumeRoleWithWebIdentityResponseReceivedHandler;
105  typedef std::function<void(const STSClient*, const Model::DecodeAuthorizationMessageRequest&, const Model::DecodeAuthorizationMessageOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DecodeAuthorizationMessageResponseReceivedHandler;
106  typedef std::function<void(const STSClient*, const Model::GetCallerIdentityRequest&, const Model::GetCallerIdentityOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetCallerIdentityResponseReceivedHandler;
107  typedef std::function<void(const STSClient*, const Model::GetFederationTokenRequest&, const Model::GetFederationTokenOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetFederationTokenResponseReceivedHandler;
108  typedef std::function<void(const STSClient*, const Model::GetSessionTokenRequest&, const Model::GetSessionTokenOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetSessionTokenResponseReceivedHandler;
109 
158  {
159  public:
161 
166  STSClient(const Client::ClientConfiguration& clientConfiguration = Client::ClientConfiguration());
167 
172  STSClient(const Auth::AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration = Client::ClientConfiguration());
173 
178  STSClient(const std::shared_ptr<Auth::AWSCredentialsProvider>& credentialsProvider,
179  const Client::ClientConfiguration& clientConfiguration = Client::ClientConfiguration());
180 
181  virtual ~STSClient();
182 
264  virtual Model::AssumeRoleOutcome AssumeRole(const Model::AssumeRoleRequest& request) const;
265 
349  virtual Model::AssumeRoleOutcomeCallable AssumeRoleCallable(const Model::AssumeRoleRequest& request) const;
350 
434  virtual void AssumeRoleAsync(const Model::AssumeRoleRequest& request, const AssumeRoleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
435 
501  virtual Model::AssumeRoleWithSAMLOutcome AssumeRoleWithSAML(const Model::AssumeRoleWithSAMLRequest& request) const;
502 
570  virtual Model::AssumeRoleWithSAMLOutcomeCallable AssumeRoleWithSAMLCallable(const Model::AssumeRoleWithSAMLRequest& request) const;
571 
639  virtual void AssumeRoleWithSAMLAsync(const Model::AssumeRoleWithSAMLRequest& request, const AssumeRoleWithSAMLResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
640 
727  virtual Model::AssumeRoleWithWebIdentityOutcome AssumeRoleWithWebIdentity(const Model::AssumeRoleWithWebIdentityRequest& request) const;
728 
817  virtual Model::AssumeRoleWithWebIdentityOutcomeCallable AssumeRoleWithWebIdentityCallable(const Model::AssumeRoleWithWebIdentityRequest& request) const;
818 
907  virtual void AssumeRoleWithWebIdentityAsync(const Model::AssumeRoleWithWebIdentityRequest& request, const AssumeRoleWithWebIdentityResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
908 
935  virtual Model::DecodeAuthorizationMessageOutcome DecodeAuthorizationMessage(const Model::DecodeAuthorizationMessageRequest& request) const;
936 
965  virtual Model::DecodeAuthorizationMessageOutcomeCallable DecodeAuthorizationMessageCallable(const Model::DecodeAuthorizationMessageRequest& request) const;
966 
995  virtual void DecodeAuthorizationMessageAsync(const Model::DecodeAuthorizationMessageRequest& request, const DecodeAuthorizationMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
996 
1001  virtual Model::GetCallerIdentityOutcome GetCallerIdentity(const Model::GetCallerIdentityRequest& request) const;
1002 
1009  virtual Model::GetCallerIdentityOutcomeCallable GetCallerIdentityCallable(const Model::GetCallerIdentityRequest& request) const;
1010 
1017  virtual void GetCallerIdentityAsync(const Model::GetCallerIdentityRequest& request, const GetCallerIdentityResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
1018 
1089  virtual Model::GetFederationTokenOutcome GetFederationToken(const Model::GetFederationTokenRequest& request) const;
1090 
1163  virtual Model::GetFederationTokenOutcomeCallable GetFederationTokenCallable(const Model::GetFederationTokenRequest& request) const;
1164 
1237  virtual void GetFederationTokenAsync(const Model::GetFederationTokenRequest& request, const GetFederationTokenResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
1238 
1285  virtual Model::GetSessionTokenOutcome GetSessionToken(const Model::GetSessionTokenRequest& request) const;
1286 
1335  virtual Model::GetSessionTokenOutcomeCallable GetSessionTokenCallable(const Model::GetSessionTokenRequest& request) const;
1336 
1385  virtual void GetSessionTokenAsync(const Model::GetSessionTokenRequest& request, const GetSessionTokenResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
1386 
1387 
1388  private:
1389  void init(const Client::ClientConfiguration& clientConfiguration);
1390 
1392  void AssumeRoleAsyncHelper(const Model::AssumeRoleRequest& request, const AssumeRoleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1393  void AssumeRoleWithSAMLAsyncHelper(const Model::AssumeRoleWithSAMLRequest& request, const AssumeRoleWithSAMLResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1394  void AssumeRoleWithWebIdentityAsyncHelper(const Model::AssumeRoleWithWebIdentityRequest& request, const AssumeRoleWithWebIdentityResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1395  void DecodeAuthorizationMessageAsyncHelper(const Model::DecodeAuthorizationMessageRequest& request, const DecodeAuthorizationMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1396  void GetCallerIdentityAsyncHelper(const Model::GetCallerIdentityRequest& request, const GetCallerIdentityResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1397  void GetFederationTokenAsyncHelper(const Model::GetFederationTokenRequest& request, const GetFederationTokenResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1398  void GetSessionTokenAsyncHelper(const Model::GetSessionTokenRequest& request, const GetSessionTokenResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
1399 
1400  Aws::String m_uri;
1401  std::shared_ptr<Utils::Threading::Executor> m_executor;
1402  };
1403 
1404 } // namespace STS
1405 } // namespace Aws
#define AWS_STS_API
Definition: STS_EXPORTS.h:37
std::function< void(const STSClient *, const Model::DecodeAuthorizationMessageRequest &, const Model::DecodeAuthorizationMessageOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > DecodeAuthorizationMessageResponseReceivedHandler
Definition: STSClient.h:105
Aws::Utils::Outcome< AssumeRoleResult, Aws::Client::AWSError< STSErrors > > AssumeRoleOutcome
Definition: STSClient.h:81
Aws::Utils::Outcome< AssumeRoleWithWebIdentityResult, Aws::Client::AWSError< STSErrors > > AssumeRoleWithWebIdentityOutcome
Definition: STSClient.h:85
std::function< void(const STSClient *, const Model::AssumeRoleRequest &, const Model::AssumeRoleOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > AssumeRoleResponseReceivedHandler
Definition: STSClient.h:100
std::function< void(const STSClient *, const Model::GetCallerIdentityRequest &, const Model::GetCallerIdentityOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > GetCallerIdentityResponseReceivedHandler
Definition: STSClient.h:106
Aws::Client::AWSXMLClient BASECLASS
Definition: STSClient.h:160
Aws::Utils::Outcome< GetFederationTokenResult, Aws::Client::AWSError< STSErrors > > GetFederationTokenOutcome
Definition: STSClient.h:88
std::future< GetCallerIdentityOutcome > GetCallerIdentityOutcomeCallable
Definition: STSClient.h:95
std::function< void(const STSClient *, const Model::GetFederationTokenRequest &, const Model::GetFederationTokenOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > GetFederationTokenResponseReceivedHandler
Definition: STSClient.h:107
Aws::Utils::Outcome< AssumeRoleWithSAMLResult, Aws::Client::AWSError< STSErrors > > AssumeRoleWithSAMLOutcome
Definition: STSClient.h:84
std::future< DecodeAuthorizationMessageOutcome > DecodeAuthorizationMessageOutcomeCallable
Definition: STSClient.h:94
std::function< void(const STSClient *, const Model::AssumeRoleWithSAMLRequest &, const Model::AssumeRoleWithSAMLOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > AssumeRoleWithSAMLResponseReceivedHandler
Definition: STSClient.h:103
std::function< void(const STSClient *, const Model::GetSessionTokenRequest &, const Model::GetSessionTokenOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > GetSessionTokenResponseReceivedHandler
Definition: STSClient.h:108
std::future< GetFederationTokenOutcome > GetFederationTokenOutcomeCallable
Definition: STSClient.h:96
std::future< AssumeRoleOutcome > AssumeRoleOutcomeCallable
Definition: STSClient.h:91
std::future< AssumeRoleWithWebIdentityOutcome > AssumeRoleWithWebIdentityOutcomeCallable
Definition: STSClient.h:93
std::future< AssumeRoleWithSAMLOutcome > AssumeRoleWithSAMLOutcomeCallable
Definition: STSClient.h:92
std::function< void(const STSClient *, const Model::AssumeRoleWithWebIdentityRequest &, const Model::AssumeRoleWithWebIdentityOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > AssumeRoleWithWebIdentityResponseReceivedHandler
Definition: STSClient.h:104
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
Aws::Utils::Outcome< DecodeAuthorizationMessageResult, Aws::Client::AWSError< STSErrors > > DecodeAuthorizationMessageOutcome
Definition: STSClient.h:86
Aws::Utils::Outcome< GetCallerIdentityResult, Aws::Client::AWSError< STSErrors > > GetCallerIdentityOutcome
Definition: STSClient.h:87
std::future< GetSessionTokenOutcome > GetSessionTokenOutcomeCallable
Definition: STSClient.h:97
Aws::Utils::Outcome< GetSessionTokenResult, Aws::Client::AWSError< STSErrors > > GetSessionTokenOutcome
Definition: STSClient.h:89
JSON (JavaScript Object Notation).