Skip to content

list_opportunities

list_opportunities(
    catalog: CatalogIdentifier,
    *,
    config_overrides: Optional[PartnerCentralSellingClientConfig] = None,
    max_results: Optional[PageSize] = None,
    next_token: Optional[str] = None,
    sort: Optional[OpportunitySort] = None,
    last_modified_date: Optional[LastModifiedDate] = None,
    identifier: Optional[FilterIdentifier] = None,
    life_cycle_stage: Optional[FilterLifeCycleStage] = None,
    life_cycle_review_status: Optional[FilterLifeCycleReviewStatus] = None,
    customer_company_name: Optional[StringList] = None,
    created_date: Optional[CreatedDateFilter] = None,
    target_close_date: Optional[TargetCloseDateFilter] = None,
) -> ListOpportunitiesResponse

This request accepts a list of filters that retrieve opportunity subsets as well as sort options. This feature is available to partners from Partner Central using the ListOpportunities API action.

To synchronize your system with Amazon Web Services, list only the opportunities that were newly created or updated. We recommend you rely on events emitted by the service into your Amazon Web Services account’s Amazon EventBridge default event bus. You can also use the ListOpportunities action.

We recommend the following approach:

  1. Find the latest LastModifiedDate that you stored, and only use the values that came from Amazon Web Services. Don’t use values generated by your system.

  2. When you send a ListOpportunities request, submit the date in ISO 8601 format in the AfterLastModifiedDate filter.

  3. Amazon Web Services only returns opportunities created or updated on or after that date and time. Use NextToken to iterate over all pages.

Parameters:

  • catalog (CatalogIdentifier) –

    Specifies the catalog associated with the request. This field takes a string value from a predefined list: AWS or Sandbox. The catalog determines which environment the opportunities are listed in. Use AWS for listing real opportunities in the Amazon Web Services catalog, and Sandbox for testing in secure, isolated environments.

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

    Specifies the maximum number of results to return in a single call. This limits the number of opportunities returned in the response to avoid providing too many results at once.

    Default: 20

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

    A pagination token used to retrieve the next set of results in subsequent calls. This token is included in the response only if there are additional result pages available.

  • sort (Optional[OpportunitySort], default: None ) –

    An object that specifies how the response is sorted. The default Sort.SortBy value is LastModifiedDate.

  • last_modified_date (Optional[LastModifiedDate], default: None ) –

    Filters the opportunities based on their last modified date. This filter helps retrieve opportunities that were updated after the specified date, allowing partners to track recent changes or updates.

  • identifier (Optional[FilterIdentifier], default: None ) –

    Filters the opportunities based on the opportunity identifier. This allows partners to retrieve specific opportunities by providing their unique identifiers, ensuring precise results.

  • life_cycle_stage (Optional[FilterLifeCycleStage], default: None ) –

    Filters the opportunities based on their lifecycle stage. This filter allows partners to retrieve opportunities at various stages in the sales cycle, such as Qualified, Technical Validation, Business Validation, or Closed Won.

  • life_cycle_review_status (Optional[FilterLifeCycleReviewStatus], default: None ) –

    Filters the opportunities based on their current lifecycle approval status. Use this filter to retrieve opportunities with statuses such as Pending Submission, In Review, Action Required, or Approved.

  • customer_company_name (Optional[StringList], default: None ) –

    Filters the opportunities based on the customer's company name. This allows partners to search for opportunities associated with a specific customer by matching the provided company name string.

  • created_date (Optional[CreatedDateFilter], default: None ) –

    Filter opportunities by creation date criteria.

  • target_close_date (Optional[TargetCloseDateFilter], default: None ) –

    Filters opportunities based on their target close date. This filter helps retrieve opportunities with an expected close date before or after a specified date.

