
                            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 ej$                   ej&                  ej(                  j*                         G d
 dej,                                      Zej$                   ej&                  ej(                  j0                         G d de                    Zy)z:Command to remove-iam-policy-binding to a secret resource.    )absolute_import)division)unicode_literals)api)
exceptions)base)iam_util)argsc                   X    e Zd ZdZddiZed        Z ej                  d      d        Z	y)RemoveIamPolicyBindinga   Remove IAM policy binding for a secret.

  Removes a policy binding from the IAM policy of a secret. One binding
  consists of a member and a role.

  See https://cloud.google.com/iam/docs/managing-policies for details of
  policy role and member types.
  EXAMPLES          To remove an IAM policy binding for the role of 'roles/viewer' for the user
          'test-user@gmail.com' on the my-secret, run:

          $ {command} my-secret --member='user:test-user@gmail.com' --role='roles/viewer'
        c                     t        j                  | dddd       t        j                  | dd       t        j                  | d       y )	N Tz;Name of the secret from which to remove IAM policy binding.)purpose
positionalrequired	help_textzto remove iam policyF)r   hidden)add_condition)secrets_args	AddSecretAddLocationr	    AddArgsForRemoveIamPolicyBinding)parsers    0lib/surface/secrets/remove_iam_policy_binding.pyArgszRemoveIamPolicyBinding.Args2   sI    O .u --fDI    z-Status code: {status_code}. {status_message}.c                    t        j                  | j                               }|j                  j                  j                         }t        j                  |      }t        j                  |      j                  ||j                  |j                  ||j                        }t        j                  |j                         d       |S )N)api_version)	conditionsecret_locationsecret)secrets_apiGetApiFromTrackReleaseTrackCONCEPTSr#   Parser	   $ValidateAndExtractConditionMutexRoleSecretsr   memberrolelocationLogSetIamPolicyName)selfr
   r    
secret_refr!   results         r   RunzRemoveIamPolicyBinding.RunA   s     --d.?.?.ABK%%++-J==dCI  		    Z__.9Mr   N)
__name__
__module____qualname____doc__detailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionr3    r   r   r   r      sS      - J J 5445r   r   c                       e Zd ZdZddiZy)RemoveIamPolicyBindingBetaz/Remove IAM policy binding of a secret resource.r   r   N)r4   r5   r6   r7   r8   r<   r   r   r>   r>   U   s     8  -r   r>   N)r7   
__future__r   r   r   googlecloudsdk.api_lib.secretsr   r$   googlecloudsdk.api_lib.utilr   r:   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr	   "googlecloudsdk.command_lib.secretsr
   r   DefaultUniverseOnlyReleaseTracksr&   GACommandr   BETAr>   r<   r   r   <module>rJ      s    A '  ' = F ( 3 C D%%(()3T\\ 3 * 3l D%%**+
!7 
 , 
r   