:doc:`Inspector2 <../../inspector2>` / Client / enable

******
enable
******



.. py:method:: Inspector2.Client.enable(**kwargs)

  

  Enables Amazon Inspector scans for one or more Amazon Web Services accounts.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/inspector2-2020-06-08/Enable>`_  


  **Request Syntax**
  ::

    response = client.enable(
        accountIds=[
            'string',
        ],
        resourceTypes=[
            'EC2'|'ECR'|'LAMBDA'|'LAMBDA_CODE'|'CODE_REPOSITORY',
        ],
        clientToken='string'
    )
    
  :type accountIds: list
  :param accountIds: 

    A list of account IDs you want to enable Amazon Inspector scans for.

    

  
    - *(string) --* 

    

  :type resourceTypes: list
  :param resourceTypes: **[REQUIRED]** 

    The resource scan types you want to enable.

    

  
    - *(string) --* 

    

  :type clientToken: string
  :param clientToken: 

    The idempotency token for the request.

    This field is autopopulated if not provided.

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

    
    ::

      {
          'accounts': [
              {
                  'accountId': 'string',
                  'status': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                  'resourceStatus': {
                      'ec2': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'ecr': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'lambda': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'lambdaCode': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'codeRepository': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
                  }
              },
          ],
          'failedAccounts': [
              {
                  'accountId': 'string',
                  'status': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                  'resourceStatus': {
                      'ec2': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'ecr': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'lambda': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'lambdaCode': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                      'codeRepository': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
                  },
                  'errorCode': 'ALREADY_ENABLED'|'ENABLE_IN_PROGRESS'|'DISABLE_IN_PROGRESS'|'SUSPEND_IN_PROGRESS'|'RESOURCE_NOT_FOUND'|'ACCESS_DENIED'|'INTERNAL_ERROR'|'SSM_UNAVAILABLE'|'SSM_THROTTLED'|'EVENTBRIDGE_UNAVAILABLE'|'EVENTBRIDGE_THROTTLED'|'RESOURCE_SCAN_NOT_DISABLED'|'DISASSOCIATE_ALL_MEMBERS'|'ACCOUNT_IS_ISOLATED'|'EC2_SSM_RESOURCE_DATA_SYNC_LIMIT_EXCEEDED'|'EC2_SSM_ASSOCIATION_VERSION_LIMIT_EXCEEDED'|'BLOCKED_BY_ORGANIZATION_POLICY',
                  'errorMessage': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **accounts** *(list) --* 

        Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.

        
        

        - *(dict) --* 

          An Amazon Web Services account within your environment that Amazon Inspector has been enabled for.

          
          

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

            The ID of the Amazon Web Services account.

            
          

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

            The status of Amazon Inspector for the account.

            
          

          - **resourceStatus** *(dict) --* 

            Details of the status of Amazon Inspector scans by resource type.

            
            

            - **ec2** *(string) --* 

              The status of Amazon Inspector scanning for Amazon EC2 resources.

              
            

            - **ecr** *(string) --* 

              The status of Amazon Inspector scanning for Amazon ECR resources.

              
            

            - **lambda** *(string) --* 

              The status of Amazon Inspector scanning for Amazon Web Services Lambda function.

              
            

            - **lambdaCode** *(string) --* 

              The status of Amazon Inspector scanning for custom application code for Amazon Web Services Lambda functions.

              
            

            - **codeRepository** *(string) --* 

              The status of Amazon Inspector scanning for code repositories.

              
        
      
    
      

      - **failedAccounts** *(list) --* 

        Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.

        
        

        - *(dict) --* 

          An object with details on why an account failed to enable Amazon Inspector.

          
          

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

            The Amazon Web Services account ID.

            
          

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

            The status of Amazon Inspector for the account.

            
          

          - **resourceStatus** *(dict) --* 

            An object detailing which resources Amazon Inspector is enabled to scan for the account.

            
            

            - **ec2** *(string) --* 

              The status of Amazon Inspector scanning for Amazon EC2 resources.

              
            

            - **ecr** *(string) --* 

              The status of Amazon Inspector scanning for Amazon ECR resources.

              
            

            - **lambda** *(string) --* 

              The status of Amazon Inspector scanning for Amazon Web Services Lambda function.

              
            

            - **lambdaCode** *(string) --* 

              The status of Amazon Inspector scanning for custom application code for Amazon Web Services Lambda functions.

              
            

            - **codeRepository** *(string) --* 

              The status of Amazon Inspector scanning for code repositories.

              
        
          

          - **errorCode** *(string) --* 

            The error code explaining why the account failed to enable Amazon Inspector.

            
          

          - **errorMessage** *(string) --* 

            The error message received when the account failed to enable Amazon Inspector.

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

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

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

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

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

  