
    
                     V   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                  j                   ej                  j"                  ej                  j$                        ej&                   G d
 dej(                                      Zy)z"Updates a AlloyDB user's password.    )absolute_import)division)unicode_literals)api_util)base)flags)user_helper)
propertiesc                   0    e Zd ZdZdddZed        Zd Zy)UpdatezJUpdate an AlloyDB user's database roles within a given cluster and region.z{description}z      To update a user's database roles, run:

        $ {command} my-username --cluster=my-cluster --region=us-central1 --db-roles=role1,role2
      )DESCRIPTIONEXAMPLESc                     t        j                  |       t        j                  |       t        j                  |d       t        j                  |d       t        j
                  |       y)zySpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs.
    FTN)r   AddUsername	AddRegion
AddCluster
AddDBRolesAddKeepExtraRoles)clsparsers     &lib/surface/alloydb/users/set_roles.pyArgszUpdate.Args,   sL     
f	OOF	VU#	VT"	F#    c                    t        j                  | j                               }|j                  }|j                  }|j
                  j                  dt        j                  j                  j                  j                  |j                  |j                  |j                        }t        j                   |||      }|j"                  j%                  |      S )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)r   AlloyDBClientReleaseTrackalloydb_clientalloydb_messagesresource_parserCreater
   VALUEScoreproject	GetOrFailregionclusterusernamer	   ConstructPatchRequestFromArgs!projects_locations_clusters_usersPatch)selfargsclientr!   r"   user_refreqs          r   Runz
Update.Run9   s     ##D$5$5$78F**N..%%,,3$$))11;;KK<< - H 
3
3(DC ;;AA#FFr   N)__name__
__module____qualname____doc__detailed_helpclassmethodr   r4    r   r   r   r      s3    
 S %
- 
$ 
$Gr   r   N)r8   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr   r	   googlecloudsdk.corer
   ReleaseTracksr    ALPHABETAGADefaultUniverseOnlyUpdateCommandr   r;   r   r   <module>rG      s    ) &  ' 3 ( 4 : * T..33T5F5F5I5I 0GT 0G 0Gr   