summaryrefslogtreecommitdiff
path: root/third_party/googleapis/google/cloud/osconfig/agentendpoint/v1beta/tasks.proto
blob: 3d522b02794bd450d7a7eb5c883ba7a24b60a792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.cloud.osconfig.agentendpoint.v1beta;

import "google/api/field_behavior.proto";
import "google/cloud/osconfig/agentendpoint/v1beta/patch_jobs.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1beta;agentendpoint";
option java_outer_classname = "Tasks";
option java_package = "com.google.cloud.osconfig.agentendpoint.v1beta";
option php_namespace = "Google\\Cloud\\OsConfig\\V1beta";

// Specifies the current agent behavior.
enum TaskDirective {
  // Unspecified is invalid.
  TASK_DIRECTIVE_UNSPECIFIED = 0;

  // The task should continue to progress.
  CONTINUE = 1;

  // Task should not be started, or if already in progress, should stop
  // at first safe stopping point.  Task should be considered done and will
  // never repeat.
  STOP = 2;
}

// Specifies the type of task to perform.
enum TaskType {
  // Unspecified is invalid.
  TASK_TYPE_UNSPECIFIED = 0;

  // The apply patches task.
  APPLY_PATCHES = 1;

  // The exec step task.
  EXEC_STEP_TASK = 2;
}

// A unit of work to be performed by the agent.
message Task {
  // Unique task id.
  string task_id = 1;

  // The type of task to perform.
  //
  // Task details must include the appropriate message based on this enum as
  // specified below:
  // APPLY_PATCHES = ApplyPatchesTask
  // EXEC_STEP = ExecStepTask;
  TaskType task_type = 2;

  // Current directive to the agent.
  TaskDirective task_directive = 3;

  // Specific details about the current task to perform.
  oneof task_details {
    // Details about the apply patches task to perform.
    ApplyPatchesTask apply_patches_task = 4;

    // Details about the exec step task to perform.
    ExecStepTask exec_step_task = 5;
  }

  // Labels describing the task.  Used for logging by the agent.
  map<string, string> service_labels = 6;
}

// Message which instructs agent to apply patches.
message ApplyPatchesTask {
  // Specific information about how patches should be applied.
  PatchConfig patch_config = 1;

  // If true, the agent will report its status as it goes through the motions
  // but won't actually run any updates or perform any reboots.
  bool dry_run = 3;
}

// Information reported from the agent about applying patches execution.
message ApplyPatchesTaskProgress {
  // The intermediate states of applying patches.
  enum State {
    // Unspecified is invalid.
    STATE_UNSPECIFIED = 0;

    // The agent has started the patch task.
    STARTED = 4;

    // The agent is currently downloading patches.
    DOWNLOADING_PATCHES = 1;

    // The agent is currently applying patches.
    APPLYING_PATCHES = 2;

    // The agent is currently rebooting the VM instance.
    REBOOTING = 3;
  }

  // Required. The current state of this patch execution.
  State state = 1 [(google.api.field_behavior) = REQUIRED];
}

// Information reported from the agent about applying patches execution.
message ApplyPatchesTaskOutput {
  // The final states of applying patches.
  enum State {
    // Unspecified is invalid.
    STATE_UNSPECIFIED = 0;

    // Applying patches completed successfully.
    SUCCEEDED = 1;

    // Applying patches completed successfully, but a reboot is required.
    SUCCEEDED_REBOOT_REQUIRED = 2;

    // Applying patches failed.
    FAILED = 3;
  }

  // Required. The final state of this task.
  State state = 1 [(google.api.field_behavior) = REQUIRED];
}

// Message which instructs agent to execute the following command.
message ExecStepTask {
  // Details of the exec step to run.
  ExecStep exec_step = 1;
}

// Information reported from the agent about the exec step execution.
message ExecStepTaskProgress {
  // The intermediate states of exec steps.
  enum State {
    // Unspecified is invalid.
    STATE_UNSPECIFIED = 0;

    // The agent has started the exec step task.
    STARTED = 1;
  }

  // Required. The current state of this exec step.
  State state = 1 [(google.api.field_behavior) = REQUIRED];
}

// Information reported from the agent about the exec step execution.
message ExecStepTaskOutput {
  // The final states of exec steps.
  enum State {
    // Unspecified is invalid.
    STATE_UNSPECIFIED = 0;

    // The exec step completed normally.
    COMPLETED = 1;

    // The exec step was terminated because it took too long.
    TIMED_OUT = 2;

    // The exec step task was cancelled before it started.
    CANCELLED = 3;
  }

  // Required. The final state of the exec step.
  State state = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The exit code received from the script which ran as part of the exec step.
  int32 exit_code = 2 [(google.api.field_behavior) = REQUIRED];
}