
    	                         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)z#Set the IAM policy for an attestor.    )absolute_import)division)unicode_literals)apis)iam)util)base)iam_utilc                   &    e Zd ZdZed        Zd Zy)SetIamPolicyaY  Set the IAM policy for an attestor.

  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 attestor `my_attestor`:

    $ {command} my_attestor iam_policy.json
  c                 P    |j                  dd       |j                  dd       y )Nattestor_namez:The name of the attestor whose IAM policy will be updated.)helppolicy_filez0The JSON or YAML file containing the IAM policy.)add_argument)clsparsers     :lib/surface/container/binauthz/attestors/set_iam_policy.pyArgszSetIamPolicy.Args,   s:    
  
 0  2    c                    t        j                  | j                               }t        j                  |      }t        j                  |j                        }t        j                  |j                  |j                  j                        \  }}|j                  ||      }t        j                  |j                         d       |S )Nattestor)r   GetApiVersionReleaseTrackr   Clientr   GetAttestorRefr   r
   ParseYamlOrJsonPolicyFiler   messages	IamPolicySetLogSetIamPolicyName)selfargsapi_versionclientattestor_refpolicy_results           r   RunzSetIamPolicy.Run8   s    $$T%6%6%89KZZ$F&&t'9'9:L2243C3C39??3L3LNIFA ZZf-F\..0*=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   r1   r   r   <module>r8      sG    * &  ' : 9 : ( 3 %4<< % %r   