
    ;                     >   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                  d
dd       e	j                  e	j                   j"                  e	j                   j$                         G d de	j&                                      Zy)z$Command to update fleet information.    )absolute_import)division)unicode_literals)client)util)base)deprecation_utils)	resourcesz447.0.0Tz+gcloud fleet scopes rbacrolebindings update)remove_versionremovealt_commandc                   &    e Zd ZdZed        Zd Zy)UpdateaS  Update a fleet namespace RBAC RoleBinding.

  This command can fail for the following reasons:
  * The RoleBinding does not exist in the project.
  * The caller does not have permission to access the RoleBinding.

  ## EXAMPLES

  To update the RBAC RoleBinding `RBRB` in namespace `NAMESPACE` in the active
  project to the `viewer` role:

    $ {command} RBRB --namespace=NAMESPACE --role=viewer

  To update the RBAC RoleBinding `RBRB` in namespace `NAMESPACE` in the active
  project to the user `someone@google.com`:

    $ {command} RBRB --namespace=NAMESPACE --user=someone@google.com

  c                    t        j                  |t        j                  | j	                            d       |j                         }|j                  dt        d       |j                  dt        d       |j                  dg d	d
       y )NzqName of the RBAC RoleBinding to be updated. Must comply with RFC 1123 (up to 63 characters, alphanumeric and '-'))api_versionrbacrb_helpz--userz*User for the RBACRoleBinding to update to.)typehelpz--groupz+Group for the RBACRoleBinding to update to.z--role)admineditviewz*Role for the RBACRoleBinding to update to.)choicesr   )r
   AddRBACResourceArgr   VERSION_MAPReleaseTrackadd_mutually_exclusive_groupadd_argumentstr)clsparsergroups      Alib/surface/container/fleet/namespaces/rbacrolebindings/update.pyArgszUpdate.Args7   s      $$S%5%5%78$	 //1E	9  
 
:  
 )9      c           	      N   t        j                  | j                               }g }dD ]%  }|j                  |      s|j	                  |       ' |j                  t        j                  |      |j                  |j                  |j                  dj                  |            S )N)release_track)roleuserr!   ,)r(   r!   r'   mask)r   FleetClientr   IsKnownAndSpecifiedappendUpdateRBACRoleBindingr
   RBACResourceNamer(   r!   r'   join)selfargsfleetclientr*   flags        r"   Runz
Update.RunS   s    $$43D3D3FGKD)		!	!$	'D * ,,""4(YYjjYYXXd^ -  r$   N)__name__
__module____qualname____doc__classmethodr#   r5    r$   r"   r   r      s     (  6r$   r   N)r9   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   r   googlecloudsdk.callioper   googlecloudsdk.command_libr	   *googlecloudsdk.command_lib.container.fleetr
   DeprecateCommandAtVersionReleaseTracksr   ALPHABETAUpdateCommandr   r;   r$   r"   <module>rF      s    + &  ' 9 7 ( 8 @ -,,=
 D%%++T->->-C-CD<T < E<r$   