Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once

#include <aws/core/auth/bearer-token-provider/AWSBearerTokenProviderBase.h>
#include <aws/core/auth/bearer-token-provider/DefaultBearerTokenProviderChain.h>
#include <aws/core/auth/bearer-token-provider/SSOBearerTokenProvider.h>
#include <aws/core/auth/bearer-token-provider/StaticBearerTokenProvider.h>
#include <aws/core/auth/signer-provider/BearerTokenAuthSignerProvider.h>
#include <aws/core/auth/signer/AWSAuthBearerSigner.h>
#include <aws/core/platform/Environment.h>
#include <smithy/identity/identity/AwsBearerTokenIdentity.h>
#include <smithy/identity/resolver/AwsBearerTokenIdentityResolver.h>
#include <smithy/identity/resolver/AwsIdentityResolverBase.h>

namespace Aws {
namespace BedrockDataAutomationRuntime {

class BedrockDataAutomationRuntimeAwsBearerTokenIdentityResolver : public smithy::AwsBearerTokenIdentityResolver {
public:
using IdentityT = smithy::AwsBearerTokenIdentity;
virtual ~BedrockDataAutomationRuntimeAwsBearerTokenIdentityResolver() = default;

BedrockDataAutomationRuntimeAwsBearerTokenIdentityResolver() {
m_providerChainLegacy.emplace_back(Aws::MakeShared<Aws::Auth::SSOBearerTokenProvider>("SSOBearerTokenProvider"));
const Aws::String bedrockToken = Aws::Environment::GetEnv("AWS_BEARER_TOKEN_BEDROCK");
if (!bedrockToken.empty()) {
m_providerChainLegacy.emplace_back(
Aws::MakeShared<Aws::Auth::StaticAWSBearerTokenProvider>("StaticAWSBearerTokenProvider", bedrockToken));
}
};

BedrockDataAutomationRuntimeAwsBearerTokenIdentityResolver(
const Aws::Client::ClientConfiguration::CredentialProviderConfiguration &config) {
m_providerChainLegacy.emplace_back(Aws::MakeShared<Aws::Auth::SSOBearerTokenProvider>("SSOBearerTokenProvider", config.profile));
const Aws::String bedrockToken = Aws::Environment::GetEnv("AWS_BEARER_TOKEN_BEDROCK");
if (!bedrockToken.empty()) {
m_providerChainLegacy.emplace_back(
Aws::MakeShared<Aws::Auth::StaticAWSBearerTokenProvider>("StaticAWSBearerTokenProvider", bedrockToken));
}
}

ResolveIdentityFutureOutcome virtual getIdentity(const IdentityProperties &identityProperties,
const AdditionalParameters &additionalParameters) override {
auto outcome = AwsBearerTokenIdentityResolver::getIdentity(identityProperties, additionalParameters);
outcome.GetResult()->AddUserAgentFeature(Aws::Client::UserAgentFeature::BEARER_SERVICE_ENV_VARS);
return outcome;
}
};

} // namespace BedrockDataAutomationRuntime
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@
*/

#pragma once
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntimeErrorMarshaller.h>
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntimeServiceClientModel.h>
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntime_EXPORTS.h>
#include <aws/core/client/AWSClient.h>
#include <aws/core/client/AWSClientAsyncCRTP.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <smithy/client/AwsSmithyClient.h>
#include <smithy/client/serializer/JsonOutcomeSerializer.h>
#include <smithy/identity/auth/built-in/GenericAuthSchemeResolver.h>
#include <smithy/identity/auth/built-in/SigV4AuthScheme.h>

namespace Aws {
namespace BedrockDataAutomationRuntime {
AWS_BEDROCKDATAAUTOMATIONRUNTIME_API extern const char SERVICE_NAME[];
/**
* <p>Amazon Bedrock Data Automation Runtime</p>
*/
class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API BedrockDataAutomationRuntimeClient
: public Aws::Client::AWSJsonClient,
public Aws::Client::ClientWithAsyncTemplateMethods<BedrockDataAutomationRuntimeClient> {
: Aws::Client::ClientWithAsyncTemplateMethods<BedrockDataAutomationRuntimeClient>,
public smithy::client::AwsSmithyClientT<Aws::BedrockDataAutomationRuntime::SERVICE_NAME,
Aws::BedrockDataAutomationRuntime::BedrockDataAutomationRuntimeClientConfiguration,
smithy::AuthSchemeResolverBase<>, Aws::Crt::Variant<smithy::SigV4AuthScheme>,
BedrockDataAutomationRuntimeEndpointProviderBase, smithy::client::JsonOutcomeSerializer,
smithy::client::JsonOutcome, Aws::Client::BedrockDataAutomationRuntimeErrorMarshaller> {
public:
typedef Aws::Client::AWSJsonClient BASECLASS;
static const char* GetServiceName();
static const char* GetAllocationTag();
inline const char* GetServiceClientName() const override { return "Bedrock Data Automation Runtime"; }

typedef BedrockDataAutomationRuntimeClientConfiguration ClientConfigurationType;
typedef BedrockDataAutomationRuntimeEndpointProvider EndpointProviderType;
Expand Down Expand Up @@ -244,10 +252,6 @@ class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API BedrockDataAutomationRuntimeClient

private:
friend class Aws::Client::ClientWithAsyncTemplateMethods<BedrockDataAutomationRuntimeClient>;
void init(const BedrockDataAutomationRuntimeClientConfiguration& clientConfiguration);

BedrockDataAutomationRuntimeClientConfiguration m_clientConfiguration;
std::shared_ptr<BedrockDataAutomationRuntimeEndpointProviderBase> m_endpointProvider;
};

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

#pragma once

#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntime_EXPORTS.h>
#include <aws/core/client/GenericClientConfiguration.h>

namespace Aws {
namespace BedrockDataAutomationRuntime {
struct AWS_BEDROCKDATAAUTOMATIONRUNTIME_API BedrockDataAutomationRuntimeClientConfiguration
: public Aws::Client::GenericClientConfiguration {
using BaseClientConfigClass = Aws::Client::GenericClientConfiguration;

BedrockDataAutomationRuntimeClientConfiguration(const 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.
*/
BedrockDataAutomationRuntimeClientConfiguration(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.
*/
BedrockDataAutomationRuntimeClientConfiguration(bool useSmartDefaults, const char* defaultMode = "legacy",
bool shouldDisableIMDS = false);

/**
* Converting constructors for compatibility with a legacy code
*/
BedrockDataAutomationRuntimeClientConfiguration(const Client::ClientConfiguration& config);

private:
void LoadBedrockDataAutomationRuntimeSpecificConfig(const Aws::String& profileName);
};
} // namespace BedrockDataAutomationRuntime
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

#pragma once
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntimeClientConfiguration.h>
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntimeEndpointRules.h>
#include <aws/bedrock-data-automation-runtime/BedrockDataAutomationRuntime_EXPORTS.h>
#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>
Expand All @@ -15,14 +15,19 @@
namespace Aws {
namespace BedrockDataAutomationRuntime {
namespace Endpoint {
using BedrockDataAutomationRuntimeClientConfiguration = Aws::BedrockDataAutomationRuntime::BedrockDataAutomationRuntimeClientConfiguration;
using EndpointParameters = Aws::Endpoint::EndpointParameters;
using Aws::Endpoint::DefaultEndpointProvider;
using Aws::Endpoint::EndpointProviderBase;

using BedrockDataAutomationRuntimeClientContextParameters = Aws::Endpoint::ClientContextParameters;

using BedrockDataAutomationRuntimeClientConfiguration = Aws::Client::GenericClientConfiguration;
using BedrockDataAutomationRuntimeBuiltInParameters = Aws::Endpoint::BuiltInParameters;
class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API BedrockDataAutomationRuntimeBuiltInParameters : public Aws::Endpoint::BuiltInParameters {
public:
virtual ~BedrockDataAutomationRuntimeBuiltInParameters() {};
using Aws::Endpoint::BuiltInParameters::SetFromClientConfiguration;
virtual void SetFromClientConfiguration(const BedrockDataAutomationRuntimeClientConfiguration& config);
};

/**
* The type for the BedrockDataAutomationRuntime Client Endpoint Provider.
Expand All @@ -37,6 +42,26 @@ using BedrockDataAutomationRuntimeDefaultEpProviderBase =
DefaultEndpointProvider<BedrockDataAutomationRuntimeClientConfiguration, BedrockDataAutomationRuntimeBuiltInParameters,
BedrockDataAutomationRuntimeClientContextParameters>;

} // namespace Endpoint
} // namespace BedrockDataAutomationRuntime

namespace Endpoint {
/**
* Export endpoint provider symbols for Windows DLL, otherwise declare as extern
*/
AWS_BEDROCKDATAAUTOMATIONRUNTIME_EXTERN template class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API
Aws::Endpoint::EndpointProviderBase<BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeClientConfiguration,
BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeBuiltInParameters,
BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeClientContextParameters>;

AWS_BEDROCKDATAAUTOMATIONRUNTIME_EXTERN template class AWS_BEDROCKDATAAUTOMATIONRUNTIME_API
Aws::Endpoint::DefaultEndpointProvider<BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeClientConfiguration,
BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeBuiltInParameters,
BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeClientContextParameters>;
} // namespace Endpoint

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

namespace BedrockDataAutomationRuntime {
using BedrockDataAutomationRuntimeClientConfiguration = Aws::Client::GenericClientConfiguration;
using BedrockDataAutomationRuntimeEndpointProviderBase =
Aws::BedrockDataAutomationRuntime::Endpoint::BedrockDataAutomationRuntimeEndpointProviderBase;
using BedrockDataAutomationRuntimeEndpointProvider =
Expand Down
Loading