Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion docs/ClientConfiguration_Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ struct AWS_CORE_API ClientConfiguration
Aws::String userAgent;
Aws::Http::Scheme scheme;
Aws::Region region;
bool useDualStack;
unsigned maxConnections;
long requestTimeoutMs;
long connectTimeoutMs;
Expand Down Expand Up @@ -41,6 +40,7 @@ The region specifies where you want the client to communicate. Examples include

### UseDualStack
Sets the endpoint calculation to go to a dual stack (ipv6 enabled) endpoint. It is your responsibility to check that the service actually supports ipv6 in the region you specify.
`useDualStack` is not part of the shared `Aws::Client::ClientConfiguration`; it is available on a service's own configuration (for example `Aws::S3::S3ClientConfiguration`) only when that service's endpoints support dual stack.

### Max Connections
The default value for the maximum number of allowed connections to a single server for your HTTP communications is 25. You can set this value as high as you can support the bandwidth. We recommend a value around 25.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,6 @@ class AWS_EC2PROTOCOL_API EC2ProtocolClient : public Aws::Client::AWSXMLClient,
std::shared_ptr<EC2ProtocolEndpointProviderBase> endpointProvider = nullptr,
const Aws::EC2Protocol::EC2ProtocolClientConfiguration& clientConfiguration = Aws::EC2Protocol::EC2ProtocolClientConfiguration());

/* Legacy constructors due deprecation */
/**
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client
* config is not specified, it will be initialized to default values.
*/
EC2ProtocolClient(const Aws::Client::ClientConfiguration& clientConfiguration);

/**
* Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
EC2ProtocolClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration);

/**
* Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
* the default http client factory will be used
*/
EC2ProtocolClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
const Aws::Client::ClientConfiguration& clientConfiguration);

/* End of legacy constructors due deprecation */
virtual ~EC2ProtocolClient();

/**
Expand Down Expand Up @@ -748,7 +727,6 @@ class AWS_EC2PROTOCOL_API EC2ProtocolClient : public Aws::Client::AWSXMLClient,
return SubmitAsync(&EC2ProtocolClient::XmlTimestamps, request, handler, context);
}

virtual void OverrideEndpoint(const Aws::String& endpoint);
virtual std::shared_ptr<EC2ProtocolEndpointProviderBase>& accessEndpointProvider();

private:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once

#include <aws/core/client/GenericClientConfiguration.h>
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>

namespace Aws {
namespace EC2Protocol {
struct AWS_EC2PROTOCOL_API EC2ProtocolClientConfiguration : public Aws::Client::GenericClientConfiguration {
using BaseClientConfigClass = Aws::Client::GenericClientConfiguration;

EC2ProtocolClientConfiguration(const Aws::Client::ClientConfigurationInitValues& configuration = {});

/**
* Create a configuration based on settings in the aws configuration file for the given profile name.
* The configuration file location can be set via the environment variable AWS_CONFIG_FILE
* @param profileName the aws profile name.
* @param shouldDisableIMDS whether or not to disable IMDS calls.
*/
EC2ProtocolClientConfiguration(const char* profileName, bool shouldDisableIMDS = false);

/**
* Create a configuration with a predefined smart defaults
* @param useSmartDefaults, required to differentiate c-tors
* @param defaultMode, default mode to use
* @param shouldDisableIMDS whether or not to disable IMDS calls.
*/
EC2ProtocolClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy", bool shouldDisableIMDS = false);

/**
* Create a configuration that starts from shared settings (region, timeouts, proxy, retry, ...),
* then loads this service's options from the environment and profile.
* Explicit, so a client is never built from the shared configuration implicitly.
*/
explicit EC2ProtocolClientConfiguration(const Aws::Client::ClientConfiguration& sharedConfig);

/**
* Enable host prefix injection.
* For services whose endpoint is injectable. e.g. servicediscovery, you can modify the http host's prefix so as to add "data-" prefix for
* DiscoverInstances request. Default to true, enabled. You can disable it for testing purpose.
*/
bool enableHostPrefixInjection = true;

