
                             d Z ddlmZ ddlmZ ddlmZ ddl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 Zd Zd Zd Zd Zd Zd Zy)z.Common flags for service-extensions resources.    )absolute_import)division)unicode_literalsN)arg_parsers)concepts)util)	yaml_data)concept_parsers)presentation_specsc           	         t         j                  j                  d      }t        j                  t        j                  dt        j                  j                  |j                         |      |d      g      j                  |        y )Nzservice_extensions.wasmPluginwasm_plugin)api_versionT)required)r	   ResourceYAMLDataFromPathr
   ConceptParserr   ResourcePresentationSpecr   ResourceSpecFromYamlGetDataAddToParser)parserr   messagewasm_plugin_datas       :lib/googlecloudsdk/command_lib/service_extensions/flags.pyAddWasmPluginResourcer      s~    //88% 

5
5##,,"**,) -  
 K    c                 *    | j                  dd       y )Nz--descriptionz-A human-readable description of the resource.helpadd_argumentr   s    r   AddDescriptionFlagr$   2   s    :  <r   c           
      ~    | j                  ddt        j                  |      ddt        j                  d             y )Nz--log-configappendF
LOG_CONFIGa          Logging options for the activity performed by this plugin.
        The following options can be set:
        * `enable`: whether to enable logging. If `log-config` flag is set,
          `enable` option is required.

        * `sample-rate`: configures the sampling rate of activity logs, where
          `1.0` means all logged activity is reported and `0.0` means no
          activity is reported. The default value is `1.0`, and the value of
          the field must be in range `0` to `1` (inclusive).

        * `min-log-level`: specifies the lowest level of the logs that
          should be exported to Cloud Logging. The default value is `INFO`.

        Example usage:
        `--log-config=enable=True,sample-rate=0.5,min-log-level=INFO
        --log_config=enable=False`
        )actiontyper   metavarr    )r"   r   	LogConfigtextwrapdedent)r   r   s     r   AddLogConfigFlagr.   8   s>    >>+&??    r   c                 *    | j                  d|       y )Nz--main-versionr   r!   )r   version_messages     r   AddVersionFlagr1   T   s    &_=r   c                 P    | j                  dt        j                  d             y )Nz--imagezt          URI of the container image containing the plugin's Wasm module,
          stored in the Artifact Registry.r   )r"   r,   r-   r#   s    r   AddImageFlagr3   X   s)    ?? . /  r   c                     | j                  ddd      }|j                  ddd       |j                  ddt        j                  d	      d
       |j                  ddd       y)z"Adds flags defining plugin config.TFzConfiguration for the plugin, provided at runtime by the
              `on_configure` function (Rust Proxy-Wasm SDK) or the
              `onConfigure` method (C++ Proxy-Wasm SDK).)mutexr   r    z--plugin-configz3Plugin runtime configuration in the textual format.)r   r    z--plugin-config-file)binaryzOPath to a local file containing the plugin runtime
              configuration.)r   r)   r    z--plugin-config-urizxURI of the container image containing the plugin's runtime
              configuration, stored in the Artifact Registry.N)	add_groupr"   r   FileContents)r   plugin_config_groups     r   AddPluginConfigFlagr:   a   s    ((< )  ""D # 
 ""##40 	 #  ""A # r   c                 n    | j                  dd      }t        ||       t        |       t        |       y )NF)r5   r   )r7   r1   r3   r:   )r   r0   wasm_plugin_version_groups      r   AddWasmPluginVersionArgsr=   ~   s5    $..UU.K*O<()/0r   )__doc__
__future__r   r   r   r,   googlecloudsdk.callioper    googlecloudsdk.calliope.conceptsr   -googlecloudsdk.command_lib.service_extensionsr   $googlecloudsdk.command_lib.util.apisr	   (googlecloudsdk.command_lib.util.conceptsr
   r   r   r$   r.   r1   r3   r:   r=    r   r   <module>rF      sK    5 &  '  / 5 > : D G&<8>:1r   