
    9                        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"                  j.                        ej&                   G d dej*                                      Zy)/Test IAM permissions for a Design Center space.    )absolute_import)division)unicode_literals)spaces)utils)arg_parsers)base)flagsap           Tests the IAM permissions that a caller has on a Design Center space.

        Returns an empty set of permissions if the space does not exist.

        Note: This operation is designed to be used for building
        permission-aware UIs and command-line tools, not for authorization
        checking. This operation may "fail open" without warning.
        ar           To test if the caller has the `designcenter.spaces.get` and
        `designcenter.spaces.update` permissions on the Space `my-space` in
        project `my-project` and location `us-central1`, run:

          $ {command} my-space --location=us-central1 --project=my-project               --permissions=designcenter.spaces.get,designcenter.spaces.update
        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)TestIamPermissionsGAr   c                 ~    t        j                  |        | j                  ddt        j                         dd       y Nz--permissions
PERMISSIONTz1The set of permissions to check for the resource.)metavartyperequiredhelpr   AddTestIamPermissionsFlagsadd_argumentr	   ArgListparsers    8lib/surface/design_center/spaces/test_iam_permissions.pyArgszTestIamPermissionsGA.Args=   ;    	$$V,
  "@      c                     t        j                  t        j                  j                        }t        j                  |      }|j                  |j                         |j                        S N)release_track)space_idpermissions)
apisSpacesClientr
   ReleaseTrackGAapi_lib_utilsGetSpaceRefTestIamPermissionsRelativeNamer%   selfargsclient	space_refs       r   RunzTestIamPermissionsGA.RunH   s[    T->->-A-ABF))$/I$$'')$$ %  r    N	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   r3    r    r   r   r   6   s#     8 - r    r   c                   *    e Zd ZdZeZed        Zd Zy)r,   r   c                 ~    t        j                  |        | j                  ddt        j                         dd       y r   r   r   s    r   r   zTestIamPermissions.ArgsW   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   r3   zTestIamPermissions.Runb   s[    T->->-D-DEF))$/I$$'')$$ %  r    Nr4   r<   r    r   r,   r,   Q   s#     8 - r    r,   N)r8   
__future__r   r   r   $googlecloudsdk.api_lib.design_centerr   r&   r   r*   googlecloudsdk.callioper	   r
   (googlecloudsdk.command_lib.design_centerr   r9   ReleaseTracksr(   r)   UniverseCompatibleHiddenCommandr   r@   r,   r<   r    r   <module>rI      s    6 &  ' ? G / ( :%4 D%%(()4<<    *0 D%%++,   -r    