Search in sources :

Example 1 with HttpChecksum

use of software.amazon.awssdk.core.interceptor.trait.HttpChecksum in project aws-sdk-java-v2 by aws.

the class HttpChecksumResolver method getResolvedChecksumSpecs.

public static ChecksumSpecs getResolvedChecksumSpecs(ExecutionAttributes executionAttributes) {
    HttpChecksum httpChecksumTraitInOperation = executionAttributes.getAttribute(SdkInternalExecutionAttribute.HTTP_CHECKSUM);
    if (httpChecksumTraitInOperation == null) {
        return null;
    }
    boolean hasRequestValidation = hasRequestValidationMode(httpChecksumTraitInOperation);
    String checksumHeaderName = httpChecksumTraitInOperation.requestAlgorithm() != null ? HttpChecksumUtils.httpChecksumHeader(httpChecksumTraitInOperation.requestAlgorithm()) : null;
    List<Algorithm> responseValidationAlgorithms = getResponseValidationAlgorithms(httpChecksumTraitInOperation);
    return ChecksumSpecs.builder().algorithm(Algorithm.fromValue(httpChecksumTraitInOperation.requestAlgorithm())).headerName(checksumHeaderName).responseValidationAlgorithms(responseValidationAlgorithms).isValidationEnabled(hasRequestValidation).isRequestChecksumRequired(httpChecksumTraitInOperation.isRequestChecksumRequired()).isRequestStreaming(httpChecksumTraitInOperation.isRequestStreaming()).build();
}
Also used : Algorithm(software.amazon.awssdk.core.checksums.Algorithm) HttpChecksum(software.amazon.awssdk.core.interceptor.trait.HttpChecksum)

Aggregations

Algorithm (software.amazon.awssdk.core.checksums.Algorithm)1 HttpChecksum (software.amazon.awssdk.core.interceptor.trait.HttpChecksum)1