
                         >   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)z5Command to create a fleet namespace RBAC RoleBinding.    )absolute_import)division)unicode_literals)client)util)base)deprecation_utils)	resourcesz447.0.0Tz+gcloud fleet scopes rbacrolebindings create)remove_versionremovealt_commandc                   &    e Zd ZdZed        Zd Zy)CreateaX  Create an RBAC RoleBinding.

  This command can fail for the following reasons:
  * The RBAC RoleBinding already exists.
  * The caller does not have permission to access the given namespace.

  ## EXAMPLES

  To create an admin RBAC RoleBinding `RBRB` in namespace `NAMESPACE` for user
  `person@google.com`, run:

    $ {command} RBRB --namespace=NAMESPACE --role=admin
    --user=person@google.com

  To create a viewer RBAC RoleBinding `RBRB` in namespace `NAMESPACE` for group
  `people@google.com`, run:

    $ {command} RBRB --namespace=NAMESPACE --role=viewer
    --group=people@google.com
  c                 $   t        j                  |t        j                  | j	                            d       |j                  d      }|j                  dt        d       |j                  dt        d	       |j                  d
dg dd       y )NzqName of the RBAC RoleBinding to be created. Must comply with RFC 1123 (up to 63 characters, alphanumeric and '-'))api_versionrbacrb_helpT)requiredz--userzUser for the RoleBinding.)typehelpz--groupzGroup for the RoleBinding.z--role)admineditviewzRole to assign.)r   choicesr   )r
   AddRBACResourceArgr   VERSION_MAPReleaseTrackadd_mutually_exclusive_groupadd_argumentstr)clsparsergroups      Alib/surface/container/fleet/namespaces/rbacrolebindings/create.pyArgszCreate.Args8   s      $$S%5%5%78$	 ///>E	(  
 
)  
 )	      c                     t        j                  | j                               }|j                  t	        j
                  |      |j                  |j                  |j                        S )N)release_track)roleuserr"   )	r   FleetClientr   CreateRBACRoleBindingr
   RBACResourceNamer(   r)   r"   )selfargsfleetclients      r#   Runz
Create.RunU   sV    $$43D3D3FGK,,""4(YYYYjj	 -  r%   N)__name__
__module____qualname____doc__classmethodr$   r0    r%   r#   r   r      s     *  8r%   r   N)r4   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   r   googlecloudsdk.callioper   googlecloudsdk.command_libr	   *googlecloudsdk.command_lib.container.fleetr
   DeprecateCommandAtVersionReleaseTracksr   ALPHABETACreateCommandr   r6   r%   r#   <module>rA      s    < &  ' 9 7 ( 8 @ -,,=
 D%%++T->->-C-CD9T 9 E9r%   