From 6e012ef87570a258933df38c7d89732f196780cb Mon Sep 17 00:00:00 2001 From: Google APIs Date: Mon, 30 Sep 2019 11:27:13 -0700 Subject: [PATCH] Synchronize new proto/yaml changes. PiperOrigin-RevId: 272026449 --- .../devtools/remoteworkers/v1test2/bots.proto | 104 ++++++++---------- .../remoteworkers/v1test2/command.proto | 35 +++++- .../remoteworkers/v1test2/remoteworkers.yaml | 18 +++ .../remoteworkers/v1test2/tasks.proto | 66 ++++++++--- .../remoteworkers/v1test2/worker.proto | 3 +- 5 files changed, 142 insertions(+), 84 deletions(-) create mode 100644 google/devtools/remoteworkers/v1test2/remoteworkers.yaml diff --git a/google/devtools/remoteworkers/v1test2/bots.proto b/google/devtools/remoteworkers/v1test2/bots.proto index fbad1bf4..662cc10a 100644 --- a/google/devtools/remoteworkers/v1test2/bots.proto +++ b/google/devtools/remoteworkers/v1test2/bots.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC +// Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,15 +11,18 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// syntax = "proto3"; package google.devtools.remoteworkers.v1test2; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/devtools/remoteworkers/v1test2/worker.proto"; import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -59,6 +62,8 @@ option objc_class_prefix = "RW"; // take the form "projects/{project_id}". This is referred to below as "the farm // resource." service Bots { + option (google.api.default_host) = "remoteworkers.googleapis.com"; + // CreateBotSession is called when the bot first joins the farm, and // establishes a session ID to ensure that multiple machines do not register // using the same name accidentally. @@ -67,6 +72,7 @@ service Bots { post: "/v1test2/{parent=**}/botSessions" body: "bot_session" }; + option (google.api.method_signature) = "parent,bot_session"; } // UpdateBotSession must be called periodically by the bot (on a schedule @@ -77,18 +83,7 @@ service Bots { patch: "/v1test2/{name=**/botSessions/*}" body: "bot_session" }; - } - - // PostBotEventTemp may be called by the bot to indicate that some exceptional - // event has occurred. This method is subject to change or removal in future - // revisions of this API; we may simply want to replace it with StackDriver or - // some other common interface. - rpc PostBotEventTemp(PostBotEventTempRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1test2/{name=**/botSessions/*}:postEvent" - body: "*" - }; + option (google.api.method_signature) = "name,bot_session,update_mask"; } } @@ -100,6 +95,11 @@ service Bots { // of the view of this API, which communicates solely with the bot and not // directly with the underlying worker. message BotSession { + option (google.api.resource) = { + type: "remoteworkers.googleapis.com/BotSession" + pattern: "{unknown_path=**}/botSessions/{bot_session}" + }; + // The bot session name, as selected by the server. Output only during a call // to CreateBotSession. string name = 1; @@ -253,52 +253,6 @@ message AdminTemp { string arg = 2; } -// Request message for CreateBotSession. -message CreateBotSessionRequest { - // The farm resource. - string parent = 1; - - // The bot session to create. Server-assigned fields like name must be unset. - BotSession bot_session = 2; -} - -// Request message for UpdateBotSession. -message UpdateBotSessionRequest { - // The bot session name. Must match bot_session.name. - string name = 1; - - // The bot session resource to update. - BotSession bot_session = 2; - - // The fields on the bot that should be updated. See the BotSession resource - // for which fields are updatable by which caller. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for PostBotEventTemp -message PostBotEventTempRequest { - // Types of bot events. - enum Type { - // Illegal value. - UNSPECIFIED = 0; - - // Interesting but harmless event. - INFO = 1; - - // Error condition. - ERROR = 2; - } - - // The bot session name. - string name = 1; - - // The type of bot event. - Type type = 2; - - // A human-readable message. - string msg = 3; -} - // A coarse description of the status of the bot that the server uses to // determine whether to assign the bot new leases. enum BotStatus { @@ -326,6 +280,9 @@ enum BotStatus { // Bots are typically only asked to shut down if its host computer will be // modified in some way, such as deleting a VM. BOT_TERMINATING = 4; + + // The bot is initializing and is not ready to accept leases. + INITIALIZING = 5; } // The state of the lease. All leases start in the PENDING state. A bot can @@ -352,3 +309,30 @@ enum LeaseState { // the lease. This may only be set by the server. CANCELLED = 5; } + +// Request message for CreateBotSession. +message CreateBotSessionRequest { + // Required. The farm resource. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The bot session to create. Server-assigned fields like name must be unset. + BotSession bot_session = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateBotSession. +message UpdateBotSessionRequest { + // Required. The bot session name. Must match bot_session.name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "remoteworkers.googleapis.com/BotSession" + } + ]; + + // Required. The bot session resource to update. + BotSession bot_session = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields on the bot that should be updated. See the BotSession resource + // for which fields are updatable by which caller. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/google/devtools/remoteworkers/v1test2/command.proto b/google/devtools/remoteworkers/v1test2/command.proto index 9d5befec..933b9cf9 100644 --- a/google/devtools/remoteworkers/v1test2/command.proto +++ b/google/devtools/remoteworkers/v1test2/command.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC +// Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// syntax = "proto3"; @@ -64,8 +65,22 @@ message CommandTask { // that don't (eg, standard header files). repeated Digest files = 2; + // Inline contents for blobs expected to be needed by the bot to execute the + // task. For example, contents of entries in `files` or blobs that are + // indirectly referenced by an entry there. + // + // The bot should check against this list before downloading required task + // inputs to reduce the number of communications between itself and the + // remote CAS server. + repeated Blob inline_blobs = 4; + // All environment variables required by the task. repeated EnvironmentVariable environment_variables = 3; + + // Directory from which a command is executed. It is a relative directory + // with respect to the bot's working directory (i.e., "./"). If it is + // non-empty, then it must exist under "./". Otherwise, "./" will be used. + string working_directory = 5; } // Describes the expected outputs of the command. @@ -182,13 +197,13 @@ message CommandResult { // uploading/downloading files). google.protobuf.Duration overhead = 5 [deprecated = true]; - // Implementation-dependent statistics about the task. Both servers and bots + // Implementation-dependent metadata about the task. Both servers and bots // may define messages which can be encoded here; bots are free to provide - // statistics in multiple formats, and servers are free to choose one or more + // metadata in multiple formats, and servers are free to choose one or more // of the values to process and ignore others. In particular, it is *not* // considered an error for the bot to provide the server with a field that it // doesn't know about. - repeated google.protobuf.Any statistics = 6; + repeated google.protobuf.Any metadata = 6; } // The metadata for a file. Similar to the equivalent message in the Remote @@ -216,8 +231,7 @@ message FileMetadata { // The metadata for a directory. Similar to the equivalent message in the Remote // Execution API. message DirectoryMetadata { - // The path of the directory, as in - // [FileMetadata.path][google.devtools.remoteworkers.v1test2.FileMetadata.path]. + // The path of the directory, as in [FileMetadata.path][google.devtools.remoteworkers.v1test2.FileMetadata.path]. string path = 1; // A pointer to the contents of the directory, in the form of a marshalled @@ -246,6 +260,15 @@ message Digest { int64 size_bytes = 2; } +// Describes a blob of binary content with its digest. +message Blob { + // The digest of the blob. This should be verified by the receiver. + Digest digest = 1; + + // The contents of the blob. + bytes contents = 2; +} + // The contents of a directory. Similar to the equivalent message in the Remote // Execution API. message Directory { diff --git a/google/devtools/remoteworkers/v1test2/remoteworkers.yaml b/google/devtools/remoteworkers/v1test2/remoteworkers.yaml new file mode 100644 index 00000000..ea05361d --- /dev/null +++ b/google/devtools/remoteworkers/v1test2/remoteworkers.yaml @@ -0,0 +1,18 @@ +type: google.api.Service +config_version: 3 +name: remoteworkers.googleapis.com +title: Remote Workers API + +apis: +- name: google.devtools.remoteworkers.v1test2.Bots +- name: google.devtools.remoteworkers.v1test2.Tasks + +types: +- name: google.devtools.remoteworkers.v1test2.AdminTemp +- name: google.devtools.remoteworkers.v1test2.CommandOutputs +- name: google.devtools.remoteworkers.v1test2.CommandOverhead +- name: google.devtools.remoteworkers.v1test2.CommandResult +- name: google.devtools.remoteworkers.v1test2.CommandTask +- name: google.devtools.remoteworkers.v1test2.Directory +- name: google.devtools.remoteworkers.v1test2.DirectoryMetadata +- name: google.devtools.remoteworkers.v1test2.FileMetadata diff --git a/google/devtools/remoteworkers/v1test2/tasks.proto b/google/devtools/remoteworkers/v1test2/tasks.proto index 236112aa..f2e85fd6 100644 --- a/google/devtools/remoteworkers/v1test2/tasks.proto +++ b/google/devtools/remoteworkers/v1test2/tasks.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC +// Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,12 +11,16 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// syntax = "proto3"; package google.devtools.remoteworkers.v1test2; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/protobuf/any.proto"; import "google/protobuf/field_mask.proto"; import "google/rpc/status.proto"; @@ -32,6 +36,8 @@ option objc_class_prefix = "RW"; // Lease.result and logs should be precreated prior to sending to the bot (eg, // via CommandTask.expected_outputs.stdout_destination). service Tasks { + option (google.api.default_host) = "remoteworkers.googleapis.com"; + // DEPRECATED - use Lease.payload instead. // GetTask reads the current state of the task. Tasks must be created through // some other interface, and should be immutable once created and exposed to @@ -40,6 +46,7 @@ service Tasks { option (google.api.http) = { get: "/v1test2/{name=**/tasks/*}" }; + option (google.api.method_signature) = "name"; } // DEPRECATED - use Lease.result instead. @@ -49,6 +56,7 @@ service Tasks { patch: "/v1test2/{name=**/tasks/*/result}" body: "result" }; + option (google.api.method_signature) = "name,result,update_mask,source"; } // DEPRECATED - precreate logs prior to sending to bot. @@ -61,6 +69,7 @@ service Tasks { post: "/v1test2/{name=**/tasks/*}:addLog" body: "*" }; + option (google.api.method_signature) = "name,log_id"; } } @@ -75,6 +84,11 @@ service Tasks { // servers should implement partial responses in order to reduce unnecessry // overhead. message Task { + option (google.api.resource) = { + type: "remoteworkers.googleapis.com/Task" + pattern: "{unknown_path=**}/tasks/{task}" + }; + // The name of this task. Output only. string name = 1; @@ -94,8 +108,11 @@ message Task { // DEPRECATED - use Lease.assignment_result instead. // The result and metadata of the task. message TaskResult { - // The name of the task result; must be a name of a `Task` followed by - // `/result`. + option (google.api.resource) = { + type: "remoteworkers.googleapis.com/TaskResult" + pattern: "{unknown_path=**}/tasks/{task}/result" + }; + string name = 1; // The result may be updated several times; the client must only set @@ -123,34 +140,49 @@ message TaskResult { // Request message for `GetTask`. message GetTaskRequest { - // The task name. - string name = 1; + // Required. The task name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "remoteworkers.googleapis.com/Task" + } + ]; } // Request message for `UpdateTaskResult`. message UpdateTaskResultRequest { - // The task result name; must match `result.name`. - string name = 1; + // Required. The task result name; must match `result.name`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "remoteworkers.googleapis.com/TaskResult" + } + ]; - // The result being updated. - TaskResult result = 2; + // Required. The result being updated. + TaskResult result = 2 [(google.api.field_behavior) = REQUIRED]; - // The fields within `result` that are specified. - google.protobuf.FieldMask update_mask = 3; + // Required. The fields within `result` that are specified. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; - // If this is being updated by a bot from BotManager, the source should be + // Required. If this is being updated by a bot from BotManager, the source should be // bot.session_id. That way, if two bots accidentally get the same name, we'll // know to reject updates from the older one. - string source = 4; + string source = 4 [(google.api.field_behavior) = REQUIRED]; } // Request message for `AddTaskLog`. message AddTaskLogRequest { - // The name of the task that will own the new log. - string name = 1; + // Required. The name of the task that will own the new log. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "remoteworkers.googleapis.com/Task" + } + ]; - // The human-readable name of the log, like `stdout` or a relative file path. - string log_id = 2; + // Required. The human-readable name of the log, like `stdout` or a relative file path. + string log_id = 2 [(google.api.field_behavior) = REQUIRED]; } // Response message for `AddTaskLog`. diff --git a/google/devtools/remoteworkers/v1test2/worker.proto b/google/devtools/remoteworkers/v1test2/worker.proto index 74722606..b7553382 100644 --- a/google/devtools/remoteworkers/v1test2/worker.proto +++ b/google/devtools/remoteworkers/v1test2/worker.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC +// Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// syntax = "proto3";