tasks.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. syntax = "proto3";
  15. package google.cloud.osconfig.agentendpoint.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/osconfig/agentendpoint/v1/config_common.proto";
  19. import "google/cloud/osconfig/agentendpoint/v1/os_policy.proto";
  20. import "google/cloud/osconfig/agentendpoint/v1/patch_jobs.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1;agentendpoint";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "Tasks";
  24. option java_package = "com.google.cloud.osconfig.agentendpoint.v1";
  25. option (google.api.resource_definition) = {
  26. type: "osconfig.googleapis.com/OSPolicyAssignment"
  27. pattern: "projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}"
  28. };
  29. // Specifies the current agent behavior.
  30. enum TaskDirective {
  31. // Unspecified is invalid.
  32. TASK_DIRECTIVE_UNSPECIFIED = 0;
  33. // The task should continue to progress.
  34. CONTINUE = 1;
  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. // Specifies the type of task to perform.
  41. enum TaskType {
  42. // Unspecified is invalid.
  43. TASK_TYPE_UNSPECIFIED = 0;
  44. // The apply patches task.
  45. APPLY_PATCHES = 1;
  46. // The exec step task.
  47. EXEC_STEP_TASK = 2;
  48. // The apply config task
  49. APPLY_CONFIG_TASK = 3;
  50. }
  51. // A unit of work to be performed by the agent.
  52. message Task {
  53. // Unique task id.
  54. string task_id = 1;
  55. // The type of task to perform.
  56. //
  57. // Task details must include the appropriate message based on this enum as
  58. // specified below:
  59. // APPLY_PATCHES = ApplyPatchesTask
  60. // EXEC_STEP = ExecStepTask
  61. // APPLY_CONFIG_TASK = ApplyConfigTask
  62. TaskType task_type = 2;
  63. // Current directive to the agent.
  64. TaskDirective task_directive = 3;
  65. // Specific details about the current task to perform.
  66. oneof task_details {
  67. // Details about the apply patches task to perform.
  68. ApplyPatchesTask apply_patches_task = 4;
  69. // Details about the exec step task to perform.
  70. ExecStepTask exec_step_task = 5;
  71. // Details about the apply config step task to perform.
  72. ApplyConfigTask apply_config_task = 7;
  73. }
  74. // Labels describing the task. Used for logging by the agent.
  75. map<string, string> service_labels = 6;
  76. }
  77. // Message which instructs agent to apply patches.
  78. message ApplyPatchesTask {
  79. // Specific information about how patches should be applied.
  80. PatchConfig patch_config = 1;
  81. // If true, the agent will report its status as it goes through the motions
  82. // but won't actually run any updates or perform any reboots.
  83. bool dry_run = 3;
  84. }
  85. // Information reported from the agent about applying patches execution.
  86. message ApplyPatchesTaskProgress {
  87. // The intermediate states of applying patches.
  88. enum State {
  89. // Unspecified is invalid.
  90. STATE_UNSPECIFIED = 0;
  91. // The agent has started the patch task.
  92. STARTED = 4;
  93. // The agent is currently downloading patches.
  94. DOWNLOADING_PATCHES = 1;
  95. // The agent is currently applying patches.
  96. APPLYING_PATCHES = 2;
  97. // The agent is currently rebooting the instance.
  98. REBOOTING = 3;
  99. }
  100. // Required. The current state of this patch execution.
  101. State state = 1 [(google.api.field_behavior) = REQUIRED];
  102. }
  103. // Information reported from the agent about applying patches execution.
  104. message ApplyPatchesTaskOutput {
  105. // The final states of applying patches.
  106. enum State {
  107. // Unspecified is invalid.
  108. STATE_UNSPECIFIED = 0;
  109. // Applying patches completed successfully.
  110. SUCCEEDED = 1;
  111. // Applying patches completed successfully, but a reboot is required.
  112. SUCCEEDED_REBOOT_REQUIRED = 2;
  113. // Applying patches failed.
  114. FAILED = 3;
  115. }
  116. // Required. The final state of this task.
  117. State state = 1 [(google.api.field_behavior) = REQUIRED];
  118. }
  119. // Message which instructs agent to execute the following command.
  120. message ExecStepTask {
  121. // Details of the exec step to run.
  122. ExecStep exec_step = 1;
  123. }
  124. // Information reported from the agent about the exec step execution.
  125. message ExecStepTaskProgress {
  126. // The intermediate states of exec steps.
  127. enum State {
  128. // Unspecified is invalid.
  129. STATE_UNSPECIFIED = 0;
  130. // The agent has started the exec step task.
  131. STARTED = 1;
  132. }
  133. // Required. The current state of this exec step.
  134. State state = 1 [(google.api.field_behavior) = REQUIRED];
  135. }
  136. // Information reported from the agent about the exec step execution.
  137. message ExecStepTaskOutput {
  138. // The final states of exec steps.
  139. enum State {
  140. // Unspecified is invalid.
  141. STATE_UNSPECIFIED = 0;
  142. // The exec step completed normally.
  143. COMPLETED = 1;
  144. // The exec step was terminated because it took too long.
  145. TIMED_OUT = 2;
  146. // The exec step task was cancelled before it started.
  147. CANCELLED = 3;
  148. }
  149. // Required. The final state of the exec step.
  150. State state = 1 [(google.api.field_behavior) = REQUIRED];
  151. // Required. The exit code received from the script which ran as part of the
  152. // exec step.
  153. int32 exit_code = 2 [(google.api.field_behavior) = REQUIRED];
  154. }
  155. // Message which instructs OS Config agent to apply the desired state
  156. // configuration.
  157. message ApplyConfigTask {
  158. // Message representing an OS policy.
  159. message OSPolicy {
  160. // User provided policy id.
  161. // Used for reporting and logging by the agent.
  162. string id = 1;
  163. // The policy mode
  164. .google.cloud.osconfig.agentendpoint.v1.OSPolicy.Mode mode = 2;
  165. // Reference to the `OSPolicyAssignment` API resource that this `OSPolicy`
  166. // belongs to.
  167. // Format:
  168. // projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}
  169. // Used for reporting and logging by the agent.
  170. string os_policy_assignment = 3 [(google.api.resource_reference) = {
  171. type: "osconfig.googleapis.com/OSPolicyAssignment"
  172. }];
  173. // List of resources associated with the policy to be set to their
  174. // desired state.
  175. repeated .google.cloud.osconfig.agentendpoint.v1.OSPolicy.Resource
  176. resources = 4;
  177. }
  178. // List of os policies to be applied for the instance.
  179. repeated OSPolicy os_policies = 1;
  180. }
  181. // Information reported from the agent regarding the progress of the task of
  182. // applying desired state configuration.
  183. message ApplyConfigTaskProgress {
  184. // The intermediate states of apply config task.
  185. enum State {
  186. // Invalid state
  187. STATE_UNSPECIFIED = 0;
  188. // The agent has started the task.
  189. STARTED = 1;
  190. // The agent is in the process of applying the configuration.
  191. APPLYING_CONFIG = 2;
  192. }
  193. // The current state of this task.
  194. State state = 1;
  195. }
  196. // Information reported from the agent regarding the output of the task of
  197. // applying desired state configuration.
  198. message ApplyConfigTaskOutput {
  199. // Result of applying desired state config for an OS policy.
  200. message OSPolicyResult {
  201. // The OS policy id
  202. string os_policy_id = 1;
  203. // Reference to the `OSPolicyAssignment` API resource that this `OSPolicy`
  204. // belongs to.
  205. // Format:
  206. // projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}
  207. // Used for reporting and logging by the agent.
  208. string os_policy_assignment = 2 [(google.api.resource_reference) = {
  209. type: "osconfig.googleapis.com/OSPolicyAssignment"
  210. }];
  211. // Results of applying desired state config for the OS policy resources.
  212. repeated OSPolicyResourceCompliance os_policy_resource_compliances = 3;
  213. }
  214. // The final state of this task.
  215. enum State {
  216. // Unspecified is invalid.
  217. STATE_UNSPECIFIED = 0;
  218. // The apply config task completed successfully.
  219. SUCCEEDED = 1;
  220. // The apply config task failed.
  221. FAILED = 2;
  222. // The apply config task was cancelled.
  223. CANCELLED = 3;
  224. }
  225. // Required. The final state of this task.
  226. State state = 1 [(google.api.field_behavior) = REQUIRED];
  227. // Results of applying desired state config for the OS policies.
  228. repeated OSPolicyResult os_policy_results = 2;
  229. }