Skip to content

create_action_target

create_action_target(
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    name: Optional[NonEmptyString] = None,
    description: Optional[NonEmptyString] = None,
    id: Optional[NonEmptyString] = None,
) -> CreateActionTargetResponse

Creates a custom action target in Security Hub CSPM.

You can use custom actions on findings and insights in Security Hub CSPM to trigger target actions in Amazon CloudWatch Events.

Parameters:

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

    The name of the custom action target. Can contain up to 20 characters.

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

    The description for the custom action target.

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

    The ID for the custom action target. Can contain up to 20 alphanumeric characters.

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.

  • ResourceConflictException –

    The resource specified in the request conflicts with an existing resource.

  • UnknownServiceError –

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

Examples:

To create a custom action target The following example creates a custom action target in Security Hub. Custom actions on findings and insights automatically trigger actions in Amazon CloudWatch Events.

>>> client.create_action_target(name='Send to remediation', description='Action to send the finding for remediation tracking', id='Remediation')
Source code in docs_src/capo_securityhub/_services/security_hub.py
def create_action_target(
    self,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    name: Optional["capo_securityhub.types.non_empty_string.NonEmptyString"] = None,
    description: Optional[
        "capo_securityhub.types.non_empty_string.NonEmptyString"
    ] = None,
    id: Optional["capo_securityhub.types.non_empty_string.NonEmptyString"] = None,
) -> "capo_securityhub.types.create_action_target_response.CreateActionTargetResponse":
    """<p>Creates a custom action target in Security Hub CSPM.</p> <p>You can use custom actions on findings and insights in Security Hub CSPM to trigger target actions in Amazon CloudWatch Events.</p>

    Args:
        name: <p>The name of the custom action target. Can contain up to 20 characters.</p>
        description: <p>The description for the custom action target.</p>
        id: <p>The ID for the custom action target. Can contain up to 20 alphanumeric characters.</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_conflict_exception.ResourceConflictException: <p>The resource specified in the request conflicts with an existing resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a custom action target
        The following example creates a custom action target in Security Hub. Custom actions on findings and insights automatically trigger actions in Amazon CloudWatch Events.

        >>> client.create_action_target(name='Send to remediation', description='Action to send the finding for remediation tracking', id='Remediation')
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.create_action_target_request.CreateActionTargetRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.create_action_target_response.CreateActionTargetResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.create_action_target

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateActionTarget")
    )
    input_: capo_securityhub.types.create_action_target_request.CreateActionTargetRequest = {}
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    if id is not None:
        input_["id"] = id

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