
                         V   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dZ	d Z
d	 Z ej                  ej                  j                        ej                   G d
 dej                                       Z ej                  ej                  j$                         G d de             Zy)z9Implementation of list command for batch operations jobs.    )absolute_import)division)unicode_literals)storage_batch_operations_api)baseglobalc                 >    i }g d}|D ]  }|| v s| |   ||<   |c S  y)zTransform for the TRANSFORMATION field in the table output.

  TRANSFORMATION is generated from the oneof field transformation.

  Args:
    job: job dictionary for transform

  Returns:
    A dictionary of the transformation type and its values.
  )putObjectHolddeleteObjectputMetadatarewriteObjectN )jobtransformationtransform_types	transforms       1lib/surface/storage/batch_operations/jobs/list.py_TransformTransformationr      s8     ./ #iC"%i.nY #    c                 &    | j                  dd      S )z4Transform for the DRY_RUN field in the table output.dry_runF)get)r   s    r   _TransformDryRunr   3   s    	E	""r   c                   0    e Zd ZdZdddZed        Zd Zy)ListList batch-operations jobs.(
      List batch operation jobs.
      a<  
      To list all batch jobs:

          $ {command}

      To list all batch jobs with a page size of `10`:

          $ {command} --page-size=10

      To list a limit of `20` batch jobs:

          $ {command} --limit=20

      To list all batch jobs in `JSON` format:

          $ {command} --format=json
      DESCRIPTIONEXAMPLESc                     t         j                  j                  |        | j                  j	                  d       | j                  j                  dt        i       y )Nae  
      table(
        name.basename():wrap=20:label=BATCH_JOB_ID,
        bucketList.buckets:wrap=20:label=SOURCE,
        transformation():wrap=20:label=TRANSFORMATION,
        createTime:wrap=20:label=CREATE_TIME,
        counters:wrap=20:label=COUNTERS,
        errorSummaries:wrap=20:label=ERROR_SUMMARIES,
        state:wrap=20:label=STATE
      )
    r   )r   URI_FLAGRemoveFromParserdisplay_info	AddFormatAddTransformsr   parsers    r   Argsz	List.ArgsT   sN    MM""6*
!! 
# 
	 %%2' r   c                 |    t        j                         j                  t        |j                  |j
                        S )N)r   StorageBatchOperationsApilist_batch_jobs_SBO_CLH_LOCATION_GLOBALlimit	page_size)selfargss     r   RunzList.Runf   s-    'AACSS $**dnn r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr)   r2   r   r   r   r   r   8   s1     $

	-.  "r   r   c                   *    e Zd ZdZdddZed        Zy)	ListAlphar   r   a  
      To list all batch jobs:

          $ {command}

      To list all batch jobs that are `not` dry run:

          $ {command} --filter="dry_run=false"

      To list all batch jobs with a page size of `10`:

          $ {command} --page-size=10

      To list a limit of `20` batch jobs:

          $ {command} --limit=20

      To list all batch jobs in `JSON` format:

          $ {command} --format=json
      r   c                     t         j                  j                  |        | j                  j	                  d       | j                  j                  t        t        d       y )Na  
      table(
        name.basename():wrap=20:label=BATCH_JOB_ID,
        dryrun():wrap=20:label=DRY_RUN,
        bucketList.buckets:wrap=20:label=SOURCE,
        transformation():wrap=20:label=TRANSFORMATION,
        createTime:wrap=20:label=CREATE_TIME,
        counters:wrap=20:label=COUNTERS,
        errorSummaries:wrap=20:label=ERROR_SUMMARIES,
        state:wrap=20:label=STATE
      )
    )r   dryrun)r   r"   r#   r$   r%   r&   r   r   r'   s    r   r)   zListAlpha.Args   sN    MM""6*
!! # 	 %%2"' r   N)r3   r4   r5   r6   r7   r8   r)   r   r   r   r:   r:   l   s*    #

	-6  r   r:   N)r6   
__future__r   r   r   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   r-   r   r   ReleaseTracksReleaseTrackGADefaultUniverseOnlyListCommandr   ALPHAr:   r   r   r   <module>rF      s    @ &  ' G (# 0#
 D%%(()/4 /  */d D%%++,0 0 -0r   