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