Method: images.setLabels

Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.

HTTP request

POST https://compute.s3nsapis.fr/compute/v1/projects/{project}/global/images/{resource}/setLabels

The URL uses gRPC Transcoding syntax. To know more about valid error responses that can be thrown by this HTTP request, please refer to the service error catalog

Path parameters

Parameters
project

string

Project ID for this request.

resource

string

Name or id of the resource for this request.

Request body

The request body contains data with the following structure:

JSON representation
{
  "labels": {
    string: string,
    ...
  },
  "labelFingerprint": string
}
Fields
labels

map (key: string, value: string)

A list of labels to apply for this resource. Each label must comply with the requirements for labels. For example,

"webserver-frontend": "images"

. A label value can also be empty (e.g.

"my-label": ""

).

labelFingerprint

string (bytes format)

The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels, otherwise the request will fail with error

412 conditionNotMet

. Make a

get()

request to the resource to get the latest fingerprint.

A base64-encoded string.

Response body

If successful, the response body contains an instance of Operation.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/compute
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

In addition to any permissions specified on the fields above, authorization requires one or more of the following IAM permissions:

  • compute.images.setLabels

To find predefined roles that contain those permissions, see Compute Engine IAM Roles.