
                         n   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  SS
KJr  SSKJr  \	R                   \	R"                  " \	R$                  R&                  \	R$                  R(                  \	R$                  R*                  5       " S S\	R,                  5      5       5       rg)zSwitchover an AlloyDB cluster.    )absolute_import)division)unicode_literals)api_util)cluster_operations)base)flags)log)
properties)	resourcesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)

Switchover   zFSwitchover an AlloyDB SECONDARY cluster in a given project and region.z{description}ze        To switchover a cluster, run:

          $ {command} my-cluster --region=us-central1
        )DESCRIPTIONEXAMPLESc                     [         R                  R                  U 5        [        R                  " U 5        [        R
                  " U 5        g)zmSpecifies 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/switchover.pyArgsSwitchover.Args.   s0     	OO'	OOF	V    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                  S9nUR                  UR                  5       UR!                  5       S9nUR"                  R%                  U5      n[&        R(                  R+                  UR,                  SS9n[.        R0                  R3                  SR5                  UR7                  5       5      5        UR8                  (       d&  [:        R<                  " USU R                  5       5        U$ )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switchoverClusterRequestz%alloydb.projects.locations.operations)
collectionzOperation ID: {}zSwitchover cluster)r   AlloyDBClientReleaseTrackalloydb_clientalloydb_messagesresource_parserCreater   VALUEScoreproject	GetOrFailregioncluster1AlloydbProjectsLocationsClustersSwitchoverRequestRelativeNameSwitchoverClusterRequest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   RunSwitchover.Run9   s;    ##D$5$5$78F**N..((//-$$))11;;KK<<	 0 K 
L
L%%'!1!J!J!L M C 
	3	3	>	>s	CB11
C 2 F JJ'..v{{}=>;;
&(9(9(; Ir    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   rB   __static_attributes__rD   r   r   r   r      s2    
 O %-   r   r   N)rI   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr	   googlecloudsdk.corer
   r   r   DefaultUniverseOnlyReleaseTracksr$   ALPHABETAGAUpdateCommandr   rD   r   r   <module>rX      s    % &  ' 3 = ( 4 # * ) T..33T5F5F5I5I7## 7 7r   