
    #                         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
  \R                  \R                  " \R                  R                  5       " S S\R                  5      5       5       rg	)
z2'logging views remove_iam_policy_binding' command.    )util)
exceptions)arg_parsers)base)iam_utilc                   `    \ rS rSrSrSS0r\S 5       r\R                  " S5      S 5       r
Srg	)
RemoveIamPolicyBinding   z(Remove IAM policy binding to a log view.EXAMPLESax            To remove an IAM policy binding for the role 'roles/my-role' for the user 'my-user@gmail.com' on my-view, run:

            $ {command} my-view --member='user:my-user@gmail.com' --role='roles/my-role' --bucket=my-bucket --location=global


          To remove a binding with a condition, run:

            $ {command} my-view --member='user:my-user@gmail.com' --role='roles/my-role' --bucket=my-bucket --location=global --condition=expression=[expression],title=[title],description=[description]

          See https://cloud.google.com/iam/docs/managing-policies for details about IAM policies and member types.
          c                     U R                  SSS9  [        R                  " U S5        [        R                  " U SS5        U R                  SS[        R
                  " SS	5      S
S9  [        R                  " U SS9  g)z Register flags for this command.VIEW_IDz,ID of the view that contains the IAM policy.)helpz!view that contains the IAM policyTz.Location of the bucket that contains the view.z--bucketz.+zmust be non-emptyz(ID of the bucket that contains the view.)requiredtyper   )add_conditionN)add_argumentr   AddParentArgsAddBucketLocationArgr   RegexpValidatorr    AddArgsForRemoveIamPolicyBinding)parsers    6lib/surface/logging/views/remove_iam_policy_binding.pyArgsRemoveIamPolicyBinding.Args.   s     F   	vBCF ((0CD7	   --fDI    z-Status code: {status_code}. {status_message}.c                    [         R                  " [         R                  " [         R                  " U5      SUR                  5      SUR                  5      n[         R
                  " U5      n[        R                  " U5      n[        R                  " UUR                  UR                  US9  [         R                  " X#5      n[        R                  " US5        U$ )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 updated policy.
bucketsviews)policymemberrole	conditionzlogging view)r   CreateResourceNameGetBucketLocationFromArgsbucketr   GetIamPolicyr   ValidateAndExtractCondition'RemoveBindingFromIamPolicyWithConditionr    r!   SetIamPolicyLogSetIamPolicy)selfargsviewr   r"   resultss         r   RunRemoveIamPolicyBinding.Run@   s     ""**40)T[[	
 	D t$F44T:I44{{YY	 -GT>2Nr    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr/   __static_attributes__r1   r   r   r	   r	      sP     1  - J J" 445r   r	   N)r6   googlecloudsdk.api_lib.loggingr   googlecloudsdk.api_lib.utilr   r9   googlecloudsdk.callioper   r   googlecloudsdk.command_lib.iamr   UniverseCompatibleReleaseTracksReleaseTrackGACommandr	   r1   r   r   <module>rE      sb    9 0 F / ( 3 D%%(()BT\\ B * Br   