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