2
2
3
3
import software .amazon .smithy .aws .go .codegen .SdkGoTypes ;
4
4
import software .amazon .smithy .aws .traits .HttpChecksumTrait ;
5
+ import software .amazon .smithy .aws .traits .ServiceTrait ;
5
6
import software .amazon .smithy .go .codegen .GoSettings ;
6
7
import software .amazon .smithy .go .codegen .GoWriter ;
7
8
import software .amazon .smithy .go .codegen .integration .GoIntegration ;
10
11
import software .amazon .smithy .model .Model ;
11
12
import software .amazon .smithy .model .shapes .OperationShape ;
12
13
import software .amazon .smithy .model .shapes .ServiceShape ;
14
+ import software .amazon .smithy .model .shapes .ShapeId ;
13
15
import software .amazon .smithy .utils .ListUtils ;
14
16
15
17
import java .util .List ;
@@ -30,12 +32,13 @@ public class ExpressDefaultChecksum implements GoIntegration {
30
32
.build ();
31
33
32
34
private static boolean hasRequiredChecksum (Model model , ServiceShape service , OperationShape operation ) {
33
- return operation .hasTrait (HttpChecksumTrait .class )
35
+ return S3ModelUtils .isServiceS3 (model , service )
36
+ && operation .hasTrait (HttpChecksumTrait .class )
34
37
&& operation .expectTrait (HttpChecksumTrait .class ).isRequestChecksumRequired ();
35
38
}
36
39
37
40
private static boolean isCreateMultipartUpload (Model model , ServiceShape service , OperationShape operation ) {
38
- return operation .getId ().getName (). equals ( " CreateMultipartUpload" );
41
+ return operation .getId ().equals ( ShapeId . from ( "com.amazonaws.s3# CreateMultipartUpload") );
39
42
}
40
43
41
44
@ Override
@@ -47,12 +50,10 @@ public byte getOrder() {
47
50
public List <RuntimeClientPlugin > getClientPlugins () {
48
51
return ListUtils .of (
49
52
RuntimeClientPlugin .builder ()
50
- .servicePredicate (S3ModelUtils ::isServiceS3 )
51
53
.operationPredicate (ExpressDefaultChecksum ::hasRequiredChecksum )
52
54
.registerMiddleware (SET_ALGORITHM_MIDDLEWARE )
53
55
.build (),
54
56
RuntimeClientPlugin .builder ()
55
- .servicePredicate (S3ModelUtils ::isServiceS3 )
56
57
.operationPredicate (ExpressDefaultChecksum ::isCreateMultipartUpload )
57
58
.registerMiddleware (SET_MPU_ALGORITHM_MIDDLEWARE )
58
59
.build ()
0 commit comments