1// Copyright 2020 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.osconfig.agentendpoint.v1; 18 19import "google/api/client.proto"; 20import "google/api/field_behavior.proto"; 21import "google/cloud/osconfig/agentendpoint/v1/inventory.proto"; 22import "google/cloud/osconfig/agentendpoint/v1/tasks.proto"; 23 24option go_package = "cloud.google.com/go/osconfig/agentendpoint/apiv1/agentendpointpb;agentendpointpb"; 25option java_multiple_files = true; 26option java_outer_classname = "AgentEndpointProto"; 27option java_package = "com.google.cloud.osconfig.agentendpoint.v1"; 28 29// OS Config agent endpoint API. 30service AgentEndpointService { 31 option (google.api.default_host) = "osconfig.googleapis.com"; 32 33 // Stream established by client to receive Task notifications. 34 rpc ReceiveTaskNotification(ReceiveTaskNotificationRequest) returns (stream ReceiveTaskNotificationResponse) { 35 option (google.api.method_signature) = "instance_id_token,agent_version"; 36 } 37 38 // Signals the start of a task execution and returns the task info. 39 rpc StartNextTask(StartNextTaskRequest) returns (StartNextTaskResponse) { 40 option (google.api.method_signature) = "instance_id_token"; 41 } 42 43 // Signals an intermediary progress checkpoint in task execution. 44 rpc ReportTaskProgress(ReportTaskProgressRequest) returns (ReportTaskProgressResponse) { 45 option (google.api.method_signature) = "instance_id_token,task_id,task_type"; 46 } 47 48 // Signals that the task execution is complete and optionally returns the next 49 // task. 50 rpc ReportTaskComplete(ReportTaskCompleteRequest) returns (ReportTaskCompleteResponse) { 51 option (google.api.method_signature) = "instance_id_token,task_id,task_type,error_message"; 52 } 53 54 // Registers the agent running on the VM. 55 rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentResponse) { 56 option (google.api.method_signature) = "instance_id_token,agent_version,supported_capabilities"; 57 } 58 59 // Reports the VMs current inventory. 60 rpc ReportInventory(ReportInventoryRequest) returns (ReportInventoryResponse) { 61 option (google.api.method_signature) = "instance_id_token,inventory_checksum,inventory"; 62 } 63} 64 65// A request message to receive task notifications. 66message ReceiveTaskNotificationRequest { 67 // Required. This is the Compute Engine instance identity token described in 68 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 69 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 70 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 71 72 // Required. The version of the agent making the request. 73 string agent_version = 2 [(google.api.field_behavior) = REQUIRED]; 74} 75 76// The streaming rpc message that will notify the agent when it has a task 77// it needs to perform on the instance. 78message ReceiveTaskNotificationResponse { 79 80} 81 82// A request message for signaling the start of a task execution. 83message StartNextTaskRequest { 84 // Required. This is the Compute Engine instance identity token described in 85 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 86 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 87 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 88} 89 90// A response message that contains the details of the task to work on. 91message StartNextTaskResponse { 92 // The details of the task that should be worked on. Can be empty if there 93 // is no new task to work on. 94 Task task = 1; 95} 96 97// A request message for reporting the progress of current task. 98message ReportTaskProgressRequest { 99 // Required. This is the Compute Engine instance identity token described in 100 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 101 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 102 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 103 104 // Required. Unique identifier of the task this applies to. 105 string task_id = 2 [(google.api.field_behavior) = REQUIRED]; 106 107 // Required. The type of task to report progress on. 108 // 109 // Progress must include the appropriate message based on this enum as 110 // specified below: 111 // APPLY_PATCHES = ApplyPatchesTaskProgress 112 // EXEC_STEP = Progress not supported for this type. 113 // APPLY_CONFIG_TASK = ApplyConfigTaskProgress 114 TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED]; 115 116 // Intermediate progress of the current task. 117 oneof progress { 118 // Details about the progress of the apply patches task. 119 ApplyPatchesTaskProgress apply_patches_task_progress = 4; 120 121 // Details about the progress of the exec step task. 122 ExecStepTaskProgress exec_step_task_progress = 5; 123 124 // Details about the progress of the apply config task. 125 ApplyConfigTaskProgress apply_config_task_progress = 6; 126 } 127} 128 129// The response message after the agent reported the current task progress. 130message ReportTaskProgressResponse { 131 // Instructs agent to continue or not. 132 TaskDirective task_directive = 1; 133} 134 135// A request message for signaling the completion of a task execution. 136message ReportTaskCompleteRequest { 137 // Required. This is the Compute Engine instance identity token described in 138 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 139 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 140 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 141 142 // Required. Unique identifier of the task this applies to. 143 string task_id = 2 [(google.api.field_behavior) = REQUIRED]; 144 145 // Required. The type of task to report completed. 146 // 147 // Output must include the appropriate message based on this enum as 148 // specified below: 149 // APPLY_PATCHES = ApplyPatchesTaskOutput 150 // EXEC_STEP = ExecStepTaskOutput 151 // APPLY_CONFIG_TASK = ApplyConfigTaskOutput 152 TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED]; 153 154 // Descriptive error message if the task execution ended in error. 155 string error_message = 4; 156 157 // Final output details of the current task. 158 oneof output { 159 // Final output details of the apply patches task; 160 ApplyPatchesTaskOutput apply_patches_task_output = 5; 161 162 // Final output details of the exec step task; 163 ExecStepTaskOutput exec_step_task_output = 6; 164 165 // Final output details of the apply config task; 166 ApplyConfigTaskOutput apply_config_task_output = 7; 167 } 168} 169 170// The response message after the agent signaled the current task complete. 171message ReportTaskCompleteResponse { 172 173} 174 175// The request message for registering the agent. 176message RegisterAgentRequest { 177 // Required. This is the Compute Engine instance identity token described in 178 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 179 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 180 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 181 182 // Required. The version of the agent. 183 string agent_version = 2 [(google.api.field_behavior) = REQUIRED]; 184 185 // Required. The capabilities supported by the agent. Supported values are: 186 // PATCH_GA 187 // GUEST_POLICY_BETA 188 // CONFIG_V1 189 repeated string supported_capabilities = 3 [(google.api.field_behavior) = REQUIRED]; 190 191 // The operating system long name. 192 // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 193 // Datacenter'. 194 string os_long_name = 4; 195 196 // The operating system short name. 197 // For example, 'windows' or 'debian'. 198 string os_short_name = 5; 199 200 // The version of the operating system. 201 string os_version = 6; 202 203 // The system architecture of the operating system. 204 string os_architecture = 7; 205} 206 207// The response message after the agent registered. 208message RegisterAgentResponse { 209 210} 211 212// The request message for having the agent report inventory. 213message ReportInventoryRequest { 214 // Required. This is the Compute Engine instance identity token described in 215 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 216 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 217 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 218 219 // Required. This is a client created checksum that should be generated based on the 220 // contents of the reported inventory. This will be used by the service to 221 // determine if it has the latest version of inventory. 222 string inventory_checksum = 2 [(google.api.field_behavior) = REQUIRED]; 223 224 // Optional. This is the details of the inventory. Should only be provided if the 225 // inventory has changed since the last report, or if instructed by the 226 // service to provide full inventory. 227 Inventory inventory = 3 [(google.api.field_behavior) = OPTIONAL]; 228} 229 230// The response message after the agent has reported inventory. 231message ReportInventoryResponse { 232 // If true, the full inventory should be reported back to the server. 233 bool report_full_inventory = 1; 234} 235