aws_sdk_sagemakergeospatial/operation/
get_tile.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetTile;
6impl GetTile {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::get_tile::GetTileInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_tile::GetTileOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_tile::GetTileError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err =
22 |err: ::aws_smithy_runtime_api::client::result::SdkError<
23 ::aws_smithy_runtime_api::client::interceptors::context::Error,
24 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25 >| { err.map_service_error(|err| err.downcast::<crate::operation::get_tile::GetTileError>().expect("correct error type")) };
26 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
27 .await
28 .map_err(map_err)?;
29 let output = context.finalize().map_err(map_err)?;
30 ::std::result::Result::Ok(
31 output
32 .downcast::<crate::operation::get_tile::GetTileOutput>()
33 .expect("correct output type"),
34 )
35 }
36
37 pub(crate) async fn orchestrate_with_stop_point(
38 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
39 input: crate::operation::get_tile::GetTileInput,
40 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
41 ) -> ::std::result::Result<
42 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
43 ::aws_smithy_runtime_api::client::result::SdkError<
44 ::aws_smithy_runtime_api::client::interceptors::context::Error,
45 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
46 >,
47 > {
48 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
49 use ::tracing::Instrument;
50 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("SageMaker Geospatial", "GetTile", input, runtime_plugins, stop_point)
51 .instrument(::tracing::debug_span!(
54 "SageMaker Geospatial.GetTile",
55 "rpc.service" = "SageMaker Geospatial",
56 "rpc.method" = "GetTile",
57 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
58 "rpc.system" = "aws-api",
59 ))
60 .await
61 }
62
63 pub(crate) fn operation_runtime_plugins(
64 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
65 client_config: &crate::config::Config,
66 config_override: ::std::option::Option<crate::config::Builder>,
67 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
68 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
69
70 if let ::std::option::Option::Some(config_override) = config_override {
71 for plugin in config_override.runtime_plugins.iter().cloned() {
72 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
73 }
74 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
75 config_override,
76 client_config.config.clone(),
77 &client_config.runtime_components,
78 ));
79 }
80 runtime_plugins
81 }
82}
83impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetTile {
84 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
85 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetTile");
86
87 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
88 GetTileRequestSerializer,
89 ));
90 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
91 GetTileResponseDeserializer,
92 ));
93
94 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
95 crate::config::auth::Params::builder()
96 .operation_name("GetTile")
97 .build()
98 .expect("required fields set"),
99 ));
100
101 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
102 "GetTile",
103 "SageMaker Geospatial",
104 ));
105 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
106 signing_options.double_uri_encode = true;
107 signing_options.content_sha256_header = false;
108 signing_options.normalize_uri_path = true;
109 signing_options.payload_override = None;
110
111 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
112 signing_options,
113 ..::std::default::Default::default()
114 });
115
116 ::std::option::Option::Some(cfg.freeze())
117 }
118
119 fn runtime_components(
120 &self,
121 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
122 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
123 #[allow(unused_mut)]
124 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetTile")
125 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
126 .with_interceptor(GetTileEndpointParamsInterceptor)
127 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
128 crate::operation::get_tile::GetTileError,
129 >::new())
130 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
131 crate::operation::get_tile::GetTileError,
132 >::new())
133 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
134 crate::operation::get_tile::GetTileError,
135 >::new());
136
137 ::std::borrow::Cow::Owned(rcb)
138 }
139}
140
141#[derive(Debug)]
142struct GetTileResponseDeserializer;
143impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetTileResponseDeserializer {
144 fn deserialize_streaming(
145 &self,
146 response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
147 ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
148 #[allow(unused_mut)]
149 let mut force_error = false;
150 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
151
152 if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
154 return ::std::option::Option::None;
155 }
156 ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
157 crate::protocol_serde::shape_get_tile::de_get_tile_http_response(response),
158 ))
159 }
160
161 fn deserialize_nonstreaming(
162 &self,
163 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
164 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
165 let body = response.body().bytes().expect("body loaded");
167 crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_get_tile::de_get_tile_http_error(
168 response.status().as_u16(),
169 response.headers(),
170 body,
171 ))
172 }
173}
174#[derive(Debug)]
175struct GetTileRequestSerializer;
176impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetTileRequestSerializer {
177 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
178 fn serialize_input(
179 &self,
180 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
181 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
182 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
183 let input = input.downcast::<crate::operation::get_tile::GetTileInput>().expect("correct type");
184 let _header_serialization_settings = _cfg
185 .load::<crate::serialization_settings::HeaderSerializationSettings>()
186 .cloned()
187 .unwrap_or_default();
188 let mut request_builder = {
189 #[allow(clippy::uninlined_format_args)]
190 fn uri_base(
191 _input: &crate::operation::get_tile::GetTileInput,
192 output: &mut ::std::string::String,
193 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
194 use ::std::fmt::Write as _;
195 let input_1 = &_input.z;
196 let input_1 = input_1
197 .as_ref()
198 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("z", "cannot be empty or unset"))?;
199 let mut z_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
200 let z = z_encoder.encode();
201 if z.is_empty() {
202 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
203 "z",
204 "cannot be empty or unset",
205 ));
206 }
207 let input_2 = &_input.x;
208 let input_2 = input_2
209 .as_ref()
210 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("x", "cannot be empty or unset"))?;
211 let mut x_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
212 let x = x_encoder.encode();
213 if x.is_empty() {
214 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
215 "x",
216 "cannot be empty or unset",
217 ));
218 }
219 let input_3 = &_input.y;
220 let input_3 = input_3
221 .as_ref()
222 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("y", "cannot be empty or unset"))?;
223 let mut y_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_3);
224 let y = y_encoder.encode();
225 if y.is_empty() {
226 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
227 "y",
228 "cannot be empty or unset",
229 ));
230 }
231 ::std::write!(output, "/tile/{z}/{x}/{y}", z = z, x = x, y = y).expect("formatting should succeed");
232 ::std::result::Result::Ok(())
233 }
234 fn uri_query(
235 _input: &crate::operation::get_tile::GetTileInput,
236 mut output: &mut ::std::string::String,
237 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
238 let mut query = ::aws_smithy_http::query::Writer::new(output);
239 let inner_4 = &_input.image_assets;
240 let inner_4 = inner_4
241 .as_ref()
242 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("image_assets", "cannot be empty or unset"))?;
243 for inner_5 in inner_4 {
244 query.push_kv("ImageAssets", &::aws_smithy_http::query::fmt_string(inner_5));
245 }
246 let inner_6 = &_input.target;
247 let inner_6 = inner_6
248 .as_ref()
249 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target", "cannot be empty or unset"))?;
250 query.push_kv("Target", &::aws_smithy_http::query::fmt_string(inner_6));
251 let inner_7 = &_input.arn;
252 let inner_7 = inner_7
253 .as_ref()
254 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("arn", "cannot be empty or unset"))?;
255 if inner_7.is_empty() {
256 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
257 "arn",
258 "cannot be empty or unset",
259 ));
260 }
261 query.push_kv("Arn", &::aws_smithy_http::query::fmt_string(inner_7));
262 if let ::std::option::Option::Some(inner_8) = &_input.image_mask {
263 {
264 query.push_kv("ImageMask", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
265 }
266 }
267 if let ::std::option::Option::Some(inner_9) = &_input.output_format {
268 {
269 query.push_kv("OutputFormat", &::aws_smithy_http::query::fmt_string(inner_9));
270 }
271 }
272 if let ::std::option::Option::Some(inner_10) = &_input.time_range_filter {
273 {
274 query.push_kv("TimeRangeFilter", &::aws_smithy_http::query::fmt_string(inner_10));
275 }
276 }
277 if let ::std::option::Option::Some(inner_11) = &_input.property_filters {
278 {
279 query.push_kv("PropertyFilters", &::aws_smithy_http::query::fmt_string(inner_11));
280 }
281 }
282 if let ::std::option::Option::Some(inner_12) = &_input.output_data_type {
283 {
284 query.push_kv("OutputDataType", &::aws_smithy_http::query::fmt_string(inner_12));
285 }
286 }
287 if let ::std::option::Option::Some(inner_13) = &_input.execution_role_arn {
288 {
289 query.push_kv("ExecutionRoleArn", &::aws_smithy_http::query::fmt_string(inner_13));
290 }
291 }
292 ::std::result::Result::Ok(())
293 }
294 #[allow(clippy::unnecessary_wraps)]
295 fn update_http_builder(
296 input: &crate::operation::get_tile::GetTileInput,
297 builder: ::http::request::Builder,
298 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
299 let mut uri = ::std::string::String::new();
300 uri_base(input, &mut uri)?;
301 uri_query(input, &mut uri)?;
302 ::std::result::Result::Ok(builder.method("GET").uri(uri))
303 }
304 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
305 builder
306 };
307 let body = ::aws_smithy_types::body::SdkBody::from("");
308
309 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
310 }
311}
312#[derive(Debug)]
313struct GetTileEndpointParamsInterceptor;
314
315impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetTileEndpointParamsInterceptor {
316 fn name(&self) -> &'static str {
317 "GetTileEndpointParamsInterceptor"
318 }
319
320 fn read_before_execution(
321 &self,
322 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
323 '_,
324 ::aws_smithy_runtime_api::client::interceptors::context::Input,
325 ::aws_smithy_runtime_api::client::interceptors::context::Output,
326 ::aws_smithy_runtime_api::client::interceptors::context::Error,
327 >,
328 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
329 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
330 let _input = context
331 .input()
332 .downcast_ref::<GetTileInput>()
333 .ok_or("failed to downcast to GetTileInput")?;
334
335 let params = crate::config::endpoint::Params::builder()
336 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
337 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
338 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
339 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
340 .build()
341 .map_err(|err| {
342 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
343 })?;
344 cfg.interceptor_state()
345 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
346 ::std::result::Result::Ok(())
347 }
348}
349
350#[non_exhaustive]
355#[derive(::std::fmt::Debug)]
356pub enum GetTileError {
357 AccessDeniedException(crate::types::error::AccessDeniedException),
359 InternalServerException(crate::types::error::InternalServerException),
361 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
363 ThrottlingException(crate::types::error::ThrottlingException),
365 ValidationException(crate::types::error::ValidationException),
367 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
369 variable wildcard pattern and check `.code()`:
370 \
371 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
372 \
373 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetTileError) for what information is available for the error.")]
374 Unhandled(crate::error::sealed_unhandled::Unhandled),
375}
376impl GetTileError {
377 pub fn unhandled(
379 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
380 ) -> Self {
381 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
382 source: err.into(),
383 meta: ::std::default::Default::default(),
384 })
385 }
386
387 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
389 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
390 source: err.clone().into(),
391 meta: err,
392 })
393 }
394 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
399 match self {
400 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
401 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
402 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
403 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
404 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
405 Self::Unhandled(e) => &e.meta,
406 }
407 }
408 pub fn is_access_denied_exception(&self) -> bool {
410 matches!(self, Self::AccessDeniedException(_))
411 }
412 pub fn is_internal_server_exception(&self) -> bool {
414 matches!(self, Self::InternalServerException(_))
415 }
416 pub fn is_resource_not_found_exception(&self) -> bool {
418 matches!(self, Self::ResourceNotFoundException(_))
419 }
420 pub fn is_throttling_exception(&self) -> bool {
422 matches!(self, Self::ThrottlingException(_))
423 }
424 pub fn is_validation_exception(&self) -> bool {
426 matches!(self, Self::ValidationException(_))
427 }
428}
429impl ::std::error::Error for GetTileError {
430 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
431 match self {
432 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
433 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
434 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
435 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
436 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
437 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
438 }
439 }
440}
441impl ::std::fmt::Display for GetTileError {
442 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
443 match self {
444 Self::AccessDeniedException(_inner) => _inner.fmt(f),
445 Self::InternalServerException(_inner) => _inner.fmt(f),
446 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
447 Self::ThrottlingException(_inner) => _inner.fmt(f),
448 Self::ValidationException(_inner) => _inner.fmt(f),
449 Self::Unhandled(_inner) => {
450 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
451 write!(f, "unhandled error ({code})")
452 } else {
453 f.write_str("unhandled error")
454 }
455 }
456 }
457 }
458}
459impl ::aws_smithy_types::retry::ProvideErrorKind for GetTileError {
460 fn code(&self) -> ::std::option::Option<&str> {
461 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
462 }
463 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
464 ::std::option::Option::None
465 }
466}
467impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetTileError {
468 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
469 match self {
470 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
471 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
472 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
473 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
474 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
475 Self::Unhandled(_inner) => &_inner.meta,
476 }
477 }
478}
479impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetTileError {
480 fn create_unhandled_error(
481 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
482 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
483 ) -> Self {
484 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
485 source,
486 meta: meta.unwrap_or_default(),
487 })
488 }
489}
490impl ::aws_types::request_id::RequestId for crate::operation::get_tile::GetTileError {
491 fn request_id(&self) -> Option<&str> {
492 self.meta().request_id()
493 }
494}
495
496pub use crate::operation::get_tile::_get_tile_output::GetTileOutput;
497
498pub use crate::operation::get_tile::_get_tile_input::GetTileInput;
499
500mod _get_tile_input;
501
502mod _get_tile_output;
503
504pub mod builders;