// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. syntax = "proto3"; package chromiumos.test.api; option go_package = "go.chromium.org/chromiumos/config/go/test/api"; import "google/protobuf/duration.proto"; import "chromiumos/test/api/device_leasing.proto"; import "chromiumos/test/api/image.proto"; // ProviderId is the ID of various VM service providers: GCloud, VM leaser // service etc. enum ProviderId { UNKNOWN = 0; GCLOUD = 1; CLOUDSDK = 2; VM_LEASER = 3; } // VMInstance represents a created VM instance. message VmInstance { // A unique identifier of the VM that can identify the VM among all configs. string name = 1; // The AddressPort information for SSH. AddressPort ssh = 2; // Configuration used to create the instance. Config config = 3; } // Request for the InstanceApi.Create endpoint. message CreateVmInstanceRequest { // Configuration of the backend to start the instance. Config config = 1; // Optional tags to be associated to the instance. map tags = 2; } // Request for the InstanceApi.List endpoint. message ListVmInstancesRequest { // Configuration of the backend to list the instance. Config config = 2; // Instances with matching tags will be filtered. map tag_filters = 1; } // AddressPort represents the SSH address of an VMInstance. message AddressPort { // An accessible address: IP, domain, or instance name if in the same network. string address = 1; // Port number for SSH. int32 port = 2; } // TODO(b/250961857): finalize fields and add documentation // Configuration to specify how to create an instance. message Config { oneof backend { GCloudBackend gcloud_backend = 1; VmLeaserBackend vm_leaser_backend = 2; } // Gcloud properties. Most properties are passed through to the corresponding // flags of gcloud. A mandatory field is required when the config is used to // create an instance. message GCloudBackend { // GCP project id. Mandatory string project = 1; // GCE zone. Mandatory. string zone = 2; // GCE machine type. Mandatory. string machine_type = 3; // A custom prefix to instance name. Mandatory. string instance_prefix = 4; // Network, must be consistent to zone. Optional, fallback to default. string network = 7; // Subnet of network. Optional, fallback to default. string subnet= 8; // A boolean flag whether to request a public IPv4 address. // If requested, ssh target will be the public IPv4 address, otherwise it // will be the GCE internal IP address. bool public_ip = 5; // A boolean flag to determine what ip address to return in ssh target. // Default is false and the public_ip flag is used for that decision. // If true, ssh target will be the GCE internal IP address regardless of // whether public_ip is requested. bool always_ssh_internal_ip = 9; // GCE Image to be used to create instance. Mandatory. GceImage image = 6; } // VM Leaser properties. The fields will be passed to VM Leaser service for // VM creation and deletion. Required fields must be passed. // // NEXT TAG: 4 message VmLeaserBackend { // The VM Leaser environment to connect to. enum Environment { ENV_LOCAL = 0; ENV_STAGING = 1; ENV_PRODUCTION = 2; } Environment env = 3; // The populated fields will specify the requirements for operations on a VM // lease. Required. api.VMRequirements vm_requirements = 1; // Duration of a VM lease. Optional, fallback to service default. // This will put a ceiling on time wasted if the client dies. google.protobuf.Duration lease_duration = 2; } }