
                         X   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	 Zd
 Z e	j"                  e	j$                  j&                         G d de	j(                               Z e	j"                  e	j$                  j,                         G d de             Zy)z4Implements command to create a new patch deployment.    )absolute_import)division)unicode_literals)utils)base)flags)
propertiesc                 @    | t         j                  j                  k(  ryy)Nzbeta  )r   ReleaseTrackBETArelease_tracks    9lib/surface/compute/os_config/patch_deployments/create.py_GetReleaseTrackTextr      s    d'',,,    c                 D    dj                  dt        |             dd}|S )z.Formats and returns detailed help for command.a        *{command}* creates a patch deployment in a project from a specified file.
      A patch deployment triggers a patch job to run at specific time(s)
      according to a schedule, and applies instance filters and other patch
      configurations to the patch job at run time. Alternatively, to run a patch
      job on-demand, see *$ gcloud*
      *{release_track}compute os-config patch-jobs execute*.
        z	{command})commandr   z      To create a patch deployment `patch-deployment-1` in the current project,
      run:

          $ {command} patch-deployment-1 --file=path_to_config_file
      )DESCRIPTIONEXAMPLES)formatr   )r   detailed_helps     r   _GetDetailedHelpr   #   s7     F.}=  ?
-( 
r   c                   `    e Zd ZdZ eej                  j                        Ze	d        Z
d Zy)Create(Create a patch deployment for a project.r   c                 2    t        j                  | d       y )Nv1api_versionr   AddPatchDeploymentsCreateFlagsparsers    r   ArgszCreate.ArgsB   s    	((TBr   c                    | j                         }t        j                  |      }t        j                  |      }t	        j
                  |j                  |j                        \  }}t        j                  j                  j                  j                         }t	        j                  |      }|j                  ||j                  |      }	|j                   j#                  |	      S )N)patchDeploymentpatchDeploymentIdparent)r   osconfig_api_utilsGetClientInstanceGetClientMessagesosconfig_command_utils"GetResourceAndUpdateFieldsFromFilefilePatchDeploymentr	   VALUEScoreproject	GetOrFailGetProjectUriPath-OsconfigProjectsPatchDeploymentsCreateRequestPATCH_DEPLOYMENT_IDprojects_patchDeploymentsr   )
selfargsr   clientmessagespatch_deployment_r3   parent_pathrequests
             r   Runz
Create.RunF   s    %%'M11-@F!33MBH !
C
C	H,,. $$,,668G(::7CKDD(22 E G ++227;;r   N)__name__
__module____qualname____doc__r   r   r   GAr   staticmethodr%   rA    r   r   r   r   <   s4    0"1B1B1E1EF-C C<r   r   c                   Z    e Zd ZdZ eej                  j                        Ze	d        Z
y)
CreateBetar   r   c                 2    t        j                  | d       y )Nv1betar   r!   r#   s    r   r%   zCreateBeta.Args`   s    	((XFr   N)rB   rC   rD   rE   r   r   r   r   r   rG   r%   rH   r   r   rJ   rJ   Z   s/    0"1B1B1G1GH-G Gr   rJ   N)rE   
__future__r   r   r   (googlecloudsdk.api_lib.compute.os_configr   r*   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.compute.os_configr   r-   googlecloudsdk.corer	   r   r   ReleaseTracksr   rF   Commandr   r   rJ   rH   r   r   <module>rT      s    ; &  ' P ( > X *2 D%%(()<T\\ < *<: D%%**+G G ,Gr   