
    
                         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 ddlmZ ej"                  ej$                   G d dej&                                      Zy)z<Implementation of objects remove-iam-policy-binding command.    )absolute_import)division)unicode_literals)api_factory)base)iam_util)errors_util)iam_command_util)storage_url)set_iam_policy_taskc                   0    e Zd ZdZdddZed        Zd Zy)RemoveIamPolicyBindingz,Remove an IAM policy binding from an object.z
      *{command}* behaves similarly to
      *{parent_command} remove-object-acl-grant*, but uses the IAM policy
      binding syntax.
      a  
      To remove access equivalent to the IAM role of
      roles/storage.legacyObjectOwner for the user john.doe@example.com on
      OBJECT in BUCKET:

        $ {command} gs://BUCKET/OBJECT --member=user:john.doe@example.com --role=roles/storage.legacyObjectOwner
      )DESCRIPTIONEXAMPLESc                 X    | j                  dd       t        j                  | d       y )Nurlz0URL of object to remove IAM policy binding from.)helpT)add_condition)add_argumentr    AddArgsForRemoveIamPolicyBinding)parsers    8lib/surface/storage/objects/remove_iam_policy_binding.pyArgszRemoveIamPolicyBinding.Args4   s,    
F  H--fDI    c                    t        j                  |j                        }t        j                  |j
                  |       t        j                  |j
                  |       t        j                  |j                        }|j                  |j                  |j                  |j                        }t        j                  |||t         j"                        S )N)r   storage_url_from_stringr   r	   raise_error_if_not_cloud_objectcommand_pathraise_error_if_not_gcsr   get_apischemeget_object_iam_policybucket_nameresource_name
generationr
    remove_iam_binding_from_resourcer   SetObjectIamPolicyTask)selfargs
url_objectclientpolicys        r   RunzRemoveIamPolicyBinding.Run:   s    44TXX>J//0A0A:N&&t'8'8*E  !2!23F))**@*@*4*B*B*4*?*?AF <<j&"5"L"L r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r-    r   r   r   r      s3     5

-" J J
r   r   N)r1   
__future__r   r   r   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   "googlecloudsdk.command_lib.storager	   r
   r   (googlecloudsdk.command_lib.storage.tasksr   HiddenUniverseCompatibleCommandr   r4   r   r   <module>r>      sZ    C &  ' 6 ( 3 : ? : H &T\\ &  &r   