# REST Resource: projects.locations.wasmPlugins

- [Resource: WasmPlugin](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#WasmPlugin)
  - [JSON representation](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#WasmPlugin.SCHEMA_REPRESENTATION)
- [LogConfig](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogConfig)
  - [JSON representation](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogConfig.SCHEMA_REPRESENTATION)
- [LogLevel](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogLevel)
- [VersionDetails](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#VersionDetails)
  - [JSON representation](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#VersionDetails.SCHEMA_REPRESENTATION)
- [UsedBy](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#UsedBy)
  - [JSON representation](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#UsedBy.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#METHODS_SUMMARY)

## Resource: WasmPlugin

`WasmPlugin` is a resource representing a service executing a customer-provided Wasm module.

| JSON representation |
|---|
| ``` { "name": string, "createTime": string, "updateTime": string, "description": string, "labels": { string: string, ... }, "mainVersionId": string, "logConfig": { object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogConfig`) }, "versions": { string: { object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#VersionDetails`) }, ... }, "usedBy": [ { object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#UsedBy`) } ], "kmsKeyName": string, "kmsKeyVersion": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. Name of the `WasmPlugin` resource in the following format: `projects/{project}/locations/{location}/wasmPlugins/{wasmPlugin}`. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp when the resource was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp when the resource was updated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `description` | `string` Optional. A human-readable description of the resource. |
| `labels` | `map (key: string, value: string)` Optional. Set of labels associated with the `WasmPlugin` resource. The format must comply with [the following requirements](https://docs.cloud.google.com/compute/docs/labeling-resources#requirements). An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `mainVersionId` | `string` 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. |
| `logConfig` | ``object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogConfig`)`` 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. |
| `versions` | ``map (key: string, value: object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#VersionDetails`))`` 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 `mainVersionId` 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`. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `usedBy[]` | ``object (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#UsedBy`)`` Output only. List of all [extensions](https://cloud.google.com/service-extensions/docs/overview) that use this `WasmPlugin` resource. |
| `kmsKeyName` | `string` 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 `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins.versions#WasmPluginVersion.FIELDS.image_uri`) and configuration (provided by `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins.versions#WasmPluginVersion.FIELDS.plugin_config_data` or `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins.versions#WasmPluginVersion.FIELDS.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). |
| `kmsKeyVersion` | `string` 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 `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#WasmPlugin.FIELDS.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 `kmsKeyName` field. See [Cloud KMS resources](https://cloud.google.com/kms/docs/resource-hierarchy) for more information. |

## LogConfig

Specifies the logging options for the activity performed by this plugin. If logging is enabled, plugin logs are exported to Cloud Logging.

| JSON representation |
|---|
| ``` { "enable": boolean, "sampleRate": number, "minLogLevel": enum (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogLevel`) } ``` |

| Fields ||
|---|---|
| `enable` | `boolean` Optional. Specifies whether to enable logging for activity by this plugin. Defaults to `false`. |
| `sampleRate` | `number` 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. |
| `minLogLevel` | ``enum (`https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins#LogLevel`)`` 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 is 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. |

## LogLevel

Possible values to specify the lowest level of logs to be exported to Cloud Logging.

| Enums ||
|---|---|
| `LOG_LEVEL_UNSPECIFIED` | Unspecified value. Defaults to `LogLevel.INFO`. |
| `TRACE` | Report logs with TRACE level and above. |
| `DEBUG` | Report logs with DEBUG level and above. |
| `INFO` | Report logs with INFO level and above. |
| `WARN` | Report logs with WARN level and above. |
| `ERROR` | Report logs with ERROR level and above. |
| `CRITICAL` | Report logs with CRITICAL level only. |

## VersionDetails

Details of a `WasmPluginVersion` resource to be inlined in the `WasmPlugin` resource.

| JSON representation |
|---|
| ``` { "createTime": string, "updateTime": string, "description": string, "labels": { string: string, ... }, "imageUri": string, "imageDigest": string, "pluginConfigDigest": string, // Union field `plugin_config_source` can be only one of the following: "pluginConfigData": string, "pluginConfigUri": string // End of list of possible types for union field `plugin_config_source`. } ``` |

| Fields ||
|---|---|
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp when the resource was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp when the resource was updated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `description` | `string` Optional. A human-readable description of the resource. |
| `labels` | `map (key: string, value: string)` Optional. Set of labels associated with the `WasmPluginVersion` resource. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `imageUri` | `string` 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 `imageUri` 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 `imageDigest` field. When pulling a container image from Artifact Registry, the digest value is used instead of an image tag. - Generic artifacts: the `imageUri` 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 `imageDigest` field. |
| `imageDigest` | `string` Output only. This field holds the digest (usually checksum) value for the plugin image. The value is calculated based on the `imageUri` field. If the `imageUri` field refers to a container image, the digest value is obtained from the container image. If the `imageUri` field refers to a generic artifact, the digest value is calculated based on the contents of the file. |
| `pluginConfigDigest` | `string` Output only. This field holds the digest (usually checksum) value for the plugin configuration. The value is calculated based on the contents of `pluginConfigData` field or the image defined by the `pluginConfigUri` field. |
| Union field `plugin_config_source`. `plugin_config_source` can be only one of the following: ||
| `pluginConfigData` | `string (https://developers.google.com/discovery/v1/type-format format)` 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 `pluginConfigDigest` field. A base64-encoded string. |
| `pluginConfigUri` | `string` 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 `pluginConfigUri` 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 `pluginConfigDigest` field. When pulling a container image from Artifact Registry, the digest value is used instead of an image tag. - Generic artifacts: the `pluginConfigUri` 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 `pluginConfigDigest` field. |

## UsedBy

Defines a resource that uses the `WasmPlugin` resource.

| JSON representation |
|---|
| ``` { "name": string } ``` |

| Fields ||
|---|---|
| `name` | `string` 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}` |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins/create` | Creates a new `WasmPlugin` resource in a given project and location. |
| ### `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins/delete` | Deletes the specified `WasmPlugin` resource. |
| ### `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins/get` | Gets details of the specified `WasmPlugin` resource. |
| ### `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins/list` | Lists `WasmPlugin` resources in a given project and location. |
| ### `https://docs.cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins/patch` | Updates the parameters of the specified `WasmPlugin` resource. |