| // Copyright 2019 The LUCI Authors. All rights reserved. |
| // Use of this source code is governed under the Apache License, Version 2.0 |
| // that can be found in the LICENSE file. |
| |
| syntax = "proto3"; |
| |
| option go_package = "go.chromium.org/luci/gce/api/instances/v1;instances"; |
| |
| package instances; |
| |
| import "google/protobuf/empty.proto"; |
| import "google/protobuf/timestamp.proto"; |
| |
| // A disk associated with a GCE instance. |
| message Disk { |
| // The image associated with this disk. |
| // https://cloud.google.com/compute/docs/reference/rest/v1/images/list. |
| string image = 1; |
| } |
| |
| // A network interface associated with a GCE instance. |
| message NetworkInterface { |
| // The internal IP address associated with this network interface. |
| string internal_ip = 1; |
| // The external IP addresses associated with this network interface. |
| repeated string external_ips = 2; |
| } |
| |
| // A GCE instance configured to exist. |
| // The instance actually exists iff the created timestamp is set. |
| message Instance { |
| // The ID of the VM this instance was created from. |
| string id = 1; |
| |
| // The hostname associated with this instance. |
| string hostname = 2; |
| |
| // The zone associated with this instance. |
| // https://cloud.google.com/compute/docs/reference/rest/v1/zones/list. |
| string zone = 3; |
| |
| // The GCP project associated with this instance. |
| string project = 4; |
| |
| // The timestamp when this instance was created. |
| google.protobuf.Timestamp created = 5; |
| |
| // The lifetime of this instance. |
| // At the end of its lifetime, the instance is deleted. |
| int64 lifetime = 6; |
| |
| // The hostname of the Swarming server this instance should connect to. |
| string swarming = 7; |
| |
| // The timestamp when this instance connected to Swarming. |
| google.protobuf.Timestamp connected = 8; |
| |
| // The timeout of this instance. |
| // If no Swarming bot has connected by the timeout, the instance is deleted. |
| int64 timeout = 9; |
| |
| // Whether this instance is drained or not. |
| // A drained instance will be safely deleted regardless of lifetime. |
| bool drained = 10; |
| |
| // The config revision associated with this instance. |
| string config_revision = 11; |
| |
| // The disks associated with this instance. |
| repeated Disk disks = 12; |
| |
| // The network interfaces associated with this instance. |
| repeated NetworkInterface network_interfaces = 13; |
| |
| // The prefix associated with this instance. |
| string prefix = 14; |
| } |
| |
| // A request to delete an instance. |
| message DeleteRequest { |
| // The ID of the instance to delete. |
| string id = 1; |
| |
| // The hostname of the instance to delete. |
| string hostname = 2; |
| } |
| |
| // A request to get an existing instance. |
| message GetRequest { |
| // The ID of the instance to get. |
| string id = 1; |
| |
| // The hostname of the instance to get. |
| string hostname = 2; |
| } |
| |
| // A request to list existing instances. |
| message ListRequest { |
| // The prefix to list instances for. |
| string prefix = 1; |
| |
| // The value of next_page_token received in a ListResponse. Used to get the |
| // next page of instances. If empty, gets the first page. |
| string page_token = 2; |
| |
| // The maximum number of results to include in the response. |
| int32 page_size = 3; |
| |
| // A filter to apply when listing instances. Currently the only supported |
| // filter is "disks.image=<image>" where <image> is the name of the image to |
| // filter for. |
| string filter = 4; |
| } |
| |
| // A response to a request to list instances. |
| message ListResponse { |
| // The prefix the instances are for. |
| string prefix = 1; |
| |
| // The instances matching the prefix. |
| repeated Instance instances = 2; |
| |
| // The value to use as the page_token in a ListRequest to get the next page of |
| // instances. If empty, there are no more instances. |
| string next_page_token = 3; |
| } |
| |
| // A service for manipulating GCE instances. |
| service Instances { |
| // Delete deletes an instance asynchronously. |
| rpc Delete(DeleteRequest) returns (google.protobuf.Empty); |
| // Get returns an existing instance. |
| rpc Get(GetRequest) returns (Instance); |
| // List returns existing instances. |
| rpc List(ListRequest) returns (ListResponse); |
| } |