Skip to content

delete_account_setting async

delete_account_setting(
    name: SettingName,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    principal_arn: Optional[String] = None,
) -> DeleteAccountSettingResponse

Disables an account setting for a specified user, role, or the root user for an account.

Parameters:

  • name (SettingName) –

    The resource name to disable the account setting for. If serviceLongArnFormat is specified, the ARN for your Amazon ECS services is affected. If taskLongArnFormat is specified, the ARN and resource ID for your Amazon ECS tasks is affected. If containerInstanceLongArnFormat is specified, the ARN and resource ID for your Amazon ECS container instances is affected. If awsvpcTrunking is specified, the ENI limit for your Amazon ECS container instances is affected.

  • principal_arn (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) of the principal. It can be a user, role, or the root user. If you specify the root user, it disables the account setting for all users, roles, and the root user of the account unless a user or role explicitly overrides these settings. If this field is omitted, the setting is changed only for the authenticated user.

    In order to use this parameter, you must be the root user, or the principal.

Raises:

  • AccessDeniedException –

    You don't have authorization to perform the requested action.

  • ClientException –

    These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

  • InvalidParameterException –

    The specified parameter isn't valid. Review the available parameters for the API request.

    For more information about service event errors, see Amazon ECS service event messages.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To delete your account setting This example deletes the account setting for your user for the specified resource type.

>>> await client.delete_account_setting(name='serviceLongArnFormat')
To delete the account settings for a specific IAM user or IAM role
This example deletes the account setting for a specific IAM user or IAM role for the specified resource type. Only the root user can view or modify the account settings for another user.
>>> await client.delete_account_setting(name='containerInstanceLongArnFormat', principal_arn='arn:aws:iam::<aws_account_id>:user/principalName')
Source code in docs_src/capo_ecs/_services/async_ecs.py
async def delete_account_setting(
    self,
    name: "capo_ecs.types.setting_name.SettingName",
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    principal_arn: Optional["capo_ecs.types.string.String"] = None,
) -> "capo_ecs.types.delete_account_setting_response.DeleteAccountSettingResponse":
    """<p>Disables an account setting for a specified user, role, or the root user for an account.</p>

    Args:
        name: <p>The resource name to disable the account setting for. If <code>serviceLongArnFormat</code> is specified, the ARN for your Amazon ECS services is affected. If <code>taskLongArnFormat</code> is specified, the ARN and resource ID for your Amazon ECS tasks is affected. If <code>containerInstanceLongArnFormat</code> is specified, the ARN and resource ID for your Amazon ECS container instances is affected. If <code>awsvpcTrunking</code> is specified, the ENI limit for your Amazon ECS container instances is affected.</p>
        principal_arn: <p>The Amazon Resource Name (ARN) of the principal. It can be a user, role, or the root user. If you specify the root user, it disables the account setting for all users, roles, and the root user of the account unless a user or role explicitly overrides these settings. If this field is omitted, the setting is changed only for the authenticated user.</p> <p>In order to use this parameter, you must be the root user, or the principal.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete your account setting
        This example deletes the account setting for your user for the specified resource type.

        >>> await client.delete_account_setting(name='serviceLongArnFormat')
        To delete the account settings for a specific IAM user or IAM role
        This example deletes the account setting for a specific IAM user or IAM role for the specified resource type. Only the root user can view or modify the account settings for another user.

        >>> await client.delete_account_setting(name='containerInstanceLongArnFormat', principal_arn='arn:aws:iam::<aws_account_id>:user/principalName')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.delete_account_setting_request.DeleteAccountSettingRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.delete_account_setting_response.DeleteAccountSettingResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.delete_account_setting

        (
            output,
            http_response,
        ) = await capo_ecs._operations.amazon_ec2_container_service_v20141113.delete_account_setting.async_delete_account_setting(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAccountSetting")
    )
    input_: capo_ecs.types.delete_account_setting_request.DeleteAccountSettingRequest = {
        "name": name
    }
    if principal_arn is not None:
        input_["principal_arn"] = principal_arn

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