
    G                     @   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r\R"                  \R$                  " \R&                  R(                  \R&                  R*                  5       " S S\R,                  5      5       5       rg)zCreate policy command.    )absolute_import)division)unicode_literals)apis)platform_policy)messages)base)flags)parsingNc                   .    \ rS rSrSr\S 5       rS rSrg)Create   a  Create a Binary Authorization platform policy.

## EXAMPLES

To create a policy for GKE in the current project:

    $ {command} my-policy --platform=gke --policy-file=my_policy.yaml

To create a policy for GKE in a specific project:

    $ {command} my-policy --platform=gke --project=my-project-id \
      --policy-file=my_policy.yaml

or

    $ {command} /projects/my-project-id/platforms/gke/policies/my-policy
    \
      --policy-file=my_policy.yaml
c                     [         R                  " U S5        U R                  SSSS9  U R                  R	                  S5        g )Nz	to createz--policy-fileTz0The JSON or YAML file containing the new policy.)requiredhelpyaml)r
   AddPlatformPolicyResourceArgadd_argumentdisplay_info	AddFormat)parsers    /lib/surface/container/binauthz/policy/create.pyArgsCreate.Args5   sE    	&&v{;
?  A !!&)    c                 f   UR                   R                  R                  5       n[        R                  " [
        R                  " UR                  5      5      n[        R                  " U[        R                  " S5      R                  5      n[        R                  " S5      R                  X$5      $ )zrRuns the command.

Args:
  args: argparse.Namespace with command-line arguments.

Returns:
  The policy resource.
v1)CONCEPTSpolicy_resource_nameParser   LoadResourceFilesix
ensure_strpolicy_filemessages_utilDictToMessageWithErrorCheckr   GetMessagesModulePlatformPolicyr   Clientr   )selfargsr   
policy_objpolicys        r   Run
Create.Run>   s      ====CCE )) 	t''(*J 66t$335F
 !!$'../CLLr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r.   __static_attributes__r0   r   r   r   r      s!    ( * *Mr   r   )r5   
__future__r   r   r   )googlecloudsdk.api_lib.container.binauthzr   r   googlecloudsdk.api_lib.utilr   r%   googlecloudsdk.callioper	   -googlecloudsdk.command_lib.container.binauthzr
   r   r"   DefaultUniverseOnlyReleaseTracksReleaseTrackBETAALPHACreateCommandr   r0   r   r   <module>rC      s     &  ' : E A ( ? A 
 D%%**D,=,=,C,CD6MT 6M E 6Mr   