27
27
import software .amazon .awssdk .identity .spi .IdentityProvider ;
28
28
import software .amazon .awssdk .identity .spi .IdentityProviders ;
29
29
import software .amazon .awssdk .identity .spi .TokenIdentity ;
30
+ import software .amazon .awssdk .protocols .json .internal .unmarshall .SdkClientJsonProtocolAdvancedOption ;
30
31
import software .amazon .awssdk .regions .ServiceMetadataAdvancedOption ;
31
32
import software .amazon .awssdk .retries .api .RetryStrategy ;
32
33
import software .amazon .awssdk .services .json .auth .scheme .JsonAuthSchemeProvider ;
@@ -59,13 +60,13 @@ protected final String serviceName() {
59
60
@ Override
60
61
protected final SdkClientConfiguration mergeServiceDefaults (SdkClientConfiguration config ) {
61
62
return config .merge (c -> c
62
- .option (SdkClientOption .ENDPOINT_PROVIDER , defaultEndpointProvider ())
63
- .option (SdkClientOption .AUTH_SCHEME_PROVIDER , defaultAuthSchemeProvider ())
64
- .option (SdkClientOption .AUTH_SCHEMES , authSchemes ())
65
- .option (SdkClientOption .CRC32_FROM_COMPRESSED_DATA_ENABLED , false )
66
- .lazyOption (AwsClientOption .TOKEN_PROVIDER ,
63
+ .option (SdkClientOption .ENDPOINT_PROVIDER , defaultEndpointProvider ())
64
+ .option (SdkClientOption .AUTH_SCHEME_PROVIDER , defaultAuthSchemeProvider ())
65
+ .option (SdkClientOption .AUTH_SCHEMES , authSchemes ())
66
+ .option (SdkClientOption .CRC32_FROM_COMPRESSED_DATA_ENABLED , false )
67
+ .lazyOption (AwsClientOption .TOKEN_PROVIDER ,
67
68
p -> TokenUtils .toSdkTokenProvider (p .get (AwsClientOption .TOKEN_IDENTITY_PROVIDER )))
68
- .option (AwsClientOption .TOKEN_IDENTITY_PROVIDER , defaultTokenProvider ()));
69
+ .option (AwsClientOption .TOKEN_IDENTITY_PROVIDER , defaultTokenProvider ()));
69
70
}
70
71
71
72
@ Override
@@ -76,7 +77,7 @@ protected final SdkClientConfiguration finalizeServiceConfiguration(SdkClientCon
76
77
endpointInterceptors .add (new JsonRequestSetEndpointInterceptor ());
77
78
ClasspathInterceptorChainFactory interceptorFactory = new ClasspathInterceptorChainFactory ();
78
79
List <ExecutionInterceptor > interceptors = interceptorFactory
79
- .getInterceptors ("software/amazon/awssdk/services/json/execution.interceptors" );
80
+ .getInterceptors ("software/amazon/awssdk/services/json/execution.interceptors" );
80
81
List <ExecutionInterceptor > additionalInterceptors = new ArrayList <>();
81
82
interceptors = CollectionUtils .mergeLists (endpointInterceptors , interceptors );
82
83
interceptors = CollectionUtils .mergeLists (interceptors , additionalInterceptors );
@@ -92,21 +93,22 @@ protected final SdkClientConfiguration finalizeServiceConfiguration(SdkClientCon
92
93
});
93
94
builder .option (SdkClientOption .EXECUTION_INTERCEPTORS , interceptors );
94
95
builder .lazyOptionIfAbsent (
95
- SdkClientOption .CLIENT_ENDPOINT_PROVIDER ,
96
- c -> AwsClientEndpointProvider
97
- .builder ()
98
- .serviceEndpointOverrideEnvironmentVariable ("AWS_ENDPOINT_URL_JSON_SERVICE" )
99
- .serviceEndpointOverrideSystemProperty ("aws.endpointUrlJson" )
100
- .serviceProfileProperty ("json_service" )
101
- .serviceEndpointPrefix (serviceEndpointPrefix ())
102
- .defaultProtocol ("https" )
103
- .region (c .get (AwsClientOption .AWS_REGION ))
104
- .profileFile (c .get (SdkClientOption .PROFILE_FILE_SUPPLIER ))
105
- .profileName (c .get (SdkClientOption .PROFILE_NAME ))
106
- .putAdvancedOption (ServiceMetadataAdvancedOption .DEFAULT_S3_US_EAST_1_REGIONAL_ENDPOINT ,
107
- c .get (ServiceMetadataAdvancedOption .DEFAULT_S3_US_EAST_1_REGIONAL_ENDPOINT ))
108
- .dualstackEnabled (c .get (AwsClientOption .DUALSTACK_ENDPOINT_ENABLED ))
109
- .fipsEnabled (c .get (AwsClientOption .FIPS_ENDPOINT_ENABLED )).build ());
96
+ SdkClientOption .CLIENT_ENDPOINT_PROVIDER ,
97
+ c -> AwsClientEndpointProvider
98
+ .builder ()
99
+ .serviceEndpointOverrideEnvironmentVariable ("AWS_ENDPOINT_URL_JSON_SERVICE" )
100
+ .serviceEndpointOverrideSystemProperty ("aws.endpointUrlJson" )
101
+ .serviceProfileProperty ("json_service" )
102
+ .serviceEndpointPrefix (serviceEndpointPrefix ())
103
+ .defaultProtocol ("https" )
104
+ .region (c .get (AwsClientOption .AWS_REGION ))
105
+ .profileFile (c .get (SdkClientOption .PROFILE_FILE_SUPPLIER ))
106
+ .profileName (c .get (SdkClientOption .PROFILE_NAME ))
107
+ .putAdvancedOption (ServiceMetadataAdvancedOption .DEFAULT_S3_US_EAST_1_REGIONAL_ENDPOINT ,
108
+ c .get (ServiceMetadataAdvancedOption .DEFAULT_S3_US_EAST_1_REGIONAL_ENDPOINT ))
109
+ .dualstackEnabled (c .get (AwsClientOption .DUALSTACK_ENDPOINT_ENABLED ))
110
+ .fipsEnabled (c .get (AwsClientOption .FIPS_ENDPOINT_ENABLED )).build ());
111
+ builder .option (SdkClientJsonProtocolAdvancedOption .ENABLE_FAST_UNMARSHALLER , true );
110
112
return builder .build ();
111
113
}
112
114
@@ -194,6 +196,6 @@ private List<SdkPlugin> internalPlugins(SdkClientConfiguration config) {
194
196
195
197
protected static void validateClientOptions (SdkClientConfiguration c ) {
196
198
Validate .notNull (c .option (AwsClientOption .TOKEN_IDENTITY_PROVIDER ),
197
- "The 'tokenProvider' must be configured in the client builder." );
199
+ "The 'tokenProvider' must be configured in the client builder." );
198
200
}
199
201
}
0 commit comments