
                         >   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                         ej"                   G d d	ej$                                      Zy
)zAdd 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)AddIamPolicyBindingzAdd IAM policy binding to an IAP TCP Tunnel Destination Group resource.

  Adds a policy binding to the IAM policy of an IAP TCP Tunnel Destination Group
  resource. One binding consists of a member, a role, and an optional condition.
  EXAMPLESa            To add 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 add an IAM policy binding for the role of
          'roles/iap.tunnelResourceAccessor' for 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 add an IAM policy binding which expires at the end of the year 2018
          for the role of 'roles/iap.tunnelResourceAccessor' and 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'

          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)zRegister 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AddAddIamPolicyBindingArgsAddIamDestGroupArgsr   URI_FLAGRemoveFromParser)parsers    9lib/surface/iap/tcp/dest_groups/add_iam_policy_binding.pyArgszAddIamPolicyBinding.ArgsG   s2     ''/  (MM""6*    c                     t        j                  |      }t        j                  | j	                         |      }|j                  |j                  |j                  |      S )a  This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      The specified function with its description and configured filter.
    )r   $ValidateAndExtractConditionMutexRoler   ParseIapDestGroupResourceReleaseTrackr
   memberrole)selfargs	conditioniap_iam_refs       r   RunzAddIamPolicyBinding.RunS   sL     ==dCI44T5F5F5H$OK**4;;		9MMr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r     r   r   r
   r
      s3     "-H 	+ 	+Nr   r
   N)r$   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   googlecloudsdk.command_lib.iapr   r   ReleaseTracksr   ALPHABETAGADefaultUniverseOnlyCommandr
   r'   r   r   <module>r2      s     &  ' ( 3 ; D%%++T->->-C-C%%((*BN$,, BN *BNr   