aws_sdk_iotwireless/operation/
disassociate_wireless_device_from_multicast_group.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct DisassociateWirelessDeviceFromMulticastGroup;
6impl DisassociateWirelessDeviceFromMulticastGroup {
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::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupInput,
14 ) -> ::std::result::Result<
15 crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError>().expect("correct error type")
27 })
28 };
29 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
30 .await
31 .map_err(map_err)?;
32 let output = context.finalize().map_err(map_err)?;
33 ::std::result::Result::Ok(
34 output
35 .downcast::<crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupOutput>()
36 .expect("correct output type"),
37 )
38 }
39
40 pub(crate) async fn orchestrate_with_stop_point(
41 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
42 input: crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupInput,
43 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
44 ) -> ::std::result::Result<
45 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
46 ::aws_smithy_runtime_api::client::result::SdkError<
47 ::aws_smithy_runtime_api::client::interceptors::context::Error,
48 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
49 >,
50 > {
51 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
52 use ::tracing::Instrument;
53 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
54 "IoT Wireless",
55 "DisassociateWirelessDeviceFromMulticastGroup",
56 input,
57 runtime_plugins,
58 stop_point,
59 )
60 .instrument(::tracing::debug_span!(
63 "IoT Wireless.DisassociateWirelessDeviceFromMulticastGroup",
64 "rpc.service" = "IoT Wireless",
65 "rpc.method" = "DisassociateWirelessDeviceFromMulticastGroup",
66 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
67 "rpc.system" = "aws-api",
68 ))
69 .await
70 }
71
72 pub(crate) fn operation_runtime_plugins(
73 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
74 client_config: &crate::config::Config,
75 config_override: ::std::option::Option<crate::config::Builder>,
76 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
77 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
78
79 if let ::std::option::Option::Some(config_override) = config_override {
80 for plugin in config_override.runtime_plugins.iter().cloned() {
81 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
82 }
83 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
84 config_override,
85 client_config.config.clone(),
86 &client_config.runtime_components,
87 ));
88 }
89 runtime_plugins
90 }
91}
92impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DisassociateWirelessDeviceFromMulticastGroup {
93 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
94 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DisassociateWirelessDeviceFromMulticastGroup");
95
96 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
97 DisassociateWirelessDeviceFromMulticastGroupRequestSerializer,
98 ));
99 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
100 DisassociateWirelessDeviceFromMulticastGroupResponseDeserializer,
101 ));
102
103 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
104 crate::config::auth::Params::builder()
105 .operation_name("DisassociateWirelessDeviceFromMulticastGroup")
106 .build()
107 .expect("required fields set"),
108 ));
109
110 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
111 "DisassociateWirelessDeviceFromMulticastGroup",
112 "IoT Wireless",
113 ));
114 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
115 signing_options.double_uri_encode = true;
116 signing_options.content_sha256_header = false;
117 signing_options.normalize_uri_path = true;
118 signing_options.payload_override = None;
119
120 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
121 signing_options,
122 ..::std::default::Default::default()
123 });
124
125 ::std::option::Option::Some(cfg.freeze())
126 }
127
128 fn runtime_components(
129 &self,
130 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
131 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
132 #[allow(unused_mut)]
133 let mut rcb =
134 ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DisassociateWirelessDeviceFromMulticastGroup")
135 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
136 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
137 ))
138 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
139 DisassociateWirelessDeviceFromMulticastGroupEndpointParamsInterceptor,
140 ))
141 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
142 crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError,
143 >::new())
144 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
145 crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError,
146 >::new())
147 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
148 crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError,
149 >::new());
150
151 ::std::borrow::Cow::Owned(rcb)
152 }
153}
154
155#[derive(Debug)]
156struct DisassociateWirelessDeviceFromMulticastGroupResponseDeserializer;
157impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DisassociateWirelessDeviceFromMulticastGroupResponseDeserializer {
158 fn deserialize_nonstreaming_with_config(
159 &self,
160 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
161 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
162 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
163 let (success, status) = (response.status().is_success(), response.status().as_u16());
164 let headers = response.headers();
165 let body = response.body().bytes().expect("body loaded");
166 #[allow(unused_mut)]
167 let mut force_error = false;
168 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
169 let parse_result = if !success && status != 204 || force_error {
170 crate::protocol_serde::shape_disassociate_wireless_device_from_multicast_group::de_disassociate_wireless_device_from_multicast_group_http_error(status, headers, body)
171 } else {
172 crate::protocol_serde::shape_disassociate_wireless_device_from_multicast_group::de_disassociate_wireless_device_from_multicast_group_http_response(status, headers, body)
173 };
174 crate::protocol_serde::type_erase_result(parse_result)
175 }
176}
177#[derive(Debug)]
178struct DisassociateWirelessDeviceFromMulticastGroupRequestSerializer;
179impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DisassociateWirelessDeviceFromMulticastGroupRequestSerializer {
180 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
181 fn serialize_input(
182 &self,
183 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
184 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
185 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
186 let input = input
187 .downcast::<crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupInput>()
188 .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::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupInput,
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.id;
201 let input_1 = input_1
202 .as_ref()
203 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("id", "cannot be empty or unset"))?;
204 let id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
205 if id.is_empty() {
206 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
207 "id",
208 "cannot be empty or unset",
209 ));
210 }
211 let input_2 = &_input.wireless_device_id;
212 let input_2 = input_2.as_ref().ok_or_else(|| {
213 ::aws_smithy_types::error::operation::BuildError::missing_field("wireless_device_id", "cannot be empty or unset")
214 })?;
215 let wireless_device_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
216 if wireless_device_id.is_empty() {
217 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
218 "wireless_device_id",
219 "cannot be empty or unset",
220 ));
221 }
222 ::std::write!(
223 output,
224 "/multicast-groups/{Id}/wireless-devices/{WirelessDeviceId}",
225 Id = id,
226 WirelessDeviceId = wireless_device_id
227 )
228 .expect("formatting should succeed");
229 ::std::result::Result::Ok(())
230 }
231 #[allow(clippy::unnecessary_wraps)]
232 fn update_http_builder(
233 input: &crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupInput,
234 builder: ::http_1x::request::Builder,
235 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
236 let mut uri = ::std::string::String::new();
237 uri_base(input, &mut uri)?;
238 ::std::result::Result::Ok(builder.method("DELETE").uri(uri))
239 }
240 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
241 builder
242 };
243 let body = ::aws_smithy_types::body::SdkBody::from("");
244
245 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
246 }
247}
248#[derive(Debug)]
249struct DisassociateWirelessDeviceFromMulticastGroupEndpointParamsInterceptor;
250
251#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
252impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DisassociateWirelessDeviceFromMulticastGroupEndpointParamsInterceptor {
253 fn name(&self) -> &'static str {
254 "DisassociateWirelessDeviceFromMulticastGroupEndpointParamsInterceptor"
255 }
256
257 fn read_before_execution(
258 &self,
259 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
260 '_,
261 ::aws_smithy_runtime_api::client::interceptors::context::Input,
262 ::aws_smithy_runtime_api::client::interceptors::context::Output,
263 ::aws_smithy_runtime_api::client::interceptors::context::Error,
264 >,
265 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
266 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
267 let _input = context
268 .input()
269 .downcast_ref::<DisassociateWirelessDeviceFromMulticastGroupInput>()
270 .ok_or("failed to downcast to DisassociateWirelessDeviceFromMulticastGroupInput")?;
271
272 let params = crate::config::endpoint::Params::builder()
273 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
274 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
275 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
276 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
277 .build()
278 .map_err(|err| {
279 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
280 })?;
281 cfg.interceptor_state()
282 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
283 ::std::result::Result::Ok(())
284 }
285}
286
287#[non_exhaustive]
292#[derive(::std::fmt::Debug)]
293pub enum DisassociateWirelessDeviceFromMulticastGroupError {
294 AccessDeniedException(crate::types::error::AccessDeniedException),
296 InternalServerException(crate::types::error::InternalServerException),
298 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
300 ThrottlingException(crate::types::error::ThrottlingException),
302 ValidationException(crate::types::error::ValidationException),
304 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
306 variable wildcard pattern and check `.code()`:
307 \
308 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
309 \
310 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DisassociateWirelessDeviceFromMulticastGroupError) for what information is available for the error.")]
311 Unhandled(crate::error::sealed_unhandled::Unhandled),
312}
313impl DisassociateWirelessDeviceFromMulticastGroupError {
314 pub fn unhandled(
316 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
317 ) -> Self {
318 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
319 source: err.into(),
320 meta: ::std::default::Default::default(),
321 })
322 }
323
324 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
326 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
327 source: err.clone().into(),
328 meta: err,
329 })
330 }
331 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
336 match self {
337 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
338 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
339 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
340 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342 Self::Unhandled(e) => &e.meta,
343 }
344 }
345 pub fn is_access_denied_exception(&self) -> bool {
347 matches!(self, Self::AccessDeniedException(_))
348 }
349 pub fn is_internal_server_exception(&self) -> bool {
351 matches!(self, Self::InternalServerException(_))
352 }
353 pub fn is_resource_not_found_exception(&self) -> bool {
355 matches!(self, Self::ResourceNotFoundException(_))
356 }
357 pub fn is_throttling_exception(&self) -> bool {
359 matches!(self, Self::ThrottlingException(_))
360 }
361 pub fn is_validation_exception(&self) -> bool {
363 matches!(self, Self::ValidationException(_))
364 }
365}
366impl ::std::error::Error for DisassociateWirelessDeviceFromMulticastGroupError {
367 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
368 match self {
369 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
370 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
371 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
372 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
373 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
374 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
375 }
376 }
377}
378impl ::std::fmt::Display for DisassociateWirelessDeviceFromMulticastGroupError {
379 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
380 match self {
381 Self::AccessDeniedException(_inner) => _inner.fmt(f),
382 Self::InternalServerException(_inner) => _inner.fmt(f),
383 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
384 Self::ThrottlingException(_inner) => _inner.fmt(f),
385 Self::ValidationException(_inner) => _inner.fmt(f),
386 Self::Unhandled(_inner) => {
387 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
388 write!(f, "unhandled error ({code})")
389 } else {
390 f.write_str("unhandled error")
391 }
392 }
393 }
394 }
395}
396impl ::aws_smithy_types::retry::ProvideErrorKind for DisassociateWirelessDeviceFromMulticastGroupError {
397 fn code(&self) -> ::std::option::Option<&str> {
398 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
399 }
400 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
401 ::std::option::Option::None
402 }
403}
404impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DisassociateWirelessDeviceFromMulticastGroupError {
405 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
406 match self {
407 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
408 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
409 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
410 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
411 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
412 Self::Unhandled(_inner) => &_inner.meta,
413 }
414 }
415}
416impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DisassociateWirelessDeviceFromMulticastGroupError {
417 fn create_unhandled_error(
418 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
419 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
420 ) -> Self {
421 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
422 source,
423 meta: meta.unwrap_or_default(),
424 })
425 }
426}
427impl ::aws_types::request_id::RequestId
428 for crate::operation::disassociate_wireless_device_from_multicast_group::DisassociateWirelessDeviceFromMulticastGroupError
429{
430 fn request_id(&self) -> Option<&str> {
431 self.meta().request_id()
432 }
433}
434
435pub use crate::operation::disassociate_wireless_device_from_multicast_group::_disassociate_wireless_device_from_multicast_group_input::DisassociateWirelessDeviceFromMulticastGroupInput;
436
437pub use crate::operation::disassociate_wireless_device_from_multicast_group::_disassociate_wireless_device_from_multicast_group_output::DisassociateWirelessDeviceFromMulticastGroupOutput;
438
439mod _disassociate_wireless_device_from_multicast_group_input;
440
441mod _disassociate_wireless_device_from_multicast_group_output;
442
443pub mod builders;