
    z
                     z    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	j                        Zy
)z8Client for interaction with Api CRUD on API Gateway API.    )absolute_import)division)unicode_literals)
exceptions)base)common_flagsc                   *    e Zd ZdZddZd Z	 	 ddZy)	ApiClientz0Client for Api objects on Cloud API Gateway API.Nc                     t         j                  j                  | |dd       | j                          | j	                  d       | j                  d       | j                          | j                          y )NApigatewayProjectsLocationsApisprojects_locations_apis)clientmessage_baseservice_nameapisapigatewayApi)r   
BaseClient__init__	DefineGet
DefineListDefineUpdateDefineDeleteDefineIamPolicyFunctions)selfr   s     .lib/googlecloudsdk/api_lib/api_gateway/apis.pyr   zApiClient.__init__   sc    OOT$**K*C  E 	NNOOFo&!!#    c                 Z    	 | j                  |       y# t        j                  $ r Y yw xY w)zChecks if an Api object exists.

    Args:
      api_ref: Resource, a resource reference for the api

    Returns:
      Boolean, indicating whether or not exists
    FT)Getapitools_exceptionsHttpNotFoundError)r   api_refs     r   	DoesExistzApiClient.DoesExist*   s2    
hhw  00 s    **c                 v   t        j                  || j                  j                  j                        }| j                  j                  |j                         |||      }| j                  |j                         ||j                         j                               }| j                  j                  |      S )a3  Creates a new Api object.

    Args:
      api_ref: Resource, a resource reference for the api
      managed_service: Optional string, reference name for OP service
      labels: Optional cloud labels
      display_name: Optional display name

    Returns:
      Long running operation response object.
    )namemanagedServicelabelsdisplayName)apiIdr   parent)r   ProcessLabelsFlagmessagesApigatewayApiLabelsValueRelativeNamecreate_requestNameParentserviceCreate)r   r!   managed_servicer&   display_nameapireqs          r   r3   zApiClient.Create:   s     ++##//1F --
%
%!!#& 	 & "C 

lln~~,,.  0C
 <<s##r   )N)NNN)__name__
__module____qualname____doc__r   r"   r3    r   r   r
   r
      s    8	$  :>$r   r
   N)r;   
__future__r   r   r   apitools.base.pyr   r   "googlecloudsdk.api_lib.api_gatewayr   &googlecloudsdk.command_lib.api_gatewayr   r   r
   r<   r   r   <module>rA      s,     ? &  ' > 3 ?9$ 9$r   