Skip to content

Commit db9aa74

Browse files
Google APIscopybara-github
authored andcommitted
feat: [Cloud Memorystore for Redis] Support Maintenance Window
PiperOrigin-RevId: 434820669
1 parent ff9e994 commit db9aa74

3 files changed

Lines changed: 126 additions & 0 deletions

File tree

google/cloud/redis/v1/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ proto_library(
2929
"//google/api:field_behavior_proto",
3030
"//google/api:resource_proto",
3131
"//google/longrunning:operations_proto",
32+
"//google/type:dayofweek_proto",
33+
"//google/type:timeofday_proto",
34+
"@com_google_protobuf//:duration_proto",
3235
"@com_google_protobuf//:field_mask_proto",
3336
"@com_google_protobuf//:timestamp_proto",
3437
],
@@ -118,6 +121,8 @@ go_proto_library(
118121
deps = [
119122
"//google/api:annotations_go_proto",
120123
"//google/longrunning:longrunning_go_proto",
124+
"//google/type:dayofweek_go_proto",
125+
"//google/type:timeofday_go_proto",
121126
],
122127
)
123128

@@ -133,6 +138,7 @@ go_gapic_library(
133138
"//google/longrunning:longrunning_go_proto",
134139
"@com_google_cloud_go//longrunning:go_default_library",
135140
"@com_google_cloud_go//longrunning/autogen:go_default_library",
141+
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
136142
],
137143
)
138144

google/cloud/redis/v1/cloud_redis.proto

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
2323
import "google/longrunning/operations.proto";
24+
import "google/protobuf/duration.proto";
2425
import "google/protobuf/field_mask.proto";
2526
import "google/protobuf/timestamp.proto";
27+
import "google/type/dayofweek.proto";
28+
import "google/type/timeofday.proto";
2629

2730
option go_package = "google.golang.org/genproto/googleapis/cloud/redis/v1;redis";
2831
option java_multiple_files = true;
@@ -201,6 +204,20 @@ service CloudRedis {
201204
metadata_type: "google.cloud.redis.v1.OperationMetadata"
202205
};
203206
}
207+
208+
// Reschedule maintenance for a given instance in a given project and
209+
// location.
210+
rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) {
211+
option (google.api.http) = {
212+
post: "/v1/{name=projects/*/locations/*/instances/*}:rescheduleMaintenance"
213+
body: "*"
214+
};
215+
option (google.api.method_signature) = "name, reschedule_type, schedule_time";
216+
option (google.longrunning.operation_info) = {
217+
response_type: "google.cloud.redis.v1.Instance"
218+
metadata_type: "google.cloud.redis.v1.OperationMetadata"
219+
};
220+
}
204221
}
205222

