
    ~                         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SKJr  SSKJr  SSKJr  \R*                   " S S\R,                  5      5       rg)z+Import Binary Authorization policy command.    )absolute_import)division)unicode_literals)apis)policies)util)messages)base)arg_parsers)parsing)log)
console_ioc                   .    \ rS rSrSr\S 5       rS rSrg)Import    aq  Import a Binary Authorization policy to the current project.

This command accepts a description of the desired policy in the form of a
YAML-formatted file. A representation of the current policy can be retrieved
using the  $ {parent_command} export  command. One method of modifying the
policy is to run `$ {parent_command} export`, dump the contents to a file,
modify the policy file to reflect the desired new policy, and provide this
modified file to `$ {command}`.

## EXAMPLES

To update the current project's policy:

  $ {parent_command} export > my_policy.yaml

  $ edit my_policy.yaml

  $ {command} my_policy.yaml
c                 f    UR                  S[        R                  SS9  UR                  SSSSS9  g )	Npolicy_filez:The file containing the YAML-formatted policy description.)typehelpz--strict-validation
store_trueFzHWhether to perform additional checks on the validity of policy contents.)actionrequiredr   )add_argumentr   PolicyFileName)clsparsers     /lib/surface/container/binauthz/policy/import.pyArgsImport.Args7   sH    
''I  K 	      c                    [         R                  " U R                  5       5      n[         R                  " U5      n[        R
                  " UR                  5      nU(       d-  0 n[        R                  " S5        [        R                  " SSS9  [        R                  " XCR                  5      n[        R                  " U5      R!                  ["        R$                  " 5       U5      $ )NzEmpty Policy provided!z&Do you want to import an empty policy?T)prompt_stringcancel_on_no)r   GetApiVersionReleaseTrackGetMessagesModuler   LoadResourceFiler   r   warningr   PromptContinuemessages_utilDictToMessageWithErrorCheckPolicyr   ClientSetr   GetPolicyRef)selfargsapi_versionr	   
policy_objpolicys         r   Run
Import.RunD   s    $$T%6%6%89K%%k2H ))$*:*:;J j 
kk*+@ 66OO%F ??;'++D,=,=,?HHr     N)	__name__
__module____qualname____firstlineno____doc__classmethodr   r5   __static_attributes__r7   r    r   r   r       s!    ( 
 
Ir    r   N)r<   
__future__r   r   r   )googlecloudsdk.api_lib.container.binauthzr   r   r   googlecloudsdk.api_lib.utilr	   r*   googlecloudsdk.callioper
   -googlecloudsdk.command_lib.container.binauthzr   r   googlecloudsdk.corer   googlecloudsdk.core.consoler   DefaultUniverseOnlyCommandr   r7   r    r   <module>rH      sV    2 &  ' : > : A ( E A # 2 8IT\\ 8I 8Ir    