1// Copyright 2023 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.redis.cluster.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/longrunning/operations.proto"; 24import "google/protobuf/any.proto"; 25import "google/protobuf/empty.proto"; 26import "google/protobuf/field_mask.proto"; 27import "google/protobuf/timestamp.proto"; 28 29option go_package = "cloud.google.com/go/redis/cluster/apiv1/clusterpb;clusterpb"; 30option java_multiple_files = true; 31option java_outer_classname = "CloudRedisClusterProto"; 32option java_package = "com.google.cloud.redis.cluster.v1"; 33option ruby_package = "Google::Cloud::Redis::Cluster::V1"; 34 35// Configures and manages Cloud Memorystore for Redis clusters 36// 37// Google Cloud Memorystore for Redis Cluster 38// 39// The `redis.googleapis.com` service implements the Google Cloud Memorystore 40// for Redis API and defines the following resource model for managing Redis 41// clusters: 42// * The service works with a collection of cloud projects, named: `/projects/*` 43// * Each project has a collection of available locations, named: `/locations/*` 44// * Each location has a collection of Redis clusters, named: `/clusters/*` 45// * As such, Redis clusters are resources of the form: 46// `/projects/{project_id}/locations/{location_id}/clusters/{instance_id}` 47// 48// Note that location_id must be a GCP `region`; for example: 49// * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` 50// 51// We use API version selector for Flex APIs 52// * The versioning strategy is release-based versioning 53// * Our backend CLH only deals with the superset version (called v1main) 54// * Existing backend for Redis Gen1 and MRR is not touched. 55// * More details in go/redis-flex-api-versioning 56service CloudRedisCluster { 57 option (google.api.default_host) = "redis.googleapis.com"; 58 option (google.api.oauth_scopes) = 59 "https://www.googleapis.com/auth/cloud-platform"; 60 61 // Lists all Redis clusters owned by a project in either the specified 62 // location (region) or all locations. 63 // 64 // The location should have the following format: 65 // 66 // * `projects/{project_id}/locations/{location_id}` 67 // 68 // If `location_id` is specified as `-` (wildcard), then all regions 69 // available to the project are queried, and the results are aggregated. 70 rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) { 71 option (google.api.http) = { 72 get: "/v1/{parent=projects/*/locations/*}/clusters" 73 }; 74 option (google.api.method_signature) = "parent"; 75 } 76 77 // Gets the details of a specific Redis cluster. 78 rpc GetCluster(GetClusterRequest) returns (Cluster) { 79 option (google.api.http) = { 80 get: "/v1/{name=projects/*/locations/*/clusters/*}" 81 }; 82 option (google.api.method_signature) = "name"; 83 } 84 85 // Updates the metadata and configuration of a specific Redis cluster. 86 // 87 // Completed longrunning.Operation will contain the new cluster object 88 // in the response field. The returned operation is automatically deleted 89 // after a few hours, so there is no need to call DeleteOperation. 90 rpc UpdateCluster(UpdateClusterRequest) 91 returns (google.longrunning.Operation) { 92 option (google.api.http) = { 93 patch: "/v1/{cluster.name=projects/*/locations/*/clusters/*}" 94 body: "cluster" 95 }; 96 option (google.api.method_signature) = "cluster,update_mask"; 97 option (google.longrunning.operation_info) = { 98 response_type: "Cluster" 99 metadata_type: "google.protobuf.Any" 100 }; 101 } 102 103 // Deletes a specific Redis cluster. Cluster stops serving and data is 104 // deleted. 105 rpc DeleteCluster(DeleteClusterRequest) 106 returns (google.longrunning.Operation) { 107 option (google.api.http) = { 108 delete: "/v1/{name=projects/*/locations/*/clusters/*}" 109 }; 110 option (google.api.method_signature) = "name"; 111 option (google.longrunning.operation_info) = { 112 response_type: "google.protobuf.Empty" 113 metadata_type: "google.protobuf.Any" 114 }; 115 } 116 117 // Creates a Redis cluster based on the specified properties. 118 // The creation is executed asynchronously and callers may check the returned 119 // operation to track its progress. Once the operation is completed the Redis 120 // cluster will be fully functional. The completed longrunning.Operation will 121 // contain the new cluster object in the response field. 122 // 123 // The returned operation is automatically deleted after a few hours, so there 124 // is no need to call DeleteOperation. 125 rpc CreateCluster(CreateClusterRequest) 126 returns (google.longrunning.Operation) { 127 option (google.api.http) = { 128 post: "/v1/{parent=projects/*/locations/*}/clusters" 129 body: "cluster" 130 }; 131 option (google.api.method_signature) = "parent,cluster,cluster_id"; 132 option (google.longrunning.operation_info) = { 133 response_type: "Cluster" 134 metadata_type: "google.protobuf.Any" 135 }; 136 } 137} 138 139// Available authorization mode of a Redis cluster. 140enum AuthorizationMode { 141 // Not set. 142 AUTH_MODE_UNSPECIFIED = 0; 143 144 // IAM basic authorization mode 145 AUTH_MODE_IAM_AUTH = 1; 146 147 // Authorization disabled mode 148 AUTH_MODE_DISABLED = 2; 149} 150 151// Available mode of in-transit encryption. 152enum TransitEncryptionMode { 153 // In-transit encryption not set. 154 TRANSIT_ENCRYPTION_MODE_UNSPECIFIED = 0; 155 156 // In-transit encryption disabled. 157 TRANSIT_ENCRYPTION_MODE_DISABLED = 1; 158 159 // Use server managed encryption for in-transit encryption. 160 TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION = 2; 161} 162 163// Request for [CreateCluster][CloudRedis.CreateCluster]. 164message CreateClusterRequest { 165 // Required. The resource name of the cluster location using the form: 166 // `projects/{project_id}/locations/{location_id}` 167 // where `location_id` refers to a GCP region. 168 string parent = 1 [ 169 (google.api.field_behavior) = REQUIRED, 170 (google.api.resource_reference) = { 171 type: "locations.googleapis.com/Location" 172 } 173 ]; 174 175 // Required. The logical name of the Redis cluster in the customer project 176 // with the following restrictions: 177 // 178 // * Must contain only lowercase letters, numbers, and hyphens. 179 // * Must start with a letter. 180 // * Must be between 1-63 characters. 181 // * Must end with a number or a letter. 182 // * Must be unique within the customer project / location 183 string cluster_id = 2 [(google.api.field_behavior) = REQUIRED]; 184 185 // Required. The cluster that is to be created. 186 Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED]; 187 188 // Idempotent request UUID. 189 string request_id = 4; 190} 191 192// Request for [ListClusters][CloudRedis.ListClusters]. 193message ListClustersRequest { 194 // Required. The resource name of the cluster location using the form: 195 // `projects/{project_id}/locations/{location_id}` 196 // where `location_id` refers to a GCP region. 197 string parent = 1 [ 198 (google.api.field_behavior) = REQUIRED, 199 (google.api.resource_reference) = { 200 type: "locations.googleapis.com/Location" 201 } 202 ]; 203 204 // The maximum number of items to return. 205 // 206 // If not specified, a default value of 1000 will be used by the service. 207 // Regardless of the page_size value, the response may include a partial list 208 // and a caller should only rely on response's 209 // [`next_page_token`][google.cloud.redis.cluster.v1.ListClustersResponse.next_page_token] 210 // to determine if there are more clusters left to be queried. 211 int32 page_size = 2; 212 213 // The `next_page_token` value returned from a previous 214 // [ListClusters][CloudRedis.ListClusters] request, if any. 215 string page_token = 3; 216} 217 218// Response for [ListClusters][CloudRedis.ListClusters]. 219message ListClustersResponse { 220 // A list of Redis clusters in the project in the specified location, 221 // or across all locations. 222 // 223 // If the `location_id` in the parent field of the request is "-", all regions 224 // available to the project are queried, and the results aggregated. 225 // If in such an aggregated query a location is unavailable, a placeholder 226 // Redis entry is included in the response with the `name` field set to a 227 // value of the form 228 // `projects/{project_id}/locations/{location_id}/clusters/`- and the 229 // `status` field set to ERROR and `status_message` field set to "location not 230 // available for ListClusters". 231 repeated Cluster clusters = 1; 232 233 // Token to retrieve the next page of results, or empty if there are no more 234 // results in the list. 235 string next_page_token = 2; 236 237 // Locations that could not be reached. 238 repeated string unreachable = 3; 239} 240 241// Request for [UpdateCluster][CloudRedis.UpdateCluster]. 242message UpdateClusterRequest { 243 // Required. Mask of fields to update. At least one path must be supplied in 244 // this field. The elements of the repeated paths field may only include these 245 // fields from [Cluster][google.cloud.redis.cluster.v1.Cluster]: 246 // 247 // * `size_gb` 248 // * `replica_count` 249 google.protobuf.FieldMask update_mask = 1 250 [(google.api.field_behavior) = REQUIRED]; 251 252 // Required. Update description. 253 // Only fields specified in update_mask are updated. 254 Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED]; 255 256 // Idempotent request UUID. 257 string request_id = 3; 258} 259 260// Request for [GetCluster][CloudRedis.GetCluster]. 261message GetClusterRequest { 262 // Required. Redis cluster resource name using the form: 263 // `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` 264 // where `location_id` refers to a GCP region. 265 string name = 1 [ 266 (google.api.field_behavior) = REQUIRED, 267 (google.api.resource_reference) = { type: "redis.googleapis.com/Cluster" } 268 ]; 269} 270 271// Request for [DeleteCluster][CloudRedis.DeleteCluster]. 272message DeleteClusterRequest { 273 // Required. Redis cluster resource name using the form: 274 // `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` 275 // where `location_id` refers to a GCP region. 276 string name = 1 [ 277 (google.api.field_behavior) = REQUIRED, 278 (google.api.resource_reference) = { type: "redis.googleapis.com/Cluster" } 279 ]; 280 281 // Idempotent request UUID. 282 string request_id = 2; 283} 284 285// A cluster instance. 286message Cluster { 287 option (google.api.resource) = { 288 type: "redis.googleapis.com/Cluster" 289 pattern: "projects/{project}/locations/{location}/clusters/{cluster}" 290 }; 291 292 // Represents additional information about the state of the cluster. 293 message StateInfo { 294 // Represents information about an updating cluster. 295 message UpdateInfo { 296 // Target number of shards for redis cluster 297 optional int32 target_shard_count = 1; 298 299 // Target number of replica nodes per shard. 300 optional int32 target_replica_count = 2; 301 } 302 303 oneof info { 304 // Describes ongoing update on the cluster when cluster state is UPDATING. 305 UpdateInfo update_info = 1; 306 } 307 } 308 309 // Represents the different states of a Redis cluster. 310 enum State { 311 // Not set. 312 STATE_UNSPECIFIED = 0; 313 314 // Redis cluster is being created. 315 CREATING = 1; 316 317 // Redis cluster has been created and is fully usable. 318 ACTIVE = 2; 319 320 // Redis cluster configuration is being updated. 321 UPDATING = 3; 322 323 // Redis cluster is being deleted. 324 DELETING = 4; 325 } 326 327 // Required. Unique name of the resource in this scope including project and 328 // location using the form: 329 // `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` 330 string name = 1 [(google.api.field_behavior) = REQUIRED]; 331 332 // Output only. The timestamp associated with the cluster creation request. 333 google.protobuf.Timestamp create_time = 3 334 [(google.api.field_behavior) = OUTPUT_ONLY]; 335 336 // Output only. The current state of this cluster. 337 // Can be CREATING, READY, UPDATING, DELETING and SUSPENDED 338 State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 339 340 // Output only. System assigned, unique identifier for the cluster. 341 string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 342 343 // Optional. The number of replica nodes per shard. 344 optional int32 replica_count = 8 [(google.api.field_behavior) = OPTIONAL]; 345 346 // Optional. The authorization mode of the Redis cluster. 347 // If not provided, auth feature is disabled for the cluster. 348 AuthorizationMode authorization_mode = 11 349 [(google.api.field_behavior) = OPTIONAL]; 350 351 // Optional. The in-transit encryption for the Redis cluster. 352 // If not provided, encryption is disabled for the cluster. 353 TransitEncryptionMode transit_encryption_mode = 12 354 [(google.api.field_behavior) = OPTIONAL]; 355 356 // Output only. Redis memory size in GB for the entire cluster. 357 optional int32 size_gb = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; 358 359 // Required. Number of shards for the Redis cluster. 360 optional int32 shard_count = 14 [(google.api.field_behavior) = REQUIRED]; 361 362 // Required. Each PscConfig configures the consumer network where IPs will 363 // be designated to the cluster for client access through Private Service 364 // Connect Automation. Currently, only one PscConfig is supported. 365 repeated PscConfig psc_configs = 15 [(google.api.field_behavior) = REQUIRED]; 366 367 // Output only. Endpoints created on each given network, for Redis clients to 368 // connect to the cluster. Currently only one discovery endpoint is supported. 369 repeated DiscoveryEndpoint discovery_endpoints = 16 370 [(google.api.field_behavior) = OUTPUT_ONLY]; 371 372 // Output only. PSC connections for discovery of the cluster topology and 373 // accessing the cluster. 374 repeated PscConnection psc_connections = 17 375 [(google.api.field_behavior) = OUTPUT_ONLY]; 376 377 // Output only. Additional information about the current state of the cluster. 378 StateInfo state_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; 379} 380 381message PscConfig { 382 // Required. The network where the IP address of the discovery endpoint will 383 // be reserved, in the form of 384 // projects/{network_project}/global/networks/{network_id}. 385 string network = 2 [(google.api.field_behavior) = REQUIRED]; 386} 387 388// Endpoints on each network, for Redis clients to connect to the cluster. 389message DiscoveryEndpoint { 390 // Output only. Address of the exposed Redis endpoint used by clients to 391 // connect to the service. The address could be either IP or hostname. 392 string address = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 393 394 // Output only. The port number of the exposed Redis endpoint. 395 int32 port = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 396 397 // Output only. Customer configuration for where the endpoint is created and 398 // accessed from. 399 PscConfig psc_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 400} 401 402// Details of consumer resources in a PSC connection. 403message PscConnection { 404 // Output only. The PSC connection id of the forwarding rule connected to the 405 // service attachment. 406 string psc_connection_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 407 408 // Output only. The IP allocated on the consumer network for the PSC 409 // forwarding rule. 410 string address = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 411 412 // Output only. The URI of the consumer side forwarding rule. 413 // Example: 414 // projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}. 415 string forwarding_rule = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 416 417 // Output only. The consumer project_id where the forwarding rule is created 418 // from. 419 string project_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 420 421 // The consumer network where the IP address resides, in the form of 422 // projects/{project_id}/global/networks/{network_id}. 423 string network = 5; 424} 425 426// Pre-defined metadata fields. 427message OperationMetadata { 428 // Output only. The time the operation was created. 429 google.protobuf.Timestamp create_time = 1 430 [(google.api.field_behavior) = OUTPUT_ONLY]; 431 432 // Output only. The time the operation finished running. 433 google.protobuf.Timestamp end_time = 2 434 [(google.api.field_behavior) = OUTPUT_ONLY]; 435 436 // Output only. Server-defined resource path for the target of the operation. 437 string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 438 439 // Output only. Name of the verb executed by the operation. 440 string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 441 442 // Output only. Human-readable status of the operation, if any. 443 string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 444 445 // Output only. Identifies whether the user has requested cancellation 446 // of the operation. Operations that have successfully been cancelled 447 // have [Operation.error][] value with a 448 // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to 449 // `Code.CANCELLED`. 450 bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; 451 452 // Output only. API version used to start the operation. 453 string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 454} 455