
                             S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  SS	KJr  SS
KJr  SSKJr  S rS rS rS rS rS rS rg)z.Common flags for service-extensions resources.    )absolute_import)division)unicode_literalsN)arg_parsers)concepts)util)	yaml_data)concept_parsers)presentation_specsc           
         [         R                  R                  S5      n[        R                  " [
        R                  " S[        R                  R                  UR                  5       US9USS9/5      R                  U 5        g )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                 $    U R                  SSS9  g )Nz--descriptionz-A human-readable description of the resource.helpadd_argumentr   s    r   AddDescriptionFlagr$   2   s    :  <r   c           
      |    U R                  SS[        R                  " U5      SS[        R                  " S5      S9  g )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                 $    U R                  SUS9  g )Nz--main-versionr   r!   )r   version_messages     r   AddVersionFlagr1   T   s    &_=r   c                 L    U R                  S[        R                  " S5      S9  g )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                     U R                  SSSS9nUR                  SSSS9  UR                  SS[        R                  " SS	9S
S9  UR                  SSSS9  g)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                 f    U R                  SSS9n[        X!5        [        U5        [        U5        g )NF)r5   r   )r7   r1   r3   r:   )r   r0   wasm_plugin_version_groups      r   AddWasmPluginVersionArgsr=   ~   s3    $..UU.K*<()/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   