2323import java .util .Set ;
2424import java .util .function .BiPredicate ;
2525import java .util .logging .Logger ;
26-
2726import software .amazon .smithy .codegen .core .Symbol ;
2827import software .amazon .smithy .codegen .core .SymbolProvider ;
29- import software .amazon .smithy .aws .go .codegen .ClientResolvedDefaultsMode ;
3028import software .amazon .smithy .go .codegen .GoDelegator ;
3129import software .amazon .smithy .go .codegen .GoSettings ;
3230import software .amazon .smithy .go .codegen .GoWriter ;
3634import software .amazon .smithy .go .codegen .integration .ConfigFieldResolver ;
3735import software .amazon .smithy .go .codegen .integration .GoIntegration ;
3836import software .amazon .smithy .go .codegen .integration .RuntimeClientPlugin ;
37+ import software .amazon .smithy .go .codegen .integration .auth .HttpBearerAuth ;
3938import software .amazon .smithy .model .Model ;
4039import software .amazon .smithy .model .shapes .ServiceShape ;
4140import software .amazon .smithy .utils .ListUtils ;
@@ -48,6 +47,7 @@ public class AddAwsConfigFields implements GoIntegration {
4847
4948 public static final String REGION_CONFIG_NAME = "Region" ;
5049 public static final String CREDENTIALS_CONFIG_NAME = "Credentials" ;
50+ public static final String BEARER_AUTH_TOKEN_CONFIG_NAME = "TokenProvider" ;
5151 public static final String ENDPOINT_RESOLVER_CONFIG_NAME = "EndpointResolver" ;
5252 public static final String AWS_ENDPOINT_RESOLVER_WITH_OPTIONS = "EndpointResolverWithOptions" ;
5353 public static final String HTTP_CLIENT_CONFIG_NAME = "HTTPClient" ;
@@ -120,20 +120,20 @@ public class AddAwsConfigFields implements GoIntegration {
120120 When creating a new API Clients this member will only be used if the
121121 Retryer Options member is nil. This value will be ignored if
122122 Retryer is not nil.
123-
123+
124124 If specified in an operation call's functional options with a value that
125125 is different than the constructed client's Options, the Client's Retryer
126126 will be wrapped to use the operation's specific RetryMaxAttempts value.
127127 """ )
128128 .awsResolveFunction (SymbolUtils .createValueSymbolBuilder (RESOLVE_AWS_CONFIG_RETRY_MAX_ATTEMPTS )
129129 .build ())
130- .addConfigFieldResolvers (ConfigFieldResolver .builder ()
131- .location (ConfigFieldResolver .Location .OPERATION )
132- .target (ConfigFieldResolver .Target .FINALIZATION )
133- .withClientInput (true )
134- .resolver (SymbolUtils .createValueSymbolBuilder (
135- FINALIZE_RETRY_MAX_ATTEMPTS_OPTIONS ).build ())
136- .build ())
130+ .addConfigFieldResolvers (ConfigFieldResolver .builder ()
131+ .location (ConfigFieldResolver .Location .OPERATION )
132+ .target (ConfigFieldResolver .Target .FINALIZATION )
133+ .withClientInput (true )
134+ .resolver (SymbolUtils .createValueSymbolBuilder (
135+ FINALIZE_RETRY_MAX_ATTEMPTS_OPTIONS ).build ())
136+ .build ())
137137 .build (),
138138
139139 AwsConfigField .builder ()
@@ -146,7 +146,7 @@ public class AddAwsConfigFields implements GoIntegration {
146146 When creating a new API Clients this member will only be used if the
147147 Retryer Options member is nil. This value will be ignored if
148148 Retryer is not nil.
149-
149+
150150 Currently does not support per operation call overrides, may in the future.
151151 """ )
152152 .awsResolveFunction (SymbolUtils .createValueSymbolBuilder (RESOLVE_AWS_CONFIG_RETRY_MODE )
@@ -166,6 +166,16 @@ public class AddAwsConfigFields implements GoIntegration {
166166 .documentation ("The credentials object to use when signing requests." )
167167 .servicePredicate (AwsSignatureVersion4 ::isSupportedAuthentication )
168168 .build (),
169+ AwsConfigField .builder ()
170+ // TOKEN_PROVIDER_OPTION_NAME added API Client's Options by HttpBearerAuth. Only
171+ // need to add NewFromConfig resolver from aws#Config type.
172+ .name (HttpBearerAuth .TOKEN_PROVIDER_OPTION_NAME )
173+ .type (SymbolUtils .createValueSymbolBuilder ("TokenProvider" ,
174+ SmithyGoDependency .SMITHY_AUTH_BEARER ).build ())
175+ .documentation ("The bearer authentication token provider for authentication requests." )
176+ .servicePredicate (HttpBearerAuth ::isSupportedAuthentication )
177+ .generatedOnClient (false )
178+ .build (),
169179 AwsConfigField .builder ()
170180 .name (API_OPTIONS_CONFIG_NAME )
171181 .type (SymbolUtils .createValueSymbolBuilder ("[]func(*middleware.Stack) error" )
0 commit comments