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