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 fn uri_base(
190 _input: &crate::operation::get_tile::GetTileInput,
191 output: &mut ::std::string::String,
192 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
193 use ::std::fmt::Write as _;
194 let input_1 = &_input.z;
195 let input_1 = input_1
196 .as_ref()
197 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("z", "cannot be empty or unset"))?;
198 let mut z_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
199 let z = z_encoder.encode();
200 if z.is_empty() {
201 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
202 "z",
203 "cannot be empty or unset",
204 ));
205 }
206 let input_2 = &_input.x;
207 let input_2 = input_2
208 .as_ref()
209 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("x", "cannot be empty or unset"))?;
210 let mut x_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
211 let x = x_encoder.encode();
212 if x.is_empty() {
213 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
214 "x",
215 "cannot be empty or unset",
216 ));
217 }
218 let input_3 = &_input.y;
219 let input_3 = input_3
220 .as_ref()
221 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("y", "cannot be empty or unset"))?;
222 let mut y_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_3);
223 let y = y_encoder.encode();
224 if y.is_empty() {
225 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
226 "y",
227 "cannot be empty or unset",
228 ));
229 }
230 ::std::write!(output, "/tile/{z}/{x}/{y}", z = z, x = x, y = y).expect("formatting should succeed");
231 ::std::result::Result::Ok(())
232 }
233 fn uri_query(
234 _input: &crate::operation::get_tile::GetTileInput,
235 mut output: &mut ::std::string::String,
236 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
237 let mut query = ::aws_smithy_http::query::Writer::new(output);
238 let inner_4 = &_input.image_assets;
239 let inner_4 = inner_4
240 .as_ref()
241 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("image_assets", "cannot be empty or unset"))?;
242 for inner_5 in inner_4 {
243 query.push_kv("ImageAssets", &::aws_smithy_http::query::fmt_string(inner_5));
244 }
245 let inner_6 = &_input.target;
246 let inner_6 = inner_6
247 .as_ref()
248 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target", "cannot be empty or unset"))?;
249 query.push_kv("Target", &::aws_smithy_http::query::fmt_string(inner_6));
250 let inner_7 = &_input.arn;
251 let inner_7 = inner_7
252 .as_ref()
253 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("arn", "cannot be empty or unset"))?;
254 if inner_7.is_empty() {
255 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
256 "arn",
257 "cannot be empty or unset",
258 ));
259 }
260 query.push_kv("Arn", &::aws_smithy_http::query::fmt_string(inner_7));
261 if let ::std::option::Option::Some(inner_8) = &_input.image_mask {
262 {
263 query.push_kv("ImageMask", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
264 }
265 }
266 if let ::std::option::Option::Some(inner_9) = &_input.output_format {
267 {
268 query.push_kv("OutputFormat", &::aws_smithy_http::query::fmt_string(inner_9));
269 }
270 }
271 if let ::std::option::Option::Some(inner_10) = &_input.time_range_filter {
272 {
273 query.push_kv("TimeRangeFilter", &::aws_smithy_http::query::fmt_string(inner_10));
274 }
275 }
276 if let ::std::option::Option::Some(inner_11) = &_input.property_filters {
277 {
278 query.push_kv("PropertyFilters", &::aws_smithy_http::query::fmt_string(inner_11));
279 }
280 }
281 if let ::std::option::Option::Some(inner_12) = &_input.output_data_type {
282 {
283 query.push_kv("OutputDataType", &::aws_smithy_http::query::fmt_string(inner_12));
284 }
285 }
286 if let ::std::option::Option::Some(inner_13) = &_input.execution_role_arn {
287 {
288 query.push_kv("ExecutionRoleArn", &::aws_smithy_http::query::fmt_string(inner_13));
289 }
290 }
291 ::std::result::Result::Ok(())
292 }
293 #[allow(clippy::unnecessary_wraps)]
294 fn update_http_builder(
295 input: &crate::operation::get_tile::GetTileInput,
296 builder: ::http::request::Builder,
297 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
298 let mut uri = ::std::string::String::new();
299 uri_base(input, &mut uri)?;
300 uri_query(input, &mut uri)?;
301 ::std::result::Result::Ok(builder.method("GET").uri(uri))
302 }
303 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
304 builder
305 };
306 let body = ::aws_smithy_types::body::SdkBody::from("");
307
308 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
309 }
310}
311#[derive(Debug)]
312struct GetTileEndpointParamsInterceptor;
313
314impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetTileEndpointParamsInterceptor {
315 fn name(&self) -> &'static str {
316 "GetTileEndpointParamsInterceptor"
317 }
318
319 fn read_before_execution(
320 &self,
321 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
322 '_,
323 ::aws_smithy_runtime_api::client::interceptors::context::Input,
324 ::aws_smithy_runtime_api::client::interceptors::context::Output,
325 ::aws_smithy_runtime_api::client::interceptors::context::Error,
326 >,
327 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
328 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
329 let _input = context
330 .input()
331 .downcast_ref::<GetTileInput>()
332 .ok_or("failed to downcast to GetTileInput")?;
333
334 let params = crate::config::endpoint::Params::builder()
335 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
336 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
337 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
338 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
339 .build()
340 .map_err(|err| {
341 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
342 })?;
343 cfg.interceptor_state()
344 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
345 ::std::result::Result::Ok(())
346 }
347}
348
349#[non_exhaustive]
354#[derive(::std::fmt::Debug)]
355pub enum GetTileError {
356 AccessDeniedException(crate::types::error::AccessDeniedException),
358 InternalServerException(crate::types::error::InternalServerException),
360 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
362 ThrottlingException(crate::types::error::ThrottlingException),
364 ValidationException(crate::types::error::ValidationException),
366 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
368 variable wildcard pattern and check `.code()`:
369 \
370 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
371 \
372 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetTileError) for what information is available for the error.")]
373 Unhandled(crate::error::sealed_unhandled::Unhandled),
374}
375impl GetTileError {
376 pub fn unhandled(
378 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
379 ) -> Self {
380 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
381 source: err.into(),
382 meta: ::std::default::Default::default(),
383 })
384 }
385
386 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
388 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
389 source: err.clone().into(),
390 meta: err,
391 })
392 }
393 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
398 match self {
399 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
400 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
401 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
402 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
403 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
404 Self::Unhandled(e) => &e.meta,
405 }
406 }
407 pub fn is_access_denied_exception(&self) -> bool {
409 matches!(self, Self::AccessDeniedException(_))
410 }
411 pub fn is_internal_server_exception(&self) -> bool {
413 matches!(self, Self::InternalServerException(_))
414 }
415 pub fn is_resource_not_found_exception(&self) -> bool {
417 matches!(self, Self::ResourceNotFoundException(_))
418 }
419 pub fn is_throttling_exception(&self) -> bool {
421 matches!(self, Self::ThrottlingException(_))
422 }
423 pub fn is_validation_exception(&self) -> bool {
425 matches!(self, Self::ValidationException(_))
426 }
427}
428impl ::std::error::Error for GetTileError {
429 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
430 match self {
431 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
432 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
433 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
434 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
435 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
436 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
437 }
438 }
439}
440impl ::std::fmt::Display for GetTileError {
441 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
442 match self {
443 Self::AccessDeniedException(_inner) => _inner.fmt(f),
444 Self::InternalServerException(_inner) => _inner.fmt(f),
445 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
446 Self::ThrottlingException(_inner) => _inner.fmt(f),
447 Self::ValidationException(_inner) => _inner.fmt(f),
448 Self::Unhandled(_inner) => {
449 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
450 write!(f, "unhandled error ({code})")
451 } else {
452 f.write_str("unhandled error")
453 }
454 }
455 }
456 }
457}
458impl ::aws_smithy_types::retry::ProvideErrorKind for GetTileError {
459 fn code(&self) -> ::std::option::Option<&str> {
460 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
461 }
462 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
463 ::std::option::Option::None
464 }
465}
466impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetTileError {
467 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
468 match self {
469 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
470 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
471 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
472 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
473 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
474 Self::Unhandled(_inner) => &_inner.meta,
475 }
476 }
477}
478impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetTileError {
479 fn create_unhandled_error(
480 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
481 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
482 ) -> Self {
483 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
484 source,
485 meta: meta.unwrap_or_default(),
486 })
487 }
488}
489impl ::aws_types::request_id::RequestId for crate::operation::get_tile::GetTileError {
490 fn request_id(&self) -> Option<&str> {
491 self.meta().request_id()
492 }
493}
494
495pub use crate::operation::get_tile::_get_tile_output::GetTileOutput;
496
497pub use crate::operation::get_tile::_get_tile_input::GetTileInput;
498
499mod _get_tile_input;
500
501mod _get_tile_output;
502
503pub mod builders;