
                         ,   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  ej                  ej                  j                  ej                  j                   ej                  j"                         G d	 d
ej$                               Zy)zDescribes an AlloyDB instance.    )absolute_import)division)unicode_literals)api_util)base)flags)
propertiesc                   0    e Zd ZdZdddZed        Zd Zy)Describez5Describes an AlloyDB instance within a given cluster.z{description}z        To describe an instance, run:

          $ {command} my-instance --cluster=my-cluster --region=us-central1
          --view=BASIC/FULL
        )DESCRIPTIONEXAMPLESc                     t        j                  | j                               }t        j                  |d       t        j
                  |       t        j                  |       t        j                  ||       y)zxSpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs
    FN)r   GetMessagesModuleReleaseTrackr   
AddClusterAddInstance	AddRegionAddView)clsparseralloydb_messagess      )lib/surface/alloydb/instances/describe.pyArgszDescribe.Args.   sW      11#2B2B2DE	VU#	f	OOF	MM&*+    c                 z   t        j                  | j                               }|j                  }|j                  }|j
                  j                  dt        j                  j                  j                  j                  |j                  |j                  |j                        }|j                  rN|j!                  |j#                         t%        j&                  |      j)                  |j                              }n |j!                  |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.instances)
projectsIdlocationsId
clustersIdinstancesId)nameview)r    )r   AlloyDBClientr   alloydb_clientr   resource_parserCreater	   VALUEScoreproject	GetOrFailregionclusterinstancer!   3AlloydbProjectsLocationsClustersInstancesGetRequestRelativeNamer   GetInstanceViewFlagMapperGetEnumForChoice%projects_locations_clusters_instancesGet)selfargsclientr#   r   instance_refreqops           r   RunzDescribe.Run;   s    ##D$5$5$78F**N..))007$$))11;;KK<<MM 1 #L yyPP((*..  0 0 ; Q =c
 PP((* Q ,c		=	=	A	A#	FBIr   N)__name__
__module____qualname____doc__detailed_helpclassmethodr   r9    r   r   r   r      s1     > 	
- 
, 
,r   r   N)r=   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr   googlecloudsdk.corer	   ReleaseTracksr   ALPHABETAGADescribeCommandr   r@   r   r   <module>rK      s|    % '  ' 4 ( 4 * D%%++T->->-C-C%%((*9t## 9*9r   