
                            S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSK	J
r
  SSK	Jr  SSKJr  SS	KJr  S
r\R"                  " \R$                  R&                  \R$                  R(                  \R$                  R*                  5      \R,                   " S S\R.                  5      5       5       r " S S\R2                  5      rg)z<The command to update the RbacRoleBinding Actuation Feature.    )absolute_import)division)unicode_literalsN)
exceptions)arg_parsers)base)	arg_utilsrbacrolebindingactuationc                   F   ^  \ rS rSrSrSr\S 5       rS rU 4S jr	Sr
U =r$ )Update    a  Update RbacRoleBinding Actuation Feature.

This command updates RbacRoleBinding Actuation Feature in a fleet.

## EXAMPLES

To update the RbacRoleBinding Actuation Feature, run:

  $ gcloud container fleet rbacrolebinding-actuation update \
      --allowed-custom-roles=role1,role2

  $ gcloud container fleet rbacrolebinding-actuation update \
      --add-allowed-custom-role=role1

  $ gcloud container fleet rbacrolebinding-actuation update \
      --remove-allowed-custom-role=role2
r
   c                     UR                  SS9nUR                  S[        R                  " 5       S[        R
                  " S5      S9  UR                  S[        SS	9  UR                  S
[        SS	9  g )NT)requiredz--allowed-custom-rolesROLESzk          The list of allowed custom roles that can be used in scope
          RBACRoleBindings.
          )typemetavarhelpz--add-allowed-custom-rolez:Add a single custom role to the allowed custom roles list.)r   r   z--remove-allowed-custom-rolez?Remove a single custom role from the allowed custom roles list.)add_mutually_exclusive_groupadd_argumentr   ArgListtextwrapdedentstr)clsparsergroups      >lib/surface/container/fleet/rbacrolebindingactuation/update.pyArgsUpdate.Args9   s    ///>E	   "__  	   
#I  
 
&N      c                     [         R                  " USSS9n[        U5      nUR                  U5      nU R	                  XA5        g )Nz	--projectT)use_defaults)r	   GetFromNamespace_EnableCommandGetWithForceEnabler   )selfargsproject
enable_cmdfeatures        r   Run
Update.RunP   s<    (({NG%J++G4GKKr    c                 ,  > U R                  5       nUR                  R                  R                  nUR                  b  UR                  nOgUR
                  b  UR                  UR
                  5        UnO<UR                  b$  U Vs/ s H  nXbR                  :w  d  M  UPM     nnO[        S5      eU R                  R                  U R                  R                  U R                  R                  US9S9S9nSn[        [        U ];  U/U5      $ s  snf )zBUpdates RbacRoleBinding Actuation Feature information for a fleet.zlOne of --allowed-custom-roles, --add-allowed-custom-role, or --remove-allowed-custom-role must be specified.)allowedCustomRoles)r
   )specz2spec.rbacrolebindingactuation.allowed_custom_roles)
GetFeaturer/   r
   r.   allowed_custom_rolesadd_allowed_custom_roleappendremove_allowed_custom_role
ValueErrormessagesFeatureCommonFeatureSpec#RBACRoleBindingActuationFeatureSpecsuperr   )
r&   r*   r'   rrb_featurecurrent_custom_rolesupdated_custom_rolesrolepatchpath	__class__s
            r   r   Update.UpdateV   s*   //#K11DD    ,!66		%	%	1!!$">">?1		(	(	4 +*d444 *   = 
 MM!!]],,%)]]%V%V#7 &W & - 
 " E @D%tfe44's   DD )__name__
__module____qualname____firstlineno____doc__feature_nameclassmethodr   r+   r   __static_attributes____classcell__)rA   s   @r   r   r       s0    
$ ,, ,5 5r    r   c                   *    \ rS rSrSrS rS rS rSrg)r$   x   z>Base class for enabling the RBACRoleBinding Actuation Feature.c                 &    [         U l        Xl        g )N)!RBACROLEBINDING_ACTUATION_FEATURErI   r'   )r&   r'   s     r   __init___EnableCommand.__init__{   s    9DIr    c                 J    U R                   R                  R                  5       $ )z:Required to initialize HubClient. See calliope base class.)r'   calliope_commandReleaseTrack)r&   s    r   rU   _EnableCommand.ReleaseTrack   s    99%%2244r    c                      U R                   R                  U R                  US95      $ ! [        R                   a<    U R                  U R                  R                  5       5        U R                  5       s $ f = f)zBGets the project's Cluster Upgrade Feature, enabling if necessary.)r(   )	hubclientr0   FeatureResourceNameapitools_exceptionsHttpNotFoundErrorEnabler6   r7   )r&   r(   s     r   r%   !_EnableCommand.GetWithForceEnable   sn    
^^&&

"
"7
"
3  00  kk$--'')*__s   '* AA:9A:)r'   rI   N)	rD   rE   rF   rG   rH   rQ   rU   r%   rK   rC   r    r   r$   r$   x   s    F5r    r$   )rH   
__future__r   r   r   r   apitools.base.pyr   rZ   googlecloudsdk.callioper   r   3googlecloudsdk.command_lib.container.fleet.featuresfeature_base$googlecloudsdk.command_lib.util.apisr	   rP   ReleaseTracksrU   ALPHABETAGADefaultUniverseOnlyUpdateCommandr   EnableCommandMixinr$   rC   r    r   <module>rk      s    C &  '  > / ( T :$> ! T..33T5F5F5I5I Q5\'' Q5 Q5h\44 r    