
                            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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 ej&                  ej(                  j*                         G d dej,                               Z ej&                  ej(                  j0                         G d de             Z ej&                  ej(                  j4                         G d de             Zddde_        y)z(Update snapshot schedule policy command.    )absolute_import)division)unicode_literals)base_classes)utils)apis)base)flags)utilc           	      \   t        j                         j                  |        t        j                  |        t        j                  | dddddd       t        j
                  |        t        j                  | d       t        j                  d|      }t        j                  | |       y	)
z A helper function to build args.schedulezWStart time for the disk snapshot schedule in UTC. For example, `--start-time="15:00"`.
zSnapshot scheduleTF)flag_suffixstart_time_helpcadence_helpsupports_weeklysupports_hourlyrequired)r   computeN)
r
   MakeResourcePolicyArgAddArgumentAddCommonArgsAddCycleFrequencyArgsAddSnapshotLabelArgsAddSnapshotMaxRetentionDaysArgsr   GetMessagesModuleAddOnSourceDiskDeleteArgs)parserapi_versionmessagess      Alib/surface/compute/resource_policies/update/snapshot_schedule.py_CommonArgsr!      s    ++F3f '	 V$''?##I{;(!!&(3    c                   ,    e Zd ZdZed        Zd Zd Zy)UpdateSnapshotSchedule:Update a Compute Engine Snapshot Schedule Resource Policy.c                 8    t        | t        j                         y N)r!   compute_apiCOMPUTE_GA_API_VERSIONr   s    r    ArgszUpdateSnapshotSchedule.Args6   s    ::;r"   c                 $    | j                  |      S r'   _Runselfargss     r    RunzUpdateSnapshotSchedule.Run:       99T?r"   c                 ,   t        j                  | j                               }|j                  }|j                  j                  }t        j                         j                  ||j                  t        j                  |j                              }t        j                  |||      }|j                  |j                         ||j                  |j                         }|j                  j"                  j$                  }|j'                  |d|fg      S )N)scope_lister)resourcePolicyresourcePolicyResourceprojectregionPatch)r   ComputeApiHolderReleaseTrackclientr   r
   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   'MakeDiskSnapshotSchedulePolicyForUpdate#ComputeResourcePoliciesPatchRequestNamer8   r9   apitools_clientresourcePoliciesMakeRequests)	r0   r1   holderr=   r   
policy_refresource_policypatch_requestservices	            r    r.   zUpdateSnapshotSchedule._Run=   s    **4+<+<+>?F]]F}}%%H,,.@@"88G A IJ
 BBD($O @@!(.""  	 A "M
 mm++<<G'= ABCCr"   N)__name__
__module____qualname____doc__staticmethodr+   r2   r.    r"   r    r$   r$   2   s"    B< <Dr"   r$   c                   &    e Zd ZdZed        Zd Zy)UpdateSnapshotScheduleBetar%   c                 8    t        | t        j                         y r'   )r!   r(   COMPUTE_BETA_API_VERSIONr*   s    r    r+   zUpdateSnapshotScheduleBeta.ArgsV   s    <<=r"   c                 $    | j                  |      S r'   r-   r/   s     r    r2   zUpdateSnapshotScheduleBeta.RunZ   r3   r"   NrM   rN   rO   rP   rQ   r+   r2   rR   r"   r    rT   rT   R   s    B> >r"   rT   c                   &    e Zd ZdZed        Zd Zy)UpdateSnapshotScheduleAlphar%   c                 8    t        | t        j                         y r'   )r!   r(   COMPUTE_ALPHA_API_VERSIONr*   s    r    r+   z UpdateSnapshotScheduleAlpha.Argsb   s    ==>r"   c                 $    | j                  |      S r'   r-   r/   s     r    r2   zUpdateSnapshotScheduleAlpha.Runf   r3   r"   NrX   rR   r"   r    rZ   rZ   ^   s    B? ?r"   rZ   z;Update a Compute Engine Snapshot Schedule Resource Policy.
zThe following command updates a Compute Engine Snapshot Schedule Resource Policy to take a daily snapshot at 13:00 UTC

  $ {command} my-resource-policy --region=REGION --start-time=13:00 --daily-schedule
)DESCRIPTIONEXAMPLESN)rP   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r(   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r@   4googlecloudsdk.command_lib.compute.resource_policiesr   r!   ReleaseTracksr<   GAUpdateCommandr$   BETArT   ALPHArZ   detailed_helprR   r"   r    <module>rl      s    / &  ' 7 ? , ( E F E4( D%%(()DT// D *D> D%%**+!7  , D%%++,"8  -		(  $r"   