
                            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	Zd
ZddZ ej                   ej"                  j$                  ej"                  j&                         G d dej(                               Zy)zThe Open Console command.    )absolute_import)division)unicode_literals)base)browser_dispatcher)
properties)urllibz7https://console.developers.google.com/appengine?{query}z2https://console.developers.google.com/logs?{query}Nc                     |d}d| fd|fg}|r|j                  d|f       t        j                  j                  |      }|rt        nt
        j                  |      S )a  Creates a URL to a page in the Developer Console according to the params.

  Args:
    project: The app engine project id
    service: A service belonging to the project
    version: A version belonging to the service, or all versions if omitted
    logs: If true, go to the log section instead of the dashboard
  Returns:
    The URL to the respective page in the Developer Console
  defaultproject	serviceId	versionId)query)appendr	   parse	urlencodeLOGS_URLCONSOLE_URLformat)r   serviceversionlogsr   query_strings         lib/surface/app/open_console.py_CreateDevConsoleURLr      sb     _Gw+w!7
8%	LL+w'(''.,(	3	3,	3	GG    c                   0    e Zd ZdZdddZed        Zd Zy)OpenConsolezCOpen the App Engine dashboard, or log viewer, in a web browser.

  z"          {description}
          a            Open the App Engine dashboard for the default service:

              $ {command}

          Open the service specific dashboard view:

              $ {command} --service="myService"

          Open the version specific dashboard view:

              $ {command} --service="myService" --version="v1"

          Open the log viewer for the default service:

              $ {command} --logs
          )DESCRIPTIONEXAMPLESc                     | j                  ddd       | j                  ddd       | j                  dd	d
dd       y )Nz	--servicez-szCThe service to consider. If not specified, use the default service.)helpz	--versionz-vz]The version to consider. If not specified, all versions for the given service are considered.z--logsz-l
store_trueFz8Open the log viewer instead of the App Engine dashboard.)actionr   r"   )add_argument)parsers    r   ArgszOpenConsole.ArgsP   sg    
!  #
 C  E
 G  Ir   c                     t         j                  j                  j                  j	                  d      }t        ||j                  |j                  |j                        }t        j                  |       y )NT)required)r   VALUEScorer   Getr   r   r   r   r   OpenURL)selfargsr   urls       r   RunzOpenConsole.Runc   sQ    $$,,00$0?G
wdllDII
NCs#r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr'   r1    r   r   r   r   3   s3    
	-. I I$$r   r   )r   NF)r5   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.appr   googlecloudsdk.corer   	six.movesr	   r   r   r   ReleaseTracksReleaseTrackGABETACommandr   r8   r   r   <module>rC      sy      &  ' ( = *  H?H( D%%(($*;*;*@*@A2$$,, 2$ B2$r   