
                         j   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iZej"                   ej$                  ej&                  j(                  ej&                  j*                  ej&                  j,                         G d dej.                                      Zy)zwList all instance operations.

Lists all instance operations that have been performed on the given
Cloud SQL instance.
    )absolute_import)division)unicode_literals)
list_pager)api_util)validate)base)flags)
propertiesEXAMPLESa          To list operations for instances with ID "prod-instance" , run:

          $ {command} --instance=prod-instance

        To list operations for instances with ID "prod-instance" that have 10 results, run:

          $ {command} --instance=prod-instance --limit=10

        To list operations for instances with ID "prod-instance" that have 10 results in a page, run:

          $ {command} --instance=prod-instance --page-size=10
        c                   *    e Zd ZdZeZed        Zd Zy)Listz?Lists all instance operations for the given Cloud SQL instance.c                     t        j                  |        | j                  j                  t         j                         | j                  j                  d        y )N)r
   AddInstancedisplay_info	AddFormatOPERATION_FORMAT_BETAAddCacheUpdater)parsers    "lib/surface/sql/operations/list.pyArgsz	List.Args;   s>    	f
!!%"="=>
''-    c                    t        j                  t         j                        }|j                  }|j                  }|j
                  j                  |j                  dt        j                  j                  j                  j                  id      }t        j                  |j                         t        j                   |j"                  |j%                  |j                  |j                        |j&                        S )a$  Lists all instance operations that have been performed on an instance.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object that has the list of operation resources if the command ran
      successfully.
    projectzsql.instances)params
collection)r   instance)limit)r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagesresource_parserParser   r   VALUEScorer   	GetOrFailr   ValidateInstanceNamer   YieldFromList
operationsSqlOperationsListRequestr   )selfargsclientr!   r"   instance_refs         r   RunzList.RunA   s      < <=F""J&&L))//:,,1199CCD" 0 $L !!$--0##-- ((<3H3H 	. 	Jjj	 r   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   r0    r   r   r   r   3   s$     H-. .
r   r   N)r4   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.sqlr   r   googlecloudsdk.callioper	   googlecloudsdk.command_lib.sqlr
   googlecloudsdk.corer   r5   DefaultUniverseOnlyReleaseTracksReleaseTrackGABETAALPHAListCommandr   r8   r   r   <module>rF      s    '  ' ' / / ( 0 * 	$ D%%(($*;*;*@*@%%++-$4 $- $r   