
    '                         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)z1Implementation of buckets get-iam-policy command.    )absolute_import)division)unicode_literals)api_factory)base)errors_util)iam_command_util)storage_urlc                   0    e Zd ZdZdddZed        Zd Zy)GetIamPolicyz Get the IAM policy for a bucket.z
      Get the IAM policy for a bucket. For more information, see [Cloud
      Identity and Access
      Management](https://cloud.google.com/storage/docs/access-control/iam).
      z
      To get the IAM policy for BUCKET:

        $ {command} gs://BUCKET

      To output the IAM policy for BUCKET to a file:

        $ {command} gs://BUCKET > policy.txt
      )DESCRIPTIONEXAMPLESc                 *    | j                  dd       y )Nurlz#Request IAM policy for this bucket.)help)add_argument)parsers    -lib/surface/storage/buckets/get_iam_policy.pyArgszGetIamPolicy.Args3   s    
$IJ    c                 .   t        j                  |j                        }t        j                  |j
                  |       t        j                  |j                        }t        j                  |j                        j                  |j                        S )N)r
   storage_url_from_stringr   r   raise_error_if_not_gcs_bucketcommand_pathr	   get_single_matching_urlr   get_apischemeget_bucket_iam_policybucket_name)selfargs
url_objectmatching_urls       r   RunzGetIamPolicy.Run7   sm    44TXX>J--d.?.?L#;;DHHEL|223II  " "r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r$    r   r   r   r      s1    (

-& K K"r   r   N)r(   
__future__r   r   r   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   r	   r
   UniverseCompatibleCommandr   r+   r   r   <module>r2      sG    8 &  ' 6 ( : ? : "4<< " "r   