We recommend using Organizations instead of Security Hub CSPM invitations to manage your member accounts. For information, see Managing Security Hub CSPM administrator and member accounts with Organizations in the Security Hub CSPM User Guide.
Invites other Amazon Web Services accounts to become member accounts for the Security Hub CSPM administrator account that the invitation is sent from.
This operation is only used to invite accounts that don't belong to an Amazon Web Services organization. Organization accounts don't receive invitations.
Before you can use this action to invite a member, you must first use the CreateMembers action to create the member account in Security Hub CSPM.
When the account owner enables Security Hub CSPM and accepts the invitation to become a member account, the administrator account can view the findings generated in the member account.
Parameters:
-
account_ids
(Optional[AccountIdList], default:
None
)
–
The list of account IDs of the Amazon Web Services accounts to invite to Security Hub CSPM as members.
Raises:
Examples:
To invite accounts to become members
The following example invites the specified AWS accounts to become member accounts associated with the calling Security Hub administrator account. You only use this operation to invite accounts that don't belong to an AWS Organizations organization.
>>> await client.invite_members(account_ids=['111122223333', '444455556666'])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
| async def invite_members(
self,
*,
config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
account_ids: Optional[
"capo_securityhub.types.account_id_list.AccountIdList"
] = None,
) -> "capo_securityhub.types.invite_members_response.InviteMembersResponse":
"""<note> <p>We recommend using Organizations instead of Security Hub CSPM invitations to manage your member accounts. For information, see <a href="https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-accounts-orgs.html">Managing Security Hub CSPM administrator and member accounts with Organizations</a> in the <i>Security Hub CSPM User Guide</i>.</p> </note> <p>Invites other Amazon Web Services accounts to become member accounts for the Security Hub CSPM administrator account that the invitation is sent from.</p> <p>This operation is only used to invite accounts that don't belong to an Amazon Web Services organization. Organization accounts don't receive invitations.</p> <p>Before you can use this action to invite a member, you must first use the <code>CreateMembers</code> action to create the member account in Security Hub CSPM.</p> <p>When the account owner enables Security Hub CSPM and accepts the invitation to become a member account, the administrator account can view the findings generated in the member account.</p>
Args:
account_ids: <p>The list of account IDs of the Amazon Web Services accounts to invite to Security Hub CSPM as members. </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 invite accounts to become members
The following example invites the specified AWS accounts to become member accounts associated with the calling Security Hub administrator account. You only use this operation to invite accounts that don't belong to an AWS Organizations organization.
>>> await client.invite_members(account_ids=['111122223333', '444455556666'])
"""
async def _handler(
req: "AsyncOperationRequest[capo_securityhub.types.invite_members_request.InviteMembersRequest]",
) -> AsyncOperationResponse[
"capo_securityhub.types.invite_members_response.InviteMembersResponse"
]:
import capo_securityhub._operations.security_hub_api_service.invite_members
(
output,
http_response,
) = await capo_securityhub._operations.security_hub_api_service.invite_members.async_invite_members(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("InviteMembers")
)
input_: capo_securityhub.types.invite_members_request.InviteMembersRequest = {}
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
|