
                         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
)z>API wrapper for `gcloud network-actions wasm-plugin` commands.    )absolute_import)division)unicode_literals)util)waiter)	resourcesc                   6    e Zd ZdZd Z	 ddZ	 	 	 	 d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/network_actions/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)parentwasmPluginId
wasmPlugin)r   8NetworkservicesProjectsLocationsWasmPluginsCreateRequest
WasmPluginr   Create)r   namer#   r    r!   
log_configrequests          r   CreateWasmPluginzClient.CreateWasmPlugin+   s`    
 	NN}}//'$ 0  	O 	
  ##**733r   c           
          | j                   j                  ||| j                   j                  ||||            }| j                  j	                  |      S )zCalls the UpdateWasmPlugin API.)mainVersionIdr    r!   r"   )r)   
updateMaskr%   )r   7NetworkservicesProjectsLocationsWasmPluginsPatchRequestr'   r   Patch)r   r)   main_versionupdate_maskr    r!   r*   r+   s           r   UpdateWasmPluginzClient.UpdateWasmPlugin<   sc     	MM"}}//*'$	 0  	N 		
  ##))'22r   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.WaitForOperationT   sj     $$66B 7 K ((  $"9"9F >> r   )NNN)NNNN)__name__
__module____qualname____doc__r   r,   r4   r?    r   r   r
   r
      s0     EI4* 30r   r
   N)rC   
__future__r   r   r   &googlecloudsdk.api_lib.network_actionsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r
   rD   r   r   <module>rI      s)    E &  ' 7 . )T Tr   