:doc:`AgreementService <../../marketplace-agreement>` / Client / search_agreements

*****************
search_agreements
*****************



.. py:method:: AgreementService.Client.search_agreements(**kwargs)

  

  Searches across all agreements that a proposer has in AWS Marketplace. The search returns a list of agreements with basic agreement information.

   

  The following filter combinations are supported when the ``PartyType`` is ``Proposer``:

   

  
  * ``AgreementType``
   
  * ``AgreementType`` + ``EndTime``
   
  * ``AgreementType`` + ``ResourceType``
   
  * ``AgreementType`` + ``ResourceType`` + ``EndTime``
   
  * ``AgreementType`` + ``ResourceType`` + ``Status``
   
  * ``AgreementType`` + ``ResourceType`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``ResourceId``
   
  * ``AgreementType`` + ``ResourceId`` + ``EndTime``
   
  * ``AgreementType`` + ``ResourceId`` + ``Status``
   
  * ``AgreementType`` + ``ResourceId`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``Status``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``OfferId``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``OfferId`` + ``Status``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``OfferId`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``OfferId`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceId``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceId`` + ``Status``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceId`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceId`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceType``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceType`` + ``EndTime``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceType`` + ``Status``
   
  * ``AgreementType`` + ``AcceptorAccountId`` + ``ResourceType`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``Status``
   
  * ``AgreementType`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``OfferId``
   
  * ``AgreementType`` + ``OfferId`` + ``EndTime``
   
  * ``AgreementType`` + ``OfferId`` + ``Status``
   
  * ``AgreementType`` + ``OfferId`` + ``Status`` + ``EndTime``
   
  * ``AgreementType`` + ``OfferSetId``
   
  * ``AgreementType`` + ``OfferSetId`` + ``EndTime``
   
  * ``AgreementType`` + ``OfferSetId`` + ``Status``
   
  * ``AgreementType`` + ``OfferSetId`` + ``Status`` + ``EndTime``
  

   

  .. note::

    

    To filter by ``EndTime``, you can use either ``BeforeEndTime`` or ``AfterEndTime``. Only ``EndTime`` is supported for sorting.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/marketplace-agreement-2020-03-01/SearchAgreements>`_  


  **Request Syntax**
  ::

    response = client.search_agreements(
        catalog='string',
        filters=[
            {
                'name': 'string',
                'values': [
                    'string',
                ]
            },
        ],
        sort={
            'sortBy': 'string',
            'sortOrder': 'ASCENDING'|'DESCENDING'
        },
        maxResults=123,
        nextToken='string'
    )
    
  :type catalog: string
  :param catalog: 

    The catalog in which the agreement was created.

    

  
  :type filters: list
  :param filters: 

    The filter name and value pair used to return a specific list of results.

     

    The following filters are supported:

     

    
    * ``ResourceIdentifier`` – The unique identifier of the resource.
     
    * ``ResourceType`` – Type of the resource, which is the product ( ``AmiProduct``, ``ContainerProduct``, ``SaaSProduct``, ``ProfessionalServicesProduct``, or ``MachineLearningProduct``).
     
    * ``PartyType`` – The party type of the caller. For agreements where the caller is the proposer, use the ``Proposer`` filter.
     
    * ``AcceptorAccountId`` – The AWS account ID of the party accepting the agreement terms.
     
    * ``OfferId`` – The unique identifier of the offer in which the terms are registered in the agreement token.
     
    * ``Status`` – The current status of the agreement. Values include ``ACTIVE``, ``ARCHIVED``, ``CANCELLED``, ``EXPIRED``, ``RENEWED``, ``REPLACED``, and ``TERMINATED``.
     
    * ``BeforeEndTime`` – A date used to filter agreements with a date before the ``endTime`` of an agreement.
     
    * ``AfterEndTime`` – A date used to filter agreements with a date after the ``endTime`` of an agreement.
     
    * ``AgreementType`` – The type of agreement. Supported value includes ``PurchaseAgreement``.
     
    * ``OfferSetId`` – A unique identifier for the offer set containing this offer. All agreements created from offers in this set include this identifier as context.
    

    

  
    - *(dict) --* 

      The filter name and value pair that is used to return a more specific list of results. Filters can be used to match a set of resources by various criteria, such as ``offerId`` or ``productId``.

      

    
      - **name** *(string) --* 

        The name of the filter.

        

      
      - **values** *(list) --* 

        The filter value.

        

      
        - *(string) --* 

        
    
    

  :type sort: dict
  :param sort: 

    An object that contains the ``SortBy`` and ``SortOrder`` attributes. Only ``EndTime`` is supported for ``SearchAgreements``. The default sort is ``EndTime`` descending.

    

  
    - **sortBy** *(string) --* 

      The attribute on which the data is grouped, which can be by ``StartTime`` and ``EndTime``. The default value is ``EndTime``.

      

    
    - **sortOrder** *(string) --* 

      The sorting order, which can be ``ASCENDING`` or ``DESCENDING``. The default value is ``DESCENDING``.

      

    
  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of agreements to return in the response.

    

  
  :type nextToken: string
  :param nextToken: 

    A token to specify where to start pagination.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'agreementViewSummaries': [
              {
                  'agreementId': 'string',
                  'acceptanceTime': datetime(2015, 1, 1),
                  'startTime': datetime(2015, 1, 1),
                  'endTime': datetime(2015, 1, 1),
                  'agreementType': 'string',
                  'acceptor': {
                      'accountId': 'string'
                  },
                  'proposer': {
                      'accountId': 'string'
                  },
                  'proposalSummary': {
                      'resources': [
                          {
                              'id': 'string',
                              'type': 'string'
                          },
                      ],
                      'offerId': 'string',
                      'offerSetId': 'string'
                  },
                  'status': 'ACTIVE'|'ARCHIVED'|'CANCELLED'|'EXPIRED'|'RENEWED'|'REPLACED'|'ROLLED_BACK'|'SUPERSEDED'|'TERMINATED'
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **agreementViewSummaries** *(list) --* 

        A summary of the agreement, including top-level attributes (for example, the agreement ID, proposer, and acceptor).

        
        

        - *(dict) --* 

          A summary of the agreement, including top-level attributes (for example, the agreement ID, proposer, and acceptor).

          
          

          - **agreementId** *(string) --* 

            The unique identifier of the agreement.

            
          

          - **acceptanceTime** *(datetime) --* 

            The date and time that the agreement was accepted.

            
          

          - **startTime** *(datetime) --* 

            The date and time when the agreement starts.

            
          

          - **endTime** *(datetime) --* 

            The date and time when the agreement ends. The field is ``null`` for pay-as-you-go agreements, which don’t have end dates.

            
          

          - **agreementType** *(string) --* 

            The type of agreement. Value is ``PurchaseAgreement``.

            
          

          - **acceptor** *(dict) --* 

            Details of the party accepting the agreement terms. This is commonly the buyer for ``PurchaseAgreement.``

            
            

            - **accountId** *(string) --* 

              The AWS account ID of the acceptor.

              
        
          

          - **proposer** *(dict) --* 

            Details of the party proposing the agreement terms, most commonly the seller for ``PurchaseAgreement``.

            
            

            - **accountId** *(string) --* 

              The AWS account ID of the proposer.

              
        
          

          - **proposalSummary** *(dict) --* 

            A summary of the proposal

            
            

            - **resources** *(list) --* 

              The list of resources involved in the agreement.

              
              

              - *(dict) --* 

                The list of resources involved in the agreement.

                
                

                - **id** *(string) --* 

                  The unique identifier of the resource.

                   

                  .. note::

                    

                    We mention the term resource, which is most commonly a product, so a ``resourceId`` is also a ``productId``.

                    

                  
                

                - **type** *(string) --* 

                  Type of the resource, which is the product. Values include ``SaaSProduct`` or ``AmiProduct``.

                  
            
          
            

            - **offerId** *(string) --* 

              The unique identifier of the offer in AWS Marketplace.

              
            

            - **offerSetId** *(string) --* 

              A unique identifier for the offer set containing this offer. All agreements created from offers in this set include this identifier as context.

              
        
          

          - **status** *(string) --* 

            The current status of the agreement.

            
      
    
      

      - **nextToken** *(string) --* 

        The token used for pagination. The field is ``null`` if there are no more results.

        
  
  **Exceptions**
  
  *   :py:class:`AgreementService.Client.exceptions.ValidationException`

  
  *   :py:class:`AgreementService.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`AgreementService.Client.exceptions.ThrottlingException`

  
  *   :py:class:`AgreementService.Client.exceptions.InternalServerException`

  