:doc:`CodeGuruSecurity <../../codeguru-security>` / Client / create_scan

***********
create_scan
***********



.. py:method:: CodeGuruSecurity.Client.create_scan(**kwargs)

  

  Use to create a scan using code uploaded to an Amazon S3 bucket.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codeguru-security-2018-05-10/CreateScan>`_  


  **Request Syntax**
  ::

    response = client.create_scan(
        clientToken='string',
        resourceId={
            'codeArtifactId': 'string'
        },
        scanName='string',
        scanType='Standard'|'Express',
        analysisType='Security'|'All',
        tags={
            'string': 'string'
        }
    )
    
  :type clientToken: string
  :param clientToken: 

    The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.

    This field is autopopulated if not provided.

  
  :type resourceId: dict
  :param resourceId: **[REQUIRED]** 

    The identifier for the resource object to be scanned.

    .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``codeArtifactId``. 

  
    - **codeArtifactId** *(string) --* 

      The identifier for the code file uploaded to the resource object. Returned by ``CreateUploadUrl`` when you upload resources to be scanned.

      

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

    The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a ``STANDARD`` scan type.

    

  
  :type scanType: string
  :param scanType: 

    The type of scan, either ``Standard`` or ``Express``. Defaults to ``Standard`` type if missing.

     

    ``Express`` scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. ``Standard`` scans have standard resource limits and use the full set of detectors to analyze your code.

    

  
  :type analysisType: string
  :param analysisType: 

    The type of analysis you want CodeGuru Security to perform in the scan, either ``Security`` or ``All``. The ``Security`` type only generates findings related to security. The ``All`` type generates both security findings and quality findings. Defaults to ``Security`` type if missing.

    

  
  :type tags: dict
  :param tags: 

    An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:

     

    
    * A tag key. For example, ``CostCenter``, ``Environment``, or ``Secret``. Tag keys are case sensitive.
     
    * An optional tag value field. For example, ``111122223333``, ``Production``, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
    

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {
          'scanName': 'string',
          'runId': 'string',
          'resourceId': {
              'codeArtifactId': 'string'
          },
          'scanState': 'InProgress'|'Successful'|'Failed',
          'scanNameArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **scanName** *(string) --* 

        The name of the scan.

        
      

      - **runId** *(string) --* 

        UUID that identifies the individual scan run.

        
      

      - **resourceId** *(dict) --* 

        The identifier for the resource object that contains resources that were scanned.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``codeArtifactId``.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as follows::

                'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}


      
        

        - **codeArtifactId** *(string) --* 

          The identifier for the code file uploaded to the resource object. Returned by ``CreateUploadUrl`` when you upload resources to be scanned.

          
    
      

      - **scanState** *(string) --* 

        The current state of the scan. Returns either ``InProgress``, ``Successful``, or ``Failed``.

        
      

      - **scanNameArn** *(string) --* 

        The ARN for the scan name.

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

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

  
  *   :py:class:`CodeGuruSecurity.Client.exceptions.ResourceNotFoundException`

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

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

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

  