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/braket/Braket_EXPORTS.h>
8 #include <aws/braket/BraketErrors.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/braket/model/CancelQuantumTaskResult.h>
15 #include <aws/braket/model/CreateQuantumTaskResult.h>
16 #include <aws/braket/model/GetDeviceResult.h>
17 #include <aws/braket/model/GetQuantumTaskResult.h>
18 #include <aws/braket/model/ListTagsForResourceResult.h>
19 #include <aws/braket/model/SearchDevicesResult.h>
20 #include <aws/braket/model/SearchQuantumTasksResult.h>
21 #include <aws/braket/model/TagResourceResult.h>
22 #include <aws/braket/model/UntagResourceResult.h>
23 #include <aws/core/client/AsyncCallerContext.h>
24 #include <aws/core/http/HttpTypes.h>
25 #include <future>
26 #include <functional>
27 
28 namespace Aws
29 {
30 
31 namespace Http
32 {
33   class HttpClient;
34   class HttpClientFactory;
35 } // namespace Http
36 
37 namespace Utils
38 {
39   template< typename R, typename E> class Outcome;
40 namespace Threading
41 {
42   class Executor;
43 } // namespace Threading
44 } // namespace Utils
45 
46 namespace Auth
47 {
48   class AWSCredentials;
49   class AWSCredentialsProvider;
50 } // namespace Auth
51 
52 namespace Client
53 {
54   class RetryStrategy;
55 } // namespace Client
56 
57 namespace Braket
58 {
59 
60 namespace Model
61 {
62         class CancelQuantumTaskRequest;
63         class CreateQuantumTaskRequest;
64         class GetDeviceRequest;
65         class GetQuantumTaskRequest;
66         class ListTagsForResourceRequest;
67         class SearchDevicesRequest;
68         class SearchQuantumTasksRequest;
69         class TagResourceRequest;
70         class UntagResourceRequest;
71 
72         typedef Aws::Utils::Outcome<CancelQuantumTaskResult, BraketError> CancelQuantumTaskOutcome;
73         typedef Aws::Utils::Outcome<CreateQuantumTaskResult, BraketError> CreateQuantumTaskOutcome;
74         typedef Aws::Utils::Outcome<GetDeviceResult, BraketError> GetDeviceOutcome;
75         typedef Aws::Utils::Outcome<GetQuantumTaskResult, BraketError> GetQuantumTaskOutcome;
76         typedef Aws::Utils::Outcome<ListTagsForResourceResult, BraketError> ListTagsForResourceOutcome;
77         typedef Aws::Utils::Outcome<SearchDevicesResult, BraketError> SearchDevicesOutcome;
78         typedef Aws::Utils::Outcome<SearchQuantumTasksResult, BraketError> SearchQuantumTasksOutcome;
79         typedef Aws::Utils::Outcome<TagResourceResult, BraketError> TagResourceOutcome;
80         typedef Aws::Utils::Outcome<UntagResourceResult, BraketError> UntagResourceOutcome;
81 
82         typedef std::future<CancelQuantumTaskOutcome> CancelQuantumTaskOutcomeCallable;
83         typedef std::future<CreateQuantumTaskOutcome> CreateQuantumTaskOutcomeCallable;
84         typedef std::future<GetDeviceOutcome> GetDeviceOutcomeCallable;
85         typedef std::future<GetQuantumTaskOutcome> GetQuantumTaskOutcomeCallable;
86         typedef std::future<ListTagsForResourceOutcome> ListTagsForResourceOutcomeCallable;
87         typedef std::future<SearchDevicesOutcome> SearchDevicesOutcomeCallable;
88         typedef std::future<SearchQuantumTasksOutcome> SearchQuantumTasksOutcomeCallable;
89         typedef std::future<TagResourceOutcome> TagResourceOutcomeCallable;
90         typedef std::future<UntagResourceOutcome> UntagResourceOutcomeCallable;
91 } // namespace Model
92 
93   class BraketClient;
94 
95     typedef std::function<void(const BraketClient*, const Model::CancelQuantumTaskRequest&, const Model::CancelQuantumTaskOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > CancelQuantumTaskResponseReceivedHandler;
96     typedef std::function<void(const BraketClient*, const Model::CreateQuantumTaskRequest&, const Model::CreateQuantumTaskOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > CreateQuantumTaskResponseReceivedHandler;
97     typedef std::function<void(const BraketClient*, const Model::GetDeviceRequest&, const Model::GetDeviceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetDeviceResponseReceivedHandler;
98     typedef std::function<void(const BraketClient*, const Model::GetQuantumTaskRequest&, const Model::GetQuantumTaskOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetQuantumTaskResponseReceivedHandler;
99     typedef std::function<void(const BraketClient*, const Model::ListTagsForResourceRequest&, const Model::ListTagsForResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > ListTagsForResourceResponseReceivedHandler;
100     typedef std::function<void(const BraketClient*, const Model::SearchDevicesRequest&, const Model::SearchDevicesOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > SearchDevicesResponseReceivedHandler;
101     typedef std::function<void(const BraketClient*, const Model::SearchQuantumTasksRequest&, const Model::SearchQuantumTasksOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > SearchQuantumTasksResponseReceivedHandler;
102     typedef std::function<void(const BraketClient*, const Model::TagResourceRequest&, const Model::TagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > TagResourceResponseReceivedHandler;
103     typedef std::function<void(const BraketClient*, const Model::UntagResourceRequest&, const Model::UntagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > UntagResourceResponseReceivedHandler;
104 
105   /**
106    * <p>The Amazon Braket API Reference provides information about the operations and
107    * structures supported in Amazon Braket.</p>
108    */
109   class AWS_BRAKET_API BraketClient : public Aws::Client::AWSJsonClient
110   {
111     public:
112       typedef Aws::Client::AWSJsonClient BASECLASS;
113 
114        /**
115         * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
116         * is not specified, it will be initialized to default values.
117         */
118         BraketClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
119 
120        /**
121         * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
122         * is not specified, it will be initialized to default values.
123         */
124         BraketClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
125 
126        /**
127         * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
128         * the default http client factory will be used
129         */
130         BraketClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
131             const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
132 
133         virtual ~BraketClient();
134 
135 
136         /**
137          * <p>Cancels the specified task.</p><p><h3>See Also:</h3>   <a
138          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CancelQuantumTask">AWS
139          * API Reference</a></p>
140          */
141         virtual Model::CancelQuantumTaskOutcome CancelQuantumTask(const Model::CancelQuantumTaskRequest& request) const;
142 
143         /**
144          * <p>Cancels the specified task.</p><p><h3>See Also:</h3>   <a
145          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CancelQuantumTask">AWS
146          * API Reference</a></p>
147          *
148          * returns a future to the operation so that it can be executed in parallel to other requests.
149          */
150         virtual Model::CancelQuantumTaskOutcomeCallable CancelQuantumTaskCallable(const Model::CancelQuantumTaskRequest& request) const;
151 
152         /**
153          * <p>Cancels the specified task.</p><p><h3>See Also:</h3>   <a
154          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CancelQuantumTask">AWS
155          * API Reference</a></p>
156          *
157          * Queues the request into a thread executor and triggers associated callback when operation has finished.
158          */
159         virtual void CancelQuantumTaskAsync(const Model::CancelQuantumTaskRequest& request, const CancelQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
160 
161         /**
162          * <p>Creates a quantum task.</p><p><h3>See Also:</h3>   <a
163          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CreateQuantumTask">AWS
164          * API Reference</a></p>
165          */
166         virtual Model::CreateQuantumTaskOutcome CreateQuantumTask(const Model::CreateQuantumTaskRequest& request) const;
167 
168         /**
169          * <p>Creates a quantum task.</p><p><h3>See Also:</h3>   <a
170          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CreateQuantumTask">AWS
171          * API Reference</a></p>
172          *
173          * returns a future to the operation so that it can be executed in parallel to other requests.
174          */
175         virtual Model::CreateQuantumTaskOutcomeCallable CreateQuantumTaskCallable(const Model::CreateQuantumTaskRequest& request) const;
176 
177         /**
178          * <p>Creates a quantum task.</p><p><h3>See Also:</h3>   <a
179          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/CreateQuantumTask">AWS
180          * API Reference</a></p>
181          *
182          * Queues the request into a thread executor and triggers associated callback when operation has finished.
183          */
184         virtual void CreateQuantumTaskAsync(const Model::CreateQuantumTaskRequest& request, const CreateQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
185 
186         /**
187          * <p>Retrieves the devices available in Amazon Braket.</p><p><h3>See Also:</h3>
188          * <a href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetDevice">AWS
189          * API Reference</a></p>
190          */
191         virtual Model::GetDeviceOutcome GetDevice(const Model::GetDeviceRequest& request) const;
192 
193         /**
194          * <p>Retrieves the devices available in Amazon Braket.</p><p><h3>See Also:</h3>
195          * <a href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetDevice">AWS
196          * API Reference</a></p>
197          *
198          * returns a future to the operation so that it can be executed in parallel to other requests.
199          */
200         virtual Model::GetDeviceOutcomeCallable GetDeviceCallable(const Model::GetDeviceRequest& request) const;
201 
202         /**
203          * <p>Retrieves the devices available in Amazon Braket.</p><p><h3>See Also:</h3>
204          * <a href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetDevice">AWS
205          * API Reference</a></p>
206          *
207          * Queues the request into a thread executor and triggers associated callback when operation has finished.
208          */
209         virtual void GetDeviceAsync(const Model::GetDeviceRequest& request, const GetDeviceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
210 
211         /**
212          * <p>Retrieves the specified quantum task.</p><p><h3>See Also:</h3>   <a
213          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetQuantumTask">AWS
214          * API Reference</a></p>
215          */
216         virtual Model::GetQuantumTaskOutcome GetQuantumTask(const Model::GetQuantumTaskRequest& request) const;
217 
218         /**
219          * <p>Retrieves the specified quantum task.</p><p><h3>See Also:</h3>   <a
220          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetQuantumTask">AWS
221          * API Reference</a></p>
222          *
223          * returns a future to the operation so that it can be executed in parallel to other requests.
224          */
225         virtual Model::GetQuantumTaskOutcomeCallable GetQuantumTaskCallable(const Model::GetQuantumTaskRequest& request) const;
226 
227         /**
228          * <p>Retrieves the specified quantum task.</p><p><h3>See Also:</h3>   <a
229          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/GetQuantumTask">AWS
230          * API Reference</a></p>
231          *
232          * Queues the request into a thread executor and triggers associated callback when operation has finished.
233          */
234         virtual void GetQuantumTaskAsync(const Model::GetQuantumTaskRequest& request, const GetQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
235 
236         /**
237          * <p>Shows the tags associated with this resource.</p><p><h3>See Also:</h3>   <a
238          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/ListTagsForResource">AWS
239          * API Reference</a></p>
240          */
241         virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const;
242 
243         /**
244          * <p>Shows the tags associated with this resource.</p><p><h3>See Also:</h3>   <a
245          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/ListTagsForResource">AWS
246          * API Reference</a></p>
247          *
248          * returns a future to the operation so that it can be executed in parallel to other requests.
249          */
250         virtual Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const Model::ListTagsForResourceRequest& request) const;
251 
252         /**
253          * <p>Shows the tags associated with this resource.</p><p><h3>See Also:</h3>   <a
254          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/ListTagsForResource">AWS
255          * API Reference</a></p>
256          *
257          * Queues the request into a thread executor and triggers associated callback when operation has finished.
258          */
259         virtual void ListTagsForResourceAsync(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
260 
261         /**
262          * <p>Searches for devices using the specified filters.</p><p><h3>See Also:</h3>
263          * <a
264          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchDevices">AWS
265          * API Reference</a></p>
266          */
267         virtual Model::SearchDevicesOutcome SearchDevices(const Model::SearchDevicesRequest& request) const;
268 
269         /**
270          * <p>Searches for devices using the specified filters.</p><p><h3>See Also:</h3>
271          * <a
272          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchDevices">AWS
273          * API Reference</a></p>
274          *
275          * returns a future to the operation so that it can be executed in parallel to other requests.
276          */
277         virtual Model::SearchDevicesOutcomeCallable SearchDevicesCallable(const Model::SearchDevicesRequest& request) const;
278 
279         /**
280          * <p>Searches for devices using the specified filters.</p><p><h3>See Also:</h3>
281          * <a
282          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchDevices">AWS
283          * API Reference</a></p>
284          *
285          * Queues the request into a thread executor and triggers associated callback when operation has finished.
286          */
287         virtual void SearchDevicesAsync(const Model::SearchDevicesRequest& request, const SearchDevicesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
288 
289         /**
290          * <p>Searches for tasks that match the specified filter values.</p><p><h3>See
291          * Also:</h3>   <a
292          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchQuantumTasks">AWS
293          * API Reference</a></p>
294          */
295         virtual Model::SearchQuantumTasksOutcome SearchQuantumTasks(const Model::SearchQuantumTasksRequest& request) const;
296 
297         /**
298          * <p>Searches for tasks that match the specified filter values.</p><p><h3>See
299          * Also:</h3>   <a
300          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchQuantumTasks">AWS
301          * API Reference</a></p>
302          *
303          * returns a future to the operation so that it can be executed in parallel to other requests.
304          */
305         virtual Model::SearchQuantumTasksOutcomeCallable SearchQuantumTasksCallable(const Model::SearchQuantumTasksRequest& request) const;
306 
307         /**
308          * <p>Searches for tasks that match the specified filter values.</p><p><h3>See
309          * Also:</h3>   <a
310          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchQuantumTasks">AWS
311          * API Reference</a></p>
312          *
313          * Queues the request into a thread executor and triggers associated callback when operation has finished.
314          */
315         virtual void SearchQuantumTasksAsync(const Model::SearchQuantumTasksRequest& request, const SearchQuantumTasksResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
316 
317         /**
318          * <p>Add a tag to the specified resource.</p><p><h3>See Also:</h3>   <a
319          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/TagResource">AWS
320          * API Reference</a></p>
321          */
322         virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const;
323 
324         /**
325          * <p>Add a tag to the specified resource.</p><p><h3>See Also:</h3>   <a
326          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/TagResource">AWS
327          * API Reference</a></p>
328          *
329          * returns a future to the operation so that it can be executed in parallel to other requests.
330          */
331         virtual Model::TagResourceOutcomeCallable TagResourceCallable(const Model::TagResourceRequest& request) const;
332 
333         /**
334          * <p>Add a tag to the specified resource.</p><p><h3>See Also:</h3>   <a
335          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/TagResource">AWS
336          * API Reference</a></p>
337          *
338          * Queues the request into a thread executor and triggers associated callback when operation has finished.
339          */
340         virtual void TagResourceAsync(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
341 
342         /**
343          * <p>Remove tags from a resource.</p><p><h3>See Also:</h3>   <a
344          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/UntagResource">AWS
345          * API Reference</a></p>
346          */
347         virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const;
348 
349         /**
350          * <p>Remove tags from a resource.</p><p><h3>See Also:</h3>   <a
351          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/UntagResource">AWS
352          * API Reference</a></p>
353          *
354          * returns a future to the operation so that it can be executed in parallel to other requests.
355          */
356         virtual Model::UntagResourceOutcomeCallable UntagResourceCallable(const Model::UntagResourceRequest& request) const;
357 
358         /**
359          * <p>Remove tags from a resource.</p><p><h3>See Also:</h3>   <a
360          * href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/UntagResource">AWS
361          * API Reference</a></p>
362          *
363          * Queues the request into a thread executor and triggers associated callback when operation has finished.
364          */
365         virtual void UntagResourceAsync(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
366 
367 
368       void OverrideEndpoint(const Aws::String& endpoint);
369     private:
370       void init(const Aws::Client::ClientConfiguration& clientConfiguration);
371         void CancelQuantumTaskAsyncHelper(const Model::CancelQuantumTaskRequest& request, const CancelQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
372         void CreateQuantumTaskAsyncHelper(const Model::CreateQuantumTaskRequest& request, const CreateQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
373         void GetDeviceAsyncHelper(const Model::GetDeviceRequest& request, const GetDeviceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
374         void GetQuantumTaskAsyncHelper(const Model::GetQuantumTaskRequest& request, const GetQuantumTaskResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
375         void ListTagsForResourceAsyncHelper(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
376         void SearchDevicesAsyncHelper(const Model::SearchDevicesRequest& request, const SearchDevicesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
377         void SearchQuantumTasksAsyncHelper(const Model::SearchQuantumTasksRequest& request, const SearchQuantumTasksResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
378         void TagResourceAsyncHelper(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
379         void UntagResourceAsyncHelper(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
380 
381       Aws::String m_uri;
382       Aws::String m_configScheme;
383       std::shared_ptr<Aws::Utils::Threading::Executor> m_executor;
384   };
385 
386 } // namespace Braket
387 } // namespace Aws
388