
                            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	  SSK
Jr  SSKJr  SS	KJr  S
 r\	R                   " \	R"                  R$                  5       " S S\	R&                  5      5       r\	R                   " \	R"                  R*                  5       " S S\5      5       r\	R                   " \	R"                  R.                  5       " S S\5      5       rSSS.\l        g)zCreate resource policy command.    )absolute_import)division)unicode_literals)base_classes)arg_parsers)base)flags)utilc                 |   [         R                  " 5       R                  U 5        [         R                  " U 5        U R	                  SSS9  U R	                  SSS9  U R	                  SSS9  U R	                  S[
        R                  R                  S	S
9  U R	                  S[
        R                  R                  SS
9  g)zA helper function.z
--timezonez
      Timezone used in interpreting schedule. The value of this field must be
      a time zone name from the tz database
      http://en.wikipedia.org/wiki/Tz_database
    )helpz--vm-start-schedulezU
      Schedule for starting the instance, specified using standard CRON format.
    z--vm-stop-schedulezU
      Schedule for stopping the instance, specified using standard CRON format.
    z--initiation-datez`
     The start time of the schedule policy. The timestamp must be
     an RFC3339 valid string.)typer   z
--end-datezbThe expiration time of the schedule policy. The timestamp must be
        an RFC3339 valid string.N)r	   MakeResourcePolicyArgAddArgumentAddCommonArgsadd_argumentr   DatetimeParseparsers    Alib/surface/compute/resource_policies/create/instance_schedule.py_CommonArgsr      s     ++F3f  	 	  	
 	  	 	%%!  " 	%%$  %    c                   .    \ rS rSrSr\S 5       rS rSrg)CreateInstanceSchedulePolicyB   :Create a Compute Engine instance schedule resource policy.c                     [        U 5        g Nr   r   s    r   Args!CreateInstanceSchedulePolicy.ArgsF   
    r   c                    [         R                  " U R                  5       5      nUR                  n[        R
                  " 5       R                  UUR                  [        R                  " UR                  5      S9nUR                  R                  n[        R                  " XAU5      nUR                  UUR                  UR                  S9nUR                  R                   R"                  nUR%                  USU4/5      S   $ )N)scope_lister)resourcePolicyprojectregionInsertr   )r   ComputeApiHolderReleaseTrackclientr	   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListermessagesr
   MakeInstanceSchedulePolicy$ComputeResourcePoliciesInsertRequestr&   r'   apitools_clientresourcePoliciesMakeRequests)	selfargsholderr+   
policy_refr0   resource_policycreate_requestservices	            r   Run CreateInstanceSchedulePolicy.RunJ   s    **4+<+<+>?F]]F,,.@@"88G A IJ
 }}%%H55j6>@OBB&""   C "N
 mm++<<G(N CDEaHHr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr    r=   __static_attributes__r?   r   r   r   r   B   s    B Ir   r   c                   (    \ rS rSrSr\S 5       rSrg) CreateInstanceSchedulePolicyBeta_   r   c                     [        U 5        g r   r   r   s    r   r    %CreateInstanceSchedulePolicyBeta.Argsc   r"   r   r?   Nr@   rA   rB   rC   rD   rE   r    rF   r?   r   r   rH   rH   _       B r   rH   c                   (    \ rS rSrSr\S 5       rSrg)!CreateInstanceSchedulePolicyAlphah   r   c                     [        U 5        g r   r   r   s    r   r    &CreateInstanceSchedulePolicyAlpha.Argsl   r"   r   r?   NrL   r?   r   r   rO   rO   h   rM   r   rO   z;Create a Compute Engine instance schedule resource policy.
a  To create an instance schedule resource policy that has a daily start operation at 8 AM and a daily stop operation at 5 PM for the UTC timezone, run:

  $ {command} my-resource-policy --description="daily policy" --vm-start-schedule="0 8 * * *" --vm-stop-schedule="0 17 * * *" --timezone="UTC" --region=REGION

Use the initiation date and end date to limit when the policy is active. To create an instance schedule resource policy with initiation and end dates, run:

  $ {command} my-resource-policy --description="limited daily policy" --vm-start-schedule="0 8 * * *" --vm-stop-schedule="0 17 * * *" --timezone="UTC" --region=REGION --initiation-date="2021-01-01T00:00:00.000Z" --end-date="2021-02-01T00:00:00.000Z"
)DESCRIPTIONEXAMPLESN)rD   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r.   4googlecloudsdk.command_lib.compute.resource_policiesr
   r   ReleaseTracksr*   GACreateCommandr   BETArH   ALPHArO   detailed_helpr?   r   r   <module>r`      s    & &  ' 7 / ( E F E"%J D%%(()I4#5#5 I *I8 D%%**+'C  , D%%++,(H  -		.  *r   