Skip to content

Commit

Permalink
feat: [Cloud Memorystore for Redis] Support Maintenance Window
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 434820669
  • Loading branch information
Google APIs authored and Copybara-Service committed Mar 15, 2022
1 parent ff9e994 commit db9aa74
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/cloud/redis/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ proto_library(
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/longrunning:operations_proto",
"//google/type:dayofweek_proto",
"//google/type:timeofday_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
Expand Down Expand Up @@ -118,6 +121,8 @@ go_proto_library(
deps = [
"//google/api:annotations_go_proto",
"//google/longrunning:longrunning_go_proto",
"//google/type:dayofweek_go_proto",
"//google/type:timeofday_go_proto",
],
)

Expand All @@ -133,6 +138,7 @@ go_gapic_library(
"//google/longrunning:longrunning_go_proto",
"@com_google_cloud_go//longrunning:go_default_library",
"@com_google_cloud_go//longrunning/autogen:go_default_library",
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
],
)

Expand Down
116 changes: 116 additions & 0 deletions google/cloud/redis/v1/cloud_redis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/type/dayofweek.proto";
import "google/type/timeofday.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/redis/v1;redis";
option java_multiple_files = true;
Expand Down Expand Up @@ -201,6 +204,20 @@ service CloudRedis {
metadata_type: "google.cloud.redis.v1.OperationMetadata"
};
}

// Reschedule maintenance for a given instance in a given project and
// location.
rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/*/instances/*}:rescheduleMaintenance"
body: "*"
};
option (google.api.method_signature) = "name, reschedule_type, schedule_time";
option (google.longrunning.operation_info) = {
response_type: "google.cloud.redis.v1.Instance"
metadata_type: "google.cloud.redis.v1.OperationMetadata"
};
}
}

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

// Optional. The number of replica nodes. The valid range for the Standard Tier with
// read replicas enabled is [1-5] and defaults to 2. If read replicas are not
// enabled for a Standard Tier instance, the only valid value is 1 and the
// default is 1. The valid value for basic tier is 0 and the default is also
// 0.

// Optional. The maintenance policy for the instance. If not provided,
// maintenance events can be performed at any time.
MaintenancePolicy maintenance_policy = 27 [(google.api.field_behavior) = OPTIONAL];

// Output only. Date and time of upcoming maintenance events which have been
// scheduled.
MaintenanceSchedule maintenance_schedule = 28 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. The number of replica nodes. The valid range for the Standard Tier with
// read replicas enabled is [1-5] and defaults to 2. If read replicas are not
// enabled for a Standard Tier instance, the only valid value is 1 and the
Expand All @@ -465,6 +496,91 @@ message Instance {
ReadReplicasMode read_replicas_mode = 35 [(google.api.field_behavior) = OPTIONAL];
}

// Request for [RescheduleMaintenance][google.cloud.redis.v1.CloudRedis.RescheduleMaintenance].
message RescheduleMaintenanceRequest {
// Reschedule options.
enum RescheduleType {
// Not set.
RESCHEDULE_TYPE_UNSPECIFIED = 0;

// If the user wants to schedule the maintenance to happen now.
IMMEDIATE = 1;

// If the user wants to use the existing maintenance policy to find the
// next available window.
NEXT_AVAILABLE_WINDOW = 2;

// If the user wants to reschedule the maintenance to a specific time.
SPECIFIC_TIME = 3;
}

// Required. Redis instance resource name using the form:
// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
// where `location_id` refers to a GCP region.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "redis.googleapis.com/Instance"
}
];

// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. Timestamp when the maintenance shall be rescheduled to if
// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
// example `2012-11-15T16:19:00.094Z`.
google.protobuf.Timestamp schedule_time = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Maintenance policy for an instance.
message MaintenancePolicy {
// Output only. The time when the policy was created.
google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The time when the policy was last updated.
google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. Description of what this policy is for. Create/Update methods
// return INVALID_ARGUMENT if the length is greater than 512.
string description = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. Maintenance window that is applied to resources covered by this
// policy. Minimum 1. For the current version, the maximum number of
// weekly_window is expected to be one.
repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Time window in which disruptive maintenance updates occur. Non-disruptive
// updates can occur inside or outside this window.
message WeeklyMaintenanceWindow {
// Required. The day of week that maintenance updates occur.
google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Start time of the window in UTC time.
google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED];

// Output only. Duration of the maintenance window. The current window is fixed at 1 hour.
google.protobuf.Duration duration = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Upcoming maintenance schedule. If no maintenance is scheduled, fields are not
// populated.
message MaintenanceSchedule {
// Output only. The start time of any upcoming scheduled maintenance for this instance.
google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The end time of any upcoming scheduled maintenance for this instance.
google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// If the scheduled maintenance can be rescheduled, default is true.
bool can_reschedule = 3 [deprecated = true];

// Output only. The deadline that the maintenance schedule start time can not go beyond,
// including reschedule.
google.protobuf.Timestamp schedule_deadline_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
message ListInstancesRequest {
// Required. The resource name of the instance location using the form:
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/redis/v1/redis_grpc_service_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"service": "google.cloud.redis.v1.CloudRedis",
"method": "GetInstanceAuthString"
},
{
"service": "google.cloud.redis.v1.CloudRedis",
"method": "RescheduleMaintenance"
},
{
"service": "google.cloud.redis.v1.CloudRedis",
"method": "CreateInstance"
Expand Down

0 comments on commit db9aa74

Please sign in to comment.