@@ -72,8 +72,8 @@ public final class AddS3Config implements TypeScriptIntegration {
72
72
);
73
73
74
74
private static final String CRT_NOTIFICATION = "<p>Note: To supply the Multi-region Access Point (MRAP) to Bucket,"
75
- + " you need to install the \" @aws-sdk/signature-v4-crt\" package to your project dependencies. \n "
76
- + "For more information, please go to https://github.com/aws/aws-sdk-js-v3#known-issues</p>" ;
75
+ + " you need to install the \" @aws-sdk/signature-v4-crt\" package to your project dependencies. \n "
76
+ + "For more information, please go to https://github.com/aws/aws-sdk-js-v3#known-issues</p>" ;
77
77
78
78
@ Override
79
79
public Model preprocessModel (Model model , TypeScriptSettings settings ) {
@@ -118,17 +118,19 @@ public void addConfigInterfaceFields(
118
118
return ;
119
119
}
120
120
writer .writeDocs ("Whether to escape request path when signing the request." )
121
- .write ("signingEscapePath?: boolean;\n " );
121
+ .write ("signingEscapePath?: boolean;\n " );
122
122
writer .writeDocs (
123
123
"Whether to override the request region with the region inferred from requested resource's ARN."
124
- + " Defaults to false." )
125
- .addImport ("Provider" , "Provider" , TypeScriptDependency .AWS_SDK_TYPES .packageName )
126
- .write ("useArnRegion?: boolean | Provider<boolean>;" );
124
+ + " Defaults to false." )
125
+ .addImport ("Provider" , "Provider" , TypeScriptDependency .AWS_SDK_TYPES .packageName )
126
+ .write ("useArnRegion?: boolean | Provider<boolean>;" );
127
127
}
128
128
129
129
@ Override
130
- public Map <String , Consumer <TypeScriptWriter >> getRuntimeConfigWriters (TypeScriptSettings settings , Model model ,
131
- SymbolProvider symbolProvider , LanguageTarget target ) {
130
+ public Map <String , Consumer <TypeScriptWriter >> getRuntimeConfigWriters (
131
+ TypeScriptSettings settings , Model model ,
132
+ SymbolProvider symbolProvider , LanguageTarget target
133
+ ) {
132
134
if (!isS3 (settings .getService (model ))) {
133
135
return Collections .emptyMap ();
134
136
}
@@ -140,18 +142,18 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(TypeScrip
140
142
writer .write ("false" );
141
143
}, "signerConstructor" , writer -> {
142
144
writer .addDependency (AwsDependency .SIGNATURE_V4_MULTIREGION )
143
- .addImport ("SignatureV4MultiRegion" , "SignatureV4MultiRegion" ,
144
- AwsDependency .SIGNATURE_V4_MULTIREGION .packageName )
145
- .write ("SignatureV4MultiRegion" );
145
+ .addImport ("SignatureV4MultiRegion" , "SignatureV4MultiRegion" ,
146
+ AwsDependency .SIGNATURE_V4_MULTIREGION .packageName )
147
+ .write ("SignatureV4MultiRegion" );
146
148
});
147
149
case NODE :
148
150
return MapUtils .of ("useArnRegion" , writer -> {
149
151
writer .addDependency (AwsDependency .NODE_CONFIG_PROVIDER )
150
- .addImport ("loadConfig" , "loadNodeConfig" , AwsDependency .NODE_CONFIG_PROVIDER .packageName )
151
- .addDependency (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE )
152
- .addImport ("NODE_USE_ARN_REGION_CONFIG_OPTIONS" , "NODE_USE_ARN_REGION_CONFIG_OPTIONS" ,
153
- AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .packageName )
154
- .write ("loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS)" );
152
+ .addImport ("loadConfig" , "loadNodeConfig" , AwsDependency .NODE_CONFIG_PROVIDER .packageName )
153
+ .addDependency (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE )
154
+ .addImport ("NODE_USE_ARN_REGION_CONFIG_OPTIONS" , "NODE_USE_ARN_REGION_CONFIG_OPTIONS" ,
155
+ AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .packageName )
156
+ .write ("loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS)" );
155
157
});
156
158
default :
157
159
return Collections .emptyMap ();
@@ -161,67 +163,67 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(TypeScrip
161
163
@ Override
162
164
public List <RuntimeClientPlugin > getClientPlugins () {
163
165
return ListUtils .of (
164
- RuntimeClientPlugin .builder ()
165
- .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "ValidateBucketName" ,
166
- HAS_MIDDLEWARE )
167
- .servicePredicate ((m , s ) -> isS3 (s ))
168
- .build (),
169
- RuntimeClientPlugin .builder ()
170
- .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "CheckContentLengthHeader" ,
171
- HAS_MIDDLEWARE )
172
- .operationPredicate ((m , s , o ) -> isS3 (s ) && o .getId ().getName (s ).equals ("PutObject" ))
173
- .build (),
174
- RuntimeClientPlugin .builder ()
175
- .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "throw200Exceptions" ,
176
- HAS_MIDDLEWARE )
177
- .operationPredicate (
178
- (m , s , o ) -> EXCEPTIONS_OF_200_OPERATIONS .contains (o .getId ().getName (s ))
179
- && isS3 (s ))
180
- .build (),
181
- RuntimeClientPlugin .builder ()
182
- .withConventions (AwsDependency .S3_MIDDLEWARE .dependency ,
183
- "WriteGetObjectResponseEndpoint" , HAS_MIDDLEWARE )
184
- .operationPredicate ((m , s , o ) -> isS3 (s )
185
- && o .getId ().getName (s ).equals ("WriteGetObjectResponse" ))
186
- .build (),
187
- RuntimeClientPlugin .builder ()
188
- .withConventions (AwsDependency .ADD_EXPECT_CONTINUE .dependency , "AddExpectContinue" ,
189
- HAS_MIDDLEWARE )
190
- .servicePredicate ((m , s ) -> isS3 (s ))
191
- .build (),
192
- RuntimeClientPlugin .builder ()
193
- .withConventions (AwsDependency .SSEC_MIDDLEWARE .dependency , "Ssec" , HAS_MIDDLEWARE )
194
- .operationPredicate ((m , s , o ) -> containsInputMembers (m , o , SSEC_INPUT_KEYS )
195
- && isS3 (s ))
196
- .build (),
197
- RuntimeClientPlugin .builder ()
198
- .withConventions (AwsDependency .LOCATION_CONSTRAINT .dependency , "LocationConstraint" ,
199
- HAS_MIDDLEWARE )
200
- .operationPredicate ((m , s , o ) -> o .getId ().getName (s ).equals ("CreateBucket" )
201
- && isS3 (s ))
202
- .build (),
203
- RuntimeClientPlugin .builder ()
204
- .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "S3" ,
205
- HAS_CONFIG )
206
- .servicePredicate ((m , s ) -> isS3 (s ) && isEndpointsV2Service (s ))
207
- .build (),
208
- /*
209
- * BUCKET_ENDPOINT_MIDDLEWARE needs two separate plugins. The first resolves the config in the client.
210
- * The second applies the middleware to bucket endpoint operations.
211
- */
212
- RuntimeClientPlugin .builder ()
213
- .withConventions (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .dependency , "BucketEndpoint" ,
214
- HAS_CONFIG )
215
- .servicePredicate ((m , s ) -> isS3 (s ) && !isEndpointsV2Service (s ))
216
- .build (),
217
- RuntimeClientPlugin .builder ()
218
- .withConventions (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .dependency , "BucketEndpoint" ,
219
- HAS_MIDDLEWARE )
220
- .operationPredicate ((m , s , o ) -> !NON_BUCKET_ENDPOINT_OPERATIONS .contains (o .getId ().getName (s ))
221
- && isS3 (s )
222
- && !isEndpointsV2Service (s )
223
- && containsInputMembers (m , o , BUCKET_ENDPOINT_INPUT_KEYS ))
224
- .build ()
166
+ RuntimeClientPlugin .builder ()
167
+ .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "ValidateBucketName" ,
168
+ HAS_MIDDLEWARE )
169
+ .servicePredicate ((m , s ) -> isS3 (s ))
170
+ .build (),
171
+ RuntimeClientPlugin .builder ()
172
+ .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "CheckContentLengthHeader" ,
173
+ HAS_MIDDLEWARE )
174
+ .operationPredicate ((m , s , o ) -> isS3 (s ) && o .getId ().getName (s ).equals ("PutObject" ))
175
+ .build (),
176
+ RuntimeClientPlugin .builder ()
177
+ .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "throw200Exceptions" ,
178
+ HAS_MIDDLEWARE )
179
+ .operationPredicate (
180
+ (m , s , o ) -> EXCEPTIONS_OF_200_OPERATIONS .contains (o .getId ().getName (s ))
181
+ && isS3 (s ))
182
+ .build (),
183
+ RuntimeClientPlugin .builder ()
184
+ .withConventions (AwsDependency .S3_MIDDLEWARE .dependency ,
185
+ "WriteGetObjectResponseEndpoint" , HAS_MIDDLEWARE )
186
+ .operationPredicate ((m , s , o ) -> isS3 (s )
187
+ && o .getId ().getName (s ).equals ("WriteGetObjectResponse" ))
188
+ .build (),
189
+ RuntimeClientPlugin .builder ()
190
+ .withConventions (AwsDependency .ADD_EXPECT_CONTINUE .dependency , "AddExpectContinue" ,
191
+ HAS_MIDDLEWARE )
192
+ .servicePredicate ((m , s ) -> isS3 (s ))
193
+ .build (),
194
+ RuntimeClientPlugin .builder ()
195
+ .withConventions (AwsDependency .SSEC_MIDDLEWARE .dependency , "Ssec" , HAS_MIDDLEWARE )
196
+ .operationPredicate ((m , s , o ) -> containsInputMembers (m , o , SSEC_INPUT_KEYS )
197
+ && isS3 (s ))
198
+ .build (),
199
+ RuntimeClientPlugin .builder ()
200
+ .withConventions (AwsDependency .LOCATION_CONSTRAINT .dependency , "LocationConstraint" ,
201
+ HAS_MIDDLEWARE )
202
+ .operationPredicate ((m , s , o ) -> o .getId ().getName (s ).equals ("CreateBucket" )
203
+ && isS3 (s ))
204
+ .build (),
205
+ RuntimeClientPlugin .builder ()
206
+ .withConventions (AwsDependency .S3_MIDDLEWARE .dependency , "S3" ,
207
+ HAS_CONFIG )
208
+ .servicePredicate ((m , s ) -> isS3 (s ) && isEndpointsV2Service (s ))
209
+ .build (),
210
+ /*
211
+ * BUCKET_ENDPOINT_MIDDLEWARE needs two separate plugins. The first resolves the config in the client.
212
+ * The second applies the middleware to bucket endpoint operations.
213
+ */
214
+ RuntimeClientPlugin .builder ()
215
+ .withConventions (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .dependency , "BucketEndpoint" ,
216
+ HAS_CONFIG )
217
+ .servicePredicate ((m , s ) -> isS3 (s ) && !isEndpointsV2Service (s ))
218
+ .build (),
219
+ RuntimeClientPlugin .builder ()
220
+ .withConventions (AwsDependency .BUCKET_ENDPOINT_MIDDLEWARE .dependency , "BucketEndpoint" ,
221
+ HAS_MIDDLEWARE )
222
+ .operationPredicate ((m , s , o ) -> !NON_BUCKET_ENDPOINT_OPERATIONS .contains (o .getId ().getName (s ))
223
+ && isS3 (s )
224
+ && !isEndpointsV2Service (s )
225
+ && containsInputMembers (m , o , BUCKET_ENDPOINT_INPUT_KEYS ))
226
+ .build ()
225
227
);
226
228
}
227
229
@@ -232,8 +234,8 @@ private static boolean containsInputMembers(
232
234
) {
233
235
OperationIndex operationIndex = OperationIndex .of (model );
234
236
return operationIndex .getInput (operationShape )
235
- .filter (input -> input .getMemberNames ().stream ().anyMatch (expectedMemberNames ::contains ))
236
- .isPresent ();
237
+ .filter (input -> input .getMemberNames ().stream ().anyMatch (expectedMemberNames ::contains ))
238
+ .isPresent ();
237
239
}
238
240
239
241
private static boolean isS3 (Shape serviceShape ) {
0 commit comments