Skip to content

Commit fd2e7f8

Browse files
committed
remove legacy bearer constructor for bedrock clients
1 parent c32f6ab commit fd2e7f8

File tree

8 files changed

+13
-46
lines changed

8 files changed

+13
-46
lines changed

generated/src/aws-cpp-sdk-bedrock-runtime/include/aws/bedrock-runtime/BedrockRuntimeClient.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class AWS_BEDROCKRUNTIME_API BedrockRuntimeClient
3737
typedef BedrockRuntimeEndpointProvider EndpointProviderType;
3838

3939
/**
40-
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
40+
* Initializes client to use mapped auth providers for different auth schemes, with default http client factory, and optional client
41+
* config.
4142
*/
4243
BedrockRuntimeClient(
4344
const Aws::UnorderedMap<Aws::String, Aws::Crt::Variant<smithy::SigV4AuthScheme, smithy::BearerTokenAuthScheme>> authSchemeMap,
@@ -71,11 +72,6 @@ class AWS_BEDROCKRUNTIME_API BedrockRuntimeClient
7172
Aws::BedrockRuntime::BedrockRuntimeClientConfiguration());
7273

7374
/* Legacy constructors due deprecation */
74-
/**
75-
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
76-
*/
77-
BedrockRuntimeClient(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider,
78-
const Aws::Client::ClientConfiguration& clientConfiguration);
7975
/**
8076
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client
8177
* config is not specified, it will be initialized to default values.

generated/src/aws-cpp-sdk-bedrock-runtime/source/BedrockRuntimeClient.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,6 @@ BedrockRuntimeClient::BedrockRuntimeClient(
6767
smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption})),
6868
authSchemeMap) {}
6969

70-
BedrockRuntimeClient::BedrockRuntimeClient(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider,
71-
const Aws::Client::ClientConfiguration& clientConfiguration)
72-
: AwsSmithyClientT(
73-
clientConfiguration, GetServiceName(), "Bedrock Runtime", Aws::Http::CreateHttpClient(clientConfiguration),
74-
Aws::MakeShared<BedrockRuntimeErrorMarshaller>(ALLOCATION_TAG), Aws::MakeShared<BedrockRuntimeEndpointProvider>(ALLOCATION_TAG),
75-
Aws::MakeShared<smithy::GenericAuthSchemeResolver<>>(
76-
ALLOCATION_TAG, Aws::Vector<smithy::AuthSchemeOption>({smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption,
77-
smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption})),
78-
{
79-
{smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId,
80-
smithy::SigV4AuthScheme{GetServiceName(), clientConfiguration.region}},
81-
{smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption.schemeId,
82-
smithy::BearerTokenAuthScheme{Aws::MakeShared<smithy::AwsBearerTokenIdentityResolver>(ALLOCATION_TAG, bearerTokenProvider),
83-
GetServiceName(), clientConfiguration.region}},
84-
}) {}
85-
8670
BedrockRuntimeClient::BedrockRuntimeClient(const BedrockRuntime::BedrockRuntimeClientConfiguration& clientConfiguration,
8771
std::shared_ptr<BedrockRuntimeEndpointProviderBase> endpointProvider)
8872
: AwsSmithyClientT(

generated/src/aws-cpp-sdk-bedrock/include/aws/bedrock/BedrockClient.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class AWS_BEDROCK_API BedrockClient
3737
typedef BedrockEndpointProvider EndpointProviderType;
3838

3939
/**
40-
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
40+
* Initializes client to use mapped auth providers for different auth schemes, with default http client factory, and optional client
41+
* config.
4142
*/
4243
BedrockClient(
4344
const Aws::UnorderedMap<Aws::String, Aws::Crt::Variant<smithy::SigV4AuthScheme, smithy::BearerTokenAuthScheme>> authSchemeMap,
@@ -66,11 +67,6 @@ class AWS_BEDROCK_API BedrockClient
6667
const Aws::Bedrock::BedrockClientConfiguration& clientConfiguration = Aws::Bedrock::BedrockClientConfiguration());
6768

