
                            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ddZ ej"                  ej$                  j&                        ej(                  ej*                   G d dej,                                             Z ej"                  ej$                  j0                        ej(                   G d dej,                                      Zy)zSet the IAM policy for a space.    )absolute_import)division)unicode_literals)spaces)utils)base)flags)iam_utilz         Set the IAM policy for a Design Center space as defined in a JSON/YAML file.

        See https://cloud.google.com/iam/docs/managing-policies for details of
          the policy file format and contents.
        a           To set the space IAM policy using a json file 'my_policy.json' for
        the Space `my-space` in project `my-project` and location `us-central1`, run:

          $ {command} my-space --location=us-central1 --project=my-project /path/to/my_policy.json

        To set the space IAM policy using a yaml file 'my_policy.yaml` for
        the Space `my-space` in project `my-project` and location `us-central1`, run:

          $ {command} my-space --location=us-central1 --project=my-project /path/to/my_policy.yaml
        z         This command uses the designcenter/v1alpha API. The full documentation for
        this API can be found at:
        http://cloud.google.com/application-design-center/docs
        )DESCRIPTIONEXAMPLESzAPI REFERENCEc                   *    e Zd ZdZeZed        Zd Zy)SetIamPolicyGASet the IAM policy for a Design Center space as defined in a JSON/YAML file.

     See https://cloud.google.com/iam/docs/managing-policies for details of
        the policy file format and contents.
  c                 X    t        j                  |        t        j                  |        y Nr	   AddSetIamPolicyFlagsr
   AddArgForPolicyFileparsers    2lib/surface/design_center/spaces/set_iam_policy.pyArgszSetIamPolicyGA.ArgsB       	v&  (    c                     t        j                  t        j                  j                        }t        j                  |      }|j                  |j                         |j                        S N)release_track)space_idpolicy_file)
apisSpacesClientr   ReleaseTrackGAapi_lib_utilsGetSpaceRefSetIamPolicyRelativeNamer   selfargsclient	space_refs       r   RunzSetIamPolicyGA.RunG   sZ    T->->-A-ABF))$/I'')t7G7G   r   N	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   r-    r   r   r   r   6   s%     !-) )r   r   c                   *    e Zd ZdZeZed        Zd Zy)SetIamPolicyAlphar   c                 X    t        j                  |        t        j                  |        y r   r   r   s    r   r   zSetIamPolicyAlpha.ArgsY   r   r   c                     t        j                  t        j                  j                        }t        j                  |      }|j                  |j                         |j                        S r   )
r    r!   r   r"   ALPHAr$   r%   r&   r'   r   r(   s       r   r-   zSetIamPolicyAlpha.Run^   sZ    T->->-D-DEF))$/I'')t7G7G   r   Nr.   r6   r   r   r8   r8   O   s%    
 !-) )r   r8   N)r2   
__future__r   r   r   $googlecloudsdk.api_lib.design_centerr   r    r   r$   googlecloudsdk.callioper   (googlecloudsdk.command_lib.design_centerr	   googlecloudsdk.command_lib.iamr
   r3   ReleaseTracksr"   r#   UniverseCompatibleHiddenCommandr   r;   r8   r6   r   r   <module>rE      s    & &  ' ? G ( : 3
%4 D%%(()T\\    *, D%%++,   -r   