:doc:`ResourceExplorer <../../resource-explorer-2>` / Client / create_view

***********
create_view
***********



.. py:method:: ResourceExplorer.Client.create_view(**kwargs)

  

  Creates a view that users can query by using the  Search operation. Results from queries that you make using this view include only resources that match the view's ``Filters``. For more information about Amazon Web Services Resource Explorer views, see `Managing views <https://docs.aws.amazon.com/resource-explorer/latest/userguide/manage-views.html>`__ in the *Amazon Web Services Resource Explorer User Guide*.

   

  Only the principals with an IAM identity-based policy that grants ``Allow`` to the ``Search`` action on a ``Resource`` with the `Amazon resource name (ARN) <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html>`__ of this view can  Search using views you create with this operation.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/resource-explorer-2-2022-07-28/CreateView>`_  


  **Request Syntax**
  ::

    response = client.create_view(
        ClientToken='string',
        ViewName='string',
        IncludedProperties=[
            {
                'Name': 'string'
            },
        ],
        Scope='string',
        Filters={
            'FilterString': 'string'
        },
        Tags={
            'string': 'string'
        }
    )
    
  :type ClientToken: string
  :param ClientToken: 

    This value helps ensure idempotency. Resource Explorer uses this value to prevent the accidental creation of duplicate versions. We recommend that you generate a `UUID-type value <https://wikipedia.org/wiki/Universally_unique_identifier>`__ to ensure the uniqueness of your views.

    This field is autopopulated if not provided.

  
  :type ViewName: string
  :param ViewName: **[REQUIRED]** 

    The name of the new view. This name appears in the list of views in Resource Explorer.

     

    The name must be no more than 64 characters long, and can include letters, digits, and the dash (-) character. The name must be unique within its Amazon Web Services Region.

    

  
  :type IncludedProperties: list
  :param IncludedProperties: 

    Specifies optional fields that you want included in search results from this view. It is a list of objects that each describe a field to include.

     

    The default is an empty list, with no optional fields included in the results.

    

  
    - *(dict) --* 

      Information about an additional property that describes a resource, that you can optionally include in the view. This lets you view that property in search results, and filter your search results based on the value of the property.

      

    
      - **Name** *(string) --* **[REQUIRED]** 

        The name of the property that is included in this view.

         

        You can specify the following property names for this field:

         

        
        * ``tags``
        

        

      
    

  :type Scope: string
  :param Scope: 

    The root ARN of the account, an organizational unit (OU), or an organization ARN. If left empty, the default is account.

    

  
  :type Filters: dict
  :param Filters: 

    An array of strings that specify which resources are included in the results of queries made using this view. When you use this view in a  Search operation, the filter string is combined with the search's ``QueryString`` parameter using a logical ``AND`` operator.

     

    For information about the supported syntax, see `Search query reference for Resource Explorer <https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-syntax.html>`__ in the *Amazon Web Services Resource Explorer User Guide*.

     

    .. warning::

       

      This query string in the context of this operation supports only `filter prefixes <https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-syntax.html#query-syntax-filters>`__ with optional `operators <https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-syntax.html#query-syntax-operators>`__. It doesn't support free-form text. For example, the string ``region:us* service:ec2 -tag:stage=prod`` includes all Amazon EC2 resources in any Amazon Web Services Region that begins with the letters ``us`` and is *not* tagged with a key ``Stage`` that has the value ``prod``.

      

    

  
    - **FilterString** *(string) --* **[REQUIRED]** 

      The string that contains the search keywords, prefixes, and operators to control the results that can be returned by a  Search operation. For more details, see `Search query syntax <https://docs.aws.amazon.com/resource-explorer/latest/APIReference/about-query-syntax.html>`__.

      

    
  
  :type Tags: dict
  :param Tags: 

    Tag key and value pairs that are attached to the view.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {
          'View': {
              'ViewArn': 'string',
              'ViewName': 'string',
              'Owner': 'string',
              'LastUpdatedAt': datetime(2015, 1, 1),
              'Scope': 'string',
              'IncludedProperties': [
                  {
                      'Name': 'string'
                  },
              ],
              'Filters': {
                  'FilterString': 'string'
              }
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **View** *(dict) --* 

        A structure that contains the details about the new view.

        
        

        - **ViewArn** *(string) --* 

          The `Amazon resource name (ARN) <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html>`__ of the view.

          
        

        - **ViewName** *(string) --* 

          The name of the view.

          
        

        - **Owner** *(string) --* 

          The Amazon Web Services account that owns this view.

          
        

        - **LastUpdatedAt** *(datetime) --* 

          The date and time when this view was last modified.

          
        

        - **Scope** *(string) --* 

          An `Amazon resource name (ARN) <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html>`__ of an Amazon Web Services account, an organization, or an organizational unit (OU) that specifies whether this view includes resources from only the specified Amazon Web Services account, all accounts in the specified organization, or all accounts in the specified OU.

           

          If not specified, the value defaults to the Amazon Web Services account used to call this operation.

          
        

        - **IncludedProperties** *(list) --* 

          A structure that contains additional information about the view.

          
          

          - *(dict) --* 

            Information about an additional property that describes a resource, that you can optionally include in the view. This lets you view that property in search results, and filter your search results based on the value of the property.

            
            

            - **Name** *(string) --* 

              The name of the property that is included in this view.

               

              You can specify the following property names for this field:

               

              
              * ``tags``
              

              
        
      
        

        - **Filters** *(dict) --* 

          An array of  SearchFilter objects that specify which resources can be included in the results of queries made using this view.

          
          

          - **FilterString** *(string) --* 

            The string that contains the search keywords, prefixes, and operators to control the results that can be returned by a  Search operation. For more details, see `Search query syntax <https://docs.aws.amazon.com/resource-explorer/latest/APIReference/about-query-syntax.html>`__.

            
      
    
  
  **Exceptions**
  
  *   :py:class:`ResourceExplorer.Client.exceptions.InternalServerException`

  
  *   :py:class:`ResourceExplorer.Client.exceptions.ValidationException`

  
  *   :py:class:`ResourceExplorer.Client.exceptions.ConflictException`

  
  *   :py:class:`ResourceExplorer.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`ResourceExplorer.Client.exceptions.UnauthorizedException`

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

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

  