aws_sdk_organizations/operation/
enable_aws_service_access.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `EnableAWSServiceAccess`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct EnableAWSServiceAccess;
6impl EnableAWSServiceAccess {
7    /// Creates a new `EnableAWSServiceAccess`
8    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::enable_aws_service_access::EnableAwsServiceAccessInput,
14    ) -> ::std::result::Result<
15        crate::operation::enable_aws_service_access::EnableAwsServiceAccessOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::enable_aws_service_access::EnableAWSServiceAccessError,
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::enable_aws_service_access::EnableAWSServiceAccessError>()
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::enable_aws_service_access::EnableAwsServiceAccessOutput>()
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::enable_aws_service_access::EnableAwsServiceAccessInput,
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(
55            "Organizations",
56            "EnableAWSServiceAccess",
57            input,
58            runtime_plugins,
59            stop_point,
60        )
61        // Create a parent span for the entire operation. Includes a random, internal-only,
62        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
63        .instrument(::tracing::debug_span!(
64            "Organizations.EnableAWSServiceAccess",
65            "rpc.service" = "Organizations",
66            "rpc.method" = "EnableAWSServiceAccess",
67            "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
68            "rpc.system" = "aws-api",
69        ))
70        .await
71    }
72
73    pub(crate) fn operation_runtime_plugins(
74        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
75        client_config: &crate::config::Config,
76        config_override: ::std::option::Option<crate::config::Builder>,
77    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
78        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
79
80        if let ::std::option::Option::Some(config_override) = config_override {
81            for plugin in config_override.runtime_plugins.iter().cloned() {
82                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
83            }
84            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
85                config_override,
86                client_config.config.clone(),
87                &client_config.runtime_components,
88            ));
89        }
90        runtime_plugins
91    }
92}
93impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for EnableAWSServiceAccess {
94    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
95        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("EnableAWSServiceAccess");
96
97        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
98            EnableAWSServiceAccessRequestSerializer,
99        ));
100        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
101            EnableAWSServiceAccessResponseDeserializer,
102        ));
103
104        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
105            crate::config::auth::Params::builder()
106                .operation_name("EnableAWSServiceAccess")
107                .build()
108                .expect("required fields set"),
109        ));
110
111        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
112            "EnableAWSServiceAccess",
113            "Organizations",
114        ));
115        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
116        signing_options.double_uri_encode = true;
117        signing_options.content_sha256_header = false;
118        signing_options.normalize_uri_path = true;
119        signing_options.payload_override = None;
120
121        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
122            signing_options,
123            ..::std::default::Default::default()
124        });
125
126        ::std::option::Option::Some(cfg.freeze())
127    }
128
129    fn runtime_components(
130        &self,
131        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
132    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
133        #[allow(unused_mut)]
134        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("EnableAWSServiceAccess")
135            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
136            .with_interceptor(EnableAWSServiceAccessEndpointParamsInterceptor)
137            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
138                crate::operation::enable_aws_service_access::EnableAWSServiceAccessError,
139            >::new())
140            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
141                crate::operation::enable_aws_service_access::EnableAWSServiceAccessError,
142            >::new())
143            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
144                crate::operation::enable_aws_service_access::EnableAWSServiceAccessError,
145            >::new());
146
147        ::std::borrow::Cow::Owned(rcb)
148    }
149}
150
151#[derive(Debug)]
152struct EnableAWSServiceAccessResponseDeserializer;
153impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for EnableAWSServiceAccessResponseDeserializer {
154    fn deserialize_nonstreaming(
155        &self,
156        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
157    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
158        let (success, status) = (response.status().is_success(), response.status().as_u16());
159        let headers = response.headers();
160        let body = response.body().bytes().expect("body loaded");
161        #[allow(unused_mut)]
162        let mut force_error = false;
163        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
164        let parse_result = if !success && status != 200 || force_error {
165            crate::protocol_serde::shape_enable_aws_service_access::de_enable_aws_service_access_http_error(status, headers, body)
166        } else {
167            crate::protocol_serde::shape_enable_aws_service_access::de_enable_aws_service_access_http_response(status, headers, body)
168        };
169        crate::protocol_serde::type_erase_result(parse_result)
170    }
171}
172#[derive(Debug)]
173struct EnableAWSServiceAccessRequestSerializer;
174impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for EnableAWSServiceAccessRequestSerializer {
175    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
176    fn serialize_input(
177        &self,
178        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
179        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
180    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
181        let input = input
182            .downcast::<crate::operation::enable_aws_service_access::EnableAwsServiceAccessInput>()
183            .expect("correct type");
184        let _header_serialization_settings = _cfg
185            .load::<crate::serialization_settings::HeaderSerializationSettings>()
186            .cloned()
187            .unwrap_or_default();
188        let mut request_builder = {
189            fn uri_base(
190                _input: &crate::operation::enable_aws_service_access::EnableAwsServiceAccessInput,
191                output: &mut ::std::string::String,
192            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
193                use ::std::fmt::Write as _;
194                ::std::write!(output, "/").expect("formatting should succeed");
195                ::std::result::Result::Ok(())
196            }
197            #[allow(clippy::unnecessary_wraps)]
198            fn update_http_builder(
199                input: &crate::operation::enable_aws_service_access::EnableAwsServiceAccessInput,
200                builder: ::http::request::Builder,
201            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
202                let mut uri = ::std::string::String::new();
203                uri_base(input, &mut uri)?;
204                ::std::result::Result::Ok(builder.method("POST").uri(uri))
205            }
206            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
207            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.1");
208            builder = _header_serialization_settings.set_default_header(
209                builder,
210                ::http::header::HeaderName::from_static("x-amz-target"),
211                "AWSOrganizationsV20161128.EnableAWSServiceAccess",
212            );
213            builder
214        };
215        let body = ::aws_smithy_types::body::SdkBody::from(
216            crate::protocol_serde::shape_enable_aws_service_access::ser_enable_aws_service_access_input(&input)?,
217        );
218        if let Some(content_length) = body.content_length() {
219            let content_length = content_length.to_string();
220            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
221        }
222        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
223    }
224}
225#[derive(Debug)]
226struct EnableAWSServiceAccessEndpointParamsInterceptor;
227
228impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EnableAWSServiceAccessEndpointParamsInterceptor {
229    fn name(&self) -> &'static str {
230        "EnableAWSServiceAccessEndpointParamsInterceptor"
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        let _input = context
244            .input()
245            .downcast_ref::<EnableAwsServiceAccessInput>()
246            .ok_or("failed to downcast to EnableAwsServiceAccessInput")?;
247
248        let params = crate::config::endpoint::Params::builder()
249            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
250            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
251            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
252            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
253            .build()
254            .map_err(|err| {
255                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
256            })?;
257        cfg.interceptor_state()
258            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
259        ::std::result::Result::Ok(())
260    }
261}
262
263// The get_* functions below are generated from JMESPath expressions in the
264// operationContextParams trait. They target the operation's input shape.
265
266/// Error type for the `EnableAWSServiceAccessError` operation.
267#[non_exhaustive]
268#[derive(::std::fmt::Debug)]
269pub enum EnableAWSServiceAccessError {
270    /// <p>You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access Management</a> in the <i>IAM User Guide</i>.</p>
271    AccessDeniedException(crate::types::error::AccessDeniedException),
272    /// <p>Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.</p>
273    AwsOrganizationsNotInUseException(crate::types::error::AwsOrganizationsNotInUseException),
274    /// <p>The target of the operation is currently being modified by a different request. Try again later.</p>
275    ConcurrentModificationException(crate::types::error::ConcurrentModificationException),
276    /// <p>Performing this operation violates a minimum or maximum value limit. For example, attempting to remove the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit:</p><note>
277    /// <p>Some of the reasons in the following list might not be applicable to this specific API or operation.</p>
278    /// </note>
279    /// <ul>
280    /// <li>
281    /// <p>ACCOUNT_CANNOT_LEAVE_ORGANIZATION: You attempted to remove the management account from the organization. You can't remove the management account. Instead, after you remove all member accounts, delete the organization itself.</p></li>
282    /// <li>
283    /// <p>ACCOUNT_CANNOT_LEAVE_WITHOUT_PHONE_VERIFICATION: You attempted to remove an account from the organization that doesn't yet have enough information to exist as a standalone account. This account requires you to first complete phone verification. Follow the steps at <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_remove.html#orgs_manage_accounts_remove-from-master">Removing a member account from your organization</a> in the <i>Organizations User Guide</i>.</p></li>
284    /// <li>
285    /// <p>ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.</p></li>
286    /// <li>
287    /// <p>ACCOUNT_CREATION_NOT_COMPLETE: Your account setup isn't complete or your account isn't fully active. You must complete the account setup before you create an organization.</p></li>
288    /// <li>
289    /// <p>ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contact <a href="https://console.aws.amazon.com/support/home#/">Amazon Web Services Support</a> to request an increase in your limit.</p>
290    /// <p>Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact Amazon Web Services Support to request an increase in the number of accounts.</p><note>
291    /// <p>Deleted and closed accounts still count toward your limit.</p>
292    /// </note> <important>
293    /// <p>If you get this exception when running a command immediately after creating the organization, wait one hour and try again. After an hour, if the command continues to fail with this error, contact <a href="https://console.aws.amazon.com/support/home#/">Amazon Web Services Support</a>.</p>
294    /// </important></li>
295    /// <li>
296    /// <p>ALL_FEATURES_MIGRATION_ORGANIZATION_SIZE_LIMIT_EXCEEDED: Your organization has more than 5000 accounts, and you can only use the standard migration process for organizations with less than 5000 accounts. Use the assisted migration process to enable all features mode, or create a support case for assistance if you are unable to use assisted migration.</p></li>
297    /// <li>
298    /// <p>CANNOT_REGISTER_SUSPENDED_ACCOUNT_AS_DELEGATED_ADMINISTRATOR: You cannot register a suspended account as a delegated administrator.</p></li>
299    /// <li>
300    /// <p>CANNOT_REGISTER_MASTER_AS_DELEGATED_ADMINISTRATOR: You attempted to register the management account of the organization as a delegated administrator for an Amazon Web Services service integrated with Organizations. You can designate only a member account as a delegated administrator.</p></li>
301    /// <li>
302    /// <p>CANNOT_CLOSE_MANAGEMENT_ACCOUNT: You attempted to close the management account. To close the management account for the organization, you must first either remove or close all member accounts in the organization. Follow standard account closure process using root credentials.​</p></li>
303    /// <li>
304    /// <p>CANNOT_REMOVE_DELEGATED_ADMINISTRATOR_FROM_ORG: You attempted to remove an account that is registered as a delegated administrator for a service integrated with your organization. To complete this operation, you must first deregister this account as a delegated administrator.</p></li>
305    /// <li>
306    /// <p>CLOSE_ACCOUNT_QUOTA_EXCEEDED: You have exceeded close account quota for the past 30 days.</p></li>
307    /// <li>
308    /// <p>CLOSE_ACCOUNT_REQUESTS_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can close at a time. ​</p></li>
309    /// <li>
310    /// <p>CREATE_ORGANIZATION_IN_BILLING_MODE_UNSUPPORTED_REGION: To create an organization in the specified region, you must enable all features mode.</p></li>
311    /// <li>
312    /// <p>DELEGATED_ADMINISTRATOR_EXISTS_FOR_THIS_SERVICE: You attempted to register an Amazon Web Services account as a delegated administrator for an Amazon Web Services service that already has a delegated administrator. To complete this operation, you must first deregister any existing delegated administrators for this service.</p></li>
313    /// <li>
314    /// <p>EMAIL_VERIFICATION_CODE_EXPIRED: The email verification code is only valid for a limited period of time. You must resubmit the request and generate a new verfication code.</p></li>
315    /// <li>
316    /// <p>HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.</p></li>
317    /// <li>
318    /// <p>INVALID_PAYMENT_INSTRUMENT: You cannot remove an account because no supported payment method is associated with the account. Amazon Web Services does not support cards issued by financial institutions in Russia or Belarus. For more information, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/manage-general.html">Managing your Amazon Web Services payments</a>.</p></li>
319    /// <li>
320    /// <p>MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's management account to the marketplace that corresponds to the management account's address. All accounts in an organization must be associated with the same marketplace.</p></li>
321    /// <li>
322    /// <p>MASTER_ACCOUNT_MISSING_BUSINESS_LICENSE: Applies only to the Amazon Web Services Regions in China. To create an organization, the master must have a valid business license. For more information, contact customer support.</p></li>
323    /// <li>
324    /// <p>MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide a valid contact address and phone number for the management account. Then try the operation again.</p></li>
325    /// <li>
326    /// <p>MASTER_ACCOUNT_NOT_GOVCLOUD_ENABLED: To complete this operation, the management account must have an associated account in the Amazon Web Services GovCloud (US-West) Region. For more information, see <a href="https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-organizations.html">Organizations</a> in the <i>Amazon Web Services GovCloud User Guide</i>.</p></li>
327    /// <li>
328    /// <p>MASTER_ACCOUNT_PAYMENT_INSTRUMENT_REQUIRED: To create an organization with this management account, you first must associate a valid payment instrument, such as a credit card, with the account. For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_account-before-remove.html">Considerations before removing an account from an organization</a> in the <i>Organizations User Guide</i>.</p></li>
329    /// <li>
330    /// <p>MAX_DELEGATED_ADMINISTRATORS_FOR_SERVICE_LIMIT_EXCEEDED: You attempted to register more delegated administrators than allowed for the service principal.</p></li>
331    /// <li>
332    /// <p>MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.</p></li>
333    /// <li>
334    /// <p>MAX_TAG_LIMIT_EXCEEDED: You have exceeded the number of tags allowed on this resource.</p></li>
335    /// <li>
336    /// <p>MEMBER_ACCOUNT_PAYMENT_INSTRUMENT_REQUIRED: To complete this operation with this member account, you first must associate a valid payment instrument, such as a credit card, with the account. For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_account-before-remove.html">Considerations before removing an account from an organization</a> in the <i>Organizations User Guide</i>.</p></li>
337    /// <li>
338    /// <p>MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.</p></li>
339    /// <li>
340    /// <p>ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.</p></li>
341    /// <li>
342    /// <p>OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.</p></li>
343    /// <li>
344    /// <p>OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.</p></li>
345    /// <li>
346    /// <p>POLICY_CONTENT_LIMIT_EXCEEDED: You attempted to create a policy that is larger than the maximum size.</p></li>
347    /// <li>
348    /// <p>POLICY_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of policies that you can have in an organization.</p></li>
349    /// <li>
350    /// <p>POLICY_TYPE_ENABLED_FOR_THIS_SERVICE: You attempted to disable service access before you disabled the policy type (for example, SECURITYHUB_POLICY). To complete this operation, you must first disable the policy type.</p></li>
351    /// <li>
352    /// <p>SERVICE_ACCESS_NOT_ENABLED:</p>
353    /// <ul>
354    /// <li>
355    /// <p>You attempted to register a delegated administrator before you enabled service access. Call the <code>EnableAWSServiceAccess</code> API first.</p></li>
356    /// <li>
357    /// <p>You attempted to enable a policy type before you enabled service access. Call the <code>EnableAWSServiceAccess</code> API first.</p></li>
358    /// </ul></li>
359    /// <li>
360    /// <p>TAG_POLICY_VIOLATION: You attempted to create or update a resource with tags that are not compliant with the tag policy requirements for this account.</p></li>
361    /// <li>
362    /// <p>WAIT_PERIOD_ACTIVE: After you create an Amazon Web Services account, you must wait until at least seven days after the account was created. Invited accounts aren't subject to this waiting period.</p></li>
363    /// </ul>
364    ConstraintViolationException(crate::types::error::ConstraintViolationException),
365    /// <p>The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:</p><note>
366    /// <p>Some of the reasons in the following list might not be applicable to this specific API or operation.</p>
367    /// </note>
368    /// <ul>
369    /// <li>
370    /// <p>DUPLICATE_TAG_KEY: Tag keys must be unique among the tags attached to the same entity.</p></li>
371    /// <li>
372    /// <p>IMMUTABLE_POLICY: You specified a policy that is managed by Amazon Web Services and can't be modified.</p></li>
373    /// <li>
374    /// <p>INPUT_REQUIRED: You must include a value for all required parameters.</p></li>
375    /// <li>
376    /// <p>INVALID_EMAIL_ADDRESS_TARGET: You specified an invalid email address for the invited account owner.</p></li>
377    /// <li>
378    /// <p>INVALID_ENUM: You specified an invalid value.</p></li>
379    /// <li>
380    /// <p>INVALID_ENUM_POLICY_TYPE: You specified an invalid policy type string.</p></li>
381    /// <li>
382    /// <p>INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.</p></li>
383    /// <li>
384    /// <p>INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.</p></li>
385    /// <li>
386    /// <p>INVALID_PAGINATION_TOKEN: Get the value for the <code>NextToken</code> parameter from the response to a previous call of the operation.</p></li>
387    /// <li>
388    /// <p>INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.</p></li>
389    /// <li>
390    /// <p>INVALID_PATTERN: You provided a value that doesn't match the required pattern.</p></li>
391    /// <li>
392    /// <p>INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.</p></li>
393    /// <li>
394    /// <p>INVALID_PRINCIPAL: You specified an invalid principal element in the policy.</p></li>
395    /// <li>
396    /// <p>INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix <code>AWSServiceRoleFor</code>.</p></li>
397    /// <li>
398    /// <p>INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.</p></li>
399    /// <li>
400    /// <p>INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.</p></li>
401    /// <li>
402    /// <p>INVALID_SYSTEM_TAGS_PARAMETER: You specified a tag key that is a system tag. You can’t add, edit, or delete system tag keys because they're reserved for Amazon Web Services use. System tags don’t count against your tags per resource limit.</p></li>
403    /// <li>
404    /// <p>MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.</p></li>
405    /// <li>
406    /// <p>MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.</p></li>
407    /// <li>
408    /// <p>MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.</p></li>
409    /// <li>
410    /// <p>MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.</p></li>
411    /// <li>
412    /// <p>MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.</p></li>
413    /// <li>
414    /// <p>MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.</p></li>
415    /// <li>
416    /// <p>NON_DETACHABLE_POLICY: You can't detach this Amazon Web Services Managed Policy.</p></li>
417    /// <li>
418    /// <p>TARGET_NOT_SUPPORTED: You can't perform the specified operation on that target entity.</p></li>
419    /// <li>
420    /// <p>UNRECOGNIZED_SERVICE_PRINCIPAL: You specified a service principal that isn't recognized.</p></li>
421    /// </ul>
422    InvalidInputException(crate::types::error::InvalidInputException),
423    /// <p>Organizations can't complete your request because of an internal service error. Try again later.</p>
424    ServiceException(crate::types::error::ServiceException),
425    /// <p>You have sent too many requests in too short a period of time. The quota helps protect against denial-of-service attacks. Try again later.</p>
426    /// <p>For information about quotas that affect Organizations, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html">Quotas for Organizations</a> in the <i>Organizations User Guide</i>.</p>
427    TooManyRequestsException(crate::types::error::TooManyRequestsException),
428    /// <p>This action isn't available in the current Amazon Web Services Region.</p>
429    UnsupportedApiEndpointException(crate::types::error::UnsupportedApiEndpointException),
430    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
431    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
432    variable wildcard pattern and check `.code()`:
433     \
434    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
435     \
436    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-EnableAWSServiceAccessError) for what information is available for the error.")]
437    Unhandled(crate::error::sealed_unhandled::Unhandled),
438}
439impl EnableAWSServiceAccessError {
440    /// Creates the `EnableAWSServiceAccessError::Unhandled` variant from any error type.
441    pub fn unhandled(
442        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
443    ) -> Self {
444        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
445            source: err.into(),
446            meta: ::std::default::Default::default(),
447        })
448    }
449
450    /// Creates the `EnableAWSServiceAccessError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
451    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
452        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
453            source: err.clone().into(),
454            meta: err,
455        })
456    }
457    ///
458    /// Returns error metadata, which includes the error code, message,
459    /// request ID, and potentially additional information.
460    ///
461    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
462        match self {
463            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
464            Self::AwsOrganizationsNotInUseException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
465            Self::ConcurrentModificationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
466            Self::ConstraintViolationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
467            Self::InvalidInputException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
468            Self::ServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
469            Self::TooManyRequestsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
470            Self::UnsupportedApiEndpointException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
471            Self::Unhandled(e) => &e.meta,
472        }
473    }
474    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::AccessDeniedException`.
475    pub fn is_access_denied_exception(&self) -> bool {
476        matches!(self, Self::AccessDeniedException(_))
477    }
478    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::AwsOrganizationsNotInUseException`.
479    pub fn is_aws_organizations_not_in_use_exception(&self) -> bool {
480        matches!(self, Self::AwsOrganizationsNotInUseException(_))
481    }
482    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::ConcurrentModificationException`.
483    pub fn is_concurrent_modification_exception(&self) -> bool {
484        matches!(self, Self::ConcurrentModificationException(_))
485    }
486    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::ConstraintViolationException`.
487    pub fn is_constraint_violation_exception(&self) -> bool {
488        matches!(self, Self::ConstraintViolationException(_))
489    }
490    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::InvalidInputException`.
491    pub fn is_invalid_input_exception(&self) -> bool {
492        matches!(self, Self::InvalidInputException(_))
493    }
494    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::ServiceException`.
495    pub fn is_service_exception(&self) -> bool {
496        matches!(self, Self::ServiceException(_))
497    }
498    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::TooManyRequestsException`.
499    pub fn is_too_many_requests_exception(&self) -> bool {
500        matches!(self, Self::TooManyRequestsException(_))
501    }
502    /// Returns `true` if the error kind is `EnableAWSServiceAccessError::UnsupportedApiEndpointException`.
503    pub fn is_unsupported_api_endpoint_exception(&self) -> bool {
504        matches!(self, Self::UnsupportedApiEndpointException(_))
505    }
506}
507impl ::std::error::Error for EnableAWSServiceAccessError {
508    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
509        match self {
510            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
511            Self::AwsOrganizationsNotInUseException(_inner) => ::std::option::Option::Some(_inner),
512            Self::ConcurrentModificationException(_inner) => ::std::option::Option::Some(_inner),
513            Self::ConstraintViolationException(_inner) => ::std::option::Option::Some(_inner),
514            Self::InvalidInputException(_inner) => ::std::option::Option::Some(_inner),
515            Self::ServiceException(_inner) => ::std::option::Option::Some(_inner),
516            Self::TooManyRequestsException(_inner) => ::std::option::Option::Some(_inner),
517            Self::UnsupportedApiEndpointException(_inner) => ::std::option::Option::Some(_inner),
518            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
519        }
520    }
521}
522impl ::std::fmt::Display for EnableAWSServiceAccessError {
523    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
524        match self {
525            Self::AccessDeniedException(_inner) => _inner.fmt(f),
526            Self::AwsOrganizationsNotInUseException(_inner) => _inner.fmt(f),
527            Self::ConcurrentModificationException(_inner) => _inner.fmt(f),
528            Self::ConstraintViolationException(_inner) => _inner.fmt(f),
529            Self::InvalidInputException(_inner) => _inner.fmt(f),
530            Self::ServiceException(_inner) => _inner.fmt(f),
531            Self::TooManyRequestsException(_inner) => _inner.fmt(f),
532            Self::UnsupportedApiEndpointException(_inner) => _inner.fmt(f),
533            Self::Unhandled(_inner) => {
534                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
535                    write!(f, "unhandled error ({code})")
536                } else {
537                    f.write_str("unhandled error")
538                }
539            }
540        }
541    }
542}
543impl ::aws_smithy_types::retry::ProvideErrorKind for EnableAWSServiceAccessError {
544    fn code(&self) -> ::std::option::Option<&str> {
545        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
546    }
547    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
548        ::std::option::Option::None
549    }
550}
551impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for EnableAWSServiceAccessError {
552    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
553        match self {
554            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
555            Self::AwsOrganizationsNotInUseException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
556            Self::ConcurrentModificationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
557            Self::ConstraintViolationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
558            Self::InvalidInputException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
559            Self::ServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
560            Self::TooManyRequestsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
561            Self::UnsupportedApiEndpointException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
562            Self::Unhandled(_inner) => &_inner.meta,
563        }
564    }
565}
566impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for EnableAWSServiceAccessError {
567    fn create_unhandled_error(
568        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
569        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
570    ) -> Self {
571        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
572            source,
573            meta: meta.unwrap_or_default(),
574        })
575    }
576}
577impl ::aws_types::request_id::RequestId for crate::operation::enable_aws_service_access::EnableAWSServiceAccessError {
578    fn request_id(&self) -> Option<&str> {
579        self.meta().request_id()
580    }
581}
582
583pub use crate::operation::enable_aws_service_access::_enable_aws_service_access_output::EnableAwsServiceAccessOutput;
584
585pub use crate::operation::enable_aws_service_access::_enable_aws_service_access_input::EnableAwsServiceAccessInput;
586
587mod _enable_aws_service_access_input;
588
589mod _enable_aws_service_access_output;
590
591/// Builders
592pub mod builders;