patch_deployments.proto 13 KB

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