1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ListRules;
6impl ListRules {
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_rules::ListRulesInput,
14 ) -> ::std::result::Result<
15 crate::operation::list_rules::ListRulesOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::list_rules::ListRulesError,
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_rules::ListRulesError>()
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_rules::ListRulesOutput>()
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_rules::ListRulesInput,
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", "ListRules", 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 ListRules {
79 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
80 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListRules");
81
82 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
83 ListRulesRequestSerializer,
84 ));
85 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
86 ListRulesResponseDeserializer,
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("ListRules", "datazone"));
95 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
96 signing_options.double_uri_encode = true;
97 signing_options.content_sha256_header = false;
98 signing_options.normalize_uri_path = true;
99 signing_options.payload_override = None;
100
101 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
102 signing_options,
103 ..::std::default::Default::default()
104 });
105
106 ::std::option::Option::Some(cfg.freeze())
107 }
108
109 fn runtime_components(
110 &self,
111 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
112 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
113 #[allow(unused_mut)]
114 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListRules")
115 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
116 .with_interceptor(ListRulesEndpointParamsInterceptor)
117 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
118 crate::operation::list_rules::ListRulesError,
119 >::new())
120 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
121 crate::operation::list_rules::ListRulesError,
122 >::new())
123 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
124 crate::operation::list_rules::ListRulesError,
125 >::new());
126
127 ::std::borrow::Cow::Owned(rcb)
128 }
129}
130
131#[derive(Debug)]
132struct ListRulesResponseDeserializer;
133impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListRulesResponseDeserializer {
134 fn deserialize_nonstreaming(
135 &self,
136 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
137 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
138 let (success, status) = (response.status().is_success(), response.status().as_u16());
139 let headers = response.headers();
140 let body = response.body().bytes().expect("body loaded");
141 #[allow(unused_mut)]
142 let mut force_error = false;
143 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
144 let parse_result = if !success && status != 200 || force_error {
145 crate::protocol_serde::shape_list_rules::de_list_rules_http_error(status, headers, body)
146 } else {
147 crate::protocol_serde::shape_list_rules::de_list_rules_http_response(status, headers, body)
148 };
149 crate::protocol_serde::type_erase_result(parse_result)
150 }
151}
152#[derive(Debug)]
153struct ListRulesRequestSerializer;
154impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListRulesRequestSerializer {
155 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
156 fn serialize_input(
157 &self,
158 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
159 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
160 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
161 let input = input.downcast::<crate::operation::list_rules::ListRulesInput>().expect("correct type");
162 let _header_serialization_settings = _cfg
163 .load::<crate::serialization_settings::HeaderSerializationSettings>()
164 .cloned()
165 .unwrap_or_default();
166 let mut request_builder = {
167 fn uri_base(
168 _input: &crate::operation::list_rules::ListRulesInput,
169 output: &mut ::std::string::String,
170 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
171 use ::std::fmt::Write as _;
172 let input_1 = &_input.domain_identifier;
173 let input_1 = input_1.as_ref().ok_or_else(|| {
174 ::aws_smithy_types::error::operation::BuildError::missing_field("domain_identifier", "cannot be empty or unset")
175 })?;
176 let domain_identifier = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
177 if domain_identifier.is_empty() {
178 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
179 "domain_identifier",
180 "cannot be empty or unset",
181 ));
182 }
183 let input_2 = &_input.target_type;
184 let input_2 = input_2
185 .as_ref()
186 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target_type", "cannot be empty or unset"))?;
187 let target_type = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
188 if target_type.is_empty() {
189 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
190 "target_type",
191 "cannot be empty or unset",
192 ));
193 }
194 let input_3 = &_input.target_identifier;
195 let input_3 = input_3.as_ref().ok_or_else(|| {
196 ::aws_smithy_types::error::operation::BuildError::missing_field("target_identifier", "cannot be empty or unset")
197 })?;
198 let target_identifier = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
199 if target_identifier.is_empty() {
200 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
201 "target_identifier",
202 "cannot be empty or unset",
203 ));
204 }
205 ::std::write!(
206 output,
207 "/v2/domains/{domainIdentifier}/list-rules/{targetType}/{targetIdentifier}",
208 domainIdentifier = domain_identifier,
209 targetType = target_type,
210 targetIdentifier = target_identifier
211 )
212 .expect("formatting should succeed");
213 ::std::result::Result::Ok(())
214 }
215 fn uri_query(
216 _input: &crate::operation::list_rules::ListRulesInput,
217 mut output: &mut ::std::string::String,
218 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
219 let mut query = ::aws_smithy_http::query::Writer::new(output);
220 if let ::std::option::Option::Some(inner_4) = &_input.rule_type {
221 {
222 query.push_kv("ruleType", &::aws_smithy_http::query::fmt_string(inner_4));
223 }
224 }
225 if let ::std::option::Option::Some(inner_5) = &_input.action {
226 {
227 query.push_kv("ruleAction", &::aws_smithy_http::query::fmt_string(inner_5));
228 }
229 }
230 if let ::std::option::Option::Some(inner_6) = &_input.project_ids {
231 {
232 for inner_7 in inner_6 {
233 query.push_kv("projectIds", &::aws_smithy_http::query::fmt_string(inner_7));
234 }
235 }
236 }
237 if let ::std::option::Option::Some(inner_8) = &_input.asset_types {
238 {
239 for inner_9 in inner_8 {
240 query.push_kv("assetTypes", &::aws_smithy_http::query::fmt_string(inner_9));
241 }
242 }
243 }
244 if let ::std::option::Option::Some(inner_10) = &_input.data_product {
245 {
246 query.push_kv("dataProduct", ::aws_smithy_types::primitive::Encoder::from(*inner_10).encode());
247 }
248 }
249 if let ::std::option::Option::Some(inner_11) = &_input.include_cascaded {
250 {
251 query.push_kv("includeCascaded", ::aws_smithy_types::primitive::Encoder::from(*inner_11).encode());
252 }
253 }
254 if let ::std::option::Option::Some(inner_12) = &_input.max_results {
255 {
256 query.push_kv("maxResults", ::aws_smithy_types::primitive::Encoder::from(*inner_12).encode());
257 }
258 }
259 if let ::std::option::Option::Some(inner_13) = &_input.next_token {
260 {
261 query.push_kv("nextToken", &::aws_smithy_http::query::fmt_string(inner_13));
262 }
263 }
264 ::std::result::Result::Ok(())
265 }
266 #[allow(clippy::unnecessary_wraps)]
267 fn update_http_builder(
268 input: &crate::operation::list_rules::ListRulesInput,
269 builder: ::http::request::Builder,
270 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
271 let mut uri = ::std::string::String::new();
272 uri_base(input, &mut uri)?;
273 uri_query(input, &mut uri)?;
274 ::std::result::Result::Ok(builder.method("GET").uri(uri))
275 }
276 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
277 builder
278 };
279 let body = ::aws_smithy_types::body::SdkBody::from("");
280
281 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
282 }
283}
284#[derive(Debug)]
285struct ListRulesEndpointParamsInterceptor;
286
287impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListRulesEndpointParamsInterceptor {
288 fn name(&self) -> &'static str {
289 "ListRulesEndpointParamsInterceptor"
290 }
291
292 fn read_before_execution(
293 &self,
294 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
295 '_,
296 ::aws_smithy_runtime_api::client::interceptors::context::Input,
297 ::aws_smithy_runtime_api::client::interceptors::context::Output,
298 ::aws_smithy_runtime_api::client::interceptors::context::Error,
299 >,
300 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
301 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
302 let _input = context
303 .input()
304 .downcast_ref::<ListRulesInput>()
305 .ok_or("failed to downcast to ListRulesInput")?;
306
307 let params = crate::config::endpoint::Params::builder()
308 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
309 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
310 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
311 .build()
312 .map_err(|err| {
313 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
314 })?;
315 cfg.interceptor_state()
316 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
317 ::std::result::Result::Ok(())
318 }
319}
320
321#[non_exhaustive]
326#[derive(::std::fmt::Debug)]
327pub enum ListRulesError {
328 AccessDeniedException(crate::types::error::AccessDeniedException),
330 InternalServerException(crate::types::error::InternalServerException),
332 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
334 ThrottlingException(crate::types::error::ThrottlingException),
336 ValidationException(crate::types::error::ValidationException),
338 UnauthorizedException(crate::types::error::UnauthorizedException),
340 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
342 variable wildcard pattern and check `.code()`:
343 \
344 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
345 \
346 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListRulesError) for what information is available for the error.")]
347 Unhandled(crate::error::sealed_unhandled::Unhandled),
348}
349impl ListRulesError {
350 pub fn unhandled(
352 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
353 ) -> Self {
354 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
355 source: err.into(),
356 meta: ::std::default::Default::default(),
357 })
358 }
359
360 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
362 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
363 source: err.clone().into(),
364 meta: err,
365 })
366 }
367 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
372 match self {
373 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
374 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
375 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
376 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
377 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
378 Self::UnauthorizedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
379 Self::Unhandled(e) => &e.meta,
380 }
381 }
382 pub fn is_access_denied_exception(&self) -> bool {
384 matches!(self, Self::AccessDeniedException(_))
385 }
386 pub fn is_internal_server_exception(&self) -> bool {
388 matches!(self, Self::InternalServerException(_))
389 }
390 pub fn is_resource_not_found_exception(&self) -> bool {
392 matches!(self, Self::ResourceNotFoundException(_))
393 }
394 pub fn is_throttling_exception(&self) -> bool {
396 matches!(self, Self::ThrottlingException(_))
397 }
398 pub fn is_validation_exception(&self) -> bool {
400 matches!(self, Self::ValidationException(_))
401 }
402 pub fn is_unauthorized_exception(&self) -> bool {
404 matches!(self, Self::UnauthorizedException(_))
405 }
406}
407impl ::std::error::Error for ListRulesError {
408 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
409 match self {
410 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
411 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
412 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
413 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
414 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
415 Self::UnauthorizedException(_inner) => ::std::option::Option::Some(_inner),
416 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
417 }
418 }
419}
420impl ::std::fmt::Display for ListRulesError {
421 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
422 match self {
423 Self::AccessDeniedException(_inner) => _inner.fmt(f),
424 Self::InternalServerException(_inner) => _inner.fmt(f),
425 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
426 Self::ThrottlingException(_inner) => _inner.fmt(f),
427 Self::ValidationException(_inner) => _inner.fmt(f),
428 Self::UnauthorizedException(_inner) => _inner.fmt(f),
429 Self::Unhandled(_inner) => {
430 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
431 write!(f, "unhandled error ({code})")
432 } else {
433 f.write_str("unhandled error")
434 }
435 }
436 }
437 }
438}
439impl ::aws_smithy_types::retry::ProvideErrorKind for ListRulesError {
440 fn code(&self) -> ::std::option::Option<&str> {
441 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
442 }
443 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
444 match self {
445 Self::InternalServerException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
446 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
447 _ => ::std::option::Option::None,
448 }
449 }
450}
451impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListRulesError {
452 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
453 match self {
454 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
455 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
456 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
457 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
458 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
459 Self::UnauthorizedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
460 Self::Unhandled(_inner) => &_inner.meta,
461 }
462 }
463}
464impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListRulesError {
465 fn create_unhandled_error(
466 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
467 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
468 ) -> Self {
469 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
470 source,
471 meta: meta.unwrap_or_default(),
472 })
473 }
474}
475impl ::aws_types::request_id::RequestId for crate::operation::list_rules::ListRulesError {
476 fn request_id(&self) -> Option<&str> {
477 self.meta().request_id()
478 }
479}
480
481pub use crate::operation::list_rules::_list_rules_output::ListRulesOutput;
482
483pub use crate::operation::list_rules::_list_rules_input::ListRulesInput;
484
485mod _list_rules_input;
486
487mod _list_rules_output;
488
489pub mod builders;
491
492pub mod paginator;