
    L                     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)zsCreates a user in a given cluster.

Creates a user in a given cluster with specified username, type, and 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)CreatezCreates a user in a given cluster.

  Creates a user in a given cluster with specified username, cluster, region,
  type, and password.
  z{description}z      To create a new user, run:

        $ {command} my-username --cluster=my-cluster --region=us-central1 --password=postgres
      )DESCRIPTIONEXAMPLESc                 V   t        j                  |        t        j                  | d       t        j                  |        t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        y)zxSpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs
    FN)	r   AddUsername
AddCluster	AddRegionAddUserPasswordAddUserTypeAddCreateSuperuser
AddDBRolesAddKeepExtraRoles)parsers    #lib/surface/alloydb/users/create.pyArgszCreate.Args5   st     
f	VU#	OOF	&!	f	V$	V	F#    c                    t        j                  | j                               }|j                  }|j                  }|j
                  j                  dt        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)
projectsIdlocationsId
clustersId)r   AlloyDBClientReleaseTrackalloydb_clientalloydb_messagesresource_parserr   r
   VALUEScoreproject	GetOrFailregionclusterr	   ConstructCreateRequestFromArgs!projects_locations_clusters_users)selfargsclientr"   r#   cluster_refreqs          r   Runz
Create.RunE   s     ##D$5$5$78F**N..((//-$$))11;;KK<<	 0 K 
4
4 +tC ;;BB3GGr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r2    r   r   r   r   !   s2    
 %
- $ $Hr   r   N)r6   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr   r	   googlecloudsdk.corer
   ReleaseTracksr!   ALPHABETAGADefaultUniverseOnlyCreateCommandr   r9   r   r   <module>rE      s    '  ' 4 ( 4 : * T..33T5F5F5I5I 6HT 6H 6Hr   