Skip to content

disable_organizations_root_sessions async

disable_organizations_root_sessions(
    *, config_overrides: Optional[AsyncIAMClientConfig] = None
) -> DisableOrganizationsRootSessionsResponse

Disables root user sessions for privileged tasks across member accounts in your organization. When you disable this feature, the management account and the delegated administrator for IAM can no longer perform privileged tasks on member accounts in your organization.

Raises:

Examples:

To disable the RootSessions feature in your organization The following command disables root user sessions for privileged tasks across member accounts in your organization.

>>> await client.disable_organizations_root_sessions()
Source code in docs_src/capo_iam/_services/async_iam.py
async def disable_organizations_root_sessions(
    self, *, config_overrides: Optional[AsyncIAMClientConfig] = None
) -> "capo_iam.types.disable_organizations_root_sessions_response.DisableOrganizationsRootSessionsResponse":
    """<p>Disables root user sessions for privileged tasks across member accounts in your organization. When you disable this feature, the management account and the delegated administrator for IAM can no longer perform privileged tasks on member accounts in your organization.</p>

    Raises:
        capo_iam.errors.account_not_management_or_delegated_administrator_exception.AccountNotManagementOrDelegatedAdministratorException: <p>The request was rejected because the account making the request is not the management account or delegated administrator account for <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#id_root-user-access-management">centralized root access</a>.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To disable the RootSessions feature in your organization
        The following command disables root user sessions for privileged tasks across member accounts in your organization.

        >>> await client.disable_organizations_root_sessions()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iam.types.disable_organizations_root_sessions_request.DisableOrganizationsRootSessionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_iam.types.disable_organizations_root_sessions_response.DisableOrganizationsRootSessionsResponse"
    ]:
        import capo_iam._operations.aws_identity_management_v20100508.disable_organizations_root_sessions

        (
            output,
            http_response,
        ) = await capo_iam._operations.aws_identity_management_v20100508.disable_organizations_root_sessions.async_disable_organizations_root_sessions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DisableOrganizationsRootSessions")
    )
    input_: capo_iam.types.disable_organizations_root_sessions_request.DisableOrganizationsRootSessionsRequest = {}

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output