
    i                     R   S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  \R                  " \R                  R                  5      \R                    " S S	\R"                  5      5       5       r\R                  " \R                  R&                  5       " S
 S\5      5       rg)z3Implementation of create command for batch actions.    )storage_batch_operations_api)base)flags)resource_args)log)
console_ioc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Create   !Create a new batch operation job.z
      Create a batch operation job, allowing you to perform operations
      such as deletion, updating metadata, and more on objects in a
      serverless manner.
      a  
      To create a batch job with the name `my-job` to perform object deletion
      on bucket `my-bucket` and the manifest file
      `gs://my-bucket/manifest.csv` specifies the objects to be transformed:

          $ {command} my-job --bucket=my-bucket --manifest-location=gs://my-bucket/manifest.csv
          --delete-object

      To create a batch job with the name `my-job` to update object metadata
      `Content-Disposition` to `inline`, `Content-Language` to `en`, and
      set object retention mode to `locked` on bucket `my-bucket` where you want to match
      objects with prefixes `prefix1` or `prefix2`:

          $ {command} my-job --bucket=my-bucket --included-object-prefixes=prefix1,prefix2
          --put-metadata=Content-Disposition=inline,Content-Language=en,Retain-Until=2025-01-01T00:00:00Z,Retention-Mode=locked

      To create a batch job with the name `my-job` to put object event based hold on objects in bucket `my-bucket` with
      logging config enabled for corresponding transform action and succeeded and failed action states:

          $ {command} my-job --bucket=my-bucket --put-object-event-based-hold
          --put-metadata=Content-Disposition=inline,Content-Language=en
          --log-actions=transform --log-action-states=succeeded,failed
      )DESCRIPTIONEXAMPLESc                 ^    [         R                  " U S5        [        R                  " U 5        g Nz	to create)r   add_batch_job_resource_argr   add_batch_jobs_flagsparsers    3lib/surface/storage/batch_operations/jobs/create.pyArgsCreate.Args=   s     ,,V[A	v&    c                    [        USS5      nUR                  (       a  U(       d  Sn[        R                  " USS9  UR                  R
                  R                  5       n[        R                  " 5       R                  XR                  5       5        [        R                  R                  SR                  UR                  5       5      5        g )Ndry_runFzThis command will delete objects specified in the batch operation job. Please ensure that you have soft delete enabled on the bucket if you want to restore the objects within the retention duration.T)messagecancel_on_nozCreated batch job: {})getattrdelete_objectr   PromptContinueCONCEPTS	batch_jobParser   StorageBatchOperationsApicreate_batch_jobRelativeNamer   statusPrintformat)selfargsr   delete_promptjob_refs        r   Run
Create.RunB   s    dIu-G'O 
  mm%%++-G ::<MM""$ JJ,33G4H4H4JKLr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r-   __static_attributes__r/   r   r   r
   r
      s2     *


-> ' 'Mr   r
   c                   (    \ rS rSrSr\S 5       rSrg)CreateAlphaV   r   c                     [         R                  " U S5        [        R                  " U 5        [        R                  " U 5        g r   )r   r   r   r   add_batch_jobs_dry_run_flagr   s    r   r   CreateAlpha.ArgsZ   s.    ,,V[A	v&	%%f-r   r/   N)r0   r1   r2   r3   r4   r6   r   r7   r/   r   r   r9   r9   V   s    ). .r   r9   N)r4   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   8googlecloudsdk.command_lib.storage.batch_operations.jobsr   googlecloudsdk.corer   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackGADefaultUniverseOnlyCommandr
   ALPHAr9   r/   r   r   <module>rJ      s    : G ( 4 R # 2 D%%(()8MT\\ 8M  *8Mv D%%++,.& . -.r   