pub fn sign(
        &self,
        operation_config: &OperationSigningConfig,
        request_config: &RequestConfig<'_>,
        credentials: &Credentials,
        request: &mut http::Request<SdkBody>,
    ) -> Result<Signature, SigningError> {
        let mut settings = SigningSettings::default();
        settings.uri_encoding = if operation_config.signing_options.double_uri_encode {
            UriEncoding::Double
        } else {
            UriEncoding::Single
        };
        settings.payload_checksum_kind = if operation_config.signing_options.content_sha256_header {
            PayloadChecksumKind::XAmzSha256
        } else {
            PayloadChecksumKind::NoHeader
        };
        let sigv4_config = aws_sigv4::http_request::SigningParams {
            access_key: credentials.access_key_id(),
            secret_key: credentials.secret_access_key(),
            security_token: credentials.session_token(),
            region: request_config.region.as_ref(),
            service_name: request_config.service.as_ref(),
            date_time: request_config.request_ts.into(),
            settings,
        };

        // A body that is already in memory can be signed directly. A  body that is not in memory
        // (any sort of streaming body) will be signed via UNSIGNED-PAYLOAD.
        let signable_body = request_config
            .payload_override
            // the payload_override is a cheap clone because it contains either a
            // reference or a short checksum (we're not cloning the entire body)
            .cloned()
            .unwrap_or_else(|| {
                request
                    .body()
                    .bytes()
                    .map(SignableBody::Bytes)
                    .unwrap_or(SignableBody::UnsignedPayload)
            });

        let (signing_headers, signature) =
            calculate_signing_headers(request, signable_body, &sigv4_config)?.into_parts();
        for (key, value) in signing_headers {
            request
                .headers_mut()
                .append(HeaderName::from_static(key), value);
        }

        Ok(Signature::new(signature))
    }
/// Sign a request using the SigV4 Protocol
///
/// Although the direct signing implementation MAY be used directly. End users will not typically
/// interact with this code. It is generally used via middleware in the request pipeline. See [`SigV4SigningStage`](crate::middleware::SigV4SigningStage).
Sign a request using the SigV4 Protocol
Although the direct signing implementation MAY be used directly. End users will not typically
interact with this code. It is generally used via middleware in the request pipeline.
Sign a request using the SigV4 Protocol Although the direct signing implementation MAY be used directly . End users will not typically interact with this code . It is generally used via middleware in the request pipeline .
pub fn sign(
        &self,
        operation_config: &OperationSigningConfig,
        request_config: &RequestConfig<'_>,
        credentials: &Credentials,
        request: &mut http::Request<SdkBody>,
    ) -> Result<Signature, SigningError> {
        let mut settings = SigningSettings::default();
        settings.uri_encoding = if operation_config.signing_options.double_uri_encode {
            UriEncoding::Double
        } else {
            UriEncoding::Single
        };
        settings.payload_checksum_kind = if operation_config.signing_options.content_sha256_header {
            PayloadChecksumKind::XAmzSha256
        } else {
            PayloadChecksumKind::NoHeader
        };
        let sigv4_config = aws_sigv4::http_request::SigningParams {
            access_key: credentials.access_key_id(),
            secret_key: credentials.secret_access_key(),
            security_token: credentials.session_token(),
            region: request_config.region.as_ref(),
            service_name: request_config.service.as_ref(),
            date_time: request_config.request_ts.into(),
            settings,
        };
        // A body that is already in memory can be signed directly. A  body that is not in memory
        // (any sort of streaming body) will be signed via UNSIGNED-PAYLOAD.
        let signable_body = request_config
            .payload_override
            // the payload_override is a cheap clone because it contains either a
            // reference or a short checksum (we're not cloning the entire body)
            .cloned()
            .unwrap_or_else(|| {
                request
                    .body()
                    .bytes()
                    .map(SignableBody::Bytes)
                    .unwrap_or(SignableBody::UnsignedPayload)
            });
        let (signing_headers, signature) =
            calculate_signing_headers(request, signable_body, &sigv4_config)?.into_parts();
        for (key, value) in signing_headers {
            request
                .headers_mut()
                .append(HeaderName::from_static(key), value);
        }
        Ok(Signature::new(signature))
    }
pub fn sign ( & self , operation_config : & OperationSigningConfig , request_config : & RequestConfig < ' _ > , credentials : & Credentials , request : & mut http :: Request < SdkBody > , ) -> Result < Signature , SigningError > { let mut settings = SigningSettings :: default ( ) ; settings . uri_encoding = if operation_config . signing_options . double_uri_encode { UriEncoding :: Double } else { UriEncoding :: Single } ; settings . payload_checksum_kind = if operation_config . signing_options . content_sha256_header { PayloadChecksumKind :: XAmzSha256 } else { PayloadChecksumKind :: NoHeader } ; let sigv4_config = aws_sigv4 :: http_request :: SigningParams { access_key : credentials . access_key_id ( ) , secret_key : credentials . secret_access_key ( ) , security_token : credentials . session_token ( ) , region : request_config . region . as_ref ( ) , service_name : request_config . service . as_ref ( ) , date_time : request_config . request_ts . into ( ) , settings , } ; // A body that is already in memory can be signed directly. A  body that is not in memory // (any sort of streaming body) will be signed via UNSIGNED-PAYLOAD. let signable_body = request_config . payload_override // the payload_override is a cheap clone because it contains either a // reference or a short checksum (we're not cloning the entire body) . cloned ( ) . unwrap_or_else ( | | { request . body ( ) . bytes ( ) . map ( SignableBody :: Bytes ) . unwrap_or ( SignableBody :: UnsignedPayload ) } ) ; let ( signing_headers , signature ) = calculate_signing_headers ( request , signable_body , & sigv4_config ) ? . into_parts ( ) ; for ( key , value ) in signing_headers { request . headers_mut ( ) . append ( HeaderName :: from_static ( key ) , value ) ; } Ok ( Signature :: new ( signature ) ) }
Sign a request using the SigV4 Protocol
Although the direct signing implementation MAY be used directly.
Sign a request using the SigV4 Protocol Although the direct signing implementation MAY be used directly .
&self
operation_config
&OperationSigningConfig
request_config
&RequestConfig<'_>
credentials
&Credentials
request
&mut http::Request<SdkBody>
&self
operation_config
&OperationSigningConfig
request_config
&RequestConfig<'_>
credentials
&Credentials
request
&mut http::Request<SdkBody>