Skip to content

list_account_settings

list_account_settings(
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    name: Optional[SettingName] = None,
    value: Optional[String] = None,
    principal_arn: Optional[String] = None,
    effective_settings: Optional[Boolean] = None,
    next_token: Optional[String] = None,
    max_results: Optional[Integer] = None,
) -> ListAccountSettingsResponse

Lists the account settings for a specified principal.

Parameters:

  • name (Optional[SettingName], default: None ) –

    The name of the account setting you want to list the settings for.

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

    The value of the account settings to filter results with. You must also specify an account setting name to use this parameter.

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

    The ARN of the principal, which can be a user, role, or the root user. If this field is omitted, the account settings are listed only for the authenticated user.

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

    Federated users assume the account setting of the root user and can't have explicit account settings set for them.

  • effective_settings (Optional[Boolean], default: None ) –

    Determines whether to return the effective settings. If true, the account settings for the root user or the default setting for the principalArn are returned. If false, the account settings for the principalArn are returned if they're set. Otherwise, no account settings are returned.

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

    The nextToken value returned from a ListAccountSettings request indicating that more results are available to fulfill the request and further calls will be needed. If maxResults was provided, it's possible the number of results to be fewer than maxResults.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

  • max_results (Optional[Integer], default: None ) –

    The maximum number of account setting results returned by ListAccountSettings in paginated output. When this parameter is used, ListAccountSettings only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListAccountSettings request with the returned nextToken value. This value can be between 1 and 10. If this parameter isn't used, then ListAccountSettings returns up to 10 results and a nextToken value if applicable.

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 view your effective account settings This example displays the effective account settings for your account.

>>> client.list_account_settings(effective_settings=True)
To view the effective account settings for a specific IAM user or IAM role
This example displays the effective account settings for the specified user or role.
>>> client.list_account_settings(effective_settings=True, principal_arn='arn:aws:iam::<aws_account_id>:user/principalName')
Source code in docs_src/capo_ecs/_services/ecs.py
def list_account_settings(
    self,
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    name: Optional["capo_ecs.types.setting_name.SettingName"] = None,
    value: Optional["capo_ecs.types.string.String"] = None,
    principal_arn: Optional["capo_ecs.types.string.String"] = None,
    effective_settings: Optional["capo_ecs.types.boolean.Boolean"] = None,
    next_token: Optional["capo_ecs.types.string.String"] = None,
    max_results: Optional["capo_ecs.types.integer.Integer"] = None,
) -> "capo_ecs.types.list_account_settings_response.ListAccountSettingsResponse":
    """<p>Lists the account settings for a specified principal.</p>

    Args:
        name: <p>The name of the account setting you want to list the settings for.</p>
        value: <p>The value of the account settings to filter results with. You must also specify an account setting name to use this parameter.</p>
        principal_arn: <p>The ARN of the principal, which can be a user, role, or the root user. If this field is omitted, the account settings are listed only for the authenticated user.</p> <p>In order to use this parameter, you must be the root user, or the principal.</p> <note> <p>Federated users assume the account setting of the root user and can't have explicit account settings set for them.</p> </note>
        effective_settings: <p>Determines whether to return the effective settings. If <code>true</code>, the account settings for the root user or the default setting for the <code>principalArn</code> are returned. If <code>false</code>, the account settings for the <code>principalArn</code> are returned if they're set. Otherwise, no account settings are returned.</p>
        next_token: <p>The <code>nextToken</code> value returned from a <code>ListAccountSettings</code> request indicating that more results are available to fulfill the request and further calls will be needed. If <code>maxResults</code> was provided, it's possible the number of results to be fewer than <code>maxResults</code>.</p> <note> <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>
        max_results: <p>The maximum number of account setting results returned by <code>ListAccountSettings</code> in paginated output. When this parameter is used, <code>ListAccountSettings</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListAccountSettings</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 10. If this parameter isn't used, then <code>ListAccountSettings</code> returns up to 10 results and a <code>nextToken</code> value if applicable.</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 view your effective account settings
        This example displays the effective account settings for your account.

        >>> client.list_account_settings(effective_settings=True)
        To view the effective account settings for a specific IAM user or IAM role
        This example displays the effective account settings for the specified user or role.

        >>> client.list_account_settings(effective_settings=True, principal_arn='arn:aws:iam::<aws_account_id>:user/principalName')
    """

    def _handler(
        req: "OperationRequest[capo_ecs.types.list_account_settings_request.ListAccountSettingsRequest]",
    ) -> OperationResponse[
        "capo_ecs.types.list_account_settings_response.ListAccountSettingsResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.list_account_settings

        output, http_response = (
            capo_ecs._operations.amazon_ec2_container_service_v20141113.list_account_settings.list_account_settings(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAccountSettings")
    )
    input_: capo_ecs.types.list_account_settings_request.ListAccountSettingsRequest = {}
    if name is not None:
        input_["name"] = name
    if value is not None:
        input_["value"] = value
    if principal_arn is not None:
        input_["principal_arn"] = principal_arn
    if effective_settings is not None:
        input_["effective_settings"] = effective_settings
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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