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