
                             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 e
j                   G d
 de
j                               Zy)z5Set the IAM policy for a Binary Authorization policy.    )absolute_import)division)unicode_literals)apis)iam)util)base)iam_utilc                   &    e Zd ZdZed        Zd Zy)SetIamPolicyax  Set the IAM policy for a Binary Authorization policy.

  See https://cloud.google.com/iam/docs/managing-policies for details of
  the policy file format and contents.

  ## EXAMPLES
  The following command will read an IAM policy defined in a JSON file
  'iam_policy.json' and set it for the current project's Binary Authorization
  policy:

    $ {command} iam_policy.json
  c                 *    |j                  dd       y )Npolicy_filez0The JSON or YAML file containing the IAM policy.)help)add_argument)clsparsers     7lib/surface/container/binauthz/policy/set_iam_policy.pyArgszSetIamPolicy.Args-   s    
0  2    c                 x   t        j                  | j                               }t        j                  |      }t        j                         }t        j                  |j                  |j                  j                        \  }}|j                  ||      }t        j                  |j                         d       |S )Npolicy)r   GetApiVersionReleaseTrackr   Clientr   GetPolicyRefr
   ParseYamlOrJsonPolicyFiler   messages	IamPolicySetLogSetIamPolicyName)selfargsapi_versionclient
policy_refr   _results           r   RunzSetIamPolicy.Run4   s    $$T%6%6%89KZZ$F""$J2243C3C39??3L3LNIFA ZZ
F+FZ__.9Mr   N)__name__
__module____qualname____doc__classmethodr   r)    r   r   r   r      s      2 2
r   r   N)r-   
__future__r   r   r   )googlecloudsdk.api_lib.container.binauthzr   r   r   googlecloudsdk.callioper	   googlecloudsdk.command_lib.iamr
   DefaultUniverseOnlyCommandr   r/   r   r   <module>r6      sG    < &  ' : 9 : ( 3 !4<< ! !r   