
                         d    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	      Zy
)zAAPI wrapper for `gcloud service-extensions wasm-plugin` commands.    )absolute_import)division)unicode_literals)util)waiter)	resourcesc                   D    e Zd ZdZd Z	 	 	 	 	 ddZ	 	 	 	 d	dZd Zd Zy)
ClientzyAPI client for WasmPlugin commands.

  Attributes:
    messages: API messages class, The Networkservices API messages.
  c                 ~   t        j                  |      | _        | j                  j                  | _        | j                  j
                  | _        | j                  j                  | _        t        j                         | _        | j                  j                  dt         j                  j                  |             y )Nnetworkservices)r   GetClientInstance_clientprojects_locations_wasmPlugins_wasm_plugin_clientprojects_locations_operations_operations_clientMESSAGES_MODULEmessagesr   Registry_resource_parserRegisterApiByNameAPI_VERSION_FOR_TRACKget)selfrelease_tracks     @lib/googlecloudsdk/api_lib/service_extensions/wasm_plugin_api.py__init__zClient.__init__!   s    ))-8DL#||JJD"llHHDLL00DM%..0D++45599-H    Nc                     | j                   j                  ||| j                   j                  |||||            }| j                  j	                  |      S )zCalls the CreateWasmPlugin API.)descriptionlabels	logConfigmainVersionIdversions)parentwasmPluginId
wasmPlugin)r   8NetworkservicesProjectsLocationsWasmPluginsCreateRequest
WasmPluginr   Create)	r   namer%   r    r!   
log_configmain_versionr$   requests	            r   CreateWasmPluginzClient.CreateWasmPlugin+   sf     	NN}}//'$*! 0  	O 
	
  ##**733r   c           
          | j                   j                  ||| j                   j                  ||||            }| j                  j	                  |      S )zCalls the UpdateWasmPlugin API.)r#   r    r!   r"   )r+   
updateMaskr'   )r   7NetworkservicesProjectsLocationsWasmPluginsPatchRequestr)   r   Patch)r   r+   r-   update_maskr    r!   r,   r.   s           r   UpdateWasmPluginzClient.UpdateWasmPluginE   sc     	MM"}}//*'$	 0  	N 		
  ##))'22r   c           
          |y | j                   j                  j                  | j                   j                  j                  j                  || j                   j	                  |||            g      S )N)imageUripluginConfigDatapluginConfigUri)keyvalue)additionalProperties)r   r)   VersionsValueAdditionalPropertyWasmPluginVersionDetails)r   
version_idimageplugin_config_dataplugin_config_uris        r   %PrepareVersionDetailsForSingleVersionz,Client.PrepareVersionDetailsForSingleVersion]   s{     ==##11MM$$22EEmm<<"%7$5 =  F 	
 2  r   c                     t         j                  j                  |j                  d      }t	        j
                  | j                  | j                        }t	        j                  |||      S )a-  Waits for the opration to complete and returns the result of the operation.

    Args:
      operation_ref: A Resource describing the Operation.
      message: The message to display to the user while they wait.

    Returns:
      result of result_service.Get request for the provided operation.
    z-networkservices.projects.locations.operations)
collection)	r   REGISTRYParseRelativeNamer+   r   CloudOperationPollerr   r   WaitFor)r   operation_refmessageop_resourcepollers        r   WaitForOperationzClient.WaitForOperationo   sj     $$66B 7 K ((  $"9"9F >> r   )NNNNN)NNNN)	__name__
__module____qualname____doc__r   r/   r5   rD   rO    r   r   r
   r
      s?     4< 30$r   r
   N)rS   
__future__r   r   r   )googlecloudsdk.api_lib.service_extensionsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r
   rT   r   r   <module>rY      s)    H &  ' : . )o or   