Raises:

  • AccessDeniedException –

    This error occurs when you don't have permission to perform the requested action.

    You don’t have access to this action or resource. Review IAM policies or contact your AWS administrator for assistance.

  • InternalServerException –

    This error occurs when the specified resource can’t be found or doesn't exist. Resource ID and type might be incorrect.

    Suggested action: This is usually a transient error. Retry after the provided retry delay or a short interval. If the problem persists, contact AWS support.

  • ResourceNotFoundException –

    This error occurs when the specified resource can't be found. The resource might not exist, or isn't visible with the current credentials.

    Suggested action: Verify that the resource ID is correct and the resource is in the expected AWS region. Check IAM permissions for accessing the resource.

  • ThrottlingException –

    This error occurs when there are too many requests sent. Review the provided quotas and adapt your usage to avoid throttling.

    This error occurs when there are too many requests sent. Review the provided Quotas and retry after the provided delay.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service or business validation rules.

    Suggested action: Review the error message, including the failed fields and reasons, to correct the request payload.

  • UnknownServiceError –

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

Source code in docs_src/capo_partnercentral_selling/_services/partner_central_selling.py
def list_opportunities(
    self,
    catalog: "capo_partnercentral_selling.types.catalog_identifier.CatalogIdentifier",
    *,
    config_overrides: Optional[PartnerCentralSellingClientConfig] = None,
    max_results: Optional[
        "capo_partnercentral_selling.types.page_size.PageSize"
    ] = None,
    next_token: Optional[str] = None,
    sort: Optional[
        "capo_partnercentral_selling.types.opportunity_sort.OpportunitySort"
    ] = None,
    last_modified_date: Optional[
        "capo_partnercentral_selling.types.last_modified_date.LastModifiedDate"
    ] = None,
    identifier: Optional[
        "capo_partnercentral_selling.types.filter_identifier.FilterIdentifier"
    ] = None,
    life_cycle_stage: Optional[
        "capo_partnercentral_selling.types.filter_life_cycle_stage.FilterLifeCycleStage"
    ] = None,
    life_cycle_review_status: Optional[
        "capo_partnercentral_selling.types.filter_life_cycle_review_status.FilterLifeCycleReviewStatus"
    ] = None,
    customer_company_name: Optional[
        "capo_partnercentral_selling.types.string_list.StringList"
    ] = None,
    created_date: Optional[
        "capo_partnercentral_selling.types.created_date_filter.CreatedDateFilter"
    ] = None,
    target_close_date: Optional[
        "capo_partnercentral_selling.types.target_close_date_filter.TargetCloseDateFilter"
    ] = None,
) -> "capo_partnercentral_selling.types.list_opportunities_response.ListOpportunitiesResponse":
    """<p>This request accepts a list of filters that retrieve opportunity subsets as well as sort options. This feature is available to partners from <a href="https://partnercentral.awspartner.com/">Partner Central</a> using the <code>ListOpportunities</code> API action.</p> <p>To synchronize your system with Amazon Web Services, list only the opportunities that were newly created or updated. We recommend you rely on events emitted by the service into your Amazon Web Services account’s Amazon EventBridge default event bus. You can also use the <code>ListOpportunities</code> action.</p> <p>We recommend the following approach:</p> <ol> <li> <p>Find the latest <code>LastModifiedDate</code> that you stored, and only use the values that came from Amazon Web Services. Don’t use values generated by your system.</p> </li> <li> <p>When you send a <code>ListOpportunities</code> request, submit the date in ISO 8601 format in the <code>AfterLastModifiedDate</code> filter.</p> </li> <li> <p>Amazon Web Services only returns opportunities created or updated on or after that date and time. Use <code>NextToken</code> to iterate over all pages.</p> </li> </ol>

    Args:
        catalog: <p>Specifies the catalog associated with the request. This field takes a string value from a predefined list: <code>AWS</code> or <code>Sandbox</code>. The catalog determines which environment the opportunities are listed in. Use <code>AWS</code> for listing real opportunities in the Amazon Web Services catalog, and <code>Sandbox</code> for testing in secure, isolated environments.</p>
        max_results: <p>Specifies the maximum number of results to return in a single call. This limits the number of opportunities returned in the response to avoid providing too many results at once.</p> <p>Default: 20</p>
        next_token: <p>A pagination token used to retrieve the next set of results in subsequent calls. This token is included in the response only if there are additional result pages available.</p>
        sort: <p>An object that specifies how the response is sorted. The default <code>Sort.SortBy</code> value is <code>LastModifiedDate</code>.</p>
        last_modified_date: <p>Filters the opportunities based on their last modified date. This filter helps retrieve opportunities that were updated after the specified date, allowing partners to track recent changes or updates.</p>
        identifier: <p>Filters the opportunities based on the opportunity identifier. This allows partners to retrieve specific opportunities by providing their unique identifiers, ensuring precise results.</p>
        life_cycle_stage: <p>Filters the opportunities based on their lifecycle stage. This filter allows partners to retrieve opportunities at various stages in the sales cycle, such as <code>Qualified</code>, <code>Technical Validation</code>, <code>Business Validation</code>, or <code>Closed Won</code>.</p>
        life_cycle_review_status: <p>Filters the opportunities based on their current lifecycle approval status. Use this filter to retrieve opportunities with statuses such as <code>Pending Submission</code>, <code>In Review</code>, <code>Action Required</code>, or <code>Approved</code>.</p>
        customer_company_name: <p>Filters the opportunities based on the customer's company name. This allows partners to search for opportunities associated with a specific customer by matching the provided company name string.</p>
        created_date: <p>Filter opportunities by creation date criteria.</p>
        target_close_date: <p>Filters opportunities based on their target close date. This filter helps retrieve opportunities with an expected close date before or after a specified date.</p>

    Raises:
        capo_partnercentral_selling.errors.access_denied_exception.AccessDeniedException: <p>This error occurs when you don't have permission to perform the requested action.</p> <p>You don’t have access to this action or resource. Review IAM policies or contact your AWS administrator for assistance.</p>
        capo_partnercentral_selling.errors.internal_server_exception.InternalServerException: <p>This error occurs when the specified resource can’t be found or doesn't exist. Resource ID and type might be incorrect.</p> <p>Suggested action: This is usually a transient error. Retry after the provided retry delay or a short interval. If the problem persists, contact AWS support.</p>
        capo_partnercentral_selling.errors.resource_not_found_exception.ResourceNotFoundException: <p>This error occurs when the specified resource can't be found. The resource might not exist, or isn't visible with the current credentials.</p> <p>Suggested action: Verify that the resource ID is correct and the resource is in the expected AWS region. Check IAM permissions for accessing the resource.</p>
        capo_partnercentral_selling.errors.throttling_exception.ThrottlingException: <p>This error occurs when there are too many requests sent. Review the provided quotas and adapt your usage to avoid throttling.</p> <p>This error occurs when there are too many requests sent. Review the provided <a href="https://docs.aws.amazon.com/partner-central/latest/selling-api/quotas.html">Quotas</a> and retry after the provided delay.</p>
        capo_partnercentral_selling.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service or business validation rules.</p> <p>Suggested action: Review the error message, including the failed fields and reasons, to correct the request payload.</p>
        capo_partnercentral_selling.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_partnercentral_selling.types.list_opportunities_request.ListOpportunitiesRequest]",
    ) -> OperationResponse[
        "capo_partnercentral_selling.types.list_opportunities_response.ListOpportunitiesResponse"
    ]:
        import capo_partnercentral_selling._operations.aws_partner_central_selling.list_opportunities

        output, http_response = (
            capo_partnercentral_selling._operations.aws_partner_central_selling.list_opportunities.list_opportunities(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_partnercentral_selling.types.list_opportunities_response.ListOpportunitiesResponse",
    ) -> dict[str, Any]:
        import capo_partnercentral_selling.types.list_opportunities_response

        return capo_partnercentral_selling.types.list_opportunities_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListOpportunities", redact_output=_redact_output),
    )
    input_: capo_partnercentral_selling.types.list_opportunities_request.ListOpportunitiesRequest = {
        "catalog": catalog
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if sort is not None:
        input_["sort"] = sort
    if last_modified_date is not None:
        input_["last_modified_date"] = last_modified_date
    if identifier is not None:
        input_["identifier"] = identifier
    if life_cycle_stage is not None:
        input_["life_cycle_stage"] = life_cycle_stage
    if life_cycle_review_status is not None:
        input_["life_cycle_review_status"] = life_cycle_review_status
    if customer_company_name is not None:
        input_["customer_company_name"] = customer_company_name
    if created_date is not None:
        input_["created_date"] = created_date
    if target_close_date is not None:
        input_["target_close_date"] = target_close_date

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