
    
                         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  e	j                  e	j                  j                          G d d	e	j"                               Zy
)z0Implements command to create a new guest policy.    )absolute_import)division)unicode_literals)utils)base)
propertiesc                   &    e Zd ZdZed        Zd Zy)CreatezCreate a guest policy for a project.

  ## EXAMPLES

    To create a guest policy `policy1` in the current project, run:

          $ {command} policy1 --file=path_to_config_file

  c                 \    | j                  dt        d       | j                  ddd       y)	See base class.	POLICY_IDz        Name of the guest policy to create.

        This name must contain only lowercase letters, numbers, and hyphens,
        start with a letter, end with a number or a letter, be between 1-63
        characters, and unique within the project.)typehelpz--fileTz        The JSON or YAML file with the guest policy to create. For information
        about the guest policy format, see https://cloud.google.com/compute/docs/osconfig/rest/v1beta/projects.guestPolicies.)requiredr   N)add_argumentstr)parsers    6lib/surface/compute/os_config/guest_policies/create.pyArgszCreate.Args'   sC     6  	 A      c                    | j                         }t        j                  |      }t        j                  |      }t	        j
                  |j                  |j                        \  }}t        j                  j                  j                  j                         }t	        j                  |      }|j                  ||j                  |      }	|j                   }
|
j#                  |	      S )r   )guestPolicyguestPolicyIdparent)ReleaseTrackosconfig_api_utilsGetClientInstanceGetClientMessagesosconfig_command_utils"GetResourceAndUpdateFieldsFromFilefileGuestPolicyr   VALUEScoreproject	GetOrFailGetProjectUriPath*OsconfigProjectsGuestPoliciesCreateRequestr   projects_guestPoliciesr
   )selfargsrelease_trackclientmessagesguest_policy_r%   parent_pathrequestservices              r   Runz
Create.Run<   s     %%'M11-@F!33MBH !
C
C	H((*\ $$,,668G(::7CKAA nn B G
 ++G>>'""r   N)__name__
__module____qualname____doc__staticmethodr   r4    r   r   r
   r
      s       (#r   r
   N)r8   
__future__r   r   r   (googlecloudsdk.api_lib.compute.os_configr   r   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.compute.os_configr   googlecloudsdk.corer   ReleaseTracksr   BETACommandr
   r:   r   r   <module>rC      sW    7 &  ' P ( X * D%%**+4#T\\ 4# ,4#r   