1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /// Orchestration and serialization glue logic for `StartAccessRequest`.
|
3 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4 + | #[non_exhaustive]
|
5 + | pub struct StartAccessRequest;
|
6 + | impl StartAccessRequest {
|
7 + | /// Creates a new `StartAccessRequest`
|
8 + | pub fn new() -> Self {
|
9 + | Self
|
10 + | }
|
11 + | /// The schema for this operation's input shape.
|
12 + | pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::start_access_request::StartAccessRequestInput::SCHEMA;
|
13 + | /// The schema for this operation's output shape.
|
14 + | pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::start_access_request::StartAccessRequestOutput::SCHEMA;
|
15 + | pub(crate) async fn orchestrate(
|
16 + | runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
17 + | input: crate::operation::start_access_request::StartAccessRequestInput,
|
18 + | ) -> ::std::result::Result<
|
19 + | crate::operation::start_access_request::StartAccessRequestOutput,
|
20 + | ::aws_smithy_runtime_api::client::result::SdkError<
|
21 + | crate::operation::start_access_request::StartAccessRequestError,
|
22 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
23 + | >,
|
24 + | > {
|
25 + | let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
|
26 + | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
27 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
28 + | >| {
|
29 + | err.map_service_error(|err| {
|
30 + | err.downcast::<crate::operation::start_access_request::StartAccessRequestError>()
|
31 + | .expect("correct error type")
|
32 + | })
|
33 + | };
|
34 + | let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
|
35 + | .await
|
36 + | .map_err(map_err)?;
|
37 + | let output = context.finalize().map_err(map_err)?;
|
38 + | ::std::result::Result::Ok(
|
39 + | output
|
40 + | .downcast::<crate::operation::start_access_request::StartAccessRequestOutput>()
|
41 + | .expect("correct output type"),
|
42 + | )
|
43 + | }
|
44 + |
|
45 + | pub(crate) async fn orchestrate_with_stop_point(
|
46 + | runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
47 + | input: crate::operation::start_access_request::StartAccessRequestInput,
|
48 + | stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
|
49 + | ) -> ::std::result::Result<
|
50 + | ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
|
51 + | ::aws_smithy_runtime_api::client::result::SdkError<
|
52 + | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
53 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
54 + | >,
|
55 + | > {
|
56 + | let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
|
57 + | use ::tracing::Instrument;
|
58 + | ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("SSM", "StartAccessRequest", input, runtime_plugins, stop_point)
|
59 + | // Create a parent span for the entire operation. Includes a random, internal-only,
|
60 + | // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
|
61 + | .instrument(::tracing::debug_span!(
|
62 + | "SSM.StartAccessRequest",
|
63 + | "rpc.service" = "SSM",
|
64 + | "rpc.method" = "StartAccessRequest",
|
65 + | "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
|
66 + | "rpc.system" = "aws-api",
|
67 + | ))
|
68 + | .await
|
69 + | }
|
70 + |
|
71 + | pub(crate) fn operation_runtime_plugins(
|
72 + | client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
73 + | client_config: &crate::config::Config,
|
74 + | config_override: ::std::option::Option<crate::config::Builder>,
|
75 + | ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
|
76 + | let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
|
77 + |
|
78 + | if let ::std::option::Option::Some(config_override) = config_override {
|
79 + | for plugin in config_override.runtime_plugins.iter().cloned() {
|
80 + | runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
|
81 + | }
|
82 + | runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
|
83 + | config_override,
|
84 + | client_config.config.clone(),
|
85 + | &client_config.runtime_components,
|
86 + | ));
|
87 + | }
|
88 + | runtime_plugins
|
89 + | }
|
90 + | }
|
91 + | /// Per-operation error registry. Contains an entry for every modeled
|
92 + | /// error this operation can throw.
|
93 + | ///
|
94 + | /// Used by the schema-serde error path as the operation-scoped lookup
|
95 + | /// for registry-backed error reification: an error code that does not
|
96 + | /// match one of the operation's modeled errors directly is resolved
|
97 + | /// against this registry first, then widened to the service-wide error
|
98 + | /// registry.
|
99 + | pub(crate) mod error_registry {
|
100 + | pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
|
101 + | ::aws_smithy_schema::registry::TypeRegistry::builder()
|
102 + | .insert_error_shape(
|
103 + | crate::types::error::AccessDeniedException::SCHEMA,
|
104 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
105 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AccessDeniedException::deserialize(d)?))
|
106 + | },
|
107 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
108 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AccessDeniedException::deserialize(d)?))
|
109 + | },
|
110 + | )
|
111 + | .insert_error_shape(
|
112 + | crate::types::error::InternalServerError::SCHEMA,
|
113 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
114 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServerError::deserialize(d)?))
|
115 + | },
|
116 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
117 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServerError::deserialize(d)?))
|
118 + | },
|
119 + | )
|
120 + | .insert_error_shape(
|
121 + | crate::types::error::ResourceNotFoundException::SCHEMA,
|
122 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
123 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
|
124 + | },
|
125 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
126 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
|
127 + | },
|
128 + | )
|
129 + | .insert_error_shape(
|
130 + | crate::types::error::ServiceQuotaExceededException::SCHEMA,
|
131 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
132 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ServiceQuotaExceededException::deserialize(d)?))
|
133 + | },
|
134 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
135 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ServiceQuotaExceededException::deserialize(d)?))
|
136 + | },
|
137 + | )
|
138 + | .insert_error_shape(
|
139 + | crate::types::error::ThrottlingException::SCHEMA,
|
140 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
141 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ThrottlingException::deserialize(d)?))
|
142 + | },
|
143 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
144 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ThrottlingException::deserialize(d)?))
|
145 + | },
|
146 + | )
|
147 + | .insert_error_shape(
|
148 + | crate::types::error::ValidationException::SCHEMA,
|
149 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
|
150 + | ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ValidationException::deserialize(d)?))
|
151 + | },
|
152 + | |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
|
153 + | ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ValidationException::deserialize(d)?))
|
154 + | },
|
155 + | )
|
156 + | .build()
|
157 + | });
|
158 + | }
|
159 + | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for StartAccessRequest {
|
160 + | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
161 + | let mut cfg = ::aws_smithy_types::config_bag::Layer::new("StartAccessRequest");
|
162 + |
|
163 + | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
|
164 + | StartAccessRequestRequestSerializer,
|
165 + | ));
|
166 + | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
|
167 + | StartAccessRequestResponseDeserializer,
|
168 + | ));
|
169 + |
|
170 + | cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
|
171 + | crate::config::auth::Params::builder()
|
172 + | .operation_name("StartAccessRequest")
|
173 + | .build()
|
174 + | .expect("required fields set"),
|
175 + | ));
|
176 + |
|
177 + | cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("StartAccessRequest", "SSM"));
|
178 + | let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
|
179 + | signing_options.double_uri_encode = true;
|
180 + | signing_options.content_sha256_header = false;
|
181 + | signing_options.normalize_uri_path = true;
|
182 + | signing_options.payload_override = None;
|
183 + |
|
184 + | cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
|
185 + | signing_options,
|
186 + | ..::std::default::Default::default()
|
187 + | });
|
188 + |
|
189 + | ::std::option::Option::Some(cfg.freeze())
|
190 + | }
|
191 + |
|
192 + | fn runtime_components(
|
193 + | &self,
|
194 + | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
195 + | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
196 + | #[allow(unused_mut)]
|
197 + | let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("StartAccessRequest")
|
198 + | .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
|
199 + | StartAccessRequestTelemetryInputCaptureInterceptor,
|
200 + | ))
|
201 + | .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
|
202 + | ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
|
203 + | ))
|
204 + | .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
|
205 + | StartAccessRequestEndpointParamsInterceptor,
|
206 + | ))
|
207 + | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
|
208 + | crate::operation::start_access_request::StartAccessRequestError,
|
209 + | >::new())
|
210 + | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
|
211 + | crate::operation::start_access_request::StartAccessRequestError,
|
212 + | >::new())
|
213 + | .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
|
214 + | crate::operation::start_access_request::StartAccessRequestError,
|
215 + | >::new())
|
216 + | .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
|
217 + | crate::operation::start_access_request::StartAccessRequestError,
|
218 + | >::new());
|
219 + |
|
220 + | ::std::borrow::Cow::Owned(rcb)
|
221 + | }
|
222 + | }
|
223 + |
|
224 + | #[derive(Debug)]
|
225 + | struct StartAccessRequestTelemetryInputCaptureInterceptor;
|
226 + |
|
227 + | #[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
|
228 + | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartAccessRequestTelemetryInputCaptureInterceptor {
|
229 + | fn name(&self) -> &'static str {
|
230 + | "StartAccessRequestTelemetryInputCaptureInterceptor"
|
231 + | }
|
232 + |
|
233 + | fn read_before_execution(
|
234 + | &self,
|
235 + | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
236 + | '_,
|
237 + | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
238 + | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
239 + | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
240 + | >,
|
241 + | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
242 + | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
243 + | // Nothing to do unless the customer opted in by naming members to record.
|
244 + | let ::std::option::Option::Some(requested) = cfg
|
245 + | .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
|
246 + | .filter(|r| !r.is_empty())
|
247 + | else {
|
248 + | return ::std::result::Result::Ok(());
|
249 + | };
|
250 + |
|
251 + | let ::std::option::Option::Some(input) = context.input().downcast_ref::<StartAccessRequestInput>() else {
|
252 + | // A mismatched input is not this interceptor's concern; skip quietly.
|
253 + | return ::std::result::Result::Ok(());
|
254 + | };
|
255 + |
|
256 + | let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
|
257 + | if requested.should_capture("Reason") {
|
258 + | if let ::std::option::Option::Some(value) = input.reason.as_deref() {
|
259 + | captured.insert("Reason", value);
|
260 + | }
|
261 + | }
|
262 + |
|
263 + | cfg.interceptor_state().store_put(captured);
|
264 + | ::std::result::Result::Ok(())
|
265 + | }
|
266 + | }
|
267 + | #[derive(Debug)]
|
268 + | struct StartAccessRequestResponseDeserializer;
|
269 + | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StartAccessRequestResponseDeserializer {
|
270 + | fn deserialize_nonstreaming_with_config(
|
271 + | &self,
|
272 + | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
273 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
274 + | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
275 + | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
276 + | // Load body and headers BEFORE BeforeParseResponse so customizations
|
277 + | // (e.g., S3's `body_is_error` check that detects errors returned with
|
278 + | // HTTP 200) can inspect them. The legacy non-streaming path also
|
279 + | // loads `body` before firing this hook.
|
280 + | let body = response.body().bytes().expect("body loaded");
|
281 + | let headers = response.headers();
|
282 + | #[allow(unused_mut)]
|
283 + | let mut force_error = false;
|
284 + | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
285 + | if !success && status != 200 || force_error {
|
286 + | let protocol = _cfg
|
287 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
288 + | .expect("a SharedClientProtocol is required");
|
289 + | #[allow(unused_mut)]
|
290 + | let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
|
291 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
292 + | })?;
|
293 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
294 + | let generic = generic_builder.build();
|
295 + | let error_code = match generic.code() {
|
296 + | ::std::option::Option::Some(code) => code,
|
297 + | ::std::option::Option::None => {
|
298 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
299 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
300 + | crate::operation::start_access_request::StartAccessRequestError::unhandled(generic),
|
301 + | ),
|
302 + | ))
|
303 + | }
|
304 + | };
|
305 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
306 + | let err = match error_code {
|
307 + | "AccessDeniedException" => crate::operation::start_access_request::StartAccessRequestError::AccessDeniedException({
|
308 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
309 + | crate::types::error::AccessDeniedException::deserialize_with_response(
|
310 + | &mut *deser,
|
311 + | response.headers(),
|
312 + | response.status().into(),
|
313 + | body,
|
314 + | )
|
315 + | }) {
|
316 + | ::std::result::Result::Ok(val) => val,
|
317 + | ::std::result::Result::Err(e) => {
|
318 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
319 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
320 + | ))
|
321 + | }
|
322 + | };
|
323 + | tmp.meta = generic;
|
324 + | tmp
|
325 + | }),
|
326 + | "InternalServerError" => crate::operation::start_access_request::StartAccessRequestError::InternalServerError({
|
327 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
328 + | crate::types::error::InternalServerError::deserialize_with_response(
|
329 + | &mut *deser,
|
330 + | response.headers(),
|
331 + | response.status().into(),
|
332 + | body,
|
333 + | )
|
334 + | }) {
|
335 + | ::std::result::Result::Ok(val) => val,
|
336 + | ::std::result::Result::Err(e) => {
|
337 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
338 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
339 + | ))
|
340 + | }
|
341 + | };
|
342 + | tmp.meta = generic;
|
343 + | if tmp.message.is_none() {
|
344 + | tmp.message = _error_message;
|
345 + | }
|
346 + | tmp
|
347 + | }),
|
348 + | "ResourceNotFoundException" => crate::operation::start_access_request::StartAccessRequestError::ResourceNotFoundException({
|
349 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
350 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
351 + | &mut *deser,
|
352 + | response.headers(),
|
353 + | response.status().into(),
|
354 + | body,
|
355 + | )
|
356 + | }) {
|
357 + | ::std::result::Result::Ok(val) => val,
|
358 + | ::std::result::Result::Err(e) => {
|
359 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
360 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
361 + | ))
|
362 + | }
|
363 + | };
|
364 + | tmp.meta = generic;
|
365 + | if tmp.message.is_none() {
|
366 + | tmp.message = _error_message;
|
367 + | }
|
368 + | tmp
|
369 + | }),
|
370 + | "ServiceQuotaExceededException" => crate::operation::start_access_request::StartAccessRequestError::ServiceQuotaExceededException({
|
371 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
372 + | crate::types::error::ServiceQuotaExceededException::deserialize_with_response(
|
373 + | &mut *deser,
|
374 + | response.headers(),
|
375 + | response.status().into(),
|
376 + | body,
|
377 + | )
|
378 + | }) {
|
379 + | ::std::result::Result::Ok(val) => val,
|
380 + | ::std::result::Result::Err(e) => {
|
381 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
382 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
383 + | ))
|
384 + | }
|
385 + | };
|
386 + | tmp.meta = generic;
|
387 + | tmp
|
388 + | }),
|
389 + | "ThrottlingException" => crate::operation::start_access_request::StartAccessRequestError::ThrottlingException({
|
390 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
391 + | crate::types::error::ThrottlingException::deserialize_with_response(
|
392 + | &mut *deser,
|
393 + | response.headers(),
|
394 + | response.status().into(),
|
395 + | body,
|
396 + | )
|
397 + | }) {
|
398 + | ::std::result::Result::Ok(val) => val,
|
399 + | ::std::result::Result::Err(e) => {
|
400 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
401 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
402 + | ))
|
403 + | }
|
404 + | };
|
405 + | tmp.meta = generic;
|
406 + | tmp
|
407 + | }),
|
408 + | "ValidationException" => crate::operation::start_access_request::StartAccessRequestError::ValidationException({
|
409 + | let mut tmp = match protocol.deserialize_error_response(response, _cfg).and_then(|mut deser| {
|
410 + | crate::types::error::ValidationException::deserialize_with_response(
|
411 + | &mut *deser,
|
412 + | response.headers(),
|
413 + | response.status().into(),
|
414 + | body,
|
415 + | )
|
416 + | }) {
|
417 + | ::std::result::Result::Ok(val) => val,
|
418 + | ::std::result::Result::Err(e) => {
|
419 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
420 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
421 + | ))
|
422 + | }
|
423 + | };
|
424 + | tmp.meta = generic;
|
425 + | if tmp.message.is_none() {
|
426 + | tmp.message = _error_message;
|
427 + | }
|
428 + | tmp
|
429 + | }),
|
430 + | _ => {
|
431 + | // Registry-backed, operation-scoped reification of an error whose
|
432 + | // code this operation does not model directly: the operation's own
|
433 + | // error registry is consulted first, then the lookup widens to the
|
434 + | // service-wide error registry. On a hit, the reified error is attached
|
435 + | // as the source of the returned unhandled error while its metadata
|
436 + | // (code, message, request id) is preserved; on a miss the generic
|
437 + | // error is returned unchanged.
|
438 + | match protocol
|
439 + | .deserialize_error_response(response, _cfg)
|
440 + | .ok()
|
441 + | .and_then(|mut deser| {
|
442 + | ::aws_smithy_schema::registry::reify_error(
|
443 + | crate::operation::start_access_request::error_registry::REGISTRY
|
444 + | .or(&crate::error_type_registry::REGISTRY),
|
445 + | error_code,
|
446 + | &mut *deser,
|
447 + | )
|
448 + | }) {
|
449 + | ::std::option::Option::Some(source) => <crate::operation::start_access_request::StartAccessRequestError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
|
450 + | ::std::option::Option::None => crate::operation::start_access_request::StartAccessRequestError::generic(generic),
|
451 + | }
|
452 + | }
|
453 + | };
|
454 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
455 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
456 + | ))
|
457 + | } else {
|
458 + | let protocol = _cfg
|
459 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
460 + | .expect("a SharedClientProtocol is required");
|
461 + | let mut deser = protocol
|
462 + | .deserialize_response(response, StartAccessRequest::OUTPUT_SCHEMA, _cfg)
|
463 + | .map_err(|e| {
|
464 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
465 + | })?;
|
466 + | // body and headers are already in scope from the top of the function;
|
467 + | // alias `headers` as `_response_headers` so MutateOutput
|
468 + | // customizations have a stable name to read from.
|
469 + | let _response_headers = headers;
|
470 + | #[allow(unused_mut)]
|
471 + | let mut output = crate::operation::start_access_request::StartAccessRequestOutput::deserialize_with_response(
|
472 + | &mut *deser,
|
473 + | _response_headers,
|
474 + | response.status().into(),
|
475 + | body,
|
476 + | )
|
477 + | .map_err(|e| {
|
478 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
479 + | })?;
|
480 + | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
481 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
482 + | }
|
483 + | }
|
484 + | }
|
485 + | #[derive(Debug)]
|
486 + | struct StartAccessRequestRequestSerializer;
|
487 + | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StartAccessRequestRequestSerializer {
|
488 + | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
489 + | fn serialize_input(
|
490 + | &self,
|
491 + | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
492 + | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
493 + | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
494 + | let input = input
|
495 + | .downcast::<crate::operation::start_access_request::StartAccessRequestInput>()
|
496 + | .expect("correct type");
|
497 + |
|
498 + | let protocol = _cfg
|
499 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
500 + | .expect("a SharedClientProtocol is required");
|
501 + | let mut request = protocol
|
502 + | .serialize_request(&input, StartAccessRequest::INPUT_SCHEMA, "/", _cfg)
|
503 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
504 + |
|
505 + | return ::std::result::Result::Ok(request);
|
506 + | }
|
507 + | }
|
508 + | #[derive(Debug)]
|
509 + | struct StartAccessRequestEndpointParamsInterceptor;
|
510 + |
|
511 + | #[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
|
512 + | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartAccessRequestEndpointParamsInterceptor {
|
513 + | fn name(&self) -> &'static str {
|
514 + | "StartAccessRequestEndpointParamsInterceptor"
|
515 + | }
|
516 + |
|
517 + | fn read_before_execution(
|
518 + | &self,
|
519 + | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
520 + | '_,
|
521 + | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
522 + | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
523 + | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
524 + | >,
|
525 + | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
526 + | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
527 + | let _input = context
|
528 + | .input()
|
529 + | .downcast_ref::<StartAccessRequestInput>()
|
530 + | .ok_or("failed to downcast to StartAccessRequestInput")?;
|
531 + |
|
532 + | let params = crate::config::endpoint::Params::builder()
|
533 + | .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
|
534 + | .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
|
535 + | .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
|
536 + | .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
|
537 + | .build()
|
538 + | .map_err(|err| {
|
539 + | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
540 + | })?;
|
541 + | cfg.interceptor_state()
|
542 + | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
543 + | ::std::result::Result::Ok(())
|
544 + | }
|
545 + | }
|
546 + |
|
547 + | // The get_* functions below are generated from JMESPath expressions in the
|
548 + | // operationContextParams trait. They target the operation's input shape.
|
549 + |
|
550 + | /// Error type for the `StartAccessRequestError` operation.
|
551 + | #[non_exhaustive]
|
552 + | #[derive(::std::fmt::Debug)]
|
553 + | pub enum StartAccessRequestError {
|
554 + | /// <p>The requester doesn't have permissions to perform the requested operation.</p>
|
555 + | AccessDeniedException(crate::types::error::AccessDeniedException),
|
556 + | /// <p>An error occurred on the server side.</p>
|
557 + | InternalServerError(crate::types::error::InternalServerError),
|
558 + | /// <p>The specified parameter to be shared could not be found.</p>
|
559 + | ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
|
560 + | /// <p>The request exceeds the service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account.</p>
|
561 + | ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
|
562 + | /// <p>The request or operation couldn't be performed because the service is throttling requests.</p>
|
563 + | ThrottlingException(crate::types::error::ThrottlingException),
|
564 + | /// <p>The request isn't valid. Verify that you entered valid contents for the command and try again.</p>
|
565 + | ValidationException(crate::types::error::ValidationException),
|
566 + | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
567 + | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
568 + | variable wildcard pattern and check `.code()`:
|
569 + | \
|
570 + | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
571 + | \
|
572 + | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-StartAccessRequestError) for what information is available for the error.")]
|
573 + | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
574 + | }
|
575 + | impl StartAccessRequestError {
|
576 + | /// Creates the `StartAccessRequestError::Unhandled` variant from any error type.
|
577 + | pub fn unhandled(
|
578 + | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|
579 + | ) -> Self {
|
580 + | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
581 + | source: err.into(),
|
582 + | meta: ::std::default::Default::default(),
|
583 + | })
|
584 + | }
|
585 + |
|
586 + | /// Creates the `StartAccessRequestError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
|
587 + | pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
588 + | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
589 + | source: err.clone().into(),
|
590 + | meta: err,
|
591 + | })
|
592 + | }
|
593 + | ///
|
594 + | /// Returns error metadata, which includes the error code, message,
|
595 + | /// request ID, and potentially additional information.
|
596 + | ///
|
597 + | pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
598 + | match self {
|
599 + | Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
600 + | Self::InternalServerError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
601 + | Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
602 + | Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
603 + | Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
604 + | Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
|
605 + | Self::Unhandled(e) => &e.meta,
|
606 + | }
|
607 + | }
|
608 + | /// Returns `true` if the error kind is `StartAccessRequestError::AccessDeniedException`.
|
609 + | pub fn is_access_denied_exception(&self) -> bool {
|
610 + | matches!(self, Self::AccessDeniedException(_))
|
611 + | }
|
612 + | /// Returns `true` if the error kind is `StartAccessRequestError::InternalServerError`.
|
613 + | pub fn is_internal_server_error(&self) -> bool {
|
614 + | matches!(self, Self::InternalServerError(_))
|
615 + | }
|
616 + | /// Returns `true` if the error kind is `StartAccessRequestError::ResourceNotFoundException`.
|
617 + | pub fn is_resource_not_found_exception(&self) -> bool {
|
618 + | matches!(self, Self::ResourceNotFoundException(_))
|
619 + | }
|
620 + | /// Returns `true` if the error kind is `StartAccessRequestError::ServiceQuotaExceededException`.
|
621 + | pub fn is_service_quota_exceeded_exception(&self) -> bool {
|
622 + | matches!(self, Self::ServiceQuotaExceededException(_))
|
623 + | }
|
624 + | /// Returns `true` if the error kind is `StartAccessRequestError::ThrottlingException`.
|
625 + | pub fn is_throttling_exception(&self) -> bool {
|
626 + | matches!(self, Self::ThrottlingException(_))
|
627 + | }
|
628 + | /// Returns `true` if the error kind is `StartAccessRequestError::ValidationException`.
|
629 + | pub fn is_validation_exception(&self) -> bool {
|
630 + | matches!(self, Self::ValidationException(_))
|
631 + | }
|
632 + | }
|
633 + | impl ::std::error::Error for StartAccessRequestError {
|
634 + | fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
635 + | match self {
|
636 + | Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
|
637 + | Self::InternalServerError(_inner) => ::std::option::Option::Some(_inner),
|
638 + | Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
|
639 + | Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
|
640 + | Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
|
641 + | Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
|
642 + | Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
|
643 + | }
|
644 + | }
|
645 + | }
|
646 + | impl ::std::fmt::Display for StartAccessRequestError {
|
647 + | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
648 + | match self {
|
649 + | Self::AccessDeniedException(_inner) => _inner.fmt(f),
|
650 + | Self::InternalServerError(_inner) => _inner.fmt(f),
|
651 + | Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
|
652 + | Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
|
653 + | Self::ThrottlingException(_inner) => _inner.fmt(f),
|
654 + | Self::ValidationException(_inner) => _inner.fmt(f),
|
655 + | Self::Unhandled(_inner) => {
|
656 + | if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
|
657 + | write!(f, "unhandled error ({code})")
|
658 + | } else {
|
659 + | f.write_str("unhandled error")
|
660 + | }
|
661 + | }
|
662 + | }
|
663 + | }
|
664 + | }
|
665 + | impl ::aws_smithy_types::retry::ProvideErrorKind for StartAccessRequestError {
|
666 + | fn code(&self) -> ::std::option::Option<&str> {
|
667 + | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
|
668 + | }
|
669 + | fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
|
670 + | ::std::option::Option::None
|
671 + | }
|
672 + | }
|
673 + | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for StartAccessRequestError {
|
674 + | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
675 + | match self {
|
676 + | Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
677 + | Self::InternalServerError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
678 + | Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
679 + | Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
680 + | Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
681 + | Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
|
682 + | Self::Unhandled(_inner) => &_inner.meta,
|
683 + | }
|
684 + | }
|
685 + | }
|
686 + | impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for StartAccessRequestError {
|
687 + | fn create_unhandled_error(
|
688 + | source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
|
689 + | meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
690 + | ) -> Self {
|
691 + | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
692 + | source,
|
693 + | meta: meta.unwrap_or_default(),
|
694 + | })
|
695 + | }
|
696 + | }
|
697 + | impl ::aws_types::request_id::RequestId for crate::operation::start_access_request::StartAccessRequestError {
|
698 + | fn request_id(&self) -> Option<&str> {
|
699 + | self.meta().request_id()
|
700 + | }
|
701 + | }
|
702 + |
|
703 + | pub use crate::operation::start_access_request::_start_access_request_input::StartAccessRequestInput;
|
704 + |
|
705 + | pub use crate::operation::start_access_request::_start_access_request_output::StartAccessRequestOutput;
|
706 + |
|
707 + | mod _start_access_request_input;
|
708 + |
|
709 + | mod _start_access_request_output;
|
710 + |
|
711 + | /// Builders
|
712 + | pub mod builders;
|