
                         |   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  \R                  " \R                  R                  5      \R                   " S S	\R                   5      5       5       r\R                  " \R                  R$                  \R                  R&                  5       " S
 S\5      5       rg)zAdd IAM Policy Binding.    )absolute_import)division)unicode_literals)base)iam_util)utilc                   :    \ rS rSrSrSS0rSr\S 5       rS r	Sr
g	)
AddIamPolicyBinding     Add IAM policy binding to an IAP IAM resource.

Adds a policy binding to the IAM policy of an IAP IAM resource. One binding
consists of a member, a role, and an optional condition.
See $ {parent_command} get-iam-policy for examples of how to specify an IAP
IAM resource.
EXAMPLESa            See $ {parent_command} get-iam-policy for examples of how to specify
          an IAP IAM resource.

          To add an IAM policy binding for the role of 'roles/editor' for the
          user 'test-user@gmail.com' on IAP IAM resource IAP_IAM_RESOURCE,
          run:

            $ {command} --resource-type=IAP_IAM_RESOURCE --member='user:test-user@gmail.com'
                --role='roles/editor'

          To add an IAM policy binding for the role of 'roles/editor' for the
          user 'test-user@gmail.com' on regional IAP IAM resource
          IAP_IAM_RESOURCE, run:

            $ {command} --resource-type=IAP_IAM_RESOURCE --member='user:test-user@gmail.com'
                --role='roles/editor' --region=REGION

          To add an IAM policy binding for the role of 'roles/editor' for all
          authenticated users on IAP IAM resource IAP_IAM_RESOURCE,
          run:

            $ {command} --resource-type=IAP_IAM_RESOURCE --member='allAuthenticatedUsers'
                --role='roles/editor'

          To add an IAM policy binding which expires at the end of the year 2018
          for the role of 'roles/browser' and the user 'test-user@gmail.com' on
          IAP IAM resource IAP_IAM_RESOURCE, run:

            $ {command} --resource-type=IAP_IAM_RESOURCE --member='user:test-user@gmail.com'
                --role='roles/browser' --condition='expression=request.time <
                timestamp("2019-01-01T00:00:00Z"),title=expires_end_of_2018,
                description=Expires at midnight on 2018-12-31'

          See https://cloud.google.com/iam/docs/managing-policies for details of
          policy role and member types.
  Fc                     [         R                  " UU R                  S9  [         R                  " U5        [        R
                  R                  U5        g)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.
)support_cloud_runN)iap_utilAddIapIamResourceArgs_support_cloud_runAddAddIamPolicyBindingArgsr   URI_FLAGRemoveFromParser)clsparsers     -lib/surface/iap/web/add_iam_policy_binding.pyArgsAddIamPolicyBinding.ArgsP   s@     ""00 ''/MM""6*    c                     [         R                  " U5      n[        R                  " U R	                  5       UU R
                  5      nUR                  UR                  UR                  U5      $ )zThis 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   ParseIapIamResourceReleaseTrackr   r
   memberrole)selfargs	conditioniap_iam_refs       r   RunAddIamPolicyBinding.Run_   s[     ==dCI..K
 **4;;		9MMr    N)__name__
__module____qualname____firstlineno____doc__detailed_helpr   classmethodr   r&   __static_attributes__r(   r   r   r
   r
      s9     $'-R + +Nr   r
   c                       \ rS rSrSrSrSrg)AddIamPolicyBindingAlphar   r   Tr(   N)r)   r*   r+   r,   r-   r   r0   r(   r   r   r2   r2   r   s     r   r2   N)r-   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   googlecloudsdk.command_lib.iapr   r   ReleaseTracksr   GADefaultUniverseOnlyCommandr
   ALPHABETAr2   r(   r   r   <module>r>      s      &  ' ( 3 ; D%%(()RN$,, RN  *RNj D%%++T->->-C-CD	2 	 E	r   