Skip to content

accept_invitation

accept_invitation(
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    master_id: Optional[NonEmptyString] = None,
    invitation_id: Optional[NonEmptyString] = None,
) -> AcceptInvitationResponse

This method is deprecated. Instead, use AcceptAdministratorInvitation.

The Security Hub CSPM console continues to use AcceptInvitation. It will eventually change to use AcceptAdministratorInvitation. Any IAM policies that specifically control access to this function must continue to use AcceptInvitation. You should also add AcceptAdministratorInvitation to your policies to ensure that the correct permissions are in place after the console begins to use AcceptAdministratorInvitation.

Accepts the invitation to be a member account and be monitored by the Security Hub CSPM administrator account that the invitation was sent from.

This operation is only used by member accounts that are not added through Organizations.

When the member account accepts the invitation, permission is granted to the administrator account to view findings generated in the member account.

Parameters:

  • master_id (Optional[NonEmptyString], default: None ) –

    The account ID of the Security Hub CSPM administrator account that sent the invitation.

  • invitation_id (Optional[NonEmptyString], default: None ) –

    The identifier of the invitation sent from the Security Hub CSPM administrator account.

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.

Source code in docs_src/capo_securityhub/_services/security_hub.py
def accept_invitation(
    self,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    master_id: Optional[
        "capo_securityhub.types.non_empty_string.NonEmptyString"
    ] = None,
    invitation_id: Optional[
        "capo_securityhub.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_securityhub.types.accept_invitation_response.AcceptInvitationResponse":
    """<p>This method is deprecated. Instead, use <code>AcceptAdministratorInvitation</code>.</p> <p>The Security Hub CSPM console continues to use <code>AcceptInvitation</code>. It will eventually change to use <code>AcceptAdministratorInvitation</code>. Any IAM policies that specifically control access to this function must continue to use <code>AcceptInvitation</code>. You should also add <code>AcceptAdministratorInvitation</code> to your policies to ensure that the correct permissions are in place after the console begins to use <code>AcceptAdministratorInvitation</code>.</p> <p>Accepts the invitation to be a member account and be monitored by the Security Hub CSPM administrator account that the invitation was sent from.</p> <p>This operation is only used by member accounts that are not added through Organizations.</p> <p>When the member account accepts the invitation, permission is granted to the administrator account to view findings generated in the member account.</p>

    Args:
        master_id: <p>The account ID of the Security Hub CSPM administrator account that sent the invitation.</p>
        invitation_id: <p>The identifier of the invitation sent from the Security Hub CSPM administrator account.</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.
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.accept_invitation_request.AcceptInvitationRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.accept_invitation_response.AcceptInvitationResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.accept_invitation

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.accept_invitation.accept_invitation(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AcceptInvitation")
    )
    input_: capo_securityhub.types.accept_invitation_request.AcceptInvitationRequest = {}
    if master_id is not None:
        input_["master_id"] = master_id
    if invitation_id is not None:
        input_["invitation_id"] = invitation_id

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