
                         8   S 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SK	J
r
  SSK	Jr  SS	KJr  \R                  " \R                  R                   \R                  R"                  \R                  R$                  5       " S
 S\R&                  5      5       rg)z(Updates a AlloyDB user's superuser role.    )absolute_import)division)unicode_literals)api_util)base)flags)user_helper)
propertiesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Update   zJUpdate an AlloyDB user's superuser role within a given cluster and region.z{description}z      To update a user's superuser role, run:

        $ {command} my-username --cluster=my-cluster --region=us-central1 --superuser=true/false
      )DESCRIPTIONEXAMPLESc                     [         R                  " U5        [         R                  " U5        [         R                  " US5        [         R                  " U5        g)zmSpecifies additional command flags.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
FN)r   AddUsername	AddRegion
AddClusterAddSetSuperuser)clsparsers     *lib/surface/alloydb/users/set_superuser.pyArgsUpdate.Args+   s<     
f	OOF	VU#	&!    c                 ~   [         R                  " U R                  5       5      nUR                  nUR                  nUR
                  R                  S[        R                  R                  R                  R                  UR                  UR                  UR                  S9nUR                  UR!                  5       S9nUR"                  R%                  U5      nSUR&                  ;   nXR(                  :X  a  U$ UR&                  Ul        [,        R.                  " XEU5      n	UR"                  R1                  U	5      $ )zConstructs and sends request.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the .Args() method.

Returns:
  ProcessHttpResponse of the request made.
z)alloydb.projects.locations.clusters.users)
projectsIdlocationsId
clustersIdusersId)namealloydbsuperuser)r   AlloyDBClientReleaseTrackalloydb_clientalloydb_messagesresource_parserCreater
   VALUEScoreproject	GetOrFailregionclusterusername/AlloydbProjectsLocationsClustersUsersGetRequestRelativeName!projects_locations_clusters_usersGetdatabaseRoles	superuserdb_rolesr	   ConstructPatchRequestFromArgsPatch)
selfargsclientr$   r%   user_refrequseris_superuseruser_reqs
             r   Run
Update.Run7   s    ##D$5$5$78F**N..%%,,3$$))11;;KK<< - H 
J
J""$ K C ;;??DD%););;L~~%k ((dm::
dh ==CCHMMr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r@   __static_attributes__rB   r   r   r   r      s3     S %
- 	" 	""Nr   r   N)rG   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr   r	   googlecloudsdk.corer
   ReleaseTracksr#   ALPHABETAGAUpdateCommandr   rB   r   r   <module>rU      s|    / &  ' 3 ( 4 : * T..33T5F5F5I5I:NT :N:Nr   