tasks.proto 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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 exec step.
  152. int32 exit_code = 2 [(google.api.field_behavior) = REQUIRED];
  153. }
  154. // Message which instructs OS Config agent to apply the desired state
  155. // configuration.
  156. message ApplyConfigTask {
  157. // Message representing an OS policy.
  158. message OSPolicy {
  159. // User provided policy id.
  160. // Used for reporting and logging by the agent.
  161. string id = 1;
  162. // The policy mode
  163. .google.cloud.osconfig.agentendpoint.v1.OSPolicy.Mode mode = 2;
  164. // Reference to the `OSPolicyAssignment` API resource that this `OSPolicy`
  165. // belongs to.
  166. // Format:
  167. // projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}
  168. // Used for reporting and logging by the agent.
  169. string os_policy_assignment = 3 [(google.api.resource_reference) = {
  170. type: "osconfig.googleapis.com/OSPolicyAssignment"
  171. }];
  172. // List of resources associated with the policy to be set to their
  173. // desired state.
  174. repeated .google.cloud.osconfig.agentendpoint.v1.OSPolicy.Resource resources = 4;
  175. }
  176. // List of os policies to be applied for the instance.
  177. repeated OSPolicy os_policies = 1;
  178. }
  179. // Information reported from the agent regarding the progress of the task of
  180. // applying desired state configuration.
  181. message ApplyConfigTaskProgress {
  182. // The intermediate states of apply config task.
  183. enum State {
  184. // Invalid state
  185. STATE_UNSPECIFIED = 0;
  186. // The agent has started the task.
  187. STARTED = 1;
  188. // The agent is in the process of applying the configuration.
  189. APPLYING_CONFIG = 2;
  190. }
  191. // The current state of this task.
  192. State state = 1;
  193. }
  194. // Information reported from the agent regarding the output of the task of
  195. // applying desired state configuration.
  196. message ApplyConfigTaskOutput {
  197. // Result of applying desired state config for an OS policy.
  198. message OSPolicyResult {
  199. // The OS policy id
  200. string os_policy_id = 1;
  201. // Reference to the `OSPolicyAssignment` API resource that this `OSPolicy`
  202. // belongs to.
  203. // Format:
  204. // projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}
  205. // Used for reporting and logging by the agent.
  206. string os_policy_assignment = 2 [(google.api.resource_reference) = {
  207. type: "osconfig.googleapis.com/OSPolicyAssignment"
  208. }];
  209. // Results of applying desired state config for the OS policy resources.
  210. repeated OSPolicyResourceCompliance os_policy_resource_compliances = 3;
  211. }
  212. // The final state of this task.
  213. enum State {
  214. // Unspecified is invalid.
  215. STATE_UNSPECIFIED = 0;
  216. // The apply config task completed successfully.
  217. SUCCEEDED = 1;
  218. // The apply config task failed.
  219. FAILED = 2;
  220. // The apply config task was cancelled.
  221. CANCELLED = 3;
  222. }
  223. // Required. The final state of this task.
  224. State state = 1 [(google.api.field_behavior) = REQUIRED];
  225. // Results of applying desired state config for the OS policies.
  226. repeated OSPolicyResult os_policy_results = 2;
  227. }