1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #pragma once
7 #include <aws/iotsecuretunneling/IoTSecureTunneling_EXPORTS.h>
8 #include <aws/iotsecuretunneling/IoTSecureTunnelingErrors.h>
9 #include <aws/core/client/AWSError.h>
10 #include <aws/core/client/ClientConfiguration.h>
11 #include <aws/core/client/AWSClient.h>
12 #include <aws/core/utils/memory/stl/AWSString.h>
13 #include <aws/core/utils/json/JsonSerializer.h>
14 #include <aws/iotsecuretunneling/model/CloseTunnelResult.h>
15 #include <aws/iotsecuretunneling/model/DescribeTunnelResult.h>
16 #include <aws/iotsecuretunneling/model/ListTagsForResourceResult.h>
17 #include <aws/iotsecuretunneling/model/ListTunnelsResult.h>
18 #include <aws/iotsecuretunneling/model/OpenTunnelResult.h>
19 #include <aws/iotsecuretunneling/model/TagResourceResult.h>
20 #include <aws/iotsecuretunneling/model/UntagResourceResult.h>
21 #include <aws/core/client/AsyncCallerContext.h>
22 #include <aws/core/http/HttpTypes.h>
23 #include <future>
24 #include <functional>
25 
26 namespace Aws
27 {
28 
29 namespace Http
30 {
31   class HttpClient;
32   class HttpClientFactory;
33 } // namespace Http
34 
35 namespace Utils
36 {
37   template< typename R, typename E> class Outcome;
38 namespace Threading
39 {
40   class Executor;
41 } // namespace Threading
42 } // namespace Utils
43 
44 namespace Auth
45 {
46   class AWSCredentials;
47   class AWSCredentialsProvider;
48 } // namespace Auth
49 
50 namespace Client
51 {
52   class RetryStrategy;
53 } // namespace Client
54 
55 namespace IoTSecureTunneling
56 {
57 
58 namespace Model
59 {
60         class CloseTunnelRequest;
61         class DescribeTunnelRequest;
62         class ListTagsForResourceRequest;
63         class ListTunnelsRequest;
64         class OpenTunnelRequest;
65         class TagResourceRequest;
66         class UntagResourceRequest;
67 
68         typedef Aws::Utils::Outcome<CloseTunnelResult, IoTSecureTunnelingError> CloseTunnelOutcome;
69         typedef Aws::Utils::Outcome<DescribeTunnelResult, IoTSecureTunnelingError> DescribeTunnelOutcome;
70         typedef Aws::Utils::Outcome<ListTagsForResourceResult, IoTSecureTunnelingError> ListTagsForResourceOutcome;
71         typedef Aws::Utils::Outcome<ListTunnelsResult, IoTSecureTunnelingError> ListTunnelsOutcome;
72         typedef Aws::Utils::Outcome<OpenTunnelResult, IoTSecureTunnelingError> OpenTunnelOutcome;
73         typedef Aws::Utils::Outcome<TagResourceResult, IoTSecureTunnelingError> TagResourceOutcome;
74         typedef Aws::Utils::Outcome<UntagResourceResult, IoTSecureTunnelingError> UntagResourceOutcome;
75 
76         typedef std::future<CloseTunnelOutcome> CloseTunnelOutcomeCallable;
77         typedef std::future<DescribeTunnelOutcome> DescribeTunnelOutcomeCallable;
78         typedef std::future<ListTagsForResourceOutcome> ListTagsForResourceOutcomeCallable;
79         typedef std::future<ListTunnelsOutcome> ListTunnelsOutcomeCallable;
80         typedef std::future<OpenTunnelOutcome> OpenTunnelOutcomeCallable;
81         typedef std::future<TagResourceOutcome> TagResourceOutcomeCallable;
82         typedef std::future<UntagResourceOutcome> UntagResourceOutcomeCallable;
83 } // namespace Model
84 
85   class IoTSecureTunnelingClient;
86 
87     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::CloseTunnelRequest&, const Model::CloseTunnelOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > CloseTunnelResponseReceivedHandler;
88     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::DescribeTunnelRequest&, const Model::DescribeTunnelOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DescribeTunnelResponseReceivedHandler;
89     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::ListTagsForResourceRequest&, const Model::ListTagsForResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > ListTagsForResourceResponseReceivedHandler;
90     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::ListTunnelsRequest&, const Model::ListTunnelsOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > ListTunnelsResponseReceivedHandler;
91     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::OpenTunnelRequest&, const Model::OpenTunnelOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > OpenTunnelResponseReceivedHandler;
92     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::TagResourceRequest&, const Model::TagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > TagResourceResponseReceivedHandler;
93     typedef std::function<void(const IoTSecureTunnelingClient*, const Model::UntagResourceRequest&, const Model::UntagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > UntagResourceResponseReceivedHandler;
94 
95   /**
96    * <fullname>AWS IoT Secure Tunneling</fullname> <p>AWS IoT Secure Tunnling enables
97    * you to create remote connections to devices deployed in the field.</p> <p>For
98    * more information about how AWS IoT Secure Tunneling works, see <a
99    * href="https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html">AWS
100    * IoT Secure Tunneling</a>.</p>
101    */
102   class AWS_IOTSECURETUNNELING_API IoTSecureTunnelingClient : public Aws::Client::AWSJsonClient
103   {
104     public:
105       typedef Aws::Client::AWSJsonClient BASECLASS;
106 
107        /**
108         * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
109         * is not specified, it will be initialized to default values.
110         */
111         IoTSecureTunnelingClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
112 
113        /**
114         * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
115         * is not specified, it will be initialized to default values.
116         */
117         IoTSecureTunnelingClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
118 
119        /**
120         * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
121         * the default http client factory will be used
122         */
123         IoTSecureTunnelingClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
124             const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
125 
126         virtual ~IoTSecureTunnelingClient();
127 
128 
129         /**
130          * <p>Closes a tunnel identified by the unique tunnel id. When a
131          * <code>CloseTunnel</code> request is received, we close the WebSocket connections
132          * between the client and proxy server so no data can be transmitted.</p><p><h3>See
133          * Also:</h3>   <a
134          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/CloseTunnel">AWS
135          * API Reference</a></p>
136          */
137         virtual Model::CloseTunnelOutcome CloseTunnel(const Model::CloseTunnelRequest& request) const;
138 
139         /**
140          * <p>Closes a tunnel identified by the unique tunnel id. When a
141          * <code>CloseTunnel</code> request is received, we close the WebSocket connections
142          * between the client and proxy server so no data can be transmitted.</p><p><h3>See
143          * Also:</h3>   <a
144          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/CloseTunnel">AWS
145          * API Reference</a></p>
146          *
147          * returns a future to the operation so that it can be executed in parallel to other requests.
148          */
149         virtual Model::CloseTunnelOutcomeCallable CloseTunnelCallable(const Model::CloseTunnelRequest& request) const;
150 
151         /**
152          * <p>Closes a tunnel identified by the unique tunnel id. When a
153          * <code>CloseTunnel</code> request is received, we close the WebSocket connections
154          * between the client and proxy server so no data can be transmitted.</p><p><h3>See
155          * Also:</h3>   <a
156          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/CloseTunnel">AWS
157          * API Reference</a></p>
158          *
159          * Queues the request into a thread executor and triggers associated callback when operation has finished.
160          */
161         virtual void CloseTunnelAsync(const Model::CloseTunnelRequest& request, const CloseTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
162 
163         /**
164          * <p>Gets information about a tunnel identified by the unique tunnel
165          * id.</p><p><h3>See Also:</h3>   <a
166          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/DescribeTunnel">AWS
167          * API Reference</a></p>
168          */
169         virtual Model::DescribeTunnelOutcome DescribeTunnel(const Model::DescribeTunnelRequest& request) const;
170 
171         /**
172          * <p>Gets information about a tunnel identified by the unique tunnel
173          * id.</p><p><h3>See Also:</h3>   <a
174          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/DescribeTunnel">AWS
175          * API Reference</a></p>
176          *
177          * returns a future to the operation so that it can be executed in parallel to other requests.
178          */
179         virtual Model::DescribeTunnelOutcomeCallable DescribeTunnelCallable(const Model::DescribeTunnelRequest& request) const;
180 
181         /**
182          * <p>Gets information about a tunnel identified by the unique tunnel
183          * id.</p><p><h3>See Also:</h3>   <a
184          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/DescribeTunnel">AWS
185          * API Reference</a></p>
186          *
187          * Queues the request into a thread executor and triggers associated callback when operation has finished.
188          */
189         virtual void DescribeTunnelAsync(const Model::DescribeTunnelRequest& request, const DescribeTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
190 
191         /**
192          * <p>Lists the tags for the specified resource.</p><p><h3>See Also:</h3>   <a
193          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTagsForResource">AWS
194          * API Reference</a></p>
195          */
196         virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const;
197 
198         /**
199          * <p>Lists the tags for the specified resource.</p><p><h3>See Also:</h3>   <a
200          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTagsForResource">AWS
201          * API Reference</a></p>
202          *
203          * returns a future to the operation so that it can be executed in parallel to other requests.
204          */
205         virtual Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const Model::ListTagsForResourceRequest& request) const;
206 
207         /**
208          * <p>Lists the tags for the specified resource.</p><p><h3>See Also:</h3>   <a
209          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTagsForResource">AWS
210          * API Reference</a></p>
211          *
212          * Queues the request into a thread executor and triggers associated callback when operation has finished.
213          */
214         virtual void ListTagsForResourceAsync(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
215 
216         /**
217          * <p>List all tunnels for an AWS account. Tunnels are listed by creation time in
218          * descending order, newer tunnels will be listed before older
219          * tunnels.</p><p><h3>See Also:</h3>   <a
220          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTunnels">AWS
221          * API Reference</a></p>
222          */
223         virtual Model::ListTunnelsOutcome ListTunnels(const Model::ListTunnelsRequest& request) const;
224 
225         /**
226          * <p>List all tunnels for an AWS account. Tunnels are listed by creation time in
227          * descending order, newer tunnels will be listed before older
228          * tunnels.</p><p><h3>See Also:</h3>   <a
229          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTunnels">AWS
230          * API Reference</a></p>
231          *
232          * returns a future to the operation so that it can be executed in parallel to other requests.
233          */
234         virtual Model::ListTunnelsOutcomeCallable ListTunnelsCallable(const Model::ListTunnelsRequest& request) const;
235 
236         /**
237          * <p>List all tunnels for an AWS account. Tunnels are listed by creation time in
238          * descending order, newer tunnels will be listed before older
239          * tunnels.</p><p><h3>See Also:</h3>   <a
240          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/ListTunnels">AWS
241          * API Reference</a></p>
242          *
243          * Queues the request into a thread executor and triggers associated callback when operation has finished.
244          */
245         virtual void ListTunnelsAsync(const Model::ListTunnelsRequest& request, const ListTunnelsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
246 
247         /**
248          * <p>Creates a new tunnel, and returns two client access tokens for clients to use
249          * to connect to the AWS IoT Secure Tunneling proxy server.</p><p><h3>See
250          * Also:</h3>   <a
251          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/OpenTunnel">AWS
252          * API Reference</a></p>
253          */
254         virtual Model::OpenTunnelOutcome OpenTunnel(const Model::OpenTunnelRequest& request) const;
255 
256         /**
257          * <p>Creates a new tunnel, and returns two client access tokens for clients to use
258          * to connect to the AWS IoT Secure Tunneling proxy server.</p><p><h3>See
259          * Also:</h3>   <a
260          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/OpenTunnel">AWS
261          * API Reference</a></p>
262          *
263          * returns a future to the operation so that it can be executed in parallel to other requests.
264          */
265         virtual Model::OpenTunnelOutcomeCallable OpenTunnelCallable(const Model::OpenTunnelRequest& request) const;
266 
267         /**
268          * <p>Creates a new tunnel, and returns two client access tokens for clients to use
269          * to connect to the AWS IoT Secure Tunneling proxy server.</p><p><h3>See
270          * Also:</h3>   <a
271          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/OpenTunnel">AWS
272          * API Reference</a></p>
273          *
274          * Queues the request into a thread executor and triggers associated callback when operation has finished.
275          */
276         virtual void OpenTunnelAsync(const Model::OpenTunnelRequest& request, const OpenTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
277 
278         /**
279          * <p>A resource tag.</p><p><h3>See Also:</h3>   <a
280          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/TagResource">AWS
281          * API Reference</a></p>
282          */
283         virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const;
284 
285         /**
286          * <p>A resource tag.</p><p><h3>See Also:</h3>   <a
287          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/TagResource">AWS
288          * API Reference</a></p>
289          *
290          * returns a future to the operation so that it can be executed in parallel to other requests.
291          */
292         virtual Model::TagResourceOutcomeCallable TagResourceCallable(const Model::TagResourceRequest& request) const;
293 
294         /**
295          * <p>A resource tag.</p><p><h3>See Also:</h3>   <a
296          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/TagResource">AWS
297          * API Reference</a></p>
298          *
299          * Queues the request into a thread executor and triggers associated callback when operation has finished.
300          */
301         virtual void TagResourceAsync(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
302 
303         /**
304          * <p>Removes a tag from a resource.</p><p><h3>See Also:</h3>   <a
305          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/UntagResource">AWS
306          * API Reference</a></p>
307          */
308         virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const;
309 
310         /**
311          * <p>Removes a tag from a resource.</p><p><h3>See Also:</h3>   <a
312          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/UntagResource">AWS
313          * API Reference</a></p>
314          *
315          * returns a future to the operation so that it can be executed in parallel to other requests.
316          */
317         virtual Model::UntagResourceOutcomeCallable UntagResourceCallable(const Model::UntagResourceRequest& request) const;
318 
319         /**
320          * <p>Removes a tag from a resource.</p><p><h3>See Also:</h3>   <a
321          * href="http://docs.aws.amazon.com/goto/WebAPI/iotsecuretunneling-2018-10-05/UntagResource">AWS
322          * API Reference</a></p>
323          *
324          * Queues the request into a thread executor and triggers associated callback when operation has finished.
325          */
326         virtual void UntagResourceAsync(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
327 
328 
329       void OverrideEndpoint(const Aws::String& endpoint);
330     private:
331       void init(const Aws::Client::ClientConfiguration& clientConfiguration);
332         void CloseTunnelAsyncHelper(const Model::CloseTunnelRequest& request, const CloseTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
333         void DescribeTunnelAsyncHelper(const Model::DescribeTunnelRequest& request, const DescribeTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
334         void ListTagsForResourceAsyncHelper(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
335         void ListTunnelsAsyncHelper(const Model::ListTunnelsRequest& request, const ListTunnelsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
336         void OpenTunnelAsyncHelper(const Model::OpenTunnelRequest& request, const OpenTunnelResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
337         void TagResourceAsyncHelper(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
338         void UntagResourceAsyncHelper(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
339 
340       Aws::String m_uri;
341       Aws::String m_configScheme;
342       std::shared_ptr<Aws::Utils::Threading::Executor> m_executor;
343   };
344 
345 } // namespace IoTSecureTunneling
346 } // namespace Aws
347