
    W
                         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 dd	lmZ  G d
 de
j"                        Zdddde_        y)z)Command to set IAM policy for a resource.    )absolute_import)division)unicode_literals)base_classes)client)base)flags)iam_utilc                   &    e Zd ZdZed        Zd Zy)SetIamPolicy@Set the IAM policy binding for a Compute Engine backend service.c                 l    t         j                  j                  |        t        j                  |        y )N)r	   #GLOBAL_REGIONAL_BACKEND_SERVICE_ARGAddArgumentr
   AddArgForPolicyFile)parsers    6lib/surface/compute/backend_services/set_iam_policy.pyArgszSetIamPolicy.Args    s$    	--99&A  (    c                    t        j                  | j                               }t        j                  j                  ||j                  t        j                  |j                              }t        j                  ||j                        }|j                  t        j                  |j                  |j                  j                  j                               S )N)scope_lister)compute_client)r   ComputeApiHolderReleaseTrackr	   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   BackendServicer   r
   ParsePolicyFilepolicy_filemessagesPolicy)selfargsholderbackend_service_refbackend_services        r   RunzSetIamPolicy.Run%   s    **4+<+<+>?F11CC&<<V]]K 	D 	M  ++FMM;O''  !1!1!'!7!7!>!>	@A Ar   N)__name__
__module____qualname____doc__staticmethodr   r)    r   r   r   r      s    H) )Ar   r   r   z_
    Sets the IAM policy for the given backend service as defined in a
    JSON or YAML file.  a      The following command will read an IAM policy defined in a JSON file
    'policy.json' and set it for the backend service `my-backend-service`:

      $ {command} my-backend-service policy.json --region=REGION

      $ {command} my-backend-service policy.json --global

    See https://cloud.google.com/iam/docs/managing-policies for details of the
    policy file format and contents.
    )briefDESCRIPTIONEXAMPLESN)r-   
__future__r   r   r   googlecloudsdk.api_lib.computer   /googlecloudsdk.api_lib.compute.backend_servicesr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r   3googlecloudsdk.command_lib.compute.backend_servicesgooglecloudsdk.command_lib.iamr
   Commandr   detailed_helpr/   r   r   <module>r<      sQ    0 &  ' 7 B ( E E 3A4<< A2 	K	

	 r   