
    
                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSK	Jr   " S	 S
\R                  5      rg)zHCommand to get information about a principal's permissions on a service.    )absolute_import)division)unicode_literals)services_util)base)arg_parsers)common_flagsc                   .    \ rS rSrSr\S 5       rS rSrg)CheckIamPolicy   a  Returns information about a principal's permissions on a service.

This command lists the permissions that the current authenticated
gcloud user has for a service. For example, if the authenticated user is
able to delete the service, `servicemanagement.services.delete` will
be among the returned permissions.

## EXAMPLES

To check the permissions for the currently authenticated gcloud, run:

  $ {command} my_produced_service_name
c                 N    [         R                  " SS9nUR                  U 5        g)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use to add arguments that go
      on the command line after this command. Positional arguments are
      allowed.
z!for which to check the IAM policy)suffixN)r	   producer_service_flagAddToParser)parserservice_flags     2lib/surface/endpoints/services/check_iam_policy.pyArgsCheckIamPolicy.Args+   s%      5524LV$    c                 ,   [         R                  " 5       n[         R                  " 5       n[         R                  nUR                  n[
        R                  " UR                  5      nU" UUR                  US9S9nUR                  R                  U5      $ )zRun 'service-management check-access'.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
      with.

Returns:
  The response from the access API call.
)permissions)
servicesIdtestIamPermissionsRequest)r   GetMessagesModuleGetClientInstanceALL_IAM_PERMISSIONS2ServicemanagementServicesTestIamPermissionsRequestr   GetServiceNameFromArgserviceTestIamPermissionsRequestservicesTestIamPermissions)selfargsmessagesclientall_iam_permissionsquery_requestr    requests           r   RunCheckIamPolicy.Run8   s     ..0H,,.F';; OOM//=G"*"D"D+ #E #-.G
 ??--g66r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r+   __static_attributes__r-   r   r   r   r      s      
% 
%7r   r   N)r2   
__future__r   r   r    googlecloudsdk.api_lib.endpointsr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.endpointsr   r	   Commandr   r-   r   r   <module>r:      s0     O &  ' : ( < =47T\\ 47r   