
                            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ddZ ej(                  de       ej*                  ej,                  j.                        ej0                   G d dej2                                             Z ej(                  de       ej*                  ej,                  j6                         G d de                    Zddde_        y)zCreate resource policy command.    )absolute_import)division)unicode_literals)base_classes)utils)apis)base)flags)utilzm
`create-snapshot-schedule` is deprecated.
Use `compute resource-policies create snapshot-schedule` instead.
Fc                 :   t        j                  d|      }t        j                         j	                  |        t        j
                  |        t        j                  | ddddd       t        j                  | ||       | j                  j                  d       y)z?A helper function to build args based on different API version.computescheduleziStart time for the disk snapshot schedule. See $ gcloud topic datetimes for information on time formats.
zSnapshot scheduleT)flag_suffixstart_time_helpcadence_helpsupports_weeklysupports_hourlyN)
r   GetMessagesModuler
   MakeResourcePolicyArgAddArgumentAddCommonArgsAddCycleFrequencyArgsAddSnapshotScheduleArgsdisplay_infoAddCacheUpdater)parserapi_versionsupport_snapshot_regionmessagess       Alib/surface/compute/resource_policies/create_snapshot_schedule.py_CommonArgsr!   #   s    ##I{;(++F3f ' 2IJ%%d+    )
is_removedwarningc                   .    e Zd ZdZed        Zd ZddZy)CreateSnapshotScheduleBetaCreate a Compute Engine Snapshot Schedule Resource Policy.

  *{command} creates a Resource Policy which can be attached to disks and
  specifies a schedule for taking disk snapshots and how long these snapshots
  should be retained.
  c                 <    t        | t        j                  d       y NT)r   r   )r!   compute_apiCOMPUTE_BETA_API_VERSIONr   s    r    ArgszCreateSnapshotScheduleBeta.Args@   s    88 $r"   c                 (    | j                  |d      S )NT)r   )_Run)selfargss     r    RunzCreateSnapshotScheduleBeta.RunH   s    99T4988r"   c                    t        j                  | j                               }|j                  }t	        j
                         j                  ||j                  t        j                  |j                              }|j                  j                  }t        j                  ||||      }|j                  ||j                  |j                        }|j                  j                   j"                  }	|j%                  |	d|fg      d   S )N)scope_lister)resourcePolicyprojectregionInsertr   )r   ComputeApiHolderReleaseTrackclientr
   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   r   MakeDiskSnapshotSchedulePolicy$ComputeResourcePoliciesInsertRequestr6   r7   apitools_clientresourcePoliciesMakeRequests)
r0   r1   r   holderr;   
policy_refr   resource_policycreate_requestservices
             r    r/   zCreateSnapshotScheduleBeta._RunK   s    **4+<+<+>?F]]F,,.@@"88G A IJ
 }}%%H99D($;=OBB&""   C "N
 mm++<<G(N CDEaHHr"   NF)__name__
__module____qualname____doc__staticmethodr-   r2   r/    r"   r    r&   r&   5   s&      9Ir"   r&   c                        e Zd ZdZed        Zy)CreateSnapshotScheduleAlphar'   c                 <    t        | t        j                  d       y r)   )r!   r*   COMPUTE_ALPHA_API_VERSIONr,   s    r    r-   z CreateSnapshotScheduleAlpha.Argsj   s    99 $&r"   N)rK   rL   rM   rN   rO   r-   rP   r"   r    rR   rR   `   s     & &r"   rR   z;Create a Compute Engine Snapshot Schedule Resource Policy.
zThe following command creates a Compute Engine Snapshot Schedule Resource Policy with a daily snapshot and a one day snapshot retention policy.

  $ {command} my-resource-policy --region=REGION --start-time=04:00Z --daily-schedule --max-retention-days=1
)DESCRIPTIONEXAMPLESNrJ   )rN   
__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   _DEPRECATION_WARNINGr!   	DeprecateReleaseTracksr:   BETAUniverseCompatibleCreateCommandr&   ALPHArR   detailed_helprP   r"   r    <module>re      s    & &  ' 7 ? , ( E F E ,$ 5*>?D%%**+%I!3!3 %I  , @%IP 5*>?D%%++,&"< & - @&$		,  (r"   