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

**********************
get_clusters_for_image
**********************



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

  

  Returns a list of clusters and metadata associated with an image.

  

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


  **Request Syntax**
  ::

    response = client.get_clusters_for_image(
        filter={
            'resourceId': 'string'
        },
        maxResults=123,
        nextToken='string'
    )
    
  :type filter: dict
  :param filter: **[REQUIRED]** 

    The resource Id for the Amazon ECR image.

    

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

      The resource Id to be used in the filter criteria.

      

    
  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to be returned in a single page of results.

    

  
  :type nextToken: string
  :param nextToken: 

    The pagination token from a previous request used to retrieve the next page of results.

    

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

    
    ::

      {
          'cluster': [
              {
                  'clusterArn': 'string',
                  'clusterDetails': [
                      {
                          'lastInUse': datetime(2015, 1, 1),
                          'runningUnitCount': 123,
                          'stoppedUnitCount': 123,
                          'clusterMetadata': {
                              'awsEcsMetadataDetails': {
                                  'detailsGroup': 'string',
                                  'taskDefinitionArn': 'string'
                              },
                              'awsEksMetadataDetails': {
                                  'namespace': 'string',
                                  'workloadInfoList': [
                                      {
                                          'name': 'string',
                                          'type': 'string'
                                      },
                                  ]
                              }
                          }
                      },
                  ]
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **cluster** *(list) --* 

        A unit of work inside of a cluster, which can include metadata about the cluster.

        
        

        - *(dict) --* 

          Information about the cluster.

          
          

          - **clusterArn** *(string) --* 

            The cluster ARN.

            
          

          - **clusterDetails** *(list) --* 

            Details about the cluster.

            
            

            - *(dict) --* 

              Details about the task or pod in the cluster.

              
              

              - **lastInUse** *(datetime) --* 

                The last timestamp when Amazon Inspector recorded the image in use in the task or pod in the cluster.

                
              

              - **runningUnitCount** *(integer) --* 

                The number of tasks or pods where an image was running on the cluster.

                
              

              - **stoppedUnitCount** *(integer) --* 

                The number of tasks or pods where an image was stopped on the cluster in the last 24 hours.

                
              

              - **clusterMetadata** *(dict) --* 

                The metadata for a cluster.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``awsEcsMetadataDetails``, ``awsEksMetadataDetails``.     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'}


              
                

                - **awsEcsMetadataDetails** *(dict) --* 

                  The details for an Amazon ECS cluster in the cluster metadata.

                  
                  

                  - **detailsGroup** *(string) --* 

                    The details group information for a task in a cluster.

                    
                  

                  - **taskDefinitionArn** *(string) --* 

                    The task definition ARN.

                    
              
                

                - **awsEksMetadataDetails** *(dict) --* 

                  The details for an Amazon EKS cluster in the cluster metadata.

                  
                  

                  - **namespace** *(string) --* 

                    The namespace for an Amazon EKS cluster.

                    
                  

                  - **workloadInfoList** *(list) --* 

                    The list of workloads.

                    
                    

                    - *(dict) --* 

                      Information about the workload.

                      
                      

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

                        The name of the workload.

                        
                      

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

                        The workload type.

                        
                  
                
              
            
          
        
      
    
      

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

        The pagination token from a previous request used to retrieve the next page of results.

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

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

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

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

  