
                         P   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 dd
lmZ ddlmZ  e	j                   e	j"                  j$                  e	j"                  j&                  e	j"                  j(                         G d de	j*                               Zy)zPromote an AlloyDB cluster.    )absolute_import)division)unicode_literals)api_util)cluster_operations)base)flags)log)
properties)	resourcesc                   0    e Zd ZdZdddZed        Zd Zy)PromotezCPromote an AlloyDB SECONDARY cluster in a given project and region.z{description}zb        To promote a cluster, run:

          $ {command} my-cluster --region=us-central1
        )DESCRIPTIONEXAMPLESc                     t         j                  j                  |        t        j                  |        t        j
                  |        y)zySpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs.
    N)r   
ASYNC_FLAGAddToParserr	   	AddRegion
AddCluster)parsers    'lib/surface/alloydb/clusters/promote.pyArgszPromote.Args-   s0     	OO'	OOF	V    c                    t        j                  | j                               }|j                  }|j                  }|j
                  j                  dt        j                  j                  j                  j                  |j                  |j                        }|j                  |j                         |j!                               }|j"                  j%                  |      }t&        j(                  j+                  |j,                  d      }t.        j0                  j3                  dj5                  |j7                                      |j8                  s%t;        j<                  |d| 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)namepromoteClusterRequestz%alloydb.projects.locations.operations)
collectionzOperation ID: {}zPromoting cluster)r   AlloyDBClientReleaseTrackalloydb_clientalloydb_messagesresource_parserCreater   VALUEScoreproject	GetOrFailregioncluster.AlloydbProjectsLocationsClustersPromoteRequestRelativeNamePromoteClusterRequestprojects_locations_clustersr   r   REGISTRYParseRelativeNamer   r
   statusPrintformatNameasync_r   Await)	selfargsclientr#   r$   cluster_refreqopop_refs	            r   RunzPromote.Run8   s6    ##D$5$5$78F**N..((//-$$))11;;KK<<	 0 !K
 
I
I%%'.DDF J HC 
	3	3	;	;C	@B11
C 2 EFJJ'..v{{}=>;;v':D<M<M<OPIr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r@    r   r   r   r      s2     L %-  r   r   N)rD   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr	   googlecloudsdk.corer
   r   r   ReleaseTracksr"   ALPHABETAGAUpdateCommandr   rG   r   r   <module>rR      s    " &  ' 3 = ( 4 # * ) T..33T5F5F5I5I2d   22r   