/**
* Request compression configuration
* To use this feature, the service needs to provide the support, and the compression
* algorithms needs to be available at SDK build time.
*/
Aws::Client::RequestCompressionConfig requestCompressionConfig;

private:
void LoadEC2ProtocolSpecificConfig(const Aws::String& profileName);
};

/**
* Values of this service's supported options that the client hands to core.
*/
AWS_EC2PROTOCOL_API Aws::Client::ServiceClientOptions GetServiceClientOptions(const EC2ProtocolClientConfiguration& config);
} // namespace EC2Protocol
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@
*/

#pragma once
#include <aws/core/client/GenericClientConfiguration.h>
#include <aws/core/endpoint/DefaultEndpointProvider.h>
#include <aws/core/endpoint/EndpointParameter.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/ec2-protocol/EC2ProtocolClientConfiguration.h>
#include <aws/ec2-protocol/EC2Protocol_EXPORTS.h>

namespace Aws {
namespace EC2Protocol {
namespace Endpoint {
using EC2ProtocolClientConfiguration = Aws::EC2Protocol::EC2ProtocolClientConfiguration;
using EndpointParameters = Aws::Endpoint::EndpointParameters;
using Aws::Endpoint::DefaultEndpointProvider;
using Aws::Endpoint::EndpointProviderBase;

using EC2ProtocolClientContextParameters = Aws::Endpoint::ClientContextParameters;

using EC2ProtocolClientConfiguration = Aws::Client::GenericClientConfiguration;
using EC2ProtocolBuiltInParameters = Aws::Endpoint::BuiltInParameters;
class AWS_EC2PROTOCOL_API EC2ProtocolBuiltInParameters : public Aws::Endpoint::BuiltInParameters {
public:
virtual ~EC2ProtocolBuiltInParameters() {};
using Aws::Endpoint::BuiltInParameters::SetFromClientConfiguration;
virtual void SetFromClientConfiguration(const EC2ProtocolClientConfiguration& config);
virtual void SetFromClientConfiguration(const EC2ProtocolClientConfiguration& config, const Aws::String& serviceName);
};

/**
* The type for the EC2Protocol Client Endpoint Provider.
Expand All @@ -34,6 +40,24 @@ using EC2ProtocolEndpointProviderBase =
using EC2ProtocolDefaultEpProviderBase =
DefaultEndpointProvider<EC2ProtocolClientConfiguration, EC2ProtocolBuiltInParameters, EC2ProtocolClientContextParameters>;

} // namespace Endpoint
} // namespace EC2Protocol

namespace Endpoint {
/**
* Export endpoint provider symbols for Windows DLL, otherwise declare as extern
*/
AWS_EC2PROTOCOL_EXTERN template class AWS_EC2PROTOCOL_API Aws::Endpoint::EndpointProviderBase<
EC2Protocol::Endpoint::EC2ProtocolClientConfiguration, EC2Protocol::Endpoint::EC2ProtocolBuiltInParameters,
EC2Protocol::Endpoint::EC2ProtocolClientContextParameters>;

AWS_EC2PROTOCOL_EXTERN template class AWS_EC2PROTOCOL_API Aws::Endpoint::DefaultEndpointProvider<
EC2Protocol::Endpoint::EC2ProtocolClientConfiguration, EC2Protocol::Endpoint::EC2ProtocolBuiltInParameters,
EC2Protocol::Endpoint::EC2ProtocolClientContextParameters>;
} // namespace Endpoint

namespace EC2Protocol {
namespace Endpoint {
/**
* Default endpoint provider used for this service
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class RetryStrategy;
} // namespace Client

namespace EC2Protocol {
using EC2ProtocolClientConfiguration = Aws::Client::GenericClientConfiguration;
using EC2ProtocolEndpointProviderBase = Aws::EC2Protocol::Endpoint::EC2ProtocolEndpointProviderBase;
using EC2ProtocolEndpointProvider = Aws::EC2Protocol::Endpoint::EC2ProtocolEndpointProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,41 +102,6 @@ EC2ProtocolClient::EC2ProtocolClient(const std::shared_ptr<AWSCredentialsProvide
init(m_clientConfiguration);
}

/* Legacy constructors due deprecation */
EC2ProtocolClient::EC2ProtocolClient(const Aws::Client::ClientConfiguration& clientConfiguration)
: BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG,
Aws::MakeShared<DefaultAWSCredentialsProviderChain>(
ALLOCATION_TAG, clientConfiguration.ResolveCredentialProviderConfig()),
SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<EC2ProtocolErrorMarshaller>(ALLOCATION_TAG)),
m_clientConfiguration(clientConfiguration),
m_endpointProvider(Aws::MakeShared<EC2ProtocolEndpointProvider>(ALLOCATION_TAG)) {
init(m_clientConfiguration);
}

EC2ProtocolClient::EC2ProtocolClient(const AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration)
: BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials),
SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<EC2ProtocolErrorMarshaller>(ALLOCATION_TAG)),
m_clientConfiguration(clientConfiguration),
m_endpointProvider(Aws::MakeShared<EC2ProtocolEndpointProvider>(ALLOCATION_TAG)) {
init(m_clientConfiguration);
}

EC2ProtocolClient::EC2ProtocolClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
const Aws::Client::ClientConfiguration& clientConfiguration)
: BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider, SERVICE_NAME,
Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
Aws::MakeShared<EC2ProtocolErrorMarshaller>(ALLOCATION_TAG)),
m_clientConfiguration(clientConfiguration),
m_endpointProvider(Aws::MakeShared<EC2ProtocolEndpointProvider>(ALLOCATION_TAG)) {
init(m_clientConfiguration);
}