206223
// Node specific properties.
@@ -441,6 +458,20 @@ message Instance {
441458
// If not provided, TLS is disabled for the instance.
442459
TransitEncryptionMode transit_encryption_mode = 26 [(google.api.field_behavior) = OPTIONAL];
443460

461+
// Optional. The number of replica nodes. The valid range for the Standard Tier with
462+
// read replicas enabled is [1-5] and defaults to 2. If read replicas are not
463+
// enabled for a Standard Tier instance, the only valid value is 1 and the
464+
// default is 1. The valid value for basic tier is 0 and the default is also
465+
// 0.
466+
467+
// Optional. The maintenance policy for the instance. If not provided,
468+
// maintenance events can be performed at any time.
469+
MaintenancePolicy maintenance_policy = 27 [(google.api.field_behavior) = OPTIONAL];
470+
471+
// Output only. Date and time of upcoming maintenance events which have been
472+
// scheduled.
473+
MaintenanceSchedule maintenance_schedule = 28 [(google.api.field_behavior) = OUTPUT_ONLY];
474+
444475
// Optional. The number of replica nodes. The valid range for the Standard Tier with
445476
// read replicas enabled is [1-5] and defaults to 2. If read replicas are not
446477
// enabled for a Standard Tier instance, the only valid value is 1 and the
@@ -465,6 +496,91 @@ message Instance {
465496
ReadReplicasMode read_replicas_mode = 35 [(google.api.field_behavior) = OPTIONAL];
466497
}
467498

499+
// Request for [RescheduleMaintenance][google.cloud.redis.v1.CloudRedis.RescheduleMaintenance].
500+
message RescheduleMaintenanceRequest {
501+
// Reschedule options.
502+
enum RescheduleType {
503+
// Not set.
504+
RESCHEDULE_TYPE_UNSPECIFIED = 0;
505+
506+
// If the user wants to schedule the maintenance to happen now.
507+
IMMEDIATE = 1;
508+
509+
// If the user wants to use the existing maintenance policy to find the
510+
// next available window.
511+
NEXT_AVAILABLE_WINDOW = 2;
512+
513+
// If the user wants to reschedule the maintenance to a specific time.
514+
SPECIFIC_TIME = 3;
515+
}
516+
517+
// Required. Redis instance resource name using the form:
518+
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
519+
// where `location_id` refers to a GCP region.
520+
string name = 1 [
521+
(google.api.field_behavior) = REQUIRED,
522+
(google.api.resource_reference) = {
523+
type: "redis.googleapis.com/Instance"
524+
}
525+
];
526+
527+
// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
528+
RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED];
529+
530+
// Optional. Timestamp when the maintenance shall be rescheduled to if
531+
// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
532+
// example `2012-11-15T16:19:00.094Z`.
533+
google.protobuf.Timestamp schedule_time = 3 [(google.api.field_behavior) = OPTIONAL];
534+
}
535+
536+
// Maintenance policy for an instance.
537+
message MaintenancePolicy {
538+
// Output only. The time when the policy was created.
539+
google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
540+
541+
// Output only. The time when the policy was last updated.
542+
google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
543+
544+
// Optional. Description of what this policy is for. Create/Update methods
545+
// return INVALID_ARGUMENT if the length is greater than 512.
546+
string description = 3 [(google.api.field_behavior) = OPTIONAL];
547+
548+
// Optional. Maintenance window that is applied to resources covered by this
549+
// policy. Minimum 1. For the current version, the maximum number of
550+
// weekly_window is expected to be one.
551+
repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = OPTIONAL];
552+
}
553+
554+
// Time window in which disruptive maintenance updates occur. Non-disruptive
555+
// updates can occur inside or outside this window.
556+
message WeeklyMaintenanceWindow {
557+
// Required. The day of week that maintenance updates occur.
558+
google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED];
559+
560+
// Required. Start time of the window in UTC time.
561+
google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED];
562+
563+
// Output only. Duration of the maintenance window. The current window is fixed at 1 hour.
564+
google.protobuf.Duration duration = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
565+
}
566+
567+
// Upcoming maintenance schedule. If no maintenance is scheduled, fields are not
568+
// populated.
569+
message MaintenanceSchedule {
570+
// Output only. The start time of any upcoming scheduled maintenance for this instance.
571+
google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
572+
573+
// Output only. The end time of any upcoming scheduled maintenance for this instance.
574+
google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
575+
576+
// If the scheduled maintenance can be rescheduled, default is true.
577+
bool can_reschedule = 3 [deprecated = true];
578+
579+
// Output only. The deadline that the maintenance schedule start time can not go beyond,
580+
// including reschedule.
581+
google.protobuf.Timestamp schedule_deadline_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
582+
}
583+
468584
// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
469585
message ListInstancesRequest {
470586
// Required. The resource name of the instance location using the form:

google/cloud/redis/v1/redis_grpc_service_config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"service": "google.cloud.redis.v1.CloudRedis",
1515
"method": "GetInstanceAuthString"
1616
},
17+
{
18+
"service": "google.cloud.redis.v1.CloudRedis",
19+
"method": "RescheduleMaintenance"
20+
},
1721
{
1822
"service": "google.cloud.redis.v1.CloudRedis",
1923
"method": "CreateInstance"

0 commit comments

Comments
 (0)