Skip to content

Commit 1fb8e3e

Browse files
Google APIscopybara-github
authored andcommitted
feat: add ExecResourceOutput for OSConfig AgentEndpoint, add error_message field to OSPolicyResourceConfigStep
Committer: @adjackura PiperOrigin-RevId: 373391138
1 parent 7d55f1b commit 1fb8e3e

5 files changed

Lines changed: 77 additions & 71 deletions

File tree

.github/workflows/generate_api_index.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

google/cloud/osconfig/agentendpoint/v1/agentendpoint.proto

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ service AgentEndpointService {
3131
option (google.api.default_host) = "osconfig.googleapis.com";
3232

3333
// Stream established by client to receive Task notifications.
34-
rpc ReceiveTaskNotification(ReceiveTaskNotificationRequest) returns (stream ReceiveTaskNotificationResponse) {
34+
rpc ReceiveTaskNotification(ReceiveTaskNotificationRequest)
35+
returns (stream ReceiveTaskNotificationResponse) {
3536
option (google.api.method_signature) = "instance_id_token,agent_version";
3637
}
3738

@@ -41,24 +42,31 @@ service AgentEndpointService {
4142
}
4243

4344
// 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";
45+
rpc ReportTaskProgress(ReportTaskProgressRequest)
46+
returns (ReportTaskProgressResponse) {
47+
option (google.api.method_signature) =
48+
"instance_id_token,task_id,task_type";
4649
}
4750

4851
// Signals that the task execution is complete and optionally returns the next
4952
// task.
50-
rpc ReportTaskComplete(ReportTaskCompleteRequest) returns (ReportTaskCompleteResponse) {
51-
option (google.api.method_signature) = "instance_id_token,task_id,task_type,error_message";
53+
rpc ReportTaskComplete(ReportTaskCompleteRequest)
54+
returns (ReportTaskCompleteResponse) {
55+
option (google.api.method_signature) =
56+
"instance_id_token,task_id,task_type,error_message";
5257
}
5358

5459
// Registers the agent running on the VM.
5560
rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentResponse) {
56-
option (google.api.method_signature) = "instance_id_token,agent_version,supported_capabilities";
61+
option (google.api.method_signature) =
62+
"instance_id_token,agent_version,supported_capabilities";
5763
}
5864

5965
// Reports the VMs current inventory.
60-
rpc ReportInventory(ReportInventoryRequest) returns (ReportInventoryResponse) {
61-
option (google.api.method_signature) = "instance_id_token,inventory_checksum,inventory";
66+
rpc ReportInventory(ReportInventoryRequest)
67+
returns (ReportInventoryResponse) {
68+
option (google.api.method_signature) =
69+
"instance_id_token,inventory_checksum,inventory";
6270
}
6371
}
6472

@@ -75,9 +83,7 @@ message ReceiveTaskNotificationRequest {
7583

7684
// The streaming rpc message that will notify the agent when it has a task
7785
// it needs to perform on the instance.
78-
message ReceiveTaskNotificationResponse {
79-
80-
}
86+
message ReceiveTaskNotificationResponse {}
8187

8288
// A request message for signaling the start of a task execution.
8389
message StartNextTaskRequest {
@@ -110,6 +116,7 @@ message ReportTaskProgressRequest {
110116
// specified below:
111117
// APPLY_PATCHES = ApplyPatchesTaskProgress
112118
// EXEC_STEP = Progress not supported for this type.
119+
// APPLY_CONFIG_TASK = ApplyConfigTaskProgress
113120
TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED];
114121

115122
// Intermediate progress of the current task.
@@ -147,6 +154,7 @@ message ReportTaskCompleteRequest {
147154
// specified below:
148155
// APPLY_PATCHES = ApplyPatchesTaskOutput
149156
// EXEC_STEP = ExecStepTaskOutput
157+
// APPLY_CONFIG_TASK = ApplyConfigTaskOutput
150158
TaskType task_type = 3 [(google.api.field_behavior) = REQUIRED];
151159

152160
// Descriptive error message if the task execution ended in error.
@@ -166,9 +174,7 @@ message ReportTaskCompleteRequest {
166174
}
167175

168176
// The response message after the agent signaled the current task complete.
169-
message ReportTaskCompleteResponse {
170-
171-
}
177+
message ReportTaskCompleteResponse {}
172178

173179
// The request message for registering the agent.
174180
message RegisterAgentRequest {
@@ -183,13 +189,13 @@ message RegisterAgentRequest {
183189
// Required. The capabilities supported by the agent. Supported values are:
184190
// PATCH_GA
185191
// GUEST_POLICY_BETA
186-
repeated string supported_capabilities = 3 [(google.api.field_behavior) = REQUIRED];
192+
// CONFIG_V1
193+
repeated string supported_capabilities = 3
194+
[(google.api.field_behavior) = REQUIRED];
187195
}
188196

189197
// The response message after the agent registered.
190-
message RegisterAgentResponse {
191-
192-
}
198+
message RegisterAgentResponse {}
193199

194200
// The request message for having the agent report inventory.
195201
message ReportInventoryRequest {
@@ -198,13 +204,13 @@ message ReportInventoryRequest {
198204
// where the audience is 'osconfig.googleapis.com' and the format is 'full'.
199205
string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED];
200206

201-
// Required. This is a client created checksum that should be generated based on the
202-
// contents of the reported inventory. This will be used by the service to
203-
// determine if it has the latest version of inventory.
207+
// Required. This is a client created checksum that should be generated based
208+
// on the contents of the reported inventory. This will be used by the
209+
// service to determine if it has the latest version of inventory.
204210
string inventory_checksum = 2 [(google.api.field_behavior) = REQUIRED];
205211

206-
// Optional. This is the details of the inventory. Should only be provided if the
207-
// inventory has changed since the last report, or if instructed by the
212+
// Optional. This is the details of the inventory. Should only be provided if
213+
// the inventory has changed since the last report, or if instructed by the
208214
// service to provide full inventory.
209215
Inventory inventory = 3 [(google.api.field_behavior) = OPTIONAL];
210216
}

google/cloud/osconfig/agentendpoint/v1/config_common.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,21 @@ message OSPolicyResourceConfigStep {
6565

6666
// Outcome of the configuration step.
6767
Outcome outcome = 2;
68+
69+
// An error message recorded during the execution of this step.
70+
// Only populated when outcome is FAILED.
71+
string error_message = 3;
6872
}
6973

7074
// Compliance data for an OS policy resource.
7175
message OSPolicyResourceCompliance {
76+
// ExecResource specific output.
77+
message ExecResourceOutput {
78+
// Output from Enforcement phase output file (if run).
79+
// Output size is limited to 100K bytes.
80+
bytes enforcement_output = 2;
81+
}
82+
7283
// The id of the OS policy resource.
7384
string os_policy_resource_id = 1;
7485

@@ -78,6 +89,12 @@ message OSPolicyResourceCompliance {
7889

7990
// Compliance state of the OS policy resource.
8091
OSPolicyComplianceState state = 3;
92+
93+
// Resource specific output.
94+
oneof output {
95+
// ExecResource specific output.
96+
ExecResourceOutput exec_resource_output = 4;
97+
}
8198
}
8299

83100
// Supported OSPolicy compliance states.

google/cloud/osconfig/agentendpoint/v1/os_policy.proto

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ message OSPolicy {
3636
message File {
3737
// Specifies a file available via some URI.
3838
message Remote {
39-
// Required. URI from which to fetch the object. It should contain both the
40-
// protocol and path following the format `{protocol}://{location}`.
39+
// Required. URI from which to fetch the object. It should contain both
40+
// the protocol and path following the format `{protocol}://{location}`.
4141
string uri = 1 [(google.api.field_behavior) = REQUIRED];
4242

4343
// SHA256 checksum of the remote file.
@@ -159,8 +159,8 @@ message OSPolicy {
159159
REMOVED = 2;
160160
}
161161

162-
// Required. The desired state the agent should maintain for this package. The
163-
// default is to ensure the package is installed.
162+
// Required. The desired state the agent should maintain for this package.
163+
// The default is to ensure the package is installed.
164164
DesiredState desired_state = 1 [(google.api.field_behavior) = REQUIRED];
165165

166166
// A system package.
@@ -206,8 +206,8 @@ message OSPolicy {
206206
DEB_SRC = 2;
207207
}
208208

209-
// Required. Type of archive files in this repository. The default behavior is
210-
// DEB.
209+
// Required. Type of archive files in this repository. The default
210+
// behavior is DEB.
211211
ArchiveType archive_type = 1 [(google.api.field_behavior) = REQUIRED];
212212

213213
// Required. URI for this repository.
@@ -216,8 +216,8 @@ message OSPolicy {
216216
// Required. Distribution of this repository.
217217
string distribution = 3 [(google.api.field_behavior) = REQUIRED];
218218

219-
// Required. List of components for this repository. Must contain at least one
220-
// item.
219+
// Required. List of components for this repository. Must contain at
220+
// least one item.
221221
repeated string components = 4 [(google.api.field_behavior) = REQUIRED];
222222

223223
// URI of the key file for this repository. The agent maintains a
@@ -229,8 +229,8 @@ message OSPolicy {
229229
// repo file that is managed at
230230
// `/etc/yum.repos.d/google_osconfig.repo`.
231231
message YumRepository {
232-
// Required. A one word, unique name for this repository. This is the `repo
233-
// id` in the yum config file and also the `display_name` if
232+
// Required. A one word, unique name for this repository. This is the
233+
// `repo id` in the yum config file and also the `display_name` if
234234
// `display_name` is omitted. This id is also used as the unique
235235
// identifier when checking for resource conflicts.
236236
string id = 1 [(google.api.field_behavior) = REQUIRED];
@@ -249,8 +249,8 @@ message OSPolicy {
249249
// repo file that is managed at
250250
// `/etc/zypp/repos.d/google_osconfig.repo`.
251251
message ZypperRepository {
252-
// Required. A one word, unique name for this repository. This is the `repo
253-
// id` in the zypper config file and also the `display_name` if
252+
// Required. A one word, unique name for this repository. This is the
253+
// `repo id` in the zypper config file and also the `display_name` if
254254
// `display_name` is omitted. This id is also used as the unique
255255
// identifier when checking for GuestPolicy conflicts.
256256
string id = 1 [(google.api.field_behavior) = REQUIRED];
@@ -330,12 +330,20 @@ message OSPolicy {
330330

331331
// Required. The script interpreter to use.
332332
Interpreter interpreter = 4 [(google.api.field_behavior) = REQUIRED];
333+
334+
// Only recorded for enforce Exec.
335+
// Path to an output file (that is created by this Exec) whose
336+
// content will be recorded in OSPolicyResourceCompliance after a
337+
// successful run. Absence or failure to read this file will result in
338+
// this ExecResource being non-compliant. Output file size is limited to
339+
// 100K bytes.
340+
string output_file_path = 5;
333341
}
334342

335-
// Required. What to run to validate this resource is in the desired state.
336-
// An exit code of 100 indicates "in desired state", and exit code of 101
337-
// indicates "not in desired state". Any other exit code indicates a
338-
// failure running validate.
343+
// Required. What to run to validate this resource is in the desired
344+
// state. An exit code of 100 indicates "in desired state", and exit code
345+
// of 101 indicates "not in desired state". Any other exit code indicates
346+
// a failure running validate.
339347
Exec validate = 1 [(google.api.field_behavior) = REQUIRED];
340348

341349
// What to run to bring this resource into the desired state.
@@ -432,6 +440,4 @@ message OSPolicy {
432440
// their desired state, and if not, enforces the desired state.
433441
ENFORCEMENT = 2;
434442
}
435-
436-
437443
}

google/cloud/osconfig/agentendpoint/v1/osconfig_v1.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ backend:
1717
deadline: 30.0
1818
- selector: google.cloud.osconfig.agentendpoint.v1.AgentEndpointService.ReceiveTaskNotification
1919
deadline: 3600.0
20+
21+
authentication:
22+
rules:
23+
- selector: 'google.longrunning.Operations.*'
24+
oauth:
25+
canonical_scopes: |-
26+
https://www.googleapis.com/auth/cloud-platform

0 commit comments

Comments
 (0)