/* End of legacy constructors due deprecation */
EC2ProtocolClient::~EC2ProtocolClient() { ShutdownSdkClient(this, -1); }

std::shared_ptr<EC2ProtocolEndpointProviderBase>& EC2ProtocolClient::accessEndpointProvider() { return m_endpointProvider; }
Expand All @@ -154,12 +119,7 @@ void EC2ProtocolClient::init(const EC2Protocol::EC2ProtocolClientConfiguration&
AWSClient::SetUserAgentExecutor(*m_clientConfiguration.executor);
AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider);
m_endpointProvider->InitBuiltInParameters(config, "ec2query");
}

void EC2ProtocolClient::OverrideEndpoint(const Aws::String& endpoint) {
AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider);
m_clientConfiguration.endpointOverride = endpoint;
m_endpointProvider->OverrideEndpoint(endpoint);
ApplyServiceOptions(GetServiceClientOptions(m_clientConfiguration));
}

EC2ProtocolClient::InvokeOperationOutcome EC2ProtocolClient::InvokeServiceOperation(const AmazonWebServiceRequest& request,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#include <aws/ec2-protocol/EC2ProtocolClientConfiguration.h>

namespace Aws {
namespace EC2Protocol {

void EC2ProtocolClientConfiguration::LoadEC2ProtocolSpecificConfig(const Aws::String& inputProfileName) {
requestCompressionConfig = Aws::Client::LoadRequestCompressionConfigFromEnvOrProfile(this->profileName);
#if defined(_MSC_VER)
(&reinterpret_cast<const int&>(inputProfileName));
#else
(void)(inputProfileName);
#endif
}

EC2ProtocolClientConfiguration::EC2ProtocolClientConfiguration(const Aws::Client::ClientConfigurationInitValues& configuration)
: BaseClientConfigClass(configuration) {
LoadEC2ProtocolSpecificConfig(this->profileName);
}

EC2ProtocolClientConfiguration::EC2ProtocolClientConfiguration(const char* inputProfileName, bool shouldDisableIMDS)
: BaseClientConfigClass(inputProfileName, shouldDisableIMDS) {
LoadEC2ProtocolSpecificConfig(Aws::String(inputProfileName));
}

EC2ProtocolClientConfiguration::EC2ProtocolClientConfiguration(bool useSmartDefaults, const char* defaultMode, bool shouldDisableIMDS)
: BaseClientConfigClass(useSmartDefaults, defaultMode, shouldDisableIMDS) {
LoadEC2ProtocolSpecificConfig(this->profileName);
}

EC2ProtocolClientConfiguration::EC2ProtocolClientConfiguration(const Aws::Client::ClientConfiguration& sharedConfig)
: BaseClientConfigClass(sharedConfig) {
LoadEC2ProtocolSpecificConfig(this->profileName);
}

Aws::Client::ServiceClientOptions GetServiceClientOptions(const EC2ProtocolClientConfiguration& config) {
Aws::Client::ServiceClientOptions options;
options.requestCompressionConfig = config.requestCompressionConfig;
return options;
}

} // namespace EC2Protocol
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,36 @@
#include <aws/ec2-protocol/internal/EC2ProtocolEndpointRules.h>

namespace Aws {
#ifndef AWS_EC2PROTOCOL_EXPORTS // Except for Windows DLL
namespace Endpoint {
/**
* Instantiate endpoint providers
*/
template class Aws::Endpoint::EndpointProviderBase<EC2Protocol::Endpoint::EC2ProtocolClientConfiguration,
EC2Protocol::Endpoint::EC2ProtocolBuiltInParameters,
EC2Protocol::Endpoint::EC2ProtocolClientContextParameters>;

template class Aws::Endpoint::DefaultEndpointProvider<EC2Protocol::Endpoint::EC2ProtocolClientConfiguration,
EC2Protocol::Endpoint::EC2ProtocolBuiltInParameters,
EC2Protocol::Endpoint::EC2ProtocolClientContextParameters>;
} // namespace Endpoint
#endif

namespace EC2Protocol {
namespace Endpoint {
EC2ProtocolEndpointProvider::EC2ProtocolEndpointProvider()
: EC2ProtocolDefaultEpProviderBase(Aws::EC2Protocol::EC2ProtocolEndpointRules::GetRulesBlob(),
Aws::EC2Protocol::EC2ProtocolEndpointRules::RulesBlobSize) {}

void EC2ProtocolBuiltInParameters::SetFromClientConfiguration(const EC2ProtocolClientConfiguration& config) {
SetFromClientConfiguration(static_cast<const EC2ProtocolClientConfiguration::BaseClientConfigClass&>(config));
}

void EC2ProtocolBuiltInParameters::SetFromClientConfiguration(const EC2ProtocolClientConfiguration& config,
const Aws::String& serviceName) {
SetFromClientConfiguration(static_cast<const EC2ProtocolClientConfiguration::BaseClientConfigClass&>(config), serviceName);
}

} // namespace Endpoint
} // namespace EC2Protocol
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,6 @@ class AWS_JSONPROTOCOL_API JsonProtocolClient : public Aws::Client::AWSJsonClien
std::shared_ptr<JsonProtocolEndpointProviderBase> endpointProvider = nullptr,
const Aws::JsonProtocol::JsonProtocolClientConfiguration& clientConfiguration = Aws::JsonProtocol::JsonProtocolClientConfiguration());

/* Legacy constructors due deprecation */
/**
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client
* config is not specified, it will be initialized to default values.
*/
JsonProtocolClient(const Aws::Client::ClientConfiguration& clientConfiguration);

/**
* Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
* is not specified, it will be initialized to default values.
*/
JsonProtocolClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration);

/**
* Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
* the default http client factory will be used
*/
JsonProtocolClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
const Aws::Client::ClientConfiguration& clientConfiguration);

/* End of legacy constructors due deprecation */
virtual ~JsonProtocolClient();

/**
Expand Down Expand Up @@ -541,7 +520,6 @@ class AWS_JSONPROTOCOL_API JsonProtocolClient : public Aws::Client::AWSJsonClien
return SubmitAsync(&JsonProtocolClient::SparseNullsOperation, request, handler, context);
}

virtual void OverrideEndpoint(const Aws::String& endpoint);
virtual std::shared_ptr<JsonProtocolEndpointProviderBase>& accessEndpointProvider();

private:
Expand Down
Loading
Loading