
                         f    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
  G d d	e      Zy
)z6API client library for Certificate Manager operations.    )absolute_import)division)unicode_literals)
list_pager)
api_client)waiterc                   ,    e Zd ZdZddZd ZddZd Zy)	OperationClientz.API client for Certificate Manager operations.Nc                     |xs t        j                         | _        | j                  j                  | _        |xs | j                  j
                  | _        y )N)r   GetClientInstance_clientprojects_locations_operations_serviceMESSAGES_MODULEmessages)selfclientr   s      <lib/googlecloudsdk/api_lib/certificate_manager/operations.py__init__zOperationClient.__init__   s>    ;Z99;DLLL>>DM< < <DM    c                     | j                   j                  |j                               }| j                  j	                  |      S )zGets operation.

    Args:
      operation_ref: a Resource reference to a
        certificatemanager.projects.locations.operations resource to get.

    Returns:
      Operation API representation.
    )name)r   7CertificatemanagerProjectsLocationsOperationsGetRequestRelativeNamer   Get)r   operation_refrequests      r   r   zOperationClient.Get#   s?     mmSS'') T +G==W%%r   c                     | j                   j                  |j                         |      }t        j                  | j
                  |||dd      S )a  List operations in a given project and location.

    Args:
      parent_ref: a Resource reference to a
        certificatemanager.projects.locations resource to list operations for.
      limit: int, the total number of results to return from the API.
      page_size: int, the number of results in each batch from the API.
      list_filter: str, filter to apply in the list request.

    Returns:
      A list of the operations in the project.
    )r   filter
operationspageSize)
batch_sizelimitfieldbatch_size_attribute)r   8CertificatemanagerProjectsLocationsOperationsListRequestr   r   YieldFromListr   )r   
parent_refr#   	page_sizelist_filterr   s         r   ListzOperationClient.List1   sU     mmTT$$&{ U <G##') )r   c                 n    t        j                  t        j                  | j                        ||d      S )a  Waits until operation is complete.

    Args:
      operation_ref: a Resource reference to a
        certificatemanager.projects.locations.operations resource to wait for.
      message: str, message to be displayed while waiting.

    Returns:
      Operation result.
    i:  )wait_ceiling_ms)r   WaitForCloudOperationPollerNoResourcesr   )r   r   messages      r   WaitForOperationz OperationClient.WaitForOperationH   s0     >>..t}}=!	# #r   )NN)NNN)__name__
__module____qualname____doc__r   r   r+   r1    r   r   r
   r
      s    6=
&).#r   r
   N)r5   
__future__r   r   r   apitools.base.pyr   *googlecloudsdk.api_lib.certificate_managerr   googlecloudsdk.api_lib.utilr   objectr
   r6   r   r   <module>r<      s(    = &  ' ' A .<#f <#r   