Skip to content

create_membership async

create_membership(
    membership_name: MembershipName,
    incident_response_team: IncidentResponseTeam,
    *,
    config_overrides: Optional[AsyncSecurityIRClientConfig] = None,
    client_token: Optional[str] = None,
    opt_in_features: Optional[OptInFeatures] = None,
    tags: Optional[TagMap] = None,
    cover_entire_organization: Optional[bool] = None,
) -> CreateMembershipResponse

Creates a new membership.

Parameters:

  • client_token (Optional[str], default: None ) –

    The clientToken field is an idempotency key used to ensure that repeated attempts for a single action will be ignored by the server during retries. A caller supplied unique ID (typically a UUID) should be provided.

  • membership_name (MembershipName) –

    Required element used in combination with CreateMembership to create a name for the membership.

  • incident_response_team (IncidentResponseTeam) –

    Required element used in combination with CreateMembership to add customer incident response team members and trusted partners to the membership.

  • opt_in_features (Optional[OptInFeatures], default: None ) –

    Optional element to enable the monitoring and investigation opt-in features for the service.

  • tags (Optional[TagMap], default: None ) –

    Optional element for customer configured tags.

  • cover_entire_organization (Optional[bool], default: None ) –

    The coverEntireOrganization parameter is a boolean flag that determines whether the membership should be applied to the entire Amazon Web Services Organization. When set to true, the membership will be created for all accounts within the organization. When set to false, the membership will only be created for specified accounts.

    This parameter is optional. If not specified, the default value is false.

    • If set to true: The membership will automatically include all existing and future accounts in the Amazon Web Services Organization.

    • If set to false: The membership will only apply to explicitly specified accounts.

Raises:

Examples:

Invoke CreateMembership

>>> await client.create_membership(membership_name='Example Membership Name.', incident_response_team=[{'name': 'Bob Jones', 'jobTitle': 'Security Responder', 'email': '[email protected]'}, {'email': '[email protected]', 'name': 'Alice', 'jobTitle': 'CEO'}], opt_in_features=[{'featureName': 'Triage', 'isEnabled': True}])
Source code in docs_src/capo_security_ir/_services/async_security_ir.py
async def create_membership(
    self,
    membership_name: "capo_security_ir.types.membership_name.MembershipName",
    incident_response_team: "capo_security_ir.types.incident_response_team.IncidentResponseTeam",
    *,
    config_overrides: Optional[AsyncSecurityIRClientConfig] = None,
    client_token: Optional[str] = None,
    opt_in_features: Optional[
        "capo_security_ir.types.opt_in_features.OptInFeatures"
    ] = None,
    tags: Optional["capo_security_ir.types.tag_map.TagMap"] = None,
    cover_entire_organization: Optional[bool] = None,
) -> "capo_security_ir.types.create_membership_response.CreateMembershipResponse":
    """<p>Creates a new membership.</p>

    Args:
        client_token: <note> <p>The <code>clientToken</code> field is an idempotency key used to ensure that repeated attempts for a single action will be ignored by the server during retries. A caller supplied unique ID (typically a UUID) should be provided. </p> </note>
        membership_name: <p>Required element used in combination with CreateMembership to create a name for the membership.</p>
        incident_response_team: <p>Required element used in combination with CreateMembership to add customer incident response team members and trusted partners to the membership. </p>
        opt_in_features: <p>Optional element to enable the monitoring and investigation opt-in features for the service.</p>
        tags: <p>Optional element for customer configured tags.</p>
        cover_entire_organization: <p>The <code>coverEntireOrganization</code> parameter is a boolean flag that determines whether the membership should be applied to the entire Amazon Web Services Organization. When set to true, the membership will be created for all accounts within the organization. When set to false, the membership will only be created for specified accounts. </p> <p>This parameter is optional. If not specified, the default value is false.</p> <ul> <li> <p>If set to <i>true</i>: The membership will automatically include all existing and future accounts in the Amazon Web Services Organization. </p> </li> <li> <p>If set to <i>false</i>: The membership will only apply to explicitly specified accounts. </p> </li> </ul>

    Raises:
        capo_security_ir.errors.access_denied_exception.AccessDeniedException: <p/>
        capo_security_ir.errors.conflict_exception.ConflictException: <p/>
        capo_security_ir.errors.internal_server_exception.InternalServerException: <p/>
        capo_security_ir.errors.invalid_token_exception.InvalidTokenException: <p/>
        capo_security_ir.errors.resource_not_found_exception.ResourceNotFoundException: <p/>
        capo_security_ir.errors.security_incident_response_not_active_exception.SecurityIncidentResponseNotActiveException: <p/>
        capo_security_ir.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p/>
        capo_security_ir.errors.throttling_exception.ThrottlingException: <p/>
        capo_security_ir.errors.validation_exception.ValidationException: <p/>
        capo_security_ir.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Invoke CreateMembership

        >>> await client.create_membership(membership_name='Example Membership Name.', incident_response_team=[{'name': 'Bob Jones', 'jobTitle': 'Security Responder', 'email': '[email protected]'}, {'email': '[email protected]', 'name': 'Alice', 'jobTitle': 'CEO'}], opt_in_features=[{'featureName': 'Triage', 'isEnabled': True}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_security_ir.types.create_membership_request.CreateMembershipRequest]",
    ) -> AsyncOperationResponse[
        "capo_security_ir.types.create_membership_response.CreateMembershipResponse"
    ]:
        import capo_security_ir._operations.security_incident_response.create_membership

        (
            output,
            http_response,
        ) = await capo_security_ir._operations.security_incident_response.create_membership.async_create_membership(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_security_ir.types.create_membership_request.CreateMembershipRequest",
    ) -> dict[str, Any]:
        import capo_security_ir.types.create_membership_request

        return capo_security_ir.types.create_membership_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateMembership", redact_input=_redact_input),
    )
    input_: capo_security_ir.types.create_membership_request.CreateMembershipRequest = {
        "membership_name": membership_name,
        "incident_response_team": incident_response_team,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if opt_in_features is not None:
        input_["opt_in_features"] = opt_in_features
    if tags is not None:
        input_["tags"] = tags
    if cover_entire_organization is not None:
        input_["cover_entire_organization"] = cover_entire_organization

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