Skip to content

disable_organization_level_resources

disable_organization_level_resources(
    *, config_overrides: Optional[IAMClientConfig] = None
) -> DisableOrganizationLevelResourcesResponse

Disables your organization's ability to create organization-level resources. An organization-level resource is an IAM resource that your organization owns instead of an individual Amazon Web Services account owning it. After you disable this capability, your organization returns to its default state and cannot create organization-level resources until the management account enables the capability again.

The organization-level resources that this capability governs include workload identity providers and workload identity templates that you create with a ResourceScope of ORGANIZATION.

Delete your organization's organization-level resources before you call this operation. If any organization-level resource still exists, IAM rejects the request with OrganizationLevelResourcesExistException. To delete an organization-scoped workload identity provider or workload identity template, see DeleteWorkloadIdentityProvider and DeleteWorkloadIdentityTemplate.

This operation acts on the organization that the calling account belongs to. Only the management account of that organization can call this operation. A delegated administrator for IAM cannot call it.

Raises:

Source code in docs_src/capo_iam/_services/iam.py
def disable_organization_level_resources(
    self, *, config_overrides: Optional[IAMClientConfig] = None
) -> "capo_iam.types.disable_organization_level_resources_response.DisableOrganizationLevelResourcesResponse":
    """<p>Disables your organization's ability to create organization-level resources. An organization-level resource is an IAM resource that your organization owns instead of an individual Amazon Web Services account owning it. After you disable this capability, your organization returns to its default state and cannot create organization-level resources until the management account enables the capability again.</p> <p>The organization-level resources that this capability governs include workload identity providers and workload identity templates that you create with a <code>ResourceScope</code> of <code>ORGANIZATION</code>.</p> <p>Delete your organization's organization-level resources before you call this operation. If any organization-level resource still exists, IAM rejects the request with <code>OrganizationLevelResourcesExistException</code>. To delete an organization-scoped workload identity provider or workload identity template, see <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteWorkloadIdentityProvider.html">DeleteWorkloadIdentityProvider</a> and <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteWorkloadIdentityTemplate.html">DeleteWorkloadIdentityTemplate</a>.</p> <p>This operation acts on the organization that the calling account belongs to. Only the management account of that organization can call this operation. A delegated administrator for IAM cannot call it.</p>

    Raises:
        capo_iam.errors.caller_is_not_management_account_exception.CallerIsNotManagementAccountException: <p>The request was rejected because the account making the request is not the management account for the organization.</p>
        capo_iam.errors.organization_level_resources_exist_exception.OrganizationLevelResourcesExistException: <p>The request was rejected because your organization still has organization-level resources. Delete them before you disable organization-level resources for your organization.</p>
        capo_iam.errors.organization_not_found_exception.OrganizationNotFoundException: <p>The request was rejected because no organization is associated with your account.</p>
        capo_iam.errors.organization_not_in_all_features_mode_exception.OrganizationNotInAllFeaturesModeException: <p>The request was rejected because your organization does not have All features enabled. For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#feature-set">Available feature sets</a> in the <i>Organizations User Guide</i>.</p>
        capo_iam.errors.service_access_not_enabled_exception.ServiceAccessNotEnabledException: <p>The request was rejected because trusted access is not enabled for IAM in Organizations. For details, see IAM and Organizations in the <i>Organizations User Guide</i>.</p>
        capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iam.types.disable_organization_level_resources_request.DisableOrganizationLevelResourcesRequest]",
    ) -> OperationResponse[
        "capo_iam.types.disable_organization_level_resources_response.DisableOrganizationLevelResourcesResponse"
    ]:
        import capo_iam._operations.aws_identity_management_v20100508.disable_organization_level_resources

        output, http_response = (
            capo_iam._operations.aws_identity_management_v20100508.disable_organization_level_resources.disable_organization_level_resources(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DisableOrganizationLevelResources")
    )
    input_: capo_iam.types.disable_organization_level_resources_request.DisableOrganizationLevelResourcesRequest = {}

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output