{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-service-mesh/json-schema/google-cloud-service-mesh-wasm-plugin-schema.json",
  "title": "WasmPlugin",
  "description": "`WasmPlugin` is a resource representing a service executing a customer-provided Wasm module.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-service-mesh-networkservices-projects-api-openapi.yml#/components/schemas/WasmPlugin",
  "properties": {
    "updateTime": {
      "readOnly": true,
      "format": "google-datetime",
      "description": "Output only. The timestamp when the resource was updated.",
      "type": "string"
    },
    "name": {
      "description": "Identifier. Name of the `WasmPlugin` resource in the following format: `projects/{project}/locations/{location}/wasmPlugins/{wasm_plugin}`.",
      "type": "string"
    },
    "mainVersionId": {
      "description": "Optional. The ID of the `WasmPluginVersion` resource that is the currently serving one. The version referred to must be a child of this `WasmPlugin` resource.",
      "type": "string"
    },
    "labels": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional. Set of labels associated with the `WasmPlugin` resource. The format must comply with [the following requirements](/compute/docs/labeling-resources#requirements)."
    },
    "versions": {
      "type": "object",
      "description": "Optional. All versions of this `WasmPlugin` resource in the key-value format. The key is the resource ID, and the value is the `VersionDetails` object. Lets you create or update a `WasmPlugin` resource and its versions in a single request. When the `main_version_id` field is not empty, it must point to one of the `VersionDetails` objects in the map. If provided in a `PATCH` request, the new versions replace the previous set. Any version omitted from the `versions` field is removed. Because the `WasmPluginVersion` resource is immutable, if a `WasmPluginVersion` resource with the same name already exists and differs, the request fails. Note: In a `GET` request, this field is populated only if the field `GetWasmPluginRequest.view` is set to `WASM_PLUGIN_VIEW_FULL`.",
      "additionalProperties": {
        "$ref": "#/$defs/WasmPluginVersionDetails"
      }
    },
    "description": {
      "type": "string",
      "description": "Optional. A human-readable description of the resource."
    },
    "logConfig": {
      "$ref": "#/$defs/WasmPluginLogConfig",
      "description": "Optional. Specifies the logging options for the activity performed by this plugin. If logging is enabled, plugin logs are exported to Cloud Logging. Note that the settings relate to the logs generated by using logging statements in your Wasm code."
    },
    "kmsKeyName": {
      "description": "Optional. The name of the customer-managed [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) to be used to encrypt the `WasmPlugin` image (provided by image_uri) and configuration (provided by plugin_config_data or plugin_config_uri) that are stored by the `Service Extensions` product at rest. Format: `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}` By default, Google Cloud automatically encrypts all data at rest using Google-owned and Google-managed encryption keys. If you need ownership and control of the keys that protect your data at rest, you can specify a customer-managed encryption key (CMEK) to encrypt your `WasmPlugin` data. For more information, see [Using customer-managed encryption keys](https://cloud.google.com/service-extensions/docs/cmek).",
      "type": "string"
    },
    "kmsKeyVersion": {
      "readOnly": true,
      "description": "Output only. The name of the specific [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions) used to encrypt the `WasmPlugin` data, if the kms_key_name field is set. Format: `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version}` This is a read-only field. `WasmPlugin` data is automatically encrypted using the most recent `CryptoKeyVersion` of the `CryptoKey` provided in the `kms_key_name` field. See [Cloud KMS resources](https://cloud.google.com/kms/docs/resource-hierarchy) for more information.",
      "type": "string"
    },
    "usedBy": {
      "readOnly": true,
      "items": {
        "$ref": "#/$defs/WasmPluginUsedBy"
      },
      "description": "Output only. List of all [extensions](https://cloud.google.com/service-extensions/docs/overview) that use this `WasmPlugin` resource.",
      "type": "array"
    },
    "createTime": {
      "description": "Output only. The timestamp when the resource was created.",
      "readOnly": true,
      "format": "google-datetime",
      "type": "string"
    }
  },
  "type": "object",
  "$defs": {
    "WasmPluginLogConfig": {
      "type": "object",
      "description": "Specifies the logging options for the activity performed by this plugin. If logging is enabled, plugin logs are exported to Cloud Logging.",
      "properties": {
        "enable": {
          "description": "Optional. Specifies whether to enable logging for activity by this plugin. Defaults to `false`.",
          "type": "boolean"
        },
        "sampleRate": {
          "format": "float",
          "description": "Optional. Non-empty default. Configures the sampling rate of activity logs, where `1.0` means all logged activity is reported and `0.0` means no activity is reported. A floating point value between `0.0` and `1.0` indicates that a percentage of log messages is stored. The default value when logging is enabled is `1.0`. The value of the field must be between `0` and `1` (inclusive). This field can be specified only if logging is enabled for this plugin.",
          "type": "number"
        },
        "minLogLevel": {
          "type": "string",
          "enum": [
            "LOG_LEVEL_UNSPECIFIED",
            "TRACE",
            "DEBUG",
            "INFO",
            "WARN",
            "ERROR",
            "CRITICAL"
          ],
          "description": "Optional. Non-empty default. Specifies the lowest level of the plugin logs that are exported to Cloud Logging. This setting relates to the logs generated by using logging statements in your Wasm code. This field can be set only if logging is enabled for the plugin. If the field is not provided when logging is enabled, it is set to `INFO` by default."
        }
      }
    },
    "WasmPluginUsedBy": {
      "description": "Defines a resource that uses the `WasmPlugin` resource.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Output only. Full name of the resource https://google.aip.dev/122#full-resource-names, for example `//networkservices.googleapis.com/projects/{project}/locations/{location}/lbRouteExtensions/{extension}`",
          "readOnly": true
        }
      },
      "type": "object"
    },
    "WasmPluginVersionDetails": {
      "properties": {
        "createTime": {
          "type": "string",
          "format": "google-datetime",
          "readOnly": true,
          "description": "Output only. The timestamp when the resource was created."
        },
        "imageDigest": {
          "type": "string",
          "readOnly": true,
          "description": "Output only. This field holds the digest (usually checksum) value for the plugin image. The value is calculated based on the `image_uri` field. If the `image_uri` field refers to a container image, the digest value is obtained from the container image. If the `image_uri` field refers to a generic artifact, the digest value is calculated based on the contents of the file."
        },
        "description": {
          "description": "Optional. A human-readable description of the resource.",
          "type": "string"
        },
        "pluginConfigData": {
          "type": "string",
          "format": "byte",
          "description": "Configuration for the plugin. The configuration is provided to the plugin at runtime through the `ON_CONFIGURE` callback. When a new `WasmPluginVersion` version is created, the digest of the contents is saved in the `plugin_config_digest` field."
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "Optional. Set of labels associated with the `WasmPluginVersion` resource."
        },
        "pluginConfigDigest": {
          "description": "Output only. This field holds the digest (usually checksum) value for the plugin configuration. The value is calculated based on the contents of `plugin_config_data` field or the image defined by the `plugin_config_uri` field.",
          "readOnly": true,
          "type": "string"
        },
        "updateTime": {
          "description": "Output only. The timestamp when the resource was updated.",
          "readOnly": true,
          "format": "google-datetime",
          "type": "string"
        },
        "pluginConfigUri": {
          "description": "URI of the plugin configuration stored in the Artifact Registry. The configuration is provided to the plugin at runtime through the `ON_CONFIGURE` callback. The URI can refer to one of the following repository formats: * Container images: the `plugin_config_uri` must point to a container that contains a single file with the name `plugin.config`. When a new `WasmPluginVersion` resource is created, the digest of the image is saved in the `plugin_config_digest` field. When pulling a container image from Artifact Registry, the digest value is used instead of an image tag. * Generic artifacts: the `plugin_config_uri` must be in this format: `projects/{project}/locations/{location}/repositories/{repository}/ genericArtifacts/{package}:{version}`. The specified package and version must contain a file with the name `plugin.config`. When a new `WasmPluginVersion` resource is created, the checksum of the contents of the file is saved in the `plugin_config_digest` field.",
          "type": "string"
        },
        "imageUri": {
          "type": "string",
          "description": "Optional. URI of the image containing the Wasm module, stored in Artifact Registry. The URI can refer to one of the following repository formats: * Container images: the `image_uri` must point to a container that contains a single file with the name `plugin.wasm`. When a new `WasmPluginVersion` resource is created, the digest of the image is saved in the `image_digest` field. When pulling a container image from Artifact Registry, the digest value is used instead of an image tag. * Generic artifacts: the `image_uri` must be in this format: `projects/{project}/locations/{location}/repositories/{repository}/ genericArtifacts/{package}:{version}`. The specified package and version must contain a file with the name `plugin.wasm`. When a new `WasmPluginVersion` resource is created, the checksum of the contents of the file is saved in the `image_digest` field."
        }
      },
      "type": "object",
      "description": "Details of a `WasmPluginVersion` resource to be inlined in the `WasmPlugin` resource."
    }
  }
}