public List getClientPlugins()

in codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java [303:433]


    public List<RuntimeClientPlugin> getClientPlugins() {
        return ListUtils.of(
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "ValidateBucketName",
                    HAS_MIDDLEWARE)
                .servicePredicate((m, s) -> isS3(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "CheckContentLengthHeader",
                    HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> isS3(s) && o.getId().getName(s).equals("PutObject"))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "throw200Exceptions",
                    HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> {
                    if (!isS3(s)) {
                        return false;
                    }
                    Optional<ShapeId> output = o.getOutput();
                    if (output.isPresent()) {
                        Shape outputShape = m.expectShape(output.get());
                        boolean hasStreamingBlobOutputPayload = outputShape.getAllMembers().values().stream().anyMatch(
                            memberShape -> {
                                boolean isPayload = memberShape.hasTrait(HttpPayloadTrait.class);
                                if (!isPayload) {
                                    return false;
                                }
                                Shape shape = m.expectShape(memberShape.getTarget());
                                boolean isBlob = shape.isBlobShape();
                                if (!isBlob) {
                                    return false;
                                }
                                return shape.hasTrait(StreamingTrait.class);
                            }
                        );
                        if (hasStreamingBlobOutputPayload) {
                            return false;
                        }
                    }
                    return output.isPresent();
                })
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.ADD_EXPECT_CONTINUE.dependency, "AddExpectContinue",
                    HAS_MIDDLEWARE)
                .servicePredicate((m, s) -> isS3(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.SSEC_MIDDLEWARE.dependency, "Ssec", HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> containsInputMembers(m, o, SSEC_INPUT_KEYS)
                    && isS3(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.LOCATION_CONSTRAINT.dependency, "LocationConstraint",
                    HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> o.getId().getName(s).equals("CreateBucket")
                    && isS3(s))
                .build(),
            RuntimeClientPlugin.builder()
                .inputConfig(
                    Symbol.builder()
                        .namespace(AwsDependency.S3_MIDDLEWARE.dependency.getPackageName(), "/")
                        .name("S3InputConfig")
                        .build()
                )
                .resolvedConfig(
                    Symbol.builder()
                        .namespace(AwsDependency.S3_MIDDLEWARE.dependency.getPackageName(), "/")
                        .name("S3ResolvedConfig")
                        .build()
                )
                .resolveFunction(
                    Symbol.builder()
                        .namespace(AwsDependency.S3_MIDDLEWARE.dependency.getPackageName(), "/")
                        .name("resolveS3Config")
                        .addDependency(
                            AwsDependency.S3_MIDDLEWARE.dependency
                        )
                        .build(),
                    (m, s, o) -> MapUtils.of(
                        "session", Symbol.builder()
                            .name("[() => this, CreateSessionCommand]")
                            .addReference(Symbol.builder()
                                .name("CreateSessionCommand")
                                .namespace("./src/commands/CreateSessionCommand", "/")
                                .build())
                            .build()
                    )
                )
                .servicePredicate((m, s) -> isS3(s) && isEndpointsV2Service(s))
                .build(),
            /*
             * BUCKET_ENDPOINT_MIDDLEWARE needs two separate plugins. The first resolves the config in the client.
             * The second applies the middleware to bucket endpoint operations.
             */
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE.dependency, "BucketEndpoint",
                    HAS_CONFIG)
                .servicePredicate((m, s) -> isS3(s) && !isEndpointsV2Service(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE.dependency, "BucketEndpoint",
                    HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> !NON_BUCKET_ENDPOINT_OPERATIONS.contains(o.getId().getName(s))
                    && isS3(s)
                    && !isEndpointsV2Service(s)
                    && containsInputMembers(m, o, BUCKET_ENDPOINT_INPUT_KEYS))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "RegionRedirectMiddleware",
                    HAS_MIDDLEWARE)
                .servicePredicate((m, s) -> isS3(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "S3ExpiresMiddleware",
                    HAS_MIDDLEWARE)
                .operationPredicate((m, s, o) -> isS3(s) && containsExpiresOutput(m, o))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "S3Express",
                    HAS_MIDDLEWARE)
                .servicePredicate((m, s) -> isS3(s) && isEndpointsV2Service(s))
                .build(),
            RuntimeClientPlugin.builder()
                .withConventions(AwsDependency.S3_MIDDLEWARE.dependency, "S3ExpressHttpSigning",
                    HAS_MIDDLEWARE)
                .servicePredicate((m, s) -> isS3(s) && isEndpointsV2Service(s))
                .build()
        );
    }