aws_sdk_datazone/operation/
list_notifications.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListNotifications;
6impl ListNotifications {
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::list_notifications::ListNotificationsInput,
14 ) -> ::std::result::Result<
15 crate::operation::list_notifications::ListNotificationsOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::list_notifications::ListNotificationsError,
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::list_notifications::ListNotificationsError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::list_notifications::ListNotificationsOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::list_notifications::ListNotificationsInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("datazone", "ListNotifications", input, runtime_plugins, stop_point).await
54 }
55
56 pub(crate) fn operation_runtime_plugins(
57 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
58 client_config: &crate::config::Config,
59 config_override: ::std::option::Option<crate::config::Builder>,
60 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
61 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
62 runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
63 ::aws_runtime::auth::sigv4::SCHEME_ID,
64 ]));
65 if let ::std::option::Option::Some(config_override) = config_override {
66 for plugin in config_override.runtime_plugins.iter().cloned() {
67 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
68 }
69 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
70 config_override,
71 client_config.config.clone(),
72 &client_config.runtime_components,
73 ));
74 }
75 runtime_plugins
76 }
77}
78impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListNotifications {
79 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
80 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListNotifications");
81
82 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
83 ListNotificationsRequestSerializer,
84 ));
85 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
86 ListNotificationsResponseDeserializer,
87 ));
88
89 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
90 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
91 ));
92
93 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
94 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
95 "ListNotifications",
96 "datazone",
97 ));
98 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
99 signing_options.double_uri_encode = true;
100 signing_options.content_sha256_header = false;
101 signing_options.normalize_uri_path = true;
102 signing_options.payload_override = None;
103
104 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
105 signing_options,
106 ..::std::default::Default::default()
107 });
108
109 ::std::option::Option::Some(cfg.freeze())
110 }
111
112 fn runtime_components(
113 &self,
114 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
115 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
116 #[allow(unused_mut)]
117 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListNotifications")
118 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
119 .with_interceptor(ListNotificationsEndpointParamsInterceptor)
120 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
121 crate::operation::list_notifications::ListNotificationsError,
122 >::new())
123 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
124 crate::operation::list_notifications::ListNotificationsError,
125 >::new())
126 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
127 crate::operation::list_notifications::ListNotificationsError,
128 >::new());
129
130 ::std::borrow::Cow::Owned(rcb)
131 }
132}
133
134#[derive(Debug)]
135struct ListNotificationsResponseDeserializer;
136impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListNotificationsResponseDeserializer {
137 fn deserialize_nonstreaming(
138 &self,
139 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
140 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
141 let (success, status) = (response.status().is_success(), response.status().as_u16());
142 let headers = response.headers();
143 let body = response.body().bytes().expect("body loaded");
144 #[allow(unused_mut)]
145 let mut force_error = false;
146 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
147 let parse_result = if !success && status != 200 || force_error {
148 crate::protocol_serde::shape_list_notifications::de_list_notifications_http_error(status, headers, body)
149 } else {
150 crate::protocol_serde::shape_list_notifications::de_list_notifications_http_response(status, headers, body)
151 };
152 crate::protocol_serde::type_erase_result(parse_result)
153 }
154}
155#[derive(Debug)]
156struct ListNotificationsRequestSerializer;
157impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListNotificationsRequestSerializer {
158 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
159 fn serialize_input(
160 &self,
161 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
162 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
163 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
164 let input = input
165 .downcast::<crate::operation::list_notifications::ListNotificationsInput>()
166 .expect("correct type");
167 let _header_serialization_settings = _cfg
168 .load::<crate::serialization_settings::HeaderSerializationSettings>()
169 .cloned()
170 .unwrap_or_default();
171 let mut request_builder = {
172 fn uri_base(
173 _input: &crate::operation::list_notifications::ListNotificationsInput,
174 output: &mut ::std::string::String,
175 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
176 use ::std::fmt::Write as _;
177 let input_1 = &_input.domain_identifier;
178 let input_1 = input_1.as_ref().ok_or_else(|| {
179 ::aws_smithy_types::error::operation::BuildError::missing_field("domain_identifier", "cannot be empty or unset")
180 })?;
181 let domain_identifier = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
182 if domain_identifier.is_empty() {
183 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
184 "domain_identifier",
185 "cannot be empty or unset",
186 ));
187 }
188 ::std::write!(
189 output,
190 "/v2/domains/{domainIdentifier}/notifications",
191 domainIdentifier = domain_identifier
192 )
193 .expect("formatting should succeed");
194 ::std::result::Result::Ok(())
195 }
196 fn uri_query(
197 _input: &crate::operation::list_notifications::ListNotificationsInput,
198 mut output: &mut ::std::string::String,
199 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
200 let mut query = ::aws_smithy_http::query::Writer::new(output);
201 let inner_2 = &_input.r#type;
202 let inner_2 = inner_2
203 .as_ref()
204 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("r#type", "cannot be empty or unset"))?;
205 query.push_kv("type", &::aws_smithy_http::query::fmt_string(inner_2));
206 if let ::std::option::Option::Some(inner_3) = &_input.after_timestamp {
207 {
208 query.push_kv(
209 "afterTimestamp",
210 &::aws_smithy_http::query::fmt_timestamp(inner_3, ::aws_smithy_types::date_time::Format::DateTime)?,
211 );
212 }
213 }
214 if let ::std::option::Option::Some(inner_4) = &_input.before_timestamp {
215 {
216 query.push_kv(
217 "beforeTimestamp",
218 &::aws_smithy_http::query::fmt_timestamp(inner_4, ::aws_smithy_types::date_time::Format::DateTime)?,
219 );
220 }
221 }
222 if let ::std::option::Option::Some(inner_5) = &_input.subjects {
223 {
224 for inner_6 in inner_5 {
225 query.push_kv("subjects", &::aws_smithy_http::query::fmt_string(inner_6));
226 }
227 }
228 }
229 if let ::std::option::Option::Some(inner_7) = &_input.task_status {
230 {
231 query.push_kv("taskStatus", &::aws_smithy_http::query::fmt_string(inner_7));
232 }
233 }
234 if let ::std::option::Option::Some(inner_8) = &_input.max_results {
235 {
236 query.push_kv("maxResults", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
237 }
238 }
239 if let ::std::option::Option::Some(inner_9) = &_input.next_token {
240 {
241 query.push_kv("nextToken", &::aws_smithy_http::query::fmt_string(inner_9));
242 }
243 }
244 ::std::result::Result::Ok(())
245 }
246 #[allow(clippy::unnecessary_wraps)]
247 fn update_http_builder(
248 input: &crate::operation::list_notifications::ListNotificationsInput,
249 builder: ::http::request::Builder,
250 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
251 let mut uri = ::std::string::String::new();
252 uri_base(input, &mut uri)?;
253 uri_query(input, &mut uri)?;
254 ::std::result::Result::Ok(builder.method("GET").uri(uri))
255 }
256 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
257 builder
258 };
259 let body = ::aws_smithy_types::body::SdkBody::from("");
260
261 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
262 }
263}
264#[derive(Debug)]
265struct ListNotificationsEndpointParamsInterceptor;
266
267impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListNotificationsEndpointParamsInterceptor {
268 fn name(&self) -> &'static str {
269 "ListNotificationsEndpointParamsInterceptor"
270 }
271
272 fn read_before_execution(
273 &self,
274 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
275 '_,
276 ::aws_smithy_runtime_api::client::interceptors::context::Input,
277 ::aws_smithy_runtime_api::client::interceptors::context::Output,
278 ::aws_smithy_runtime_api::client::interceptors::context::Error,
279 >,
280 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
281 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
282 let _input = context
283 .input()
284 .downcast_ref::<ListNotificationsInput>()
285 .ok_or("failed to downcast to ListNotificationsInput")?;
286
287 let params = crate::config::endpoint::Params::builder()
288 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
289 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
290 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
291 .build()
292 .map_err(|err| {
293 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
294 })?;
295 cfg.interceptor_state()
296 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
297 ::std::result::Result::Ok(())
298 }
299}
300
301#[non_exhaustive]
306#[derive(::std::fmt::Debug)]
307pub enum ListNotificationsError {
308 AccessDeniedException(crate::types::error::AccessDeniedException),
310 InternalServerException(crate::types::error::InternalServerException),
312 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
314 ValidationException(crate::types::error::ValidationException),
316 ThrottlingException(crate::types::error::ThrottlingException),
318 UnauthorizedException(crate::types::error::UnauthorizedException),
320 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
322 variable wildcard pattern and check `.code()`:
323 \
324 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
325 \
326 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListNotificationsError) for what information is available for the error.")]
327 Unhandled(crate::error::sealed_unhandled::Unhandled),
328}
329impl ListNotificationsError {
330 pub fn unhandled(
332 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
333 ) -> Self {
334 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
335 source: err.into(),
336 meta: ::std::default::Default::default(),
337 })
338 }
339
340 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
342 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
343 source: err.clone().into(),
344 meta: err,
345 })
346 }
347 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
352 match self {
353 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
354 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
355 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
356 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
357 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
358 Self::UnauthorizedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
359 Self::Unhandled(e) => &e.meta,
360 }
361 }
362 pub fn is_access_denied_exception(&self) -> bool {
364 matches!(self, Self::AccessDeniedException(_))
365 }
366 pub fn is_internal_server_exception(&self) -> bool {
368 matches!(self, Self::InternalServerException(_))
369 }
370 pub fn is_resource_not_found_exception(&self) -> bool {
372 matches!(self, Self::ResourceNotFoundException(_))
373 }
374 pub fn is_validation_exception(&self) -> bool {
376 matches!(self, Self::ValidationException(_))
377 }
378 pub fn is_throttling_exception(&self) -> bool {
380 matches!(self, Self::ThrottlingException(_))
381 }
382 pub fn is_unauthorized_exception(&self) -> bool {
384 matches!(self, Self::UnauthorizedException(_))
385 }
386}
387impl ::std::error::Error for ListNotificationsError {
388 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
389 match self {
390 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
391 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
392 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
393 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
394 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
395 Self::UnauthorizedException(_inner) => ::std::option::Option::Some(_inner),
396 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
397 }
398 }
399}
400impl ::std::fmt::Display for ListNotificationsError {
401 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
402 match self {
403 Self::AccessDeniedException(_inner) => _inner.fmt(f),
404 Self::InternalServerException(_inner) => _inner.fmt(f),
405 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
406 Self::ValidationException(_inner) => _inner.fmt(f),
407 Self::ThrottlingException(_inner) => _inner.fmt(f),
408 Self::UnauthorizedException(_inner) => _inner.fmt(f),
409 Self::Unhandled(_inner) => {
410 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
411 write!(f, "unhandled error ({code})")
412 } else {
413 f.write_str("unhandled error")
414 }
415 }
416 }
417 }
418}
419impl ::aws_smithy_types::retry::ProvideErrorKind for ListNotificationsError {
420 fn code(&self) -> ::std::option::Option<&str> {
421 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
422 }
423 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
424 match self {
425 Self::InternalServerException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
426 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
427 _ => ::std::option::Option::None,
428 }
429 }
430}
431impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListNotificationsError {
432 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
433 match self {
434 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
435 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
436 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
437 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
438 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
439 Self::UnauthorizedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
440 Self::Unhandled(_inner) => &_inner.meta,
441 }
442 }
443}
444impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListNotificationsError {
445 fn create_unhandled_error(
446 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
447 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
448 ) -> Self {
449 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
450 source,
451 meta: meta.unwrap_or_default(),
452 })
453 }
454}
455impl ::aws_types::request_id::RequestId for crate::operation::list_notifications::ListNotificationsError {
456 fn request_id(&self) -> Option<&str> {
457 self.meta().request_id()
458 }
459}
460
461pub use crate::operation::list_notifications::_list_notifications_output::ListNotificationsOutput;
462
463pub use crate::operation::list_notifications::_list_notifications_input::ListNotificationsInput;
464
465mod _list_notifications_input;
466
467mod _list_notifications_output;
468
469pub mod builders;
471
472pub mod paginator;