xref: /aosp_15_r20/external/googleapis/google/cloud/osconfig/agentendpoint/v1beta/tasks.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/field_behavior.proto";
20import "google/cloud/osconfig/agentendpoint/v1beta/patch_jobs.proto";
21
22option go_package = "cloud.google.com/go/osconfig/agentendpoint/apiv1beta/agentendpointpb;agentendpointpb";
23option java_outer_classname = "Tasks";
24option java_package = "com.google.cloud.osconfig.agentendpoint.v1beta";
25option php_namespace = "Google\\Cloud\\OsConfig\\V1beta";
26
27// Specifies the current agent behavior.
28enum TaskDirective {
29  // Unspecified is invalid.
30  TASK_DIRECTIVE_UNSPECIFIED = 0;
31
32  // The task should continue to progress.
33  CONTINUE = 1;
34
35  // Task should not be started, or if already in progress, should stop
36  // at first safe stopping point.  Task should be considered done and will
37  // never repeat.
38  STOP = 2;
39}
40
41// Specifies the type of task to perform.
42enum TaskType {
43  // Unspecified is invalid.
44  TASK_TYPE_UNSPECIFIED = 0;
45
46  // The apply patches task.
47  APPLY_PATCHES = 1;
48
49  // The exec step task.
50  EXEC_STEP_TASK = 2;
51}
52
53// A unit of work to be performed by the agent.
54message Task {
55  // Unique task id.
56  string task_id = 1;
57
58  // The type of task to perform.
59  //
60  // Task details must include the appropriate message based on this enum as
61  // specified below:
62  // APPLY_PATCHES = ApplyPatchesTask
63  // EXEC_STEP = ExecStepTask;
64  TaskType task_type = 2;
65
66  // Current directive to the agent.
67  TaskDirective task_directive = 3;
68
69  // Specific details about the current task to perform.
70  oneof task_details {
71    // Details about the apply patches task to perform.
72    ApplyPatchesTask apply_patches_task = 4;
73
74    // Details about the exec step task to perform.
75    ExecStepTask exec_step_task = 5;
76  }
77
78  // Labels describing the task.  Used for logging by the agent.
79  map<string, string> service_labels = 6;
80}
81
82// Message which instructs agent to apply patches.
83message ApplyPatchesTask {
84  // Specific information about how patches should be applied.
85  PatchConfig patch_config = 1;
86
87  // If true, the agent will report its status as it goes through the motions
88  // but won't actually run any updates or perform any reboots.
89  bool dry_run = 3;
90}
91
92// Information reported from the agent about applying patches execution.
93message ApplyPatchesTaskProgress {
94  // The intermediate states of applying patches.
95  enum State {
96    // Unspecified is invalid.
97    STATE_UNSPECIFIED = 0;
98
99    // The agent has started the patch task.
100    STARTED = 4;
101
102    // The agent is currently downloading patches.
103    DOWNLOADING_PATCHES = 1;
104
105    // The agent is currently applying patches.
106    APPLYING_PATCHES = 2;
107
108    // The agent is currently rebooting the VM instance.
109    REBOOTING = 3;
110  }
111
112  // Required. The current state of this patch execution.
113  State state = 1 [(google.api.field_behavior) = REQUIRED];
114}
115
116// Information reported from the agent about applying patches execution.
117message ApplyPatchesTaskOutput {
118  // The final states of applying patches.
119  enum State {
120    // Unspecified is invalid.
121    STATE_UNSPECIFIED = 0;
122
123    // Applying patches completed successfully.
124    SUCCEEDED = 1;
125
126    // Applying patches completed successfully, but a reboot is required.
127    SUCCEEDED_REBOOT_REQUIRED = 2;
128
129    // Applying patches failed.
130    FAILED = 3;
131  }
132
133  // Required. The final state of this task.
134  State state = 1 [(google.api.field_behavior) = REQUIRED];
135}
136
137// Message which instructs agent to execute the following command.
138message ExecStepTask {
139  // Details of the exec step to run.
140  ExecStep exec_step = 1;
141}
142
143// Information reported from the agent about the exec step execution.
144message ExecStepTaskProgress {
145  // The intermediate states of exec steps.
146  enum State {
147    // Unspecified is invalid.
148    STATE_UNSPECIFIED = 0;
149
150    // The agent has started the exec step task.
151    STARTED = 1;
152  }
153
154  // Required. The current state of this exec step.
155  State state = 1 [(google.api.field_behavior) = REQUIRED];
156}
157
158// Information reported from the agent about the exec step execution.
159message ExecStepTaskOutput {
160  // The final states of exec steps.
161  enum State {
162    // Unspecified is invalid.
163    STATE_UNSPECIFIED = 0;
164
165    // The exec step completed normally.
166    COMPLETED = 1;
167
168    // The exec step was terminated because it took too long.
169    TIMED_OUT = 2;
170
171    // The exec step task was cancelled before it started.
172    CANCELLED = 3;
173  }
174
175  // Required. The final state of the exec step.
176  State state = 1 [(google.api.field_behavior) = REQUIRED];
177
178  // Required. The exit code received from the script which ran as part of the exec step.
179  int32 exit_code = 2 [(google.api.field_behavior) = REQUIRED];
180}
181