Struct aws_sdk_s3::input::PutBucketVersioningInput
source · #[non_exhaustive]pub struct PutBucketVersioningInput { /* private fields */ }
Implementations§
source§impl PutBucketVersioningInput
impl PutBucketVersioningInput
sourcepub async fn make_operation(
&self,
_config: &Config
) -> Result<Operation<PutBucketVersioning, AwsResponseRetryClassifier>, BuildError>
pub async fn make_operation(
&self,
_config: &Config
) -> Result<Operation<PutBucketVersioning, AwsResponseRetryClassifier>, BuildError>
Consumes the builder and constructs an Operation<PutBucketVersioning
>
Examples found in repository?
13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150
pub async fn customize(
self,
) -> std::result::Result<
crate::operation::customize::CustomizableOperation<
crate::operation::PutBucketVersioning,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::result::SdkError<crate::error::PutBucketVersioningError>,
> {
let handle = self.handle.clone();
let operation = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
Ok(crate::operation::customize::CustomizableOperation { handle, operation })
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PutBucketVersioningOutput,
aws_smithy_http::result::SdkError<crate::error::PutBucketVersioningError>,
> {
let op = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
self.handle.client.call(op).await
}
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a new builder-style object to manufacture PutBucketVersioningInput
.
source§impl PutBucketVersioningInput
impl PutBucketVersioningInput
sourcepub fn content_md5(&self) -> Option<&str>
pub fn content_md5(&self) -> Option<&str>
>The base64-encoded 128-bit MD5 digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see RFC 1864.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
sourcepub fn checksum_algorithm(&self) -> Option<&ChecksumAlgorithm>
pub fn checksum_algorithm(&self) -> Option<&ChecksumAlgorithm>
Indicates the algorithm used to create the checksum for the object when using the SDK. This header will not provide any additional functionality if not using the SDK. When sending this header, there must be a corresponding x-amz-checksum
or x-amz-trailer
header sent. Otherwise, Amazon S3 fails the request with the HTTP status code 400 Bad Request
. For more information, see Checking object integrity in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided ChecksumAlgorithm
parameter.
Examples found in repository?
19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::PutBucketVersioning,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let checksum_algorithm = self.checksum_algorithm().cloned();
let mut request = {
fn uri_base(
_input: &crate::input::PutBucketVersioningInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_160 = &_input.bucket;
let input_160 = input_160.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bucket",
"cannot be empty or unset",
)
})?;
let bucket = aws_smithy_http::label::fmt_string(
input_160,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bucket.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bucket",
"cannot be empty or unset",
),
);
}
write!(output, "/{Bucket}", Bucket = bucket).expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::PutBucketVersioningInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
query.push_v("versioning");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::PutBucketVersioningInput,
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)?;
let builder = crate::http_serde::add_headers_put_bucket_versioning(input, builder)?;
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/xml",
);
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_bucket_versioning_input(
&self.versioning_configuration,
)?,
);
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);
request = request.augment(|mut req, properties| {
let checksum_algorithm = checksum_algorithm.as_ref();
let checksum_algorithm = checksum_algorithm
.map(|algorithm| algorithm.as_str())
.or(Some("md5"));
let checksum_algorithm = match checksum_algorithm {
Some(algo) => Some(
algo.parse::<aws_smithy_checksums::ChecksumAlgorithm>()
.map_err(aws_smithy_http::operation::error::BuildError::other)?,
),
None => None,
};
if let Some(checksum_algorithm) = checksum_algorithm {
crate::http_body_checksum::add_checksum_calculation_to_request(
&mut req,
properties,
checksum_algorithm,
)?;
}
Result::<_, aws_smithy_http::operation::error::BuildError>::Ok(req)
})?;
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
signing_config.signing_options.content_sha256_header = true;
signing_config.signing_options.double_uri_encode = false;
signing_config.signing_options.normalize_uri_path = false;
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::PutBucketVersioning::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"PutBucketVersioning",
"s3",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
sourcepub fn mfa(&self) -> Option<&str>
pub fn mfa(&self) -> Option<&str>
The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
sourcepub fn versioning_configuration(&self) -> Option<&VersioningConfiguration>
pub fn versioning_configuration(&self) -> Option<&VersioningConfiguration>
Container for setting the versioning state.
sourcepub fn expected_bucket_owner(&self) -> Option<&str>
pub fn expected_bucket_owner(&self) -> Option<&str>
The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden
(access denied).
Trait Implementations§
source§impl Clone for PutBucketVersioningInput
impl Clone for PutBucketVersioningInput
source§fn clone(&self) -> PutBucketVersioningInput
fn clone(&self) -> PutBucketVersioningInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more