Skip to content

create_custom_detection_rule_org_configuration async

create_custom_detection_rule_org_configuration(
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    rule_id: Optional[RuleId] = None,
    mode: Optional[AssociationMode] = None,
    include_account_ids: Optional[DetectionRuleAccountIds] = None,
    exclude_account_ids: Optional[DetectionRuleAccountIds] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateCustomDetectionRuleOrgConfigurationResponse

Creates an organization-level configuration that enables a custom detection rule across your organization. This operation is available only to the delegated administrator account.

Parameters:

  • rule_id (Optional[RuleId], default: None ) –

    The unique identifier for the custom detection rule.

  • mode (Optional[AssociationMode], default: None ) –

    The execution mode of the organization configuration. Valid values: LIVE | DRY_RUN.

  • include_account_ids (Optional[DetectionRuleAccountIds], default: None ) –

    The account IDs to include in the organization configuration. Mutually exclusive with ExcludeAccountIds.

  • exclude_account_ids (Optional[DetectionRuleAccountIds], default: None ) –

    The account IDs to exclude from the organization configuration. Mutually exclusive with IncludeAccountIds.

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

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time.

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def create_custom_detection_rule_org_configuration(
    self,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    rule_id: Optional["capo_guardduty.types.rule_id.RuleId"] = None,
    mode: Optional["capo_guardduty.types.association_mode.AssociationMode"] = None,
    include_account_ids: Optional[
        "capo_guardduty.types.detection_rule_account_ids.DetectionRuleAccountIds"
    ] = None,
    exclude_account_ids: Optional[
        "capo_guardduty.types.detection_rule_account_ids.DetectionRuleAccountIds"
    ] = None,
    client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
) -> "capo_guardduty.types.create_custom_detection_rule_org_configuration_response.CreateCustomDetectionRuleOrgConfigurationResponse":
    """<p>Creates an organization-level configuration that enables a custom detection rule across your organization. This operation is available only to the delegated administrator account.</p>

    Args:
        rule_id: <p>The unique identifier for the custom detection rule.</p>
        mode: <p>The execution mode of the organization configuration. Valid values: <code>LIVE</code> | <code>DRY_RUN</code>.</p>
        include_account_ids: <p>The account IDs to include in the organization configuration. Mutually exclusive with <code>ExcludeAccountIds</code>.</p>
        exclude_account_ids: <p>The account IDs to exclude from the organization configuration. Mutually exclusive with <code>IncludeAccountIds</code>.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time.</p>

    Raises:
        capo_guardduty.errors.access_denied_exception.AccessDeniedException: <p>An access denied exception object.</p>
        capo_guardduty.errors.bad_request_exception.BadRequestException: <p>A bad request exception object.</p>
        capo_guardduty.errors.conflict_exception.ConflictException: <p>A request conflict exception object.</p>
        capo_guardduty.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal server error exception object.</p>
        capo_guardduty.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
        capo_guardduty.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_guardduty.types.create_custom_detection_rule_org_configuration_request.CreateCustomDetectionRuleOrgConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.create_custom_detection_rule_org_configuration_response.CreateCustomDetectionRuleOrgConfigurationResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_custom_detection_rule_org_configuration

        (
            output,
            http_response,
        ) = await capo_guardduty._operations.guard_duty_api_service.create_custom_detection_rule_org_configuration.async_create_custom_detection_rule_org_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCustomDetectionRuleOrgConfiguration"),
    )
    input_: capo_guardduty.types.create_custom_detection_rule_org_configuration_request.CreateCustomDetectionRuleOrgConfigurationRequest = {}
    if rule_id is not None:
        input_["rule_id"] = rule_id
    if mode is not None:
        input_["mode"] = mode
    if include_account_ids is not None:
        input_["include_account_ids"] = include_account_ids
    if exclude_account_ids is not None:
        input_["exclude_account_ids"] = exclude_account_ids
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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