|
| 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/core/client/AWSClient.h> |
| 8 | +#include <aws/core/client/AWSClientAsyncCRTP.h> |
| 9 | +#include <aws/core/client/ClientConfiguration.h> |
| 10 | +#include <aws/core/utils/json/JsonSerializer.h> |
| 11 | +#include <aws/test-new-service-sdk-testing/TestNewServiceSDKTestingServiceClientModel.h> |
| 12 | +#include <aws/test-new-service-sdk-testing/TestNewServiceSDKTesting_EXPORTS.h> |
| 13 | + |
| 14 | +namespace Aws { |
| 15 | +namespace TestNewServiceSDKTesting { |
| 16 | +class AWS_TESTNEWSERVICESDKTESTING_API TestNewServiceSDKTestingClient |
| 17 | + : public Aws::Client::AWSJsonClient, |
| 18 | + public Aws::Client::ClientWithAsyncTemplateMethods<TestNewServiceSDKTestingClient> { |
| 19 | + public: |
| 20 | + typedef Aws::Client::AWSJsonClient BASECLASS; |
| 21 | + static const char* GetServiceName(); |
| 22 | + static const char* GetAllocationTag(); |
| 23 | + |
| 24 | + typedef TestNewServiceSDKTestingClientConfiguration ClientConfigurationType; |
| 25 | + typedef TestNewServiceSDKTestingEndpointProvider EndpointProviderType; |
| 26 | + |
| 27 | + /** |
| 28 | + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client |
| 29 | + * config is not specified, it will be initialized to default values. |
| 30 | + */ |
| 31 | + TestNewServiceSDKTestingClient(const Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration& clientConfiguration = |
| 32 | + Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration(), |
| 33 | + std::shared_ptr<TestNewServiceSDKTestingEndpointProviderBase> endpointProvider = nullptr); |
| 34 | + |
| 35 | + /** |
| 36 | + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config |
| 37 | + * is not specified, it will be initialized to default values. |
| 38 | + */ |
| 39 | + TestNewServiceSDKTestingClient(const Aws::Auth::AWSCredentials& credentials, |
| 40 | + std::shared_ptr<TestNewServiceSDKTestingEndpointProviderBase> endpointProvider = nullptr, |
| 41 | + const Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration& clientConfiguration = |
| 42 | + Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration()); |
| 43 | + |
| 44 | + /** |
| 45 | + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, |
| 46 | + * the default http client factory will be used |
| 47 | + */ |
| 48 | + TestNewServiceSDKTestingClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider, |
| 49 | + std::shared_ptr<TestNewServiceSDKTestingEndpointProviderBase> endpointProvider = nullptr, |
| 50 | + const Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration& clientConfiguration = |
| 51 | + Aws::TestNewServiceSDKTesting::TestNewServiceSDKTestingClientConfiguration()); |
| 52 | + |
| 53 | + /* Legacy constructors due deprecation */ |
| 54 | + /** |
| 55 | + * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client |
| 56 | + * config is not specified, it will be initialized to default values. |
| 57 | + */ |
| 58 | + TestNewServiceSDKTestingClient(const Aws::Client::ClientConfiguration& clientConfiguration); |
| 59 | + |
| 60 | + /** |
| 61 | + * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config |
| 62 | + * is not specified, it will be initialized to default values. |
| 63 | + */ |
| 64 | + TestNewServiceSDKTestingClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration); |
| 65 | + |
| 66 | + /** |
| 67 | + * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, |
| 68 | + * the default http client factory will be used |
| 69 | + */ |
| 70 | + TestNewServiceSDKTestingClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider, |
| 71 | + const Aws::Client::ClientConfiguration& clientConfiguration); |
| 72 | + |
| 73 | + /* End of legacy constructors due deprecation */ |
| 74 | + virtual ~TestNewServiceSDKTestingClient(); |
| 75 | + |
| 76 | + /** |
| 77 | + * |
| 78 | + */ |
| 79 | + virtual Model::GetFooOutcome GetFoo(const Model::GetFooRequest& request) const; |
| 80 | + |
| 81 | + /** |
| 82 | + * A Callable wrapper for GetFoo that returns a future to the operation so that it can be executed in parallel to other requests. |
| 83 | + */ |
| 84 | + template <typename GetFooRequestT = Model::GetFooRequest> |
| 85 | + Model::GetFooOutcomeCallable GetFooCallable(const GetFooRequestT& request) const { |
| 86 | + return SubmitCallable(&TestNewServiceSDKTestingClient::GetFoo, request); |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * An Async wrapper for GetFoo that queues the request into a thread executor and triggers associated callback when operation has |
| 91 | + * finished. |
| 92 | + */ |
| 93 | + template <typename GetFooRequestT = Model::GetFooRequest> |
| 94 | + void GetFooAsync(const GetFooRequestT& request, const GetFooResponseReceivedHandler& handler, |
| 95 | + const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const { |
| 96 | + return SubmitAsync(&TestNewServiceSDKTestingClient::GetFoo, request, handler, context); |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * |
| 101 | + */ |
| 102 | + virtual Model::GetFoosOutcome GetFoos(const Model::GetFoosRequest& request = {}) const; |
| 103 | + |
| 104 | + /** |
| 105 | + * A Callable wrapper for GetFoos that returns a future to the operation so that it can be executed in parallel to other requests. |
| 106 | + */ |
| 107 | + template <typename GetFoosRequestT = Model::GetFoosRequest> |
| 108 | + Model::GetFoosOutcomeCallable GetFoosCallable(const GetFoosRequestT& request = {}) const { |
| 109 | + return SubmitCallable(&TestNewServiceSDKTestingClient::GetFoos, request); |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * An Async wrapper for GetFoos that queues the request into a thread executor and triggers associated callback when operation has |
| 114 | + * finished. |
| 115 | + */ |
| 116 | + template <typename GetFoosRequestT = Model::GetFoosRequest> |
| 117 | + void GetFoosAsync(const GetFoosResponseReceivedHandler& handler, |
| 118 | + const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr, |
| 119 | + const GetFoosRequestT& request = {}) const { |
| 120 | + return SubmitAsync(&TestNewServiceSDKTestingClient::GetFoos, request, handler, context); |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * |
| 125 | + * |
| 126 | + * Queues the request into a thread executor. |
| 127 | + * The streamReadyHandler is triggered when the stream is ready to be written to. |
| 128 | + * The handler is triggered when the request is finished. |
| 129 | + */ |
| 130 | + virtual void PublishFoosAsync(Model::PublishFoosRequest& request, const PublishFoosStreamReadyHandler& streamReadyHandler, |
| 131 | + const PublishFoosResponseReceivedHandler& handler, |
| 132 | + const std::shared_ptr<const Aws::Client::AsyncCallerContext>& handlerContext = nullptr) const; |
| 133 | + |
| 134 | + void OverrideEndpoint(const Aws::String& endpoint); |
| 135 | + std::shared_ptr<TestNewServiceSDKTestingEndpointProviderBase>& accessEndpointProvider(); |
| 136 | + |
| 137 | + private: |
| 138 | + friend class Aws::Client::ClientWithAsyncTemplateMethods<TestNewServiceSDKTestingClient>; |
| 139 | + void init(const TestNewServiceSDKTestingClientConfiguration& clientConfiguration); |
| 140 | + |
| 141 | + TestNewServiceSDKTestingClientConfiguration m_clientConfiguration; |
| 142 | + std::shared_ptr<TestNewServiceSDKTestingEndpointProviderBase> m_endpointProvider; |
| 143 | +}; |
| 144 | + |
| 145 | +} // namespace TestNewServiceSDKTesting |
| 146 | +} // namespace Aws |
0 commit comments