aws_sdk_s3control/operation/
get_data_access.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetDataAccess;
6impl GetDataAccess {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::get_data_access::GetDataAccessInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_data_access::GetDataAccessOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_data_access::GetDataAccessError,
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::get_data_access::GetDataAccessError>()
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::get_data_access::GetDataAccessOutput>()
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::get_data_access::GetDataAccessInput,
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 use ::tracing::Instrument;
54 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("S3 Control", "GetDataAccess", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "S3 Control.GetDataAccess",
59 "rpc.service" = "S3 Control",
60 "rpc.method" = "GetDataAccess",
61 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62 "rpc.system" = "aws-api",
63 ))
64 .await
65 }
66
67 pub(crate) fn operation_runtime_plugins(
68 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69 client_config: &crate::config::Config,
70 config_override: ::std::option::Option<crate::config::Builder>,
71 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73 runtime_plugins = runtime_plugins
74 .with_operation_plugin(crate::client_http_checksum_required::HttpChecksumRequiredRuntimePlugin::new())
75 .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
76 ::aws_runtime::auth::sigv4::SCHEME_ID,
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}
91impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetDataAccess {
92 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
93 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetDataAccess");
94
95 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
96 GetDataAccessRequestSerializer,
97 ));
98 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
99 GetDataAccessResponseDeserializer,
100 ));
101
102 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
103 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
104 ));
105
106 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
107 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
108 "GetDataAccess",
109 "S3 Control",
110 ));
111 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
112 signing_options.double_uri_encode = true;
113 signing_options.content_sha256_header = true;
114 signing_options.normalize_uri_path = true;
115 signing_options.payload_override = None;
116
117 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
118 signing_options,
119 ..::std::default::Default::default()
120 });
121
122 ::std::option::Option::Some(cfg.freeze())
123 }
124
125 fn runtime_components(
126 &self,
127 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
128 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
129 #[allow(unused_mut)]
130 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetDataAccess")
131 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
132 .with_interceptor(GetDataAccessEndpointParamsInterceptor)
133 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
134 crate::operation::get_data_access::GetDataAccessError,
135 >::new())
136 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
137 crate::operation::get_data_access::GetDataAccessError,
138 >::new())
139 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
140 crate::operation::get_data_access::GetDataAccessError,
141 >::new());
142
143 ::std::borrow::Cow::Owned(rcb)
144 }
145}
146
147#[derive(Debug)]
148struct GetDataAccessResponseDeserializer;
149impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetDataAccessResponseDeserializer {
150 fn deserialize_nonstreaming(
151 &self,
152 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
153 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
154 let (success, status) = (response.status().is_success(), response.status().as_u16());
155 let headers = response.headers();
156 let body = response.body().bytes().expect("body loaded");
157 #[allow(unused_mut)]
158 let mut force_error = false;
159 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
160 let parse_result = if !success && status != 200 || force_error {
161 crate::protocol_serde::shape_get_data_access::de_get_data_access_http_error(status, headers, body)
162 } else {
163 crate::protocol_serde::shape_get_data_access::de_get_data_access_http_response(status, headers, body)
164 };
165 crate::protocol_serde::type_erase_result(parse_result)
166 }
167}
168#[derive(Debug)]
169struct GetDataAccessRequestSerializer;
170impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetDataAccessRequestSerializer {
171 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
172 fn serialize_input(
173 &self,
174 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
175 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
176 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
177 let input = input
178 .downcast::<crate::operation::get_data_access::GetDataAccessInput>()
179 .expect("correct type");
180 let _header_serialization_settings = _cfg
181 .load::<crate::serialization_settings::HeaderSerializationSettings>()
182 .cloned()
183 .unwrap_or_default();
184 let mut request_builder = {
185 fn uri_base(
186 _input: &crate::operation::get_data_access::GetDataAccessInput,
187 output: &mut ::std::string::String,
188 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
189 use ::std::fmt::Write as _;
190 ::std::write!(output, "/v20180820/accessgrantsinstance/dataaccess").expect("formatting should succeed");
191 ::std::result::Result::Ok(())
192 }
193 fn uri_query(
194 _input: &crate::operation::get_data_access::GetDataAccessInput,
195 mut output: &mut ::std::string::String,
196 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
197 let mut query = ::aws_smithy_http::query::Writer::new(output);
198 let inner_1 = &_input.target;
199 let inner_1 = inner_1
200 .as_ref()
201 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target", "cannot be empty or unset"))?;
202 if inner_1.is_empty() {
203 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
204 "target",
205 "cannot be empty or unset",
206 ));
207 }
208 query.push_kv("target", &::aws_smithy_http::query::fmt_string(inner_1));
209 let inner_2 = &_input.permission;
210 let inner_2 = inner_2
211 .as_ref()
212 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("permission", "cannot be empty or unset"))?;
213 query.push_kv("permission", &::aws_smithy_http::query::fmt_string(inner_2));
214 if let ::std::option::Option::Some(inner_3) = &_input.duration_seconds {
215 {
216 query.push_kv("durationSeconds", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode());
217 }
218 }
219 if let ::std::option::Option::Some(inner_4) = &_input.privilege {
220 {
221 query.push_kv("privilege", &::aws_smithy_http::query::fmt_string(inner_4));
222 }
223 }
224 if let ::std::option::Option::Some(inner_5) = &_input.target_type {
225 {
226 query.push_kv("targetType", &::aws_smithy_http::query::fmt_string(inner_5));
227 }
228 }
229 ::std::result::Result::Ok(())
230 }
231 #[allow(clippy::unnecessary_wraps)]
232 fn update_http_builder(
233 input: &crate::operation::get_data_access::GetDataAccessInput,
234 builder: ::http::request::Builder,
235 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
236 let mut uri = ::std::string::String::new();
237 uri_base(input, &mut uri)?;
238 uri_query(input, &mut uri)?;
239 let builder = crate::protocol_serde::shape_get_data_access::ser_get_data_access_headers(input, builder)?;
240 ::std::result::Result::Ok(builder.method("GET").uri(uri))
241 }
242 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
243 builder
244 };
245 let body = ::aws_smithy_types::body::SdkBody::from("");
246
247 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
248 }
249}
250#[derive(Debug)]
251struct GetDataAccessEndpointParamsInterceptor;
252
253impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetDataAccessEndpointParamsInterceptor {
254 fn name(&self) -> &'static str {
255 "GetDataAccessEndpointParamsInterceptor"
256 }
257
258 fn read_before_execution(
259 &self,
260 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
261 '_,
262 ::aws_smithy_runtime_api::client::interceptors::context::Input,
263 ::aws_smithy_runtime_api::client::interceptors::context::Output,
264 ::aws_smithy_runtime_api::client::interceptors::context::Error,
265 >,
266 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
267 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
268 let _input = context
269 .input()
270 .downcast_ref::<GetDataAccessInput>()
271 .ok_or("failed to downcast to GetDataAccessInput")?;
272
273 let params = crate::config::endpoint::Params::builder()
274 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
275 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
276 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
277 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
278 .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
279 .set_requires_account_id(Some(true))
280 .set_account_id(Some(
281 _input
282 .account_id
283 .clone()
284 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
285 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("account_id", "A required field was not set"))?,
286 ))
287 .build()
288 .map_err(|err| {
289 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
290 })?;
291 cfg.interceptor_state()
292 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
293 ::std::result::Result::Ok(())
294 }
295}
296
297#[non_exhaustive]
302#[derive(::std::fmt::Debug)]
303pub enum GetDataAccessError {
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-GetDataAccessError) for what information is available for the error.")]
311 Unhandled(crate::error::sealed_unhandled::Unhandled),
312}
313impl GetDataAccessError {
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::Unhandled(e) => &e.meta,
338 }
339 }
340}
341impl ::std::error::Error for GetDataAccessError {
342 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
343 match self {
344 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
345 }
346 }
347}
348impl ::std::fmt::Display for GetDataAccessError {
349 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
350 match self {
351 Self::Unhandled(_inner) => {
352 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
353 write!(f, "unhandled error ({code})")
354 } else {
355 f.write_str("unhandled error")
356 }
357 }
358 }
359 }
360}
361impl ::aws_smithy_types::retry::ProvideErrorKind for GetDataAccessError {
362 fn code(&self) -> ::std::option::Option<&str> {
363 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
364 }
365 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
366 ::std::option::Option::None
367 }
368}
369impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetDataAccessError {
370 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
371 match self {
372 Self::Unhandled(_inner) => &_inner.meta,
373 }
374 }
375}
376impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetDataAccessError {
377 fn create_unhandled_error(
378 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
379 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
380 ) -> Self {
381 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
382 source,
383 meta: meta.unwrap_or_default(),
384 })
385 }
386}
387impl ::aws_types::request_id::RequestId for crate::operation::get_data_access::GetDataAccessError {
388 fn request_id(&self) -> Option<&str> {
389 self.meta().request_id()
390 }
391}
392
393pub use crate::operation::get_data_access::_get_data_access_output::GetDataAccessOutput;
394
395pub use crate::operation::get_data_access::_get_data_access_input::GetDataAccessInput;
396
397mod _get_data_access_input;
398
399mod _get_data_access_output;
400
401pub mod builders;