All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.auth.signer.params.AwsS3V4SignerParams Maven / Gradle / Ivy

Go to download

The AWS SDK for Java - Auth module holds the classes that are used for authentication with services

There is a newer version: 2.29.15
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package software.amazon.awssdk.auth.signer.params;

import software.amazon.awssdk.annotations.SdkPublicApi;

@SdkPublicApi
public final class AwsS3V4SignerParams extends Aws4SignerParams {

    private final Boolean enableChunkedEncoding;
    private final Boolean enablePayloadSigning;

    private AwsS3V4SignerParams(BuilderImpl builder) {
        super(builder);
        this.enableChunkedEncoding = builder.enableChunkedEncoding;
        this.enablePayloadSigning = builder.enablePayloadSigning;
    }

    public Boolean enableChunkedEncoding() {
        return enableChunkedEncoding;
    }

    public Boolean enablePayloadSigning() {
        return enablePayloadSigning;
    }

    public static Builder builder() {
        return new BuilderImpl();
    }

    public interface Builder extends Aws4SignerParams.Builder {

        /**
         * 

* Configures the client to enable chunked encoding for all requests. *

*

* The default behavior is to enable chunked encoding automatically. Disable this flag will result in * disabling chunked encoding for all requests. *

*

* Note: Disabling this option has performance implications since the checksum for the * payload will have to be pre-calculated before sending the data. If your payload is large this * will affect the overall time required to upload an object. Using this option is recommended * only if your endpoint does not implement chunked uploading. *

* * @param enableChunkedEncoding True to enable chunked encoding and False to disable. Default value is True. */ Builder enableChunkedEncoding(Boolean enableChunkedEncoding); /** *

* Configures the client to sign payloads in all situations. *

*

* Payload signing is optional when chunked encoding is not used and requests are made * against an HTTPS endpoint. Under these conditions the client will by default * opt to not sign payloads to optimize performance. If this flag is set to true the * client will instead always sign payloads. *

*

* Note: Payload signing can be expensive, particularly if transferring * large payloads in a single chunk. Enabling this option will result in a performance * penalty. *

* * @param enablePayloadSigning True to explicitly enable payload signing in all situations. Default value is False. */ Builder enablePayloadSigning(Boolean enablePayloadSigning); @Override AwsS3V4SignerParams build(); } private static final class BuilderImpl extends Aws4SignerParams.BuilderImpl implements Builder { static final boolean DEFAULT_CHUNKED_ENCODING_ENABLED = false; static final boolean DEFAULT_PAYLOAD_SIGNING_ENABLED = false; private Boolean enableChunkedEncoding = DEFAULT_CHUNKED_ENCODING_ENABLED; private Boolean enablePayloadSigning = DEFAULT_PAYLOAD_SIGNING_ENABLED; private BuilderImpl() { // By default, S3 should not normalize paths normalizePath(false); } @Override public Builder enableChunkedEncoding(Boolean enableChunkedEncoding) { this.enableChunkedEncoding = enableChunkedEncoding; return this; } public void setEnableChunkedEncoding(Boolean enableChunkedEncoding) { enableChunkedEncoding(enableChunkedEncoding); } @Override public Builder enablePayloadSigning(Boolean enablePayloadSigning) { this.enablePayloadSigning = enablePayloadSigning; return this; } public void setEnablePayloadSigning(Boolean enablePayloadSigning) { enablePayloadSigning(enablePayloadSigning); } @Override public AwsS3V4SignerParams build() { return new AwsS3V4SignerParams(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy