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.v1beta; 18 19import "google/api/client.proto"; 20import "google/api/field_behavior.proto"; 21import "google/cloud/osconfig/agentendpoint/v1beta/guest_policies.proto"; 22import "google/cloud/osconfig/agentendpoint/v1beta/tasks.proto"; 23 24option go_package = "cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb;agentendpointpb"; 25option java_multiple_files = true; 26option java_outer_classname = "AgentEndpointProto"; 27option java_package = "com.google.cloud.osconfig.agentendpoint.v1beta"; 28option php_namespace = "Google\\Cloud\\OsConfig\\V1beta"; 29 30// OS Config agent endpoint API. 31service AgentEndpointService { 32 option (google.api.default_host) = "osconfig.googleapis.com"; 33 34 // Stream established by client to receive Task notifications. 35 rpc ReceiveTaskNotification(ReceiveTaskNotificationRequest) returns (stream ReceiveTaskNotificationResponse) { 36 option (google.api.method_signature) = "instance_id_token,agent_version"; 37 } 38 39 // Signals the start of a task execution and returns the task info. 40 rpc StartNextTask(StartNextTaskRequest) returns (StartNextTaskResponse) { 41 option (google.api.method_signature) = "instance_id_token"; 42 } 43 44 // Signals an intermediary progress checkpoint in task execution. 45 rpc ReportTaskProgress(ReportTaskProgressRequest) returns (ReportTaskProgressResponse) { 46 option (google.api.method_signature) = "instance_id_token,task_id,task_type"; 47 } 48 49 // Signals that the task execution is complete and optionally returns the next 50 // task. 51 rpc ReportTaskComplete(ReportTaskCompleteRequest) returns (ReportTaskCompleteResponse) { 52 option (google.api.method_signature) = "instance_id_token,task_id,task_type,error_message"; 53 } 54 55 // Lookup the effective guest policy that applies to a VM instance. This 56 // lookup merges all policies that are assigned to the instance ancestry. 57 rpc LookupEffectiveGuestPolicy(LookupEffectiveGuestPolicyRequest) returns (EffectiveGuestPolicy) { 58 option (google.api.method_signature) = "instance_id_token,os_short_name,os_version,os_architecture"; 59 } 60 61 // Registers the agent running on the VM. 62 rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentResponse) { 63 option (google.api.method_signature) = "instance_id_token,agent_version,supported_capabilities"; 64 } 65} 66 67// A request message to receive task notifications. 68message ReceiveTaskNotificationRequest { 69 // Required. This is the Compute Engine instance identity token described in 70 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 71 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 72 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 73 74 // Required. The version of the agent making the request. 75 string agent_version = 2 [(google.api.field_behavior) = REQUIRED]; 76} 77 78// The streaming rpc message that notifies the agent when it has a task 79// that it needs to perform on the VM instance. 80message ReceiveTaskNotificationResponse { 81 82} 83 84// A request message for signaling the start of a task execution. 85message StartNextTaskRequest { 86 // Required. This is the Compute Engine instance identity token described in 87 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 88 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 89 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 90} 91 92// A response message that contains the details of the task to work on. 93message StartNextTaskResponse { 94 // The details of the task that should be worked on. Can be empty if there 95 // is no new task to work on. 96 Task task = 1; 97} 98 99// A request message for reporting the progress of current task. 100message ReportTaskProgressRequest { 101 // Required. This is the Compute Engine instance identity token described in 102 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 103 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 104 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 105 106 // Required. Unique identifier of the task this applies to. 107 string task_id = 2 [(google.api.field_behavior) = REQUIRED]; 108 109 // Required. The type of task to report progress on. 110 // 111 // Progress must include the appropriate message based on this enum as 112 // specified below: 113 // APPLY_PATCHES = ApplyPatchesTaskProgress 114 // EXEC_STEP = Progress not supported for this type. 115 // APPLY_CONFIG_TASK = ApplyConfigTaskProgress 116 TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED]; 117 118 // Intermediate progress of the current task. 119 oneof progress { 120 // Details about the progress of the apply patches task. 121 ApplyPatchesTaskProgress apply_patches_task_progress = 4; 122 123 // Details about the progress of the exec step task. 124 ExecStepTaskProgress exec_step_task_progress = 5; 125 } 126} 127 128// The response message after the agent reported the current task progress. 129message ReportTaskProgressResponse { 130 // Instructs agent to continue or not. 131 TaskDirective task_directive = 1; 132} 133 134// A request message for signaling the completion of a task execution. 135message ReportTaskCompleteRequest { 136 // Required. This is the Compute Engine instance identity token described in 137 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 138 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 139 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 140 141 // Required. Unique identifier of the task this applies to. 142 string task_id = 2 [(google.api.field_behavior) = REQUIRED]; 143 144 // Required. The type of task to report completed. 145 // 146 // The output must include the appropriate message based on the following 147 // enum values: 148 // APPLY_PATCHES = ApplyPatchesTaskOutput 149 // EXEC_STEP = ExecStepTaskOutput 150 // APPLY_CONFIG_TASK = ApplyConfigTaskOutput 151 TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED]; 152 153 // Descriptive error message if the task execution ended in error. 154 string error_message = 4; 155 156 // Final output details of the current task. 157 oneof output { 158 // Final output details of the apply patches task; 159 ApplyPatchesTaskOutput apply_patches_task_output = 5; 160 161 // Final output details of the exec step task; 162 ExecStepTaskOutput exec_step_task_output = 6; 163 } 164} 165 166// The response message after the agent signaled the current task complete. 167message ReportTaskCompleteResponse { 168 169} 170 171// The request message for registering the agent. 172message RegisterAgentRequest { 173 // Required. This is the Compute Engine instance identity token described in 174 // https://cloud.google.com/compute/docs/instances/verifying-instance-identity 175 // where the audience is 'osconfig.googleapis.com' and the format is 'full'. 176 string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; 177 178 // Required. The version of the agent. 179 string agent_version = 2 [(google.api.field_behavior) = REQUIRED]; 180 181 // Required. The capabilities supported by the agent. Supported values are: 182 // PATCH_GA 183 // GUEST_POLICY_BETA 184 // CONFIG_V1 185 repeated string supported_capabilities = 3 [(google.api.field_behavior) = REQUIRED]; 186 187 // The operating system long name. 188 // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 189 // Datacenter'. 190 string os_long_name = 4; 191 192 // The operating system short name. 193 // For example, 'windows' or 'debian'. 194 string os_short_name = 5; 195 196 // The version of the operating system. 197 string os_version = 6; 198 199 // The system architecture of the operating system. 200 string os_architecture = 7; 201} 202 203// The response message after the agent registered. 204message RegisterAgentResponse { 205 206} 207