Skip to content

list_organization_admin_accounts async

list_organization_admin_accounts(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    max_results: Optional[AdminsMaxResults] = None,
    next_token: Optional[NextToken] = None,
    feature: Optional[SecurityHubFeature] = None,
) -> ListOrganizationAdminAccountsResponse

Lists the Security Hub CSPM administrator accounts. Can only be called by the organization management account.

Parameters:

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

    The maximum number of items to return in the response.

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

    The token that is required for pagination. On your first call to the ListOrganizationAdminAccounts operation, set the value of this parameter to NULL. For subsequent calls to the operation, to continue listing data, set the value of this parameter to the value returned from the previous response.

  • feature (Optional[SecurityHubFeature], default: None ) –

    The feature where the delegated administrator account is listed. Defaults to Security Hub CSPM if not specified.

Raises:

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • InvalidInputException –

    The request was rejected because you supplied an invalid or out-of-range value for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • UnknownServiceError –

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

Examples:

To list administrator acccounts for an organization The following example lists the Security Hub administrator accounts for an organization. Only the organization management account can call this operation.

>>> await client.list_organization_admin_accounts()
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def list_organization_admin_accounts(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    max_results: Optional[
        "capo_securityhub.types.admins_max_results.AdminsMaxResults"
    ] = None,
    next_token: Optional["capo_securityhub.types.next_token.NextToken"] = None,
    feature: Optional[
        "capo_securityhub.types.security_hub_feature.SecurityHubFeature"
    ] = None,
) -> "capo_securityhub.types.list_organization_admin_accounts_response.ListOrganizationAdminAccountsResponse":
    """<p>Lists the Security Hub CSPM administrator accounts. Can only be called by the organization management account.</p>

    Args:
        max_results: <p>The maximum number of items to return in the response.</p>
        next_token: <p>The token that is required for pagination. On your first call to the <code>ListOrganizationAdminAccounts</code> operation, set the value of this parameter to <code>NULL</code>. For subsequent calls to the operation, to continue listing data, set the value of this parameter to the value returned from the previous response. </p>
        feature: <p>The feature where the delegated administrator account is listed. Defaults to Security Hub CSPM if not specified.</p>

    Raises:
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To list administrator acccounts for an organization
        The following example lists the Security  Hub administrator accounts for an organization. Only the organization management account can call this operation.

        >>> await client.list_organization_admin_accounts()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.list_organization_admin_accounts_request.ListOrganizationAdminAccountsRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.list_organization_admin_accounts_response.ListOrganizationAdminAccountsResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.list_organization_admin_accounts

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.list_organization_admin_accounts.async_list_organization_admin_accounts(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListOrganizationAdminAccounts")
    )
    input_: capo_securityhub.types.list_organization_admin_accounts_request.ListOrganizationAdminAccountsRequest = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if feature is not None:
        input_["feature"] = feature

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