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.memcache.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/duration.proto";
25import "google/protobuf/field_mask.proto";
26import "google/protobuf/timestamp.proto";
27import "google/type/dayofweek.proto";
28import "google/type/timeofday.proto";
29
30option go_package = "cloud.google.com/go/memcache/apiv1/memcachepb;memcachepb";
31option java_multiple_files = true;
32option java_outer_classname = "CloudMemcacheProto";
33option java_package = "com.google.cloud.memcache.v1";
34
35// Configures and manages Cloud Memorystore for Memcached instances.
36//
37//
38// The `memcache.googleapis.com` service implements the Google Cloud Memorystore
39// for Memcached API and defines the following resource model for managing
40// Memorystore Memcached (also called Memcached below) instances:
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 Memcached instances, named:
44// `/instances/*`
45// * As such, Memcached instances are resources of the form:
46//   `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
47//
48// Note that location_id must be a GCP `region`; for example:
49// * `projects/my-memcached-project/locations/us-central1/instances/my-memcached`
50service CloudMemcache {
51  option (google.api.default_host) = "memcache.googleapis.com";
52  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
53
54  // Lists Instances in a given location.
55  rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
56    option (google.api.http) = {
57      get: "/v1/{parent=projects/*/locations/*}/instances"
58    };
59    option (google.api.method_signature) = "parent";
60  }
61
62  // Gets details of a single Instance.
63  rpc GetInstance(GetInstanceRequest) returns (Instance) {
64    option (google.api.http) = {
65      get: "/v1/{name=projects/*/locations/*/instances/*}"
66    };
67    option (google.api.method_signature) = "name";
68  }
69
70  // Creates a new Instance in a given location.
71  rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) {
72    option (google.api.http) = {
73      post: "/v1/{parent=projects/*/locations/*}/instances"
74      body: "instance"
75    };
76    option (google.api.method_signature) = "parent,instance,instance_id";
77    option (google.longrunning.operation_info) = {
78      response_type: "google.cloud.memcache.v1.Instance"
79      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
80    };
81  }
82
83  // Updates an existing Instance in a given project and location.
84  rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) {
85    option (google.api.http) = {
86      patch: "/v1/{instance.name=projects/*/locations/*/instances/*}"
87      body: "instance"
88    };
89    option (google.api.method_signature) = "instance,update_mask";
90    option (google.longrunning.operation_info) = {
91      response_type: "google.cloud.memcache.v1.Instance"
92      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
93    };
94  }
95
96  // Updates the defined Memcached parameters for an existing instance.
97  // This method only stages the parameters, it must be followed by
98  // `ApplyParameters` to apply the parameters to nodes of the Memcached
99  // instance.
100  rpc UpdateParameters(UpdateParametersRequest) returns (google.longrunning.Operation) {
101    option (google.api.http) = {
102      patch: "/v1/{name=projects/*/locations/*/instances/*}:updateParameters"
103      body: "*"
104    };
105    option (google.api.method_signature) = "name,update_mask,parameters";
106    option (google.longrunning.operation_info) = {
107      response_type: "google.cloud.memcache.v1.Instance"
108      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
109    };
110  }
111
112  // Deletes a single Instance.
113  rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) {
114    option (google.api.http) = {
115      delete: "/v1/{name=projects/*/locations/*/instances/*}"
116    };
117    option (google.api.method_signature) = "name";
118    option (google.longrunning.operation_info) = {
119      response_type: "google.protobuf.Empty"
120      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
121    };
122  }
123
124  // `ApplyParameters` restarts the set of specified nodes in order to update
125  // them to the current set of parameters for the Memcached Instance.
126  rpc ApplyParameters(ApplyParametersRequest) returns (google.longrunning.Operation) {
127    option (google.api.http) = {
128      post: "/v1/{name=projects/*/locations/*/instances/*}:applyParameters"
129      body: "*"
130    };
131    option (google.api.method_signature) = "name,node_ids,apply_all";
132    option (google.longrunning.operation_info) = {
133      response_type: "google.cloud.memcache.v1.Instance"
134      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
135    };
136  }
137
138  // Reschedules upcoming maintenance event.
139  rpc RescheduleMaintenance(RescheduleMaintenanceRequest) returns (google.longrunning.Operation) {
140    option (google.api.http) = {
141      post: "/v1/{instance=projects/*/locations/*/instances/*}:rescheduleMaintenance"
142      body: "*"
143    };
144    option (google.api.method_signature) = "instance, reschedule_type, schedule_time";
145    option (google.longrunning.operation_info) = {
146      response_type: "google.cloud.memcache.v1.Instance"
147      metadata_type: "google.cloud.memcache.v1.OperationMetadata"
148    };
149  }
150}
151
152// A Memorystore for Memcached instance
153message Instance {
154  option (google.api.resource) = {
155    type: "memcache.googleapis.com/Instance"
156    pattern: "projects/{project}/locations/{location}/instances/{instance}"
157  };
158
159  // Different states of a Memcached instance.
160  enum State {
161    // State not set.
162    STATE_UNSPECIFIED = 0;
163
164    // Memcached instance is being created.
165    CREATING = 1;
166
167    // Memcached instance has been created and ready to be used.
168    READY = 2;
169
170    // Memcached instance is updating configuration such as maintenance policy
171    // and schedule.
172    UPDATING = 3;
173
174    // Memcached instance is being deleted.
175    DELETING = 4;
176
177    // Memcached instance is going through maintenance, e.g. data plane rollout.
178    PERFORMING_MAINTENANCE = 5;
179  }
180
181  // Configuration for a Memcached Node.
182  message NodeConfig {
183    // Required. Number of cpus per Memcached node.
184    int32 cpu_count = 1 [(google.api.field_behavior) = REQUIRED];
185
186    // Required. Memory size in MiB for each Memcached node.
187    int32 memory_size_mb = 2 [(google.api.field_behavior) = REQUIRED];
188  }
189
190  message Node {
191    // Different states of a Memcached node.
192    enum State {
193      // Node state is not set.
194      STATE_UNSPECIFIED = 0;
195
196      // Node is being created.
197      CREATING = 1;
198
199      // Node has been created and ready to be used.
200      READY = 2;
201
202      // Node is being deleted.
203      DELETING = 3;
204
205      // Node is being updated.
206      UPDATING = 4;
207    }
208
209    // Output only. Identifier of the Memcached node. The node id does not
210    // include project or location like the Memcached instance name.
211    string node_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
212
213    // Output only. Location (GCP Zone) for the Memcached node.
214    string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
215
216    // Output only. Current state of the Memcached node.
217    State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
218
219    // Output only. Hostname or IP address of the Memcached node used by the
220    // clients to connect to the Memcached server on this node.
221    string host = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
222
223    // Output only. The port number of the Memcached server on this node.
224    int32 port = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
225
226    // User defined parameters currently applied to the node.
227    MemcacheParameters parameters = 6;
228  }
229
230  message InstanceMessage {
231    enum Code {
232      // Message Code not set.
233      CODE_UNSPECIFIED = 0;
234
235      // Memcached nodes are distributed unevenly.
236      ZONE_DISTRIBUTION_UNBALANCED = 1;
237    }
238
239    // A code that correspond to one type of user-facing message.
240    Code code = 1;
241
242    // Message on memcached instance which will be exposed to users.
243    string message = 2;
244  }
245
246  // Required. Unique name of the resource in this scope including project and
247  // location using the form:
248  //     `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
249  //
250  // Note: Memcached instances are managed and addressed at the regional level
251  // so `location_id` here refers to a Google Cloud region; however, users may
252  // choose which zones Memcached nodes should be provisioned in within an
253  // instance. Refer to [zones][google.cloud.memcache.v1.Instance.zones] field for more details.
254  string name = 1 [(google.api.field_behavior) = REQUIRED];
255
256  // User provided name for the instance, which is only used for display
257  // purposes. Cannot be more than 80 characters.
258  string display_name = 2;
259
260  // Resource labels to represent user-provided metadata.
261  // Refer to cloud documentation on labels for more details.
262  // https://cloud.google.com/compute/docs/labeling-resources
263  map<string, string> labels = 3;
264
265  // The full name of the Google Compute Engine
266  // [network](/compute/docs/networks-and-firewalls#networks) to which the
267  // instance is connected. If left unspecified, the `default` network
268  // will be used.
269  string authorized_network = 4;
270
271  // Zones in which Memcached nodes should be provisioned.
272  // Memcached nodes will be equally distributed across these zones. If not
273  // provided, the service will by default create nodes in all zones in the
274  // region for the instance.
275  repeated string zones = 5;
276
277  // Required. Number of nodes in the Memcached instance.
278  int32 node_count = 6 [(google.api.field_behavior) = REQUIRED];
279
280  // Required. Configuration for Memcached nodes.
281  NodeConfig node_config = 7 [(google.api.field_behavior) = REQUIRED];
282
283  // The major version of Memcached software.
284  // If not provided, latest supported version will be used. Currently the
285  // latest supported major version is `MEMCACHE_1_5`.
286  // The minor version will be automatically determined by our system based on
287  // the latest supported minor version.
288  MemcacheVersion memcache_version = 9;
289
290  // User defined parameters to apply to the memcached process
291  // on each node.
292  MemcacheParameters parameters = 11;
293
294  // Output only. List of Memcached nodes.
295  // Refer to [Node][google.cloud.memcache.v1.Instance.Node] message for more details.
296  repeated Node memcache_nodes = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
297
298  // Output only. The time the instance was created.
299  google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
300
301  // Output only. The time the instance was updated.
302  google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
303
304  // Output only. The state of this Memcached instance.
305  State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
306
307  // Output only. The full version of memcached server running on this instance.
308  // System automatically determines the full memcached version for an instance
309  // based on the input MemcacheVersion.
310  // The full version format will be "memcached-1.5.16".
311  string memcache_full_version = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
312
313  // List of messages that describe the current state of the Memcached instance.
314  repeated InstanceMessage instance_messages = 19;
315
316  // Output only. Endpoint for the Discovery API.
317  string discovery_endpoint = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
318
319  // The maintenance policy for the instance. If not provided,
320  // the maintenance event will be performed based on Memorystore
321  // internal rollout schedule.
322  MaintenancePolicy maintenance_policy = 21;
323
324  // Output only. Published maintenance schedule.
325  MaintenanceSchedule maintenance_schedule = 22 [(google.api.field_behavior) = OUTPUT_ONLY];
326}
327
328// Maintenance policy per instance.
329message MaintenancePolicy {
330  // Output only. The time when the policy was created.
331  google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
332
333  // Output only. The time when the policy was updated.
334  google.protobuf.Timestamp update_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
335
336  // Description of what this policy is for. Create/Update methods
337  // return INVALID_ARGUMENT if the length is greater than 512.
338  string description = 3;
339
340  // Required. Maintenance window that is applied to resources covered by this
341  // policy. Minimum 1. For the current version, the maximum number of
342  // weekly_maintenance_windows is expected to be one.
343  repeated WeeklyMaintenanceWindow weekly_maintenance_window = 4 [(google.api.field_behavior) = REQUIRED];
344}
345
346// Time window specified for weekly operations.
347message WeeklyMaintenanceWindow {
348  // Required. Allows to define schedule that runs specified day of the week.
349  google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED];
350
351  // Required. Start time of the window in UTC.
352  google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED];
353
354  // Required. Duration of the time window.
355  google.protobuf.Duration duration = 3 [(google.api.field_behavior) = REQUIRED];
356}
357
358// Upcoming maintenance schedule.
359message MaintenanceSchedule {
360  // Output only. The start time of any upcoming scheduled maintenance for this instance.
361  google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
362
363  // Output only. The end time of any upcoming scheduled maintenance for this instance.
364  google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
365
366  // Output only. The deadline that the maintenance schedule start time can not go beyond,
367  // including reschedule.
368  google.protobuf.Timestamp schedule_deadline_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
369}
370
371// Request for [RescheduleMaintenance][google.cloud.memcache.v1.CloudMemcache.RescheduleMaintenance].
372message RescheduleMaintenanceRequest {
373  // Reschedule options.
374  enum RescheduleType {
375    // Not set.
376    RESCHEDULE_TYPE_UNSPECIFIED = 0;
377
378    // If the user wants to schedule the maintenance to happen now.
379    IMMEDIATE = 1;
380
381    // If the user wants to use the existing maintenance policy to find the
382    // next available window.
383    NEXT_AVAILABLE_WINDOW = 2;
384
385    // If the user wants to reschedule the maintenance to a specific time.
386    SPECIFIC_TIME = 3;
387  }
388
389  // Required. Memcache instance resource name using the form:
390  //     `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
391  // where `location_id` refers to a GCP region.
392  string instance = 1 [
393    (google.api.field_behavior) = REQUIRED,
394    (google.api.resource_reference) = {
395      type: "memcache.googleapis.com/Instance"
396    }
397  ];
398
399  // Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
400  RescheduleType reschedule_type = 2 [(google.api.field_behavior) = REQUIRED];
401
402  // Timestamp when the maintenance shall be rescheduled to if
403  // reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
404  // example `2012-11-15T16:19:00.094Z`.
405  google.protobuf.Timestamp schedule_time = 3;
406}
407
408// Request for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
409message ListInstancesRequest {
410  // Required. The resource name of the instance location using the form:
411  //     `projects/{project_id}/locations/{location_id}`
412  // where `location_id` refers to a GCP region
413  string parent = 1 [
414    (google.api.field_behavior) = REQUIRED,
415    (google.api.resource_reference) = {
416      type: "locations.googleapis.com/Location"
417    }
418  ];
419
420  // The maximum number of items to return.
421  //
422  // If not specified, a default value of 1000 will be used by the service.
423  // Regardless of the `page_size` value, the response may include a partial
424  // list and a caller should only rely on response's
425  // [`next_page_token`][google.cloud.memcache.v1.ListInstancesResponse.next_page_token]
426  // to determine if there are more instances left to be queried.
427  int32 page_size = 2;
428
429  // The `next_page_token` value returned from a previous List request, if any.
430  string page_token = 3;
431
432  // List filter. For example, exclude all Memcached instances with name as
433  // my-instance by specifying `"name != my-instance"`.
434  string filter = 4;
435
436  // Sort results. Supported values are "name", "name desc" or "" (unsorted).
437  string order_by = 5;
438}
439
440// Response for [ListInstances][google.cloud.memcache.v1.CloudMemcache.ListInstances].
441message ListInstancesResponse {
442  // A list of Memcached instances in the project in the specified location,
443  // or across all locations.
444  //
445  // If the `location_id` in the parent field of the request is "-", all regions
446  // available to the project are queried, and the results aggregated.
447  repeated Instance instances = 1;
448
449  // Token to retrieve the next page of results, or empty if there are no more
450  // results in the list.
451  string next_page_token = 2;
452
453  // Locations that could not be reached.
454  repeated string unreachable = 3;
455}
456
457// Request for [GetInstance][google.cloud.memcache.v1.CloudMemcache.GetInstance].
458message GetInstanceRequest {
459  // Required. Memcached instance resource name in the format:
460  //     `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
461  // where `location_id` refers to a GCP region
462  string name = 1 [
463    (google.api.field_behavior) = REQUIRED,
464    (google.api.resource_reference) = {
465      type: "memcache.googleapis.com/Instance"
466    }
467  ];
468}
469
470// Request for [CreateInstance][google.cloud.memcache.v1.CloudMemcache.CreateInstance].
471message CreateInstanceRequest {
472  // Required. The resource name of the instance location using the form:
473  //     `projects/{project_id}/locations/{location_id}`
474  // where `location_id` refers to a GCP region
475  string parent = 1 [
476    (google.api.field_behavior) = REQUIRED,
477    (google.api.resource_reference) = {
478      type: "locations.googleapis.com/Location"
479    }
480  ];
481
482  // Required. The logical name of the Memcached instance in the user
483  // project with the following restrictions:
484  //
485  // * Must contain only lowercase letters, numbers, and hyphens.
486  // * Must start with a letter.
487  // * Must be between 1-40 characters.
488  // * Must end with a number or a letter.
489  // * Must be unique within the user project / location.
490  //
491  // If any of the above are not met, the API raises an invalid argument error.
492  string instance_id = 2 [(google.api.field_behavior) = REQUIRED];
493
494  // Required. A Memcached Instance
495  Instance instance = 3 [(google.api.field_behavior) = REQUIRED];
496}
497
498// Request for [UpdateInstance][google.cloud.memcache.v1.CloudMemcache.UpdateInstance].
499message UpdateInstanceRequest {
500  // Required. Mask of fields to update.
501  //
502  //  *   `displayName`
503  google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED];
504
505  // Required. A Memcached Instance.
506  // Only fields specified in update_mask are updated.
507  Instance instance = 2 [(google.api.field_behavior) = REQUIRED];
508}
509
510// Request for [DeleteInstance][google.cloud.memcache.v1.CloudMemcache.DeleteInstance].
511message DeleteInstanceRequest {
512  // Required. Memcached instance resource name in the format:
513  //     `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
514  // where `location_id` refers to a GCP region
515  string name = 1 [
516    (google.api.field_behavior) = REQUIRED,
517    (google.api.resource_reference) = {
518      type: "memcache.googleapis.com/Instance"
519    }
520  ];
521}
522
523// Request for [ApplyParameters][google.cloud.memcache.v1.CloudMemcache.ApplyParameters].
524message ApplyParametersRequest {
525  // Required. Resource name of the Memcached instance for which parameter group updates
526  // should be applied.
527  string name = 1 [
528    (google.api.field_behavior) = REQUIRED,
529    (google.api.resource_reference) = {
530      type: "memcache.googleapis.com/Instance"
531    }
532  ];
533
534  // Nodes to which the instance-level parameter group is applied.
535  repeated string node_ids = 2;
536
537  // Whether to apply instance-level parameter group to all nodes. If set to
538  // true, users are restricted from specifying individual nodes, and
539  // `ApplyParameters` updates all nodes within the instance.
540  bool apply_all = 3;
541}
542
543// Request for [UpdateParameters][google.cloud.memcache.v1.CloudMemcache.UpdateParameters].
544message UpdateParametersRequest {
545  // Required. Resource name of the Memcached instance for which the parameters should be
546  // updated.
547  string name = 1 [
548    (google.api.field_behavior) = REQUIRED,
549    (google.api.resource_reference) = {
550      type: "memcache.googleapis.com/Instance"
551    }
552  ];
553
554  // Required. Mask of fields to update.
555  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
556
557  // The parameters to apply to the instance.
558  MemcacheParameters parameters = 3;
559}
560
561// Memcached versions supported by our service.
562enum MemcacheVersion {
563  MEMCACHE_VERSION_UNSPECIFIED = 0;
564
565  // Memcached 1.5 version.
566  MEMCACHE_1_5 = 1;
567}
568
569message MemcacheParameters {
570  // Output only. The unique ID associated with this set of parameters. Users
571  // can use this id to determine if the parameters associated with the instance
572  // differ from the parameters associated with the nodes. A discrepancy between
573  // parameter ids can inform users that they may need to take action to apply
574  // parameters on nodes.
575  string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
576
577  // User defined set of parameters to use in the memcached process.
578  map<string, string> params = 3;
579}
580
581// Represents the metadata of a long-running operation.
582message OperationMetadata {
583  // Output only. Time when the operation was created.
584  google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
585
586  // Output only. Time when the operation finished running.
587  google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
588
589  // Output only. Server-defined resource path for the target of the operation.
590  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
591
592  // Output only. Name of the verb executed by the operation.
593  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
594
595  // Output only. Human-readable status of the operation, if any.
596  string status_detail = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
597
598  // Output only. Identifies whether the user has requested cancellation
599  // of the operation. Operations that have successfully been cancelled
600  // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
601  // corresponding to `Code.CANCELLED`.
602  bool cancel_requested = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
603
604  // Output only. API version used to start the operation.
605  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
606}
607
608// Metadata for the given [google.cloud.location.Location][google.cloud.location.Location].
609message LocationMetadata {
610  // Output only. The set of available zones in the location. The map is keyed
611  // by the lowercase ID of each zone, as defined by GCE. These keys can be
612  // specified in the `zones` field when creating a Memcached instance.
613  map<string, ZoneMetadata> available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
614}
615
616message ZoneMetadata {
617
618}
619