tasks.proto 5.2 KB

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