patch_deployments.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/osconfig/v1/patch_jobs.proto";
  19. import "google/protobuf/duration.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/type/datetime.proto";
  22. import "google/type/dayofweek.proto";
  23. import "google/type/timeofday.proto";
  24. option csharp_namespace = "Google.Cloud.OsConfig.V1";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig";
  26. option java_outer_classname = "PatchDeployments";
  27. option java_package = "com.google.cloud.osconfig.v1";
  28. option php_namespace = "Google\\Cloud\\OsConfig\\V1";
  29. option ruby_package = "Google::Cloud::OsConfig::V1";
  30. // Patch deployments are configurations that individual patch jobs use to
  31. // complete a patch. These configurations include instance filter, package
  32. // repository settings, and a schedule. For more information about creating and
  33. // managing patch deployments, see [Scheduling patch
  34. // jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs).
  35. message PatchDeployment {
  36. option (google.api.resource) = {
  37. type: "osconfig.googleapis.com/PatchDeployment"
  38. pattern: "projects/{project}/patchDeployments/{patch_deployment}"
  39. };
  40. // Unique name for the patch deployment resource in a project. The patch
  41. // deployment name is in the form:
  42. // `projects/{project_id}/patchDeployments/{patch_deployment_id}`.
  43. // This field is ignored when you create a new patch deployment.
  44. string name = 1;
  45. // Optional. Description of the patch deployment. Length of the description is
  46. // limited to 1024 characters.
  47. string description = 2 [(google.api.field_behavior) = OPTIONAL];
  48. // Required. VM instances to patch.
  49. PatchInstanceFilter instance_filter = 3
  50. [(google.api.field_behavior) = REQUIRED];
  51. // Optional. Patch configuration that is applied.
  52. PatchConfig patch_config = 4 [(google.api.field_behavior) = OPTIONAL];
  53. // Optional. Duration of the patch. After the duration ends, the patch times
  54. // out.
  55. google.protobuf.Duration duration = 5
  56. [(google.api.field_behavior) = OPTIONAL];
  57. // Schedule for the patch.
  58. oneof schedule {
  59. // Required. Schedule a one-time execution.
  60. OneTimeSchedule one_time_schedule = 6
  61. [(google.api.field_behavior) = REQUIRED];
  62. // Required. Schedule recurring executions.
  63. RecurringSchedule recurring_schedule = 7
  64. [(google.api.field_behavior) = REQUIRED];
  65. }
  66. // Output only. Time the patch deployment was created. Timestamp is in
  67. // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  68. google.protobuf.Timestamp create_time = 8
  69. [(google.api.field_behavior) = OUTPUT_ONLY];
  70. // Output only. Time the patch deployment was last updated. Timestamp is in
  71. // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  72. google.protobuf.Timestamp update_time = 9
  73. [(google.api.field_behavior) = OUTPUT_ONLY];
  74. // Output only. The last time a patch job was started by this deployment.
  75. // Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text
  76. // format.
  77. google.protobuf.Timestamp last_execute_time = 10
  78. [(google.api.field_behavior) = OUTPUT_ONLY];
  79. // Optional. Rollout strategy of the patch job.
  80. PatchRollout rollout = 11 [(google.api.field_behavior) = OPTIONAL];
  81. }
  82. // Sets the time for a one time patch deployment. Timestamp is in
  83. // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  84. message OneTimeSchedule {
  85. // Required. The desired patch job execution time.
  86. google.protobuf.Timestamp execute_time = 1
  87. [(google.api.field_behavior) = REQUIRED];
  88. }
  89. // Sets the time for recurring patch deployments.
  90. message RecurringSchedule {
  91. // Specifies the frequency of the recurring patch deployments.
  92. enum Frequency {
  93. // Invalid. A frequency must be specified.
  94. FREQUENCY_UNSPECIFIED = 0;
  95. // Indicates that the frequency should be expressed in terms of
  96. // weeks.
  97. WEEKLY = 1;
  98. // Indicates that the frequency should be expressed in terms of
  99. // months.
  100. MONTHLY = 2;
  101. }
  102. // Required. Defines the time zone that `time_of_day` is relative to.
  103. // The rules for daylight saving time are determined by the chosen time zone.
  104. google.type.TimeZone time_zone = 1 [(google.api.field_behavior) = REQUIRED];
  105. // Optional. The time that the recurring schedule becomes effective.
  106. // Defaults to `create_time` of the patch deployment.
  107. google.protobuf.Timestamp start_time = 2
  108. [(google.api.field_behavior) = OPTIONAL];
  109. // Optional. The end time at which a recurring patch deployment schedule is no
  110. // longer active.
  111. google.protobuf.Timestamp end_time = 3
  112. [(google.api.field_behavior) = OPTIONAL];
  113. // Required. Time of the day to run a recurring deployment.
  114. google.type.TimeOfDay time_of_day = 4
  115. [(google.api.field_behavior) = REQUIRED];
  116. // Required. The frequency unit of this recurring schedule.
  117. Frequency frequency = 5 [(google.api.field_behavior) = REQUIRED];
  118. // Configurations for this recurring schedule.
  119. // Configurations must match frequency.
  120. oneof schedule_config {
  121. // Required. Schedule with weekly executions.
  122. WeeklySchedule weekly = 6 [(google.api.field_behavior) = REQUIRED];
  123. // Required. Schedule with monthly executions.
  124. MonthlySchedule monthly = 7 [(google.api.field_behavior) = REQUIRED];
  125. }
  126. // Output only. The time the last patch job ran successfully.
  127. google.protobuf.Timestamp last_execute_time = 9
  128. [(google.api.field_behavior) = OUTPUT_ONLY];
  129. // Output only. The time the next patch job is scheduled to run.
  130. google.protobuf.Timestamp next_execute_time = 10
  131. [(google.api.field_behavior) = OUTPUT_ONLY];
  132. }
  133. // Represents a weekly schedule.
  134. message WeeklySchedule {
  135. // Required. Day of the week.
  136. google.type.DayOfWeek day_of_week = 1
  137. [(google.api.field_behavior) = REQUIRED];
  138. }
  139. // Represents a monthly schedule. An example of a valid monthly schedule is
  140. // "on the third Tuesday of the month" or "on the 15th of the month".
  141. message MonthlySchedule {
  142. // One day in a month.
  143. oneof day_of_month {
  144. // Required. Week day in a month.
  145. WeekDayOfMonth week_day_of_month = 1
  146. [(google.api.field_behavior) = REQUIRED];
  147. // Required. One day of the month. 1-31 indicates the 1st to the 31st day.
  148. // -1 indicates the last day of the month. Months without the target day
  149. // will be skipped. For example, a schedule to run "every month on the 31st"
  150. // will not run in February, April, June, etc.
  151. int32 month_day = 2 [(google.api.field_behavior) = REQUIRED];
  152. }
  153. }
  154. // Represents one week day in a month. An example is "the 4th Sunday".
  155. message WeekDayOfMonth {
  156. // Required. Week number in a month. 1-4 indicates the 1st to 4th week of the
  157. // month. -1 indicates the last week of the month.
  158. int32 week_ordinal = 1 [(google.api.field_behavior) = REQUIRED];
  159. // Required. A day of the week.
  160. google.type.DayOfWeek day_of_week = 2
  161. [(google.api.field_behavior) = REQUIRED];
  162. }
  163. // A request message for creating a patch deployment.
  164. message CreatePatchDeploymentRequest {
  165. // Required. The project to apply this patch deployment to in the form
  166. // `projects/*`.
  167. string parent = 1 [
  168. (google.api.field_behavior) = REQUIRED,
  169. (google.api.resource_reference) = {
  170. type: "cloudresourcemanager.googleapis.com/Project"
  171. }
  172. ];
  173. // Required. A name for the patch deployment in the project. When creating a
  174. // name the following rules apply:
  175. // * Must contain only lowercase letters, numbers, and hyphens.
  176. // * Must start with a letter.
  177. // * Must be between 1-63 characters.
  178. // * Must end with a number or a letter.
  179. // * Must be unique within the project.
  180. string patch_deployment_id = 2 [(google.api.field_behavior) = REQUIRED];
  181. // Required. The patch deployment to create.
  182. PatchDeployment patch_deployment = 3 [(google.api.field_behavior) = REQUIRED];
  183. }
  184. // A request message for retrieving a patch deployment.
  185. message GetPatchDeploymentRequest {
  186. // Required. The resource name of the patch deployment in the form
  187. // `projects/*/patchDeployments/*`.
  188. string name = 1 [
  189. (google.api.field_behavior) = REQUIRED,
  190. (google.api.resource_reference) = {
  191. type: "osconfig.googleapis.com/PatchDeployment"
  192. }
  193. ];
  194. }
  195. // A request message for listing patch deployments.
  196. message ListPatchDeploymentsRequest {
  197. // Required. The resource name of the parent in the form `projects/*`.
  198. string parent = 1 [
  199. (google.api.field_behavior) = REQUIRED,
  200. (google.api.resource_reference) = {
  201. type: "cloudresourcemanager.googleapis.com/Project"
  202. }
  203. ];
  204. // Optional. The maximum number of patch deployments to return. Default is
  205. // 100.
  206. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  207. // Optional. A pagination token returned from a previous call to
  208. // ListPatchDeployments that indicates where this listing should continue
  209. // from.
  210. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  211. }
  212. // A response message for listing patch deployments.
  213. message ListPatchDeploymentsResponse {
  214. // The list of patch deployments.
  215. repeated PatchDeployment patch_deployments = 1;
  216. // A pagination token that can be used to get the next page of patch
  217. // deployments.
  218. string next_page_token = 2;
  219. }
  220. // A request message for deleting a patch deployment.
  221. message DeletePatchDeploymentRequest {
  222. // Required. The resource name of the patch deployment in the form
  223. // `projects/*/patchDeployments/*`.
  224. string name = 1 [
  225. (google.api.field_behavior) = REQUIRED,
  226. (google.api.resource_reference) = {
  227. type: "osconfig.googleapis.com/PatchDeployment"
  228. }
  229. ];
  230. }