Skip to content

list_benefits async

list_benefits(
    catalog: CatalogName,
    *,
    config_overrides: Optional[AsyncPartnerCentralBenefitsClientConfig] = None,
    programs: Optional[Programs] = None,
    fulfillment_types: Optional[FulfillmentTypes] = None,
    status: Optional[BenefitStatuses] = None,
    max_results: Optional[int] = None,
    next_token: Optional[str] = None,
) -> ListBenefitsOutput

Retrieves a paginated list of available benefits based on specified filter criteria.

Parameters:

  • catalog (CatalogName) –

    The catalog identifier to filter benefits by catalog.

  • programs (Optional[Programs], default: None ) –

    Filter benefits by specific AWS partner programs.

  • fulfillment_types (Optional[FulfillmentTypes], default: None ) –

    Filter benefits by specific fulfillment types.

  • status (Optional[BenefitStatuses], default: None ) –

    Filter benefits by their current status.

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

    The maximum number of benefits to return in a single response.

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

    A pagination token to retrieve the next set of results from a previous request.

Raises:

  • AccessDeniedException –

    Thrown when the caller does not have sufficient permissions to perform the requested operation.

  • InternalServerException –

    Thrown when an unexpected error occurs on the server side during request processing.

  • ResourceNotFoundException –

    Thrown when the requested resource cannot be found or does not exist.

  • ThrottlingException –

    Thrown when the request rate exceeds the allowed limits and the request is being throttled.

  • ValidationException –

    Thrown when the request contains invalid parameters or fails input validation requirements.

  • UnknownServiceError –

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

Source code in docs_src/capo_partnercentral_benefits/_services/async_partner_central_benefits.py
async def list_benefits(
    self,
    catalog: "capo_partnercentral_benefits.types.catalog_name.CatalogName",
    *,
    config_overrides: Optional[AsyncPartnerCentralBenefitsClientConfig] = None,
    programs: Optional[
        "capo_partnercentral_benefits.types.programs.Programs"
    ] = None,
    fulfillment_types: Optional[
        "capo_partnercentral_benefits.types.fulfillment_types.FulfillmentTypes"
    ] = None,
    status: Optional[
        "capo_partnercentral_benefits.types.benefit_statuses.BenefitStatuses"
    ] = None,
    max_results: Optional[int] = None,
    next_token: Optional[str] = None,
) -> "capo_partnercentral_benefits.types.list_benefits_output.ListBenefitsOutput":
    """<p>Retrieves a paginated list of available benefits based on specified filter criteria.</p>

    Args:
        catalog: <p>The catalog identifier to filter benefits by catalog.</p>
        programs: <p>Filter benefits by specific AWS partner programs.</p>
        fulfillment_types: <p>Filter benefits by specific fulfillment types.</p>
        status: <p>Filter benefits by their current status.</p>
        max_results: <p>The maximum number of benefits to return in a single response.</p>
        next_token: <p>A pagination token to retrieve the next set of results from a previous request.</p>

    Raises:
        capo_partnercentral_benefits.errors.access_denied_exception.AccessDeniedException: <p>Thrown when the caller does not have sufficient permissions to perform the requested operation.</p>
        capo_partnercentral_benefits.errors.internal_server_exception.InternalServerException: <p>Thrown when an unexpected error occurs on the server side during request processing.</p>
        capo_partnercentral_benefits.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when the requested resource cannot be found or does not exist.</p>
        capo_partnercentral_benefits.errors.throttling_exception.ThrottlingException: <p>Thrown when the request rate exceeds the allowed limits and the request is being throttled.</p>
        capo_partnercentral_benefits.errors.validation_exception.ValidationException: <p>Thrown when the request contains invalid parameters or fails input validation requirements.</p>
        capo_partnercentral_benefits.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_partnercentral_benefits.types.list_benefits_input.ListBenefitsInput]",
    ) -> AsyncOperationResponse[
        "capo_partnercentral_benefits.types.list_benefits_output.ListBenefitsOutput"
    ]:
        import capo_partnercentral_benefits._operations.partner_central_benefits_service.list_benefits

        (
            output,
            http_response,
        ) = await capo_partnercentral_benefits._operations.partner_central_benefits_service.list_benefits.async_list_benefits(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListBenefits")
    )
    input_: capo_partnercentral_benefits.types.list_benefits_input.ListBenefitsInput = {
        "catalog": catalog
    }
    if programs is not None:
        input_["programs"] = programs
    if fulfillment_types is not None:
        input_["fulfillment_types"] = fulfillment_types
    if status is not None:
        input_["status"] = status
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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