Skip to content

delete_members async

delete_members(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    account_ids: Optional[AccountIdList] = None,
) -> DeleteMembersResponse

Deletes the specified member accounts from Security Hub CSPM.

You can invoke this API only to delete accounts that became members through invitation. You can't invoke this API to delete accounts that belong to an Organizations organization.

Parameters:

  • account_ids (Optional[AccountIdList], default: None ) –

    The list of account IDs for the member accounts to delete.

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.

  • ResourceNotFoundException –

    The request was rejected because we can't find the specified resource.

  • UnknownServiceError –

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

Examples:

To delete a member account The following example deletes the specified member account from Security Hub. This operation can be used to delete member accounts that are part of an organization or that were invited manually.

>>> await client.delete_members(account_ids=['123456789111', '123456789222'])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def delete_members(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    account_ids: Optional[
        "capo_securityhub.types.account_id_list.AccountIdList"
    ] = None,
) -> "capo_securityhub.types.delete_members_response.DeleteMembersResponse":
    """<p>Deletes the specified member accounts from Security Hub CSPM.</p> <p>You can invoke this API only to delete accounts that became members through invitation. You can't invoke this API to delete accounts that belong to an Organizations organization.</p>

    Args:
        account_ids: <p>The list of account IDs for the member accounts to delete.</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.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a member account
        The following example deletes the specified member account from Security Hub. This operation can be used to delete member accounts that are part of an organization or that were invited manually.

        >>> await client.delete_members(account_ids=['123456789111', '123456789222'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.delete_members_request.DeleteMembersRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.delete_members_response.DeleteMembersResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.delete_members

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteMembers")
    )
    input_: capo_securityhub.types.delete_members_request.DeleteMembersRequest = {}
    if account_ids is not None:
        input_["account_ids"] = account_ids

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