
                            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Zd Z ej$                  ej&                  j(                         G d dej*                               Z ej$                  ej&                  j.                         G d dej*                               Z ej$                  ej&                  j2                         G d dej*                               Zy)zRemove IAM Policy Binding.    )absolute_import)division)unicode_literals)models)base)iam_util)endpoint_util)flags)models_util)region_utilc                    t        j                  | |       t        j                  dd      j	                  |        t        j
                  d      j	                  |        t        j                  j                  |        y )Nadd_conditionTz+for which to remove IAM policy binding from)requiredverb)include_global)	r    AddArgsForRemoveIamPolicyBindingr
   GetModelResourceArgAddToParserGetRegionArgr   URI_FLAGRemoveFromParser)parserr   s     ;lib/surface/ai_platform/models/remove_iam_policy_binding.py_GetRemoveIamPolicyBindingArgsr      s[    
++F-P8::E+f:MD)55f=--  (    c                    t        j                  |       }t        j                  |      5  t	        j
                         }t        j                  || j                  | j                  | j                        cd d d        S # 1 sw Y   y xY w)Nregion)r   	GetRegionr	   MlEndpointOverridesr   ModelsClientr   RemoveIamPolicyBindingmodelmemberrole)argsr   clients      r   _Runr)   '   s]      &&((7  "F--fdjj$++.2ii9 877s   A
B  B	c                   V    e Zd ZdZdZ ej                  dddd      Zed        Z	d	 Z
y
)r#     Removes IAM policy binding from an AI Platform Model resource.

  Removes a policy binding from an AI Platform Model. One
  binding consists of a member, a role and an optional condition.
  See $ {parent_command} get-iam-policy for examples of how to
  specify a model resource.
  3remove IAM policy binding from an AI Platform modelr$   my_modelroles/ml.adminFr&   	conditionc                     t        | d       yRegister 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.
    Fr   Nr   r   s    r   ArgszRemoveIamPolicyBinding.Args=        #6?r   c                     t        |      S   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)   selfr'   s     r   RunzRemoveIamPolicyBinding.RunG        :r   N__name__
__module____qualname____doc__descriptionr   (GetDetailedHelpForRemoveIamPolicyBindingdetailed_helpstaticmethodr6   r>    r   r   r#   r#   /   G     F+C(CCz 0EC- @ @
r   r#   c                   V    e Zd ZdZdZ ej                  dddd      Zed        Z	d	 Z
y
)RemoveIamPolicyBindingBetar+   r,   r$   r-   r.   Fr/   c                     t        | d       yr2   r4   r5   s    r   r6   zRemoveIamPolicyBindingBeta.Argsb   r7   r   c                     t        |      S r9   r;   r<   s     r   r>   zRemoveIamPolicyBindingBeta.Runl   r?   r   Nr@   rI   r   r   rL   rL   T   rJ   r   rL   c                   V    e Zd ZdZdZ ej                  dddd      Zed        Z	d	 Z
y
)RemoveIamPolicyBindingAlphaa&  Removes IAM policy binding from an AI Platform Model resource.

  Remove an IAM policy binding from the IAM policy of a ML model. One binding
  consists of a member, a role, and an optional condition.
  See $ {parent_command} get-iam-policy for examples of how to
  specify a model resource.
  r,   r$   r-   r.   Fr/   c                     t        | d       y)r3   Tr   Nr4   r5   s    r   r6   z RemoveIamPolicyBindingAlpha.Args   s     #6>r   c                    t        j                  |      }t        j                  |      5  t	        j
                  |      }t	        j                  ||j                         t        j                  t        j                         |j                  |j                  |j                  |      cddd       S # 1 sw Y   yxY w)r:   r   N)r   r    r	   r!   r   ValidateAndExtractCondition'ValidateMutexConditionAndPrimitiveRolesr&   r   #RemoveIamPolicyBindingWithConditionr   r"   r$   r%   )r=   r'   r   r0   s       r   r>   zRemoveIamPolicyBindingAlpha.Run   s     ""4(F		*	*&	966t<i66y$))L<<



T[[$))YP 
:	9	9s   A>B44B=Nr@   rI   r   r   rP   rP   y   sF     F+C(CCz 0EC- ? ?Pr   rP   N)F)rD   
__future__r   r   r    googlecloudsdk.api_lib.ml_enginer   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   $googlecloudsdk.command_lib.ml_enginer	   r
   r   r   r   r)   ReleaseTracksReleaseTrackGACommandr#   BETArL   ALPHArP   rI   r   r   <module>ra      s    ! &  ' 3 ( 3 > 6 < <)9 D%%(()!T\\ ! *!H D%%**+! ! ,!H D%%++,&P$,, &P -&Pr   