pub struct PutObject { /* private fields */ }
Expand description

Operation shape for PutObject.

This is usually constructed for you using the the fluent builder returned by put_object.

See crate::client::fluent_builders::PutObject for more details about the operation.

Implementations§

Creates a new builder-style object to manufacture PutObjectInput.

Creates a new PutObject operation.

Examples found in repository?
src/input.rs (line 2152)
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
    pub async fn make_operation(
        self,
        _config: &crate::config::Config,
    ) -> std::result::Result<
        aws_smithy_http::operation::Operation<
            crate::operation::PutObject,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::operation::error::BuildError,
    > {
        let mut request = {
            fn uri_base(
                _input: &crate::input::PutObjectInput,
                output: &mut String,
            ) -> Result<(), aws_smithy_http::operation::error::BuildError> {
                let input_29 = &_input.backup_job_id;
                let input_29 = input_29.as_ref().ok_or_else(|| {
                    aws_smithy_http::operation::error::BuildError::missing_field(
                        "backup_job_id",
                        "cannot be empty or unset",
                    )
                })?;
                let backup_job_id = aws_smithy_http::label::fmt_string(
                    input_29,
                    aws_smithy_http::label::EncodingStrategy::Default,
                );
                if backup_job_id.is_empty() {
                    return Err(
                        aws_smithy_http::operation::error::BuildError::missing_field(
                            "backup_job_id",
                            "cannot be empty or unset",
                        ),
                    );
                }
                let input_30 = &_input.object_name;
                let input_30 = input_30.as_ref().ok_or_else(|| {
                    aws_smithy_http::operation::error::BuildError::missing_field(
                        "object_name",
                        "cannot be empty or unset",
                    )
                })?;
                let object_name = aws_smithy_http::label::fmt_string(
                    input_30,
                    aws_smithy_http::label::EncodingStrategy::Default,
                );
                if object_name.is_empty() {
                    return Err(
                        aws_smithy_http::operation::error::BuildError::missing_field(
                            "object_name",
                            "cannot be empty or unset",
                        ),
                    );
                }
                write!(
                    output,
                    "/backup-jobs/{BackupJobId}/object/{ObjectName}/put-object",
                    BackupJobId = backup_job_id,
                    ObjectName = object_name
                )
                .expect("formatting should succeed");
                Ok(())
            }
            fn uri_query(
                _input: &crate::input::PutObjectInput,
                mut output: &mut String,
            ) -> Result<(), aws_smithy_http::operation::error::BuildError> {
                let mut query = aws_smithy_http::query::Writer::new(&mut output);
                if let Some(inner_31) = &_input.metadata_string {
                    {
                        query.push_kv(
                            "metadata-string",
                            &aws_smithy_http::query::fmt_string(&inner_31),
                        );
                    }
                }
                if _input.inline_chunk_length != 0 {
                    query.push_kv(
                        "length",
                        aws_smithy_types::primitive::Encoder::from(_input.inline_chunk_length)
                            .encode(),
                    );
                }
                if let Some(inner_32) = &_input.inline_chunk_checksum {
                    {
                        query.push_kv("checksum", &aws_smithy_http::query::fmt_string(&inner_32));
                    }
                }
                if let Some(inner_33) = &_input.inline_chunk_checksum_algorithm {
                    {
                        query.push_kv(
                            "checksum-algorithm",
                            &aws_smithy_http::query::fmt_string(&inner_33),
                        );
                    }
                }
                if let Some(inner_34) = &_input.object_checksum {
                    {
                        query.push_kv(
                            "object-checksum",
                            &aws_smithy_http::query::fmt_string(&inner_34),
                        );
                    }
                }
                if let Some(inner_35) = &_input.object_checksum_algorithm {
                    {
                        query.push_kv(
                            "object-checksum-algorithm",
                            &aws_smithy_http::query::fmt_string(&inner_35),
                        );
                    }
                }
                if _input.throw_on_duplicate {
                    query.push_kv(
                        "throwOnDuplicate",
                        aws_smithy_types::primitive::Encoder::from(_input.throw_on_duplicate)
                            .encode(),
                    );
                }
                Ok(())
            }
            #[allow(clippy::unnecessary_wraps)]
            fn update_http_builder(
                input: &crate::input::PutObjectInput,
                builder: http::request::Builder,
            ) -> std::result::Result<
                http::request::Builder,
                aws_smithy_http::operation::error::BuildError,
            > {
                let mut uri = String::new();
                uri_base(input, &mut uri)?;
                uri_query(input, &mut uri)?;
                Ok(builder.method("PUT").uri(uri))
            }
            let mut builder = update_http_builder(&self, http::request::Builder::new())?;
            builder = aws_smithy_http::header::set_request_header_if_absent(
                builder,
                http::header::CONTENT_TYPE,
                "application/octet-stream",
            );
            builder
        };
        let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
        #[allow(clippy::useless_conversion)]
        let body = aws_smithy_http::body::SdkBody::from(
            crate::operation_ser::serialize_payload_put_object_input(self.inline_chunk)?
                .into_inner(),
        );
        if let Some(content_length) = body.content_length() {
            request = aws_smithy_http::header::set_request_header_if_absent(
                request,
                http::header::CONTENT_LENGTH,
                content_length,
            );
        }
        let request = request.body(body).expect("should be valid request");
        let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
        request
            .properties_mut()
            .insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
        let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
            aws_types::os_shim_internal::Env::real(),
            crate::API_METADATA.clone(),
        );
        if let Some(app_name) = _config.app_name() {
            user_agent = user_agent.with_app_name(app_name.clone());
        }
        request.properties_mut().insert(user_agent);
        let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
        signing_config.signing_options.content_sha256_header = true;
        request
            .properties_mut()
            .insert(aws_sig_auth::signer::SignableBody::UnsignedPayload);
        request.properties_mut().insert(signing_config);
        request
            .properties_mut()
            .insert(aws_types::SigningService::from_static(
                _config.signing_service(),
            ));
        if let Some(region) = &_config.region {
            request
                .properties_mut()
                .insert(aws_types::region::SigningRegion::from(region.clone()));
        }
        let endpoint_params = aws_endpoint::Params::new(_config.region.clone());
        request
            .properties_mut()
            .insert::<aws_smithy_http::endpoint::Result>(
                _config.endpoint_resolver.resolve_endpoint(&endpoint_params),
            );
        if let Some(region) = &_config.region {
            request.properties_mut().insert(region.clone());
        }
        aws_http::auth::set_provider(
            &mut request.properties_mut(),
            _config.credentials_provider.clone(),
        );
        let op =
            aws_smithy_http::operation::Operation::new(request, crate::operation::PutObject::new())
                .with_metadata(aws_smithy_http::operation::Metadata::new(
                    "PutObject",
                    "backupstorage",
                ));
        let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
        Ok(op)
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Output type of the HttpResponse. Read more
Parse an HTTP request without reading the body. If the body must be provided to proceed, return None Read more
Parse an HTTP request from a fully loaded body. This is for standard request/response style APIs like AwsJson 1.0/1.1 and the error path of most streaming APIs Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more