Skip to content

list_targets

list_targets(
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    filters: Optional[ListTargetsFilters] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListTargetsResult

Returns a list of the notification rule targets for an Amazon Web Services account.

Parameters:

  • filters (Optional[ListTargetsFilters], default: None ) –

    The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.

    A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.

  • next_token (Optional[NextToken], default: None ) –

    An enumeration token that, when provided in a request, returns the next batch of the results.

  • max_results (Optional[MaxResults], default: None ) –

    A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100.

Raises:

Source code in docs_src/capo_codestar_notifications/_services/codestarnotifications.py
def list_targets(
    self,
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    filters: Optional[
        "capo_codestar_notifications.types.list_targets_filters.ListTargetsFilters"
    ] = None,
    next_token: Optional[
        "capo_codestar_notifications.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_codestar_notifications.types.max_results.MaxResults"
    ] = None,
) -> "capo_codestar_notifications.types.list_targets_result.ListTargetsResult":
    """<p>Returns a list of the notification rule targets for an Amazon Web Services account.</p>

    Args:
        filters: <p>The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.</p> <note> <p>A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.</p> </note>
        next_token: <p>An enumeration token that, when provided in a request, returns the next batch of the results.</p>
        max_results: <p>A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100.</p>

    Raises:
        capo_codestar_notifications.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The value for the enumeration token used in the request to return the next batch of the results is not valid. </p>
        capo_codestar_notifications.errors.validation_exception.ValidationException: <p>One or more parameter values are not valid.</p>
        capo_codestar_notifications.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codestar_notifications.types.list_targets_request.ListTargetsRequest]",
    ) -> OperationResponse[
        "capo_codestar_notifications.types.list_targets_result.ListTargetsResult"
    ]:
        import capo_codestar_notifications._operations.code_star_notifications_20191015.list_targets

        output, http_response = (
            capo_codestar_notifications._operations.code_star_notifications_20191015.list_targets.list_targets(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_codestar_notifications.types.list_targets_result.ListTargetsResult",
    ) -> dict[str, Any]:
        import capo_codestar_notifications.types.list_targets_result

        return (
            capo_codestar_notifications.types.list_targets_result.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListTargets", redact_output=_redact_output),
    )
    input_: capo_codestar_notifications.types.list_targets_request.ListTargetsRequest = {}
    if filters is not None:
        input_["filters"] = filters
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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