
                         l    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Z G d	 d
      Zy)zJAPI wrapper for `gcloud service-extensions wasm-plugin-versions` commands.    )absolute_import)division)unicode_literals)util)waiter)	resourcesNc                   ,    e Zd ZdZd Z	 	 	 	 ddZd Zy)ClientzAPI client for WasmPluginVersion 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_versions_wasm_plugin_version_clientprojects_locations_operations_operations_clientMESSAGES_MODULEmessagesr   Registry_resource_parserRegisterApiByNameAPI_VERSION_FOR_TRACKget)selfrelease_tracks     Hlib/googlecloudsdk/api_lib/service_extensions/wasm_plugin_version_api.py__init__zClient.__init__"   s    ))-8DL<< 	$ #llHHDLL00DM%..0D++45599-H    Nc                     d}|rt        j                  |      }| j                  j                  ||| j                  j	                  |||||            }	| j
                  j                  |	      S )a  Calls the CreateWasmPluginVersion API.

    Args:
      name: string, wasmPluginVersion's name.
      parent: string, wasmPluginVersion's parent relative name.
      image: string, URI of the container image containing the Wasm module,
        stored in the Artifact Registry.
      plugin_config_data: string or bytes, WasmPlugin configuration in the
        textual or binary format.
      plugin_config_uri: string, URI of the container image containing the
        plugin configuration, stored in the Artifact Registry.
      description: string, human-readable description of the service.
      labels: set of label tags.

    Returns:
      (Operation) The response message.
    N)imageUridescriptionlabelspluginConfigDatapluginConfigUri)parentwasmPluginVersionIdwasmPluginVersion)sixensure_binaryr   @NetworkservicesProjectsLocationsWasmPluginsVersionsCreateRequestWasmPluginVersionr   Create)
r   namer%   imageplugin_config_dataplugin_config_urir!   r"   plugin_config_data_binaryrequests
             r   CreateWasmPluginVersionzClient.CreateWasmPluginVersion.   s    6 !% #&"3"34F"GVV $"mm=='!: 1 >  	W 
	
  ++227;;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.WaitForOperation^   sj     $$66B 7 K (((($*A*AF >> r   )NNNN)__name__
__module____qualname____doc__r   r3   r>    r   r   r
   r
      s%    
" .<`r   r
   )rB   
__future__r   r   r   )googlecloudsdk.api_lib.service_extensionsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r(   r
   rC   r   r   <module>rH      s,    Q &  ' : . ) 
] ]r   