
    <                         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  ej                  ej                  j                  ej                  j                  ej                  j                          G d d	ej"                               Zy
)zRemove IAM Policy Binding.    )absolute_import)division)unicode_literals)base)iam_util)utilc                   .    e Zd ZdZddiZed        Zd Zy)RemoveIamPolicyBindingzRemove IAM policy binding from an IAP TCP Destination Group resource.

  Removes a policy binding from the IAM policy of an IAP TCP Destination Group
  resource. One binding consists of a member, a role and an optional condition.
  EXAMPLESa  
          To remove an IAM policy binding for the role of
          'roles/iap.tunnelResourceAccessor' for the user 'test-user@gmail.com'
          in the group 'my-group' located in the region 'us-west1', run:

            $ {command} --member='user:test-user@gmail.com'
              --role='roles/iap.tunnelResourceAccessor' --dest-group='my-group'
              --region='us-west1'

          To remove an IAM policy binding for the role of
          'roles/iap.tunnelResourceAccessor' from all authenticated users in the
          group 'my-group' located in the region 'us-west1', run:

            $ {command} --member='allAuthenticatedUsers'
              --role='roles/iap.tunnelResourceAccessor' --dest-group='my-group'
              --region='us-west1'

          To remove an IAM policy binding which expires at the end of the year
          2018 for the role of 'roles/iap.tunnelResourceAccessor' for the user
          'test-user@gmail.com' in the group 'my-group' located in the region
          'us-west1', run:

            $ {command} --member='user:test-user@gmail.com'
              --role='roles/iap.tunnelResourceAccessor'
              --condition='expression=request.time < timestamp("2019-01-01T00:00:00Z"),title=expires_end_of_2018, description=Expires at midnight on 2018-12-31'
              --dest-group='my-group' --region='us-west1'

          To remove all IAM policy bindings regardless of the condition for the
          role of 'roles/iap.tunnelResourceAccessor' and for the user
          'test-user@gmail.com' in the group 'my-group' located in the region
          'us-west1', run:

            $ {command} --member='user:test-user@gmail.com'
              --role='roles/iap.tunnelResourceAccessor' --dest-group='my-group'
              --region='us-west1'

          See https://cloud.google.com/iam/docs/managing-policies for details of
          policy role and member types.
  c                     t        j                  |        t        j                  |        t        j                  j                  |        y)zRegisters flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    N)iap_utilAddRemoveIamPolicyBindingArgsAddIamDestGroupArgsr   URI_FLAGRemoveFromParser)parsers    <lib/surface/iap/tcp/dest_groups/remove_iam_policy_binding.pyArgszRemoveIamPolicyBinding.ArgsN   s2     **62  (MM""6*    c                     t        j                  |      }t        j                  | j	                         |      }|j                  |j                  |j                  ||j                         y)zHandles the execution when users run this command.

    Args:
      args: An argparse namespace. All the arguments that were provided to this
        command invocation.
    N)	r   ValidateAndExtractConditionr   ParseIapDestGroupResourceReleaseTrackr
   memberroleall)selfargs	conditioniap_iam_refs       r   RunzRemoveIamPolicyBinding.RunZ   sR     44T:I44T5F5F5H$OK&&t{{DIIy'+xx1r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r!    r   r   r
   r
      s2     '*-X 	+ 	+
1r   r
   N)r%   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   googlecloudsdk.command_lib.iapr   r   ReleaseTracksr   ALPHABETAGACommandr
   r(   r   r   <module>r2      sv    ! &  ' ( 3 ; D%%++T->->-C-C%%((*H1T\\ H1*H1r   