
                         F   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 ddlmZ ddlmZ ddlZ ej2                  ej4                  j6                  ej4                  j8                         G d dej:                               Zy)z4Command to remove IAM policy binding for a resource.    )absolute_import)division)unicode_literals)projects_api)smart_guardrails)
http_retry)base)iam_util)flags)util)
completers)
console_ioNc                       e Zd ZdZ ej
                         Zed        Z e	j                  ej                  j                  j                        d        Zy)RemoveIamPolicyBindingzRemove IAM policy binding from the IAM policy of a project.

  Removes a policy binding from the IAM policy of a project, given a project ID
  and the binding.
  c                 8   t        j                  d      j                  |       t        j                  |t
        j                  d       | j                         t        j                  j                  k7  r%t        j                  d      j                  |       y y )Nzremove IAM policy binding fromT)role_completeradd_conditionzIAM policy binding removal)r   GetProjectResourceArgAddToParserr
    AddArgsForRemoveIamPolicyBindingr   ProjectsIamRolesCompleterReleaseTrackr	   GAGetRecommendFlag)clsparsers     1lib/surface/projects/remove_iam_policy_binding.pyArgszRemoveIamPolicyBinding.Args,   s|    	 @AMM --!;;
 T..1119:FFvN 2    c                    t        j                  |j                        }t        j                  |      }| j                         t        j
                  j                  k7  r|j                  r|st        j                          t        j                  t        j
                  j                  |j                         |j                  |j                        }t        j                          |rt!        j"                  |      sy t%        j&                  ||j                  |j                  ||j(                        }t        j*                  |j                  d       |S )Nproject)command_lib_utilParseProject
project_idr
   $ValidateAndExtractConditionMutexRoler   r	   r   	recommendEnableUserProjectQuotar   GetIamPolicyBindingDeletionRiskNamememberroleDisableUserProjectQuotar   PromptContinuer   #RemoveIamPolicyBindingWithConditionallLogSetIamPolicy)selfargsproject_ref	conditionrisk_messageresults         r   RunzRemoveIamPolicyBinding.Run9   s    "//@K==dCI 	t00333NN
 !!#%EE




 0 0 2DKKl ""$	((6==T[[$))YF T__i8Mr   N)__name__
__module____qualname____doc__r"   (GetDetailedHelpForRemoveIamPolicyBindingdetailed_helpclassmethodr   r   RetryOnHttpStatussixmoveshttp_clientCONFLICTr7    r   r   r   r   "   sa     L"KKM-
O 
O  :		 5 5 > >? @r   r   )r;   
__future__r   r   r   +googlecloudsdk.api_lib.cloudresourcemanagerr   'googlecloudsdk.api_lib.smart_guardrailsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   googlecloudsdk.command_lib.iamr
   #googlecloudsdk.command_lib.projectsr   r   r"   +googlecloudsdk.command_lib.resource_managerr   googlecloudsdk.core.consoler   six.moves.http_clientr@   ReleaseTracksr   ALPHABETACommandr   rD   r   r   <module>rS      sx     ; &  ' D D 2 ( 3 5 H B 2  D%%++T->->-C-CD0T\\ 0 E0r   