6869
/* Legacy constructors due deprecation */
69-
/**
70-
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
71-
*/
72-
BedrockClient(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider,
73-
const Aws::Client::ClientConfiguration& clientConfiguration);
7470
/**
7571
* Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client
7672
* config is not specified, it will be initialized to default values.

generated/src/aws-cpp-sdk-bedrock/source/BedrockClient.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,6 @@ BedrockClient::BedrockClient(
152152
smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption})),
153153
authSchemeMap) {}
154154

155-
BedrockClient::BedrockClient(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider,
156-
const Aws::Client::ClientConfiguration& clientConfiguration)
157-
: AwsSmithyClientT(
158-
clientConfiguration, GetServiceName(), "Bedrock", Aws::Http::CreateHttpClient(clientConfiguration),
159-
Aws::MakeShared<BedrockErrorMarshaller>(ALLOCATION_TAG), Aws::MakeShared<BedrockEndpointProvider>(ALLOCATION_TAG),
160-
Aws::MakeShared<smithy::GenericAuthSchemeResolver<>>(
161-
ALLOCATION_TAG, Aws::Vector<smithy::AuthSchemeOption>({smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption,
162-
smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption})),
163-
{
164-
{smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId,
165-
smithy::SigV4AuthScheme{GetServiceName(), clientConfiguration.region}},
166-
{smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption.schemeId,
167-
smithy::BearerTokenAuthScheme{Aws::MakeShared<smithy::AwsBearerTokenIdentityResolver>(ALLOCATION_TAG, bearerTokenProvider),
168-
GetServiceName(), clientConfiguration.region}},
169-
}) {}
170-
171155
BedrockClient::BedrockClient(const Bedrock::BedrockClientConfiguration& clientConfiguration,
172156
std::shared_ptr<BedrockEndpointProviderBase> endpointProvider)
173157
: AwsSmithyClientT(

tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/ServiceModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public boolean hasOnlyBearerAuth() {
7676
return authSchemes.size() == 1 && operations.values().parallelStream().allMatch(operation -> operation.getSignerName().equals("Aws::Auth::BEARER_SIGNER"));
7777
}
7878

79+
public boolean shouldCreateLegacyBearerConstructor() {
80+
return !metadata.getServiceFullName().toLowerCase().contains("bedrock");
81+
}
82+
7983
public boolean hasServiceSpecificClientConfig() {
8084
return metadata.getServiceId().equalsIgnoreCase("S3") ||
8185
metadata.getServiceId().equalsIgnoreCase("S3-CRT") ||

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientHeaderConstructors.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
#if($additionalCtorArgs.containsKey($ctorKey))#set($addArgDummy = $bearerAddCtorArgs.put($ctorKey, $additionalCtorArgs.get($ctorKey)))#end
9393
#end
9494
/**
95-
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
95+
* Initializes client to use mapped auth providers for different auth schemes, with default http client factory, and optional client config.
9696
*/
9797
${className}(const Aws::UnorderedMap<Aws::String, Aws::Crt::Variant<${AuthSchemeVariants}>> authSchemeMap,
9898
${clsWSpace} std::shared_ptr<${metadata.classNamePrefix}EndpointProviderBase> endpointProvider = ${endpointsProviderDefaultCtorDummy},

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientHeaderLegacyConstructors.vm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#foreach ($ctorKey in ["signPayloads", "useVirtualAddressing", "USEast1RegionalEndpoint"])
3434
#if($additionalCtorArgs.containsKey($ctorKey))#set($addArgDummy = $bearerAddCtorArgs.put($ctorKey, $additionalCtorArgs.get($ctorKey)))#end
3535
#end
36+
#if ($serviceModel.shouldCreateLegacyBearerConstructor()) ##We don't want this legacy constructor for newly migrated smithy clients
3637
/**
3738
* Initializes client to use BearerTokenAuthSignerProvider, with default http client factory, and optional client config.
3839
*/
@@ -41,7 +42,7 @@
4142

4243
#foreach($ctorArgument in $bearerAddCtorArgs)
4344
${clsWSpace} ${ctorArgument}#if( $foreach.hasNext ),#else);#end
44-
45+
#end ###if ($serviceModel.shouldCreateLegacyBearerConstructor())
4546
#end
4647
#end##if(($serviceModel.hasBearerAuth() && $serviceModel.useSmithyClient) || $serviceModel.hasOnlyBearerAuth())
4748
#if(!$serviceModel.hasOnlyBearerAuth())

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ${className}::${className}(const Aws::UnorderedMap<Aws::String, Aws::Crt::Varian
1616
{
1717
}
1818

19+
#if ($serviceModel.shouldCreateLegacyBearerConstructor) ##We don't want this legacy constructor for newly migrated smithy clients
1920
${className}::${className}(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider,
2021
const Aws::Client::ClientConfiguration& clientConfiguration) :
2122
AwsSmithyClientT(clientConfiguration,
@@ -36,6 +37,7 @@ ${className}::${className}(const Aws::Auth::BearerTokenAuthSignerProvider& beare
3637
})
3738
{
3839
}
40+
#end
3941
## END OF BEARER TOKEN AUTH PROVIDER C-TOR
4042

4143

0 commit comments

Comments
 (0)