Struct aws_sdk_s3::input::RestoreObjectInput
source · #[non_exhaustive]pub struct RestoreObjectInput { /* private fields */ }
Implementations§
source§impl RestoreObjectInput
impl RestoreObjectInput
sourcepub async fn make_operation(
&self,
_config: &Config
) -> Result<Operation<RestoreObject, AwsResponseRetryClassifier>, BuildError>
pub async fn make_operation(
&self,
_config: &Config
) -> Result<Operation<RestoreObject, AwsResponseRetryClassifier>, BuildError>
Consumes the builder and constructs an Operation<RestoreObject
>
Examples found in repository?
15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278
pub async fn customize(
self,
) -> std::result::Result<
crate::operation::customize::CustomizableOperation<
crate::operation::RestoreObject,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::result::SdkError<crate::error::RestoreObjectError>,
> {
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::RestoreObjectOutput,
aws_smithy_http::result::SdkError<crate::error::RestoreObjectError>,
> {
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 RestoreObjectInput
.
source§impl RestoreObjectInput
impl RestoreObjectInput
sourcepub fn bucket(&self) -> Option<&str>
pub fn bucket(&self) -> Option<&str>
The bucket name containing the object to restore.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
. When using this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using Amazon S3 on Outposts in the Amazon S3 User Guide.
sourcepub fn version_id(&self) -> Option<&str>
pub fn version_id(&self) -> Option<&str>
VersionId used to reference a specific version of the object.
sourcepub fn restore_request(&self) -> Option<&RestoreRequest>
pub fn restore_request(&self) -> Option<&RestoreRequest>
Container for restore job parameters.
sourcepub fn request_payer(&self) -> Option<&RequestPayer>
pub fn request_payer(&self) -> Option<&RequestPayer>
Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.
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?
23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::RestoreObject,
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::RestoreObjectInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_180 = &_input.bucket;
let input_180 = input_180.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_180,
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",
),
);
}
let input_181 = &_input.key;
let input_181 = input_181.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"key",
"cannot be empty or unset",
)
})?;
let key = aws_smithy_http::label::fmt_string(
input_181,
aws_smithy_http::label::EncodingStrategy::Greedy,
);
if key.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"key",
"cannot be empty or unset",
),
);
}
write!(output, "/{Bucket}/{Key}", Bucket = bucket, Key = key)
.expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::RestoreObjectInput,
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("restore");
query.push_kv("x-id", "RestoreObject");
if let Some(inner_182) = &_input.version_id {
{
query.push_kv("versionId", &aws_smithy_http::query::fmt_string(&inner_182));
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::RestoreObjectInput,
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_restore_object(input, builder)?;
Ok(builder.method("POST").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_restore_object_input(&self.restore_request)?,
);
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());
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::RestoreObject::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"RestoreObject",
"s3",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
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 RestoreObjectInput
impl Clone for RestoreObjectInput
source§fn clone(&self) -> RestoreObjectInput
fn clone(&self) -> RestoreObjectInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more