• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.cloud.redis.v1;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.core.BetaApi;
22 import com.google.api.gax.core.BackgroundResource;
23 import com.google.api.gax.httpjson.longrunning.OperationsClient;
24 import com.google.api.gax.longrunning.OperationFuture;
25 import com.google.api.gax.paging.AbstractFixedSizeCollection;
26 import com.google.api.gax.paging.AbstractPage;
27 import com.google.api.gax.paging.AbstractPagedListResponse;
28 import com.google.api.gax.rpc.OperationCallable;
29 import com.google.api.gax.rpc.PageContext;
30 import com.google.api.gax.rpc.UnaryCallable;
31 import com.google.cloud.location.GetLocationRequest;
32 import com.google.cloud.location.ListLocationsRequest;
33 import com.google.cloud.location.ListLocationsResponse;
34 import com.google.cloud.location.Location;
35 import com.google.cloud.redis.v1.stub.CloudRedisStub;
36 import com.google.cloud.redis.v1.stub.CloudRedisStubSettings;
37 import com.google.common.util.concurrent.MoreExecutors;
38 import com.google.longrunning.Operation;
39 import com.google.protobuf.Empty;
40 import com.google.protobuf.FieldMask;
41 import com.google.protobuf.Timestamp;
42 import java.io.IOException;
43 import java.util.List;
44 import java.util.concurrent.TimeUnit;
45 import javax.annotation.Generated;
46 
47 // AUTO-GENERATED DOCUMENTATION AND CLASS.
48 /**
49  * Service Description: Configures and manages Cloud Memorystore for Redis instances
50  *
51  * <p>Google Cloud Memorystore for Redis v1
52  *
53  * <p>The `redis.googleapis.com` service implements the Google Cloud Memorystore for Redis API and
54  * defines the following resource model for managing Redis instances:
55  *
56  * <ul>
57  *   <li>The service works with a collection of cloud projects, named: `/projects/&#42;`
58  *   <li>Each project has a collection of available locations, named: `/locations/&#42;`
59  *   <li>Each location has a collection of Redis instances, named: `/instances/&#42;`
60  *   <li>As such, Redis instances are resources of the form:
61  *       `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
62  * </ul>
63  *
64  * <p>Note that location_id must be referring to a GCP `region`; for example:
65  *
66  * <ul>
67  *   <li>`projects/redpepper-1290/locations/us-central1/instances/my-redis`
68  * </ul>
69  *
70  * <p>This class provides the ability to make remote calls to the backing service through method
71  * calls that map to API methods. Sample code to get started:
72  *
73  * <pre>{@code
74  * // This snippet has been automatically generated and should be regarded as a code template only.
75  * // It will require modifications to work:
76  * // - It may require correct/in-range values for request initialization.
77  * // - It may require specifying regional endpoints when creating the service client as shown in
78  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
79  * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
80  *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
81  *   Instance response = cloudRedisClient.getInstance(name);
82  * }
83  * }</pre>
84  *
85  * <p>Note: close() needs to be called on the CloudRedisClient object to clean up resources such as
86  * threads. In the example above, try-with-resources is used, which automatically calls close().
87  *
88  * <p>The surface of this class includes several types of Java methods for each of the API's
89  * methods:
90  *
91  * <ol>
92  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
93  *       converted into function parameters. It may be the case that not all fields are available as
94  *       parameters, and not every API method will have a flattened method entry point.
95  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
96  *       which must be constructed before the call. Not every API method will have a request object
97  *       method.
98  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
99  *       callable object, which can be used to initiate calls to the service.
100  * </ol>
101  *
102  * <p>See the individual methods for example code.
103  *
104  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
105  * these names, this class includes a format method for each type of name, and additionally a parse
106  * method to extract the individual identifiers contained within names that are returned.
107  *
108  * <p>This class can be customized by passing in a custom instance of CloudRedisSettings to
109  * create(). For example:
110  *
111  * <p>To customize credentials:
112  *
113  * <pre>{@code
114  * // This snippet has been automatically generated and should be regarded as a code template only.
115  * // It will require modifications to work:
116  * // - It may require correct/in-range values for request initialization.
117  * // - It may require specifying regional endpoints when creating the service client as shown in
118  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
119  * CloudRedisSettings cloudRedisSettings =
120  *     CloudRedisSettings.newBuilder()
121  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
122  *         .build();
123  * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
124  * }</pre>
125  *
126  * <p>To customize the endpoint:
127  *
128  * <pre>{@code
129  * // This snippet has been automatically generated and should be regarded as a code template only.
130  * // It will require modifications to work:
131  * // - It may require correct/in-range values for request initialization.
132  * // - It may require specifying regional endpoints when creating the service client as shown in
133  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
134  * CloudRedisSettings cloudRedisSettings =
135  *     CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
136  * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
137  * }</pre>
138  *
139  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
140  * the wire:
141  *
142  * <pre>{@code
143  * // This snippet has been automatically generated and should be regarded as a code template only.
144  * // It will require modifications to work:
145  * // - It may require correct/in-range values for request initialization.
146  * // - It may require specifying regional endpoints when creating the service client as shown in
147  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
148  * CloudRedisSettings cloudRedisSettings = CloudRedisSettings.newHttpJsonBuilder().build();
149  * CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
150  * }</pre>
151  *
152  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
153  */
154 @Generated("by gapic-generator-java")
155 public class CloudRedisClient implements BackgroundResource {
156   private final CloudRedisSettings settings;
157   private final CloudRedisStub stub;
158   private final OperationsClient httpJsonOperationsClient;
159   private final com.google.longrunning.OperationsClient operationsClient;
160 
161   /** Constructs an instance of CloudRedisClient with default settings. */
create()162   public static final CloudRedisClient create() throws IOException {
163     return create(CloudRedisSettings.newBuilder().build());
164   }
165 
166   /**
167    * Constructs an instance of CloudRedisClient, using the given settings. The channels are created
168    * based on the settings passed in, or defaults for any settings that are not set.
169    */
create(CloudRedisSettings settings)170   public static final CloudRedisClient create(CloudRedisSettings settings) throws IOException {
171     return new CloudRedisClient(settings);
172   }
173 
174   /**
175    * Constructs an instance of CloudRedisClient, using the given stub for making calls. This is for
176    * advanced usage - prefer using create(CloudRedisSettings).
177    */
create(CloudRedisStub stub)178   public static final CloudRedisClient create(CloudRedisStub stub) {
179     return new CloudRedisClient(stub);
180   }
181 
182   /**
183    * Constructs an instance of CloudRedisClient, using the given settings. This is protected so that
184    * it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
185    */
CloudRedisClient(CloudRedisSettings settings)186   protected CloudRedisClient(CloudRedisSettings settings) throws IOException {
187     this.settings = settings;
188     this.stub = ((CloudRedisStubSettings) settings.getStubSettings()).createStub();
189     this.operationsClient =
190         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
191     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
192   }
193 
CloudRedisClient(CloudRedisStub stub)194   protected CloudRedisClient(CloudRedisStub stub) {
195     this.settings = null;
196     this.stub = stub;
197     this.operationsClient =
198         com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
199     this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
200   }
201 
getSettings()202   public final CloudRedisSettings getSettings() {
203     return settings;
204   }
205 
getStub()206   public CloudRedisStub getStub() {
207     return stub;
208   }
209 
210   /**
211    * Returns the OperationsClient that can be used to query the status of a long-running operation
212    * returned by another API method call.
213    */
getOperationsClient()214   public final com.google.longrunning.OperationsClient getOperationsClient() {
215     return operationsClient;
216   }
217 
218   /**
219    * Returns the OperationsClient that can be used to query the status of a long-running operation
220    * returned by another API method call.
221    */
222   @BetaApi
getHttpJsonOperationsClient()223   public final OperationsClient getHttpJsonOperationsClient() {
224     return httpJsonOperationsClient;
225   }
226 
227   // AUTO-GENERATED DOCUMENTATION AND METHOD.
228   /**
229    * Lists all Redis instances owned by a project in either the specified location (region) or all
230    * locations.
231    *
232    * <p>The location should have the following format:
233    *
234    * <ul>
235    *   <li>`projects/{project_id}/locations/{location_id}`
236    * </ul>
237    *
238    * <p>If `location_id` is specified as `-` (wildcard), then all regions available to the project
239    * are queried, and the results are aggregated.
240    *
241    * <p>Sample code:
242    *
243    * <pre>{@code
244    * // This snippet has been automatically generated and should be regarded as a code template only.
245    * // It will require modifications to work:
246    * // - It may require correct/in-range values for request initialization.
247    * // - It may require specifying regional endpoints when creating the service client as shown in
248    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
249    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
250    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
251    *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
252    *     // doThingsWith(element);
253    *   }
254    * }
255    * }</pre>
256    *
257    * @param parent Required. The resource name of the instance location using the form:
258    *     `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
259    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
260    */
listInstances(LocationName parent)261   public final ListInstancesPagedResponse listInstances(LocationName parent) {
262     ListInstancesRequest request =
263         ListInstancesRequest.newBuilder()
264             .setParent(parent == null ? null : parent.toString())
265             .build();
266     return listInstances(request);
267   }
268 
269   // AUTO-GENERATED DOCUMENTATION AND METHOD.
270   /**
271    * Lists all Redis instances owned by a project in either the specified location (region) or all
272    * locations.
273    *
274    * <p>The location should have the following format:
275    *
276    * <ul>
277    *   <li>`projects/{project_id}/locations/{location_id}`
278    * </ul>
279    *
280    * <p>If `location_id` is specified as `-` (wildcard), then all regions available to the project
281    * are queried, and the results are aggregated.
282    *
283    * <p>Sample code:
284    *
285    * <pre>{@code
286    * // This snippet has been automatically generated and should be regarded as a code template only.
287    * // It will require modifications to work:
288    * // - It may require correct/in-range values for request initialization.
289    * // - It may require specifying regional endpoints when creating the service client as shown in
290    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
291    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
292    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
293    *   for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
294    *     // doThingsWith(element);
295    *   }
296    * }
297    * }</pre>
298    *
299    * @param parent Required. The resource name of the instance location using the form:
300    *     `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
301    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
302    */
listInstances(String parent)303   public final ListInstancesPagedResponse listInstances(String parent) {
304     ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build();
305     return listInstances(request);
306   }
307 
308   // AUTO-GENERATED DOCUMENTATION AND METHOD.
309   /**
310    * Lists all Redis instances owned by a project in either the specified location (region) or all
311    * locations.
312    *
313    * <p>The location should have the following format:
314    *
315    * <ul>
316    *   <li>`projects/{project_id}/locations/{location_id}`
317    * </ul>
318    *
319    * <p>If `location_id` is specified as `-` (wildcard), then all regions available to the project
320    * are queried, and the results are aggregated.
321    *
322    * <p>Sample code:
323    *
324    * <pre>{@code
325    * // This snippet has been automatically generated and should be regarded as a code template only.
326    * // It will require modifications to work:
327    * // - It may require correct/in-range values for request initialization.
328    * // - It may require specifying regional endpoints when creating the service client as shown in
329    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
330    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
331    *   ListInstancesRequest request =
332    *       ListInstancesRequest.newBuilder()
333    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
334    *           .setPageSize(883849137)
335    *           .setPageToken("pageToken873572522")
336    *           .build();
337    *   for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
338    *     // doThingsWith(element);
339    *   }
340    * }
341    * }</pre>
342    *
343    * @param request The request object containing all of the parameters for the API call.
344    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
345    */
listInstances(ListInstancesRequest request)346   public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) {
347     return listInstancesPagedCallable().call(request);
348   }
349 
350   // AUTO-GENERATED DOCUMENTATION AND METHOD.
351   /**
352    * Lists all Redis instances owned by a project in either the specified location (region) or all
353    * locations.
354    *
355    * <p>The location should have the following format:
356    *
357    * <ul>
358    *   <li>`projects/{project_id}/locations/{location_id}`
359    * </ul>
360    *
361    * <p>If `location_id` is specified as `-` (wildcard), then all regions available to the project
362    * are queried, and the results are aggregated.
363    *
364    * <p>Sample code:
365    *
366    * <pre>{@code
367    * // This snippet has been automatically generated and should be regarded as a code template only.
368    * // It will require modifications to work:
369    * // - It may require correct/in-range values for request initialization.
370    * // - It may require specifying regional endpoints when creating the service client as shown in
371    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
372    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
373    *   ListInstancesRequest request =
374    *       ListInstancesRequest.newBuilder()
375    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
376    *           .setPageSize(883849137)
377    *           .setPageToken("pageToken873572522")
378    *           .build();
379    *   ApiFuture<Instance> future =
380    *       cloudRedisClient.listInstancesPagedCallable().futureCall(request);
381    *   // Do something.
382    *   for (Instance element : future.get().iterateAll()) {
383    *     // doThingsWith(element);
384    *   }
385    * }
386    * }</pre>
387    */
388   public final UnaryCallable<ListInstancesRequest, ListInstancesPagedResponse>
listInstancesPagedCallable()389       listInstancesPagedCallable() {
390     return stub.listInstancesPagedCallable();
391   }
392 
393   // AUTO-GENERATED DOCUMENTATION AND METHOD.
394   /**
395    * Lists all Redis instances owned by a project in either the specified location (region) or all
396    * locations.
397    *
398    * <p>The location should have the following format:
399    *
400    * <ul>
401    *   <li>`projects/{project_id}/locations/{location_id}`
402    * </ul>
403    *
404    * <p>If `location_id` is specified as `-` (wildcard), then all regions available to the project
405    * are queried, and the results are aggregated.
406    *
407    * <p>Sample code:
408    *
409    * <pre>{@code
410    * // This snippet has been automatically generated and should be regarded as a code template only.
411    * // It will require modifications to work:
412    * // - It may require correct/in-range values for request initialization.
413    * // - It may require specifying regional endpoints when creating the service client as shown in
414    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
415    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
416    *   ListInstancesRequest request =
417    *       ListInstancesRequest.newBuilder()
418    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
419    *           .setPageSize(883849137)
420    *           .setPageToken("pageToken873572522")
421    *           .build();
422    *   while (true) {
423    *     ListInstancesResponse response = cloudRedisClient.listInstancesCallable().call(request);
424    *     for (Instance element : response.getInstancesList()) {
425    *       // doThingsWith(element);
426    *     }
427    *     String nextPageToken = response.getNextPageToken();
428    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
429    *       request = request.toBuilder().setPageToken(nextPageToken).build();
430    *     } else {
431    *       break;
432    *     }
433    *   }
434    * }
435    * }</pre>
436    */
listInstancesCallable()437   public final UnaryCallable<ListInstancesRequest, ListInstancesResponse> listInstancesCallable() {
438     return stub.listInstancesCallable();
439   }
440 
441   // AUTO-GENERATED DOCUMENTATION AND METHOD.
442   /**
443    * Gets the details of a specific Redis instance.
444    *
445    * <p>Sample code:
446    *
447    * <pre>{@code
448    * // This snippet has been automatically generated and should be regarded as a code template only.
449    * // It will require modifications to work:
450    * // - It may require correct/in-range values for request initialization.
451    * // - It may require specifying regional endpoints when creating the service client as shown in
452    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
453    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
454    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
455    *   Instance response = cloudRedisClient.getInstance(name);
456    * }
457    * }</pre>
458    *
459    * @param name Required. Redis instance resource name using the form:
460    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
461    *     refers to a GCP region.
462    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
463    */
getInstance(InstanceName name)464   public final Instance getInstance(InstanceName name) {
465     GetInstanceRequest request =
466         GetInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
467     return getInstance(request);
468   }
469 
470   // AUTO-GENERATED DOCUMENTATION AND METHOD.
471   /**
472    * Gets the details of a specific Redis instance.
473    *
474    * <p>Sample code:
475    *
476    * <pre>{@code
477    * // This snippet has been automatically generated and should be regarded as a code template only.
478    * // It will require modifications to work:
479    * // - It may require correct/in-range values for request initialization.
480    * // - It may require specifying regional endpoints when creating the service client as shown in
481    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
482    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
483    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
484    *   Instance response = cloudRedisClient.getInstance(name);
485    * }
486    * }</pre>
487    *
488    * @param name Required. Redis instance resource name using the form:
489    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
490    *     refers to a GCP region.
491    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
492    */
getInstance(String name)493   public final Instance getInstance(String name) {
494     GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build();
495     return getInstance(request);
496   }
497 
498   // AUTO-GENERATED DOCUMENTATION AND METHOD.
499   /**
500    * Gets the details of a specific Redis instance.
501    *
502    * <p>Sample code:
503    *
504    * <pre>{@code
505    * // This snippet has been automatically generated and should be regarded as a code template only.
506    * // It will require modifications to work:
507    * // - It may require correct/in-range values for request initialization.
508    * // - It may require specifying regional endpoints when creating the service client as shown in
509    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
510    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
511    *   GetInstanceRequest request =
512    *       GetInstanceRequest.newBuilder()
513    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
514    *           .build();
515    *   Instance response = cloudRedisClient.getInstance(request);
516    * }
517    * }</pre>
518    *
519    * @param request The request object containing all of the parameters for the API call.
520    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
521    */
getInstance(GetInstanceRequest request)522   public final Instance getInstance(GetInstanceRequest request) {
523     return getInstanceCallable().call(request);
524   }
525 
526   // AUTO-GENERATED DOCUMENTATION AND METHOD.
527   /**
528    * Gets the details of a specific Redis instance.
529    *
530    * <p>Sample code:
531    *
532    * <pre>{@code
533    * // This snippet has been automatically generated and should be regarded as a code template only.
534    * // It will require modifications to work:
535    * // - It may require correct/in-range values for request initialization.
536    * // - It may require specifying regional endpoints when creating the service client as shown in
537    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
538    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
539    *   GetInstanceRequest request =
540    *       GetInstanceRequest.newBuilder()
541    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
542    *           .build();
543    *   ApiFuture<Instance> future = cloudRedisClient.getInstanceCallable().futureCall(request);
544    *   // Do something.
545    *   Instance response = future.get();
546    * }
547    * }</pre>
548    */
getInstanceCallable()549   public final UnaryCallable<GetInstanceRequest, Instance> getInstanceCallable() {
550     return stub.getInstanceCallable();
551   }
552 
553   // AUTO-GENERATED DOCUMENTATION AND METHOD.
554   /**
555    * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response
556    * will be empty. This information is not included in the details returned to GetInstance.
557    *
558    * <p>Sample code:
559    *
560    * <pre>{@code
561    * // This snippet has been automatically generated and should be regarded as a code template only.
562    * // It will require modifications to work:
563    * // - It may require correct/in-range values for request initialization.
564    * // - It may require specifying regional endpoints when creating the service client as shown in
565    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
566    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
567    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
568    *   InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
569    * }
570    * }</pre>
571    *
572    * @param name Required. Redis instance resource name using the form:
573    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
574    *     refers to a GCP region.
575    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
576    */
getInstanceAuthString(InstanceName name)577   public final InstanceAuthString getInstanceAuthString(InstanceName name) {
578     GetInstanceAuthStringRequest request =
579         GetInstanceAuthStringRequest.newBuilder()
580             .setName(name == null ? null : name.toString())
581             .build();
582     return getInstanceAuthString(request);
583   }
584 
585   // AUTO-GENERATED DOCUMENTATION AND METHOD.
586   /**
587    * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response
588    * will be empty. This information is not included in the details returned to GetInstance.
589    *
590    * <p>Sample code:
591    *
592    * <pre>{@code
593    * // This snippet has been automatically generated and should be regarded as a code template only.
594    * // It will require modifications to work:
595    * // - It may require correct/in-range values for request initialization.
596    * // - It may require specifying regional endpoints when creating the service client as shown in
597    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
598    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
599    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
600    *   InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
601    * }
602    * }</pre>
603    *
604    * @param name Required. Redis instance resource name using the form:
605    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
606    *     refers to a GCP region.
607    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
608    */
getInstanceAuthString(String name)609   public final InstanceAuthString getInstanceAuthString(String name) {
610     GetInstanceAuthStringRequest request =
611         GetInstanceAuthStringRequest.newBuilder().setName(name).build();
612     return getInstanceAuthString(request);
613   }
614 
615   // AUTO-GENERATED DOCUMENTATION AND METHOD.
616   /**
617    * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response
618    * will be empty. This information is not included in the details returned to GetInstance.
619    *
620    * <p>Sample code:
621    *
622    * <pre>{@code
623    * // This snippet has been automatically generated and should be regarded as a code template only.
624    * // It will require modifications to work:
625    * // - It may require correct/in-range values for request initialization.
626    * // - It may require specifying regional endpoints when creating the service client as shown in
627    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
628    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
629    *   GetInstanceAuthStringRequest request =
630    *       GetInstanceAuthStringRequest.newBuilder()
631    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
632    *           .build();
633    *   InstanceAuthString response = cloudRedisClient.getInstanceAuthString(request);
634    * }
635    * }</pre>
636    *
637    * @param request The request object containing all of the parameters for the API call.
638    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
639    */
getInstanceAuthString(GetInstanceAuthStringRequest request)640   public final InstanceAuthString getInstanceAuthString(GetInstanceAuthStringRequest request) {
641     return getInstanceAuthStringCallable().call(request);
642   }
643 
644   // AUTO-GENERATED DOCUMENTATION AND METHOD.
645   /**
646    * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response
647    * will be empty. This information is not included in the details returned to GetInstance.
648    *
649    * <p>Sample code:
650    *
651    * <pre>{@code
652    * // This snippet has been automatically generated and should be regarded as a code template only.
653    * // It will require modifications to work:
654    * // - It may require correct/in-range values for request initialization.
655    * // - It may require specifying regional endpoints when creating the service client as shown in
656    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
657    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
658    *   GetInstanceAuthStringRequest request =
659    *       GetInstanceAuthStringRequest.newBuilder()
660    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
661    *           .build();
662    *   ApiFuture<InstanceAuthString> future =
663    *       cloudRedisClient.getInstanceAuthStringCallable().futureCall(request);
664    *   // Do something.
665    *   InstanceAuthString response = future.get();
666    * }
667    * }</pre>
668    */
669   public final UnaryCallable<GetInstanceAuthStringRequest, InstanceAuthString>
getInstanceAuthStringCallable()670       getInstanceAuthStringCallable() {
671     return stub.getInstanceAuthStringCallable();
672   }
673 
674   // AUTO-GENERATED DOCUMENTATION AND METHOD.
675   /**
676    * Creates a Redis instance based on the specified tier and memory size.
677    *
678    * <p>By default, the instance is accessible from the project's [default
679    * network](https://cloud.google.com/vpc/docs/vpc).
680    *
681    * <p>The creation is executed asynchronously and callers may check the returned operation to
682    * track its progress. Once the operation is completed the Redis instance will be fully
683    * functional. Completed longrunning.Operation will contain the new instance object in the
684    * response field.
685    *
686    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
687    * call DeleteOperation.
688    *
689    * <p>Sample code:
690    *
691    * <pre>{@code
692    * // This snippet has been automatically generated and should be regarded as a code template only.
693    * // It will require modifications to work:
694    * // - It may require correct/in-range values for request initialization.
695    * // - It may require specifying regional endpoints when creating the service client as shown in
696    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
697    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
698    *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
699    *   String instanceId = "instanceId902024336";
700    *   Instance instance = Instance.newBuilder().build();
701    *   Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
702    * }
703    * }</pre>
704    *
705    * @param parent Required. The resource name of the instance location using the form:
706    *     `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
707    * @param instanceId Required. The logical name of the Redis instance in the customer project with
708    *     the following restrictions:
709    *     <ul>
710    *       <li>Must contain only lowercase letters, numbers, and hyphens.
711    *       <li>Must start with a letter.
712    *       <li>Must be between 1-40 characters.
713    *       <li>Must end with a number or a letter.
714    *       <li>Must be unique within the customer project / location
715    *     </ul>
716    *
717    * @param instance Required. A Redis [Instance] resource
718    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
719    */
createInstanceAsync( LocationName parent, String instanceId, Instance instance)720   public final OperationFuture<Instance, OperationMetadata> createInstanceAsync(
721       LocationName parent, String instanceId, Instance instance) {
722     CreateInstanceRequest request =
723         CreateInstanceRequest.newBuilder()
724             .setParent(parent == null ? null : parent.toString())
725             .setInstanceId(instanceId)
726             .setInstance(instance)
727             .build();
728     return createInstanceAsync(request);
729   }
730 
731   // AUTO-GENERATED DOCUMENTATION AND METHOD.
732   /**
733    * Creates a Redis instance based on the specified tier and memory size.
734    *
735    * <p>By default, the instance is accessible from the project's [default
736    * network](https://cloud.google.com/vpc/docs/vpc).
737    *
738    * <p>The creation is executed asynchronously and callers may check the returned operation to
739    * track its progress. Once the operation is completed the Redis instance will be fully
740    * functional. Completed longrunning.Operation will contain the new instance object in the
741    * response field.
742    *
743    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
744    * call DeleteOperation.
745    *
746    * <p>Sample code:
747    *
748    * <pre>{@code
749    * // This snippet has been automatically generated and should be regarded as a code template only.
750    * // It will require modifications to work:
751    * // - It may require correct/in-range values for request initialization.
752    * // - It may require specifying regional endpoints when creating the service client as shown in
753    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
754    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
755    *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
756    *   String instanceId = "instanceId902024336";
757    *   Instance instance = Instance.newBuilder().build();
758    *   Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
759    * }
760    * }</pre>
761    *
762    * @param parent Required. The resource name of the instance location using the form:
763    *     `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
764    * @param instanceId Required. The logical name of the Redis instance in the customer project with
765    *     the following restrictions:
766    *     <ul>
767    *       <li>Must contain only lowercase letters, numbers, and hyphens.
768    *       <li>Must start with a letter.
769    *       <li>Must be between 1-40 characters.
770    *       <li>Must end with a number or a letter.
771    *       <li>Must be unique within the customer project / location
772    *     </ul>
773    *
774    * @param instance Required. A Redis [Instance] resource
775    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
776    */
createInstanceAsync( String parent, String instanceId, Instance instance)777   public final OperationFuture<Instance, OperationMetadata> createInstanceAsync(
778       String parent, String instanceId, Instance instance) {
779     CreateInstanceRequest request =
780         CreateInstanceRequest.newBuilder()
781             .setParent(parent)
782             .setInstanceId(instanceId)
783             .setInstance(instance)
784             .build();
785     return createInstanceAsync(request);
786   }
787 
788   // AUTO-GENERATED DOCUMENTATION AND METHOD.
789   /**
790    * Creates a Redis instance based on the specified tier and memory size.
791    *
792    * <p>By default, the instance is accessible from the project's [default
793    * network](https://cloud.google.com/vpc/docs/vpc).
794    *
795    * <p>The creation is executed asynchronously and callers may check the returned operation to
796    * track its progress. Once the operation is completed the Redis instance will be fully
797    * functional. Completed longrunning.Operation will contain the new instance object in the
798    * response field.
799    *
800    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
801    * call DeleteOperation.
802    *
803    * <p>Sample code:
804    *
805    * <pre>{@code
806    * // This snippet has been automatically generated and should be regarded as a code template only.
807    * // It will require modifications to work:
808    * // - It may require correct/in-range values for request initialization.
809    * // - It may require specifying regional endpoints when creating the service client as shown in
810    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
811    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
812    *   CreateInstanceRequest request =
813    *       CreateInstanceRequest.newBuilder()
814    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
815    *           .setInstanceId("instanceId902024336")
816    *           .setInstance(Instance.newBuilder().build())
817    *           .build();
818    *   Instance response = cloudRedisClient.createInstanceAsync(request).get();
819    * }
820    * }</pre>
821    *
822    * @param request The request object containing all of the parameters for the API call.
823    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
824    */
createInstanceAsync( CreateInstanceRequest request)825   public final OperationFuture<Instance, OperationMetadata> createInstanceAsync(
826       CreateInstanceRequest request) {
827     return createInstanceOperationCallable().futureCall(request);
828   }
829 
830   // AUTO-GENERATED DOCUMENTATION AND METHOD.
831   /**
832    * Creates a Redis instance based on the specified tier and memory size.
833    *
834    * <p>By default, the instance is accessible from the project's [default
835    * network](https://cloud.google.com/vpc/docs/vpc).
836    *
837    * <p>The creation is executed asynchronously and callers may check the returned operation to
838    * track its progress. Once the operation is completed the Redis instance will be fully
839    * functional. Completed longrunning.Operation will contain the new instance object in the
840    * response field.
841    *
842    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
843    * call DeleteOperation.
844    *
845    * <p>Sample code:
846    *
847    * <pre>{@code
848    * // This snippet has been automatically generated and should be regarded as a code template only.
849    * // It will require modifications to work:
850    * // - It may require correct/in-range values for request initialization.
851    * // - It may require specifying regional endpoints when creating the service client as shown in
852    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
853    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
854    *   CreateInstanceRequest request =
855    *       CreateInstanceRequest.newBuilder()
856    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
857    *           .setInstanceId("instanceId902024336")
858    *           .setInstance(Instance.newBuilder().build())
859    *           .build();
860    *   OperationFuture<Instance, OperationMetadata> future =
861    *       cloudRedisClient.createInstanceOperationCallable().futureCall(request);
862    *   // Do something.
863    *   Instance response = future.get();
864    * }
865    * }</pre>
866    */
867   public final OperationCallable<CreateInstanceRequest, Instance, OperationMetadata>
createInstanceOperationCallable()868       createInstanceOperationCallable() {
869     return stub.createInstanceOperationCallable();
870   }
871 
872   // AUTO-GENERATED DOCUMENTATION AND METHOD.
873   /**
874    * Creates a Redis instance based on the specified tier and memory size.
875    *
876    * <p>By default, the instance is accessible from the project's [default
877    * network](https://cloud.google.com/vpc/docs/vpc).
878    *
879    * <p>The creation is executed asynchronously and callers may check the returned operation to
880    * track its progress. Once the operation is completed the Redis instance will be fully
881    * functional. Completed longrunning.Operation will contain the new instance object in the
882    * response field.
883    *
884    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
885    * call DeleteOperation.
886    *
887    * <p>Sample code:
888    *
889    * <pre>{@code
890    * // This snippet has been automatically generated and should be regarded as a code template only.
891    * // It will require modifications to work:
892    * // - It may require correct/in-range values for request initialization.
893    * // - It may require specifying regional endpoints when creating the service client as shown in
894    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
895    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
896    *   CreateInstanceRequest request =
897    *       CreateInstanceRequest.newBuilder()
898    *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
899    *           .setInstanceId("instanceId902024336")
900    *           .setInstance(Instance.newBuilder().build())
901    *           .build();
902    *   ApiFuture<Operation> future = cloudRedisClient.createInstanceCallable().futureCall(request);
903    *   // Do something.
904    *   Operation response = future.get();
905    * }
906    * }</pre>
907    */
createInstanceCallable()908   public final UnaryCallable<CreateInstanceRequest, Operation> createInstanceCallable() {
909     return stub.createInstanceCallable();
910   }
911 
912   // AUTO-GENERATED DOCUMENTATION AND METHOD.
913   /**
914    * Updates the metadata and configuration of a specific Redis instance.
915    *
916    * <p>Completed longrunning.Operation will contain the new instance object in the response field.
917    * The returned operation is automatically deleted after a few hours, so there is no need to call
918    * DeleteOperation.
919    *
920    * <p>Sample code:
921    *
922    * <pre>{@code
923    * // This snippet has been automatically generated and should be regarded as a code template only.
924    * // It will require modifications to work:
925    * // - It may require correct/in-range values for request initialization.
926    * // - It may require specifying regional endpoints when creating the service client as shown in
927    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
928    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
929    *   FieldMask updateMask = FieldMask.newBuilder().build();
930    *   Instance instance = Instance.newBuilder().build();
931    *   Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).get();
932    * }
933    * }</pre>
934    *
935    * @param updateMask Required. Mask of fields to update. At least one path must be supplied in
936    *     this field. The elements of the repeated paths field may only include these fields from
937    *     [Instance][google.cloud.redis.v1.Instance]:
938    *     <p>&#42; `displayName` &#42; `labels` &#42; `memorySizeGb` &#42; `redisConfig` &#42;
939    *     `replica_count`
940    * @param instance Required. Update description. Only fields specified in update_mask are updated.
941    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
942    */
updateInstanceAsync( FieldMask updateMask, Instance instance)943   public final OperationFuture<Instance, OperationMetadata> updateInstanceAsync(
944       FieldMask updateMask, Instance instance) {
945     UpdateInstanceRequest request =
946         UpdateInstanceRequest.newBuilder().setUpdateMask(updateMask).setInstance(instance).build();
947     return updateInstanceAsync(request);
948   }
949 
950   // AUTO-GENERATED DOCUMENTATION AND METHOD.
951   /**
952    * Updates the metadata and configuration of a specific Redis instance.
953    *
954    * <p>Completed longrunning.Operation will contain the new instance object in the response field.
955    * The returned operation is automatically deleted after a few hours, so there is no need to call
956    * DeleteOperation.
957    *
958    * <p>Sample code:
959    *
960    * <pre>{@code
961    * // This snippet has been automatically generated and should be regarded as a code template only.
962    * // It will require modifications to work:
963    * // - It may require correct/in-range values for request initialization.
964    * // - It may require specifying regional endpoints when creating the service client as shown in
965    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
966    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
967    *   UpdateInstanceRequest request =
968    *       UpdateInstanceRequest.newBuilder()
969    *           .setUpdateMask(FieldMask.newBuilder().build())
970    *           .setInstance(Instance.newBuilder().build())
971    *           .build();
972    *   Instance response = cloudRedisClient.updateInstanceAsync(request).get();
973    * }
974    * }</pre>
975    *
976    * @param request The request object containing all of the parameters for the API call.
977    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
978    */
updateInstanceAsync( UpdateInstanceRequest request)979   public final OperationFuture<Instance, OperationMetadata> updateInstanceAsync(
980       UpdateInstanceRequest request) {
981     return updateInstanceOperationCallable().futureCall(request);
982   }
983 
984   // AUTO-GENERATED DOCUMENTATION AND METHOD.
985   /**
986    * Updates the metadata and configuration of a specific Redis instance.
987    *
988    * <p>Completed longrunning.Operation will contain the new instance object in the response field.
989    * The returned operation is automatically deleted after a few hours, so there is no need to call
990    * DeleteOperation.
991    *
992    * <p>Sample code:
993    *
994    * <pre>{@code
995    * // This snippet has been automatically generated and should be regarded as a code template only.
996    * // It will require modifications to work:
997    * // - It may require correct/in-range values for request initialization.
998    * // - It may require specifying regional endpoints when creating the service client as shown in
999    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1000    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1001    *   UpdateInstanceRequest request =
1002    *       UpdateInstanceRequest.newBuilder()
1003    *           .setUpdateMask(FieldMask.newBuilder().build())
1004    *           .setInstance(Instance.newBuilder().build())
1005    *           .build();
1006    *   OperationFuture<Instance, OperationMetadata> future =
1007    *       cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
1008    *   // Do something.
1009    *   Instance response = future.get();
1010    * }
1011    * }</pre>
1012    */
1013   public final OperationCallable<UpdateInstanceRequest, Instance, OperationMetadata>
updateInstanceOperationCallable()1014       updateInstanceOperationCallable() {
1015     return stub.updateInstanceOperationCallable();
1016   }
1017 
1018   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1019   /**
1020    * Updates the metadata and configuration of a specific Redis instance.
1021    *
1022    * <p>Completed longrunning.Operation will contain the new instance object in the response field.
1023    * The returned operation is automatically deleted after a few hours, so there is no need to call
1024    * DeleteOperation.
1025    *
1026    * <p>Sample code:
1027    *
1028    * <pre>{@code
1029    * // This snippet has been automatically generated and should be regarded as a code template only.
1030    * // It will require modifications to work:
1031    * // - It may require correct/in-range values for request initialization.
1032    * // - It may require specifying regional endpoints when creating the service client as shown in
1033    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1034    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1035    *   UpdateInstanceRequest request =
1036    *       UpdateInstanceRequest.newBuilder()
1037    *           .setUpdateMask(FieldMask.newBuilder().build())
1038    *           .setInstance(Instance.newBuilder().build())
1039    *           .build();
1040    *   ApiFuture<Operation> future = cloudRedisClient.updateInstanceCallable().futureCall(request);
1041    *   // Do something.
1042    *   Operation response = future.get();
1043    * }
1044    * }</pre>
1045    */
updateInstanceCallable()1046   public final UnaryCallable<UpdateInstanceRequest, Operation> updateInstanceCallable() {
1047     return stub.updateInstanceCallable();
1048   }
1049 
1050   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1051   /**
1052    * Upgrades Redis instance to the newer Redis version specified in the request.
1053    *
1054    * <p>Sample code:
1055    *
1056    * <pre>{@code
1057    * // This snippet has been automatically generated and should be regarded as a code template only.
1058    * // It will require modifications to work:
1059    * // - It may require correct/in-range values for request initialization.
1060    * // - It may require specifying regional endpoints when creating the service client as shown in
1061    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1062    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1063    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
1064    *   String redisVersion = "redisVersion-1972584739";
1065    *   Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
1066    * }
1067    * }</pre>
1068    *
1069    * @param name Required. Redis instance resource name using the form:
1070    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1071    *     refers to a GCP region.
1072    * @param redisVersion Required. Specifies the target version of Redis software to upgrade to.
1073    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1074    */
upgradeInstanceAsync( InstanceName name, String redisVersion)1075   public final OperationFuture<Instance, OperationMetadata> upgradeInstanceAsync(
1076       InstanceName name, String redisVersion) {
1077     UpgradeInstanceRequest request =
1078         UpgradeInstanceRequest.newBuilder()
1079             .setName(name == null ? null : name.toString())
1080             .setRedisVersion(redisVersion)
1081             .build();
1082     return upgradeInstanceAsync(request);
1083   }
1084 
1085   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1086   /**
1087    * Upgrades Redis instance to the newer Redis version specified in the request.
1088    *
1089    * <p>Sample code:
1090    *
1091    * <pre>{@code
1092    * // This snippet has been automatically generated and should be regarded as a code template only.
1093    * // It will require modifications to work:
1094    * // - It may require correct/in-range values for request initialization.
1095    * // - It may require specifying regional endpoints when creating the service client as shown in
1096    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1097    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1098    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
1099    *   String redisVersion = "redisVersion-1972584739";
1100    *   Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
1101    * }
1102    * }</pre>
1103    *
1104    * @param name Required. Redis instance resource name using the form:
1105    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1106    *     refers to a GCP region.
1107    * @param redisVersion Required. Specifies the target version of Redis software to upgrade to.
1108    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1109    */
upgradeInstanceAsync( String name, String redisVersion)1110   public final OperationFuture<Instance, OperationMetadata> upgradeInstanceAsync(
1111       String name, String redisVersion) {
1112     UpgradeInstanceRequest request =
1113         UpgradeInstanceRequest.newBuilder().setName(name).setRedisVersion(redisVersion).build();
1114     return upgradeInstanceAsync(request);
1115   }
1116 
1117   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1118   /**
1119    * Upgrades Redis instance to the newer Redis version specified in the request.
1120    *
1121    * <p>Sample code:
1122    *
1123    * <pre>{@code
1124    * // This snippet has been automatically generated and should be regarded as a code template only.
1125    * // It will require modifications to work:
1126    * // - It may require correct/in-range values for request initialization.
1127    * // - It may require specifying regional endpoints when creating the service client as shown in
1128    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1129    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1130    *   UpgradeInstanceRequest request =
1131    *       UpgradeInstanceRequest.newBuilder()
1132    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1133    *           .setRedisVersion("redisVersion-1972584739")
1134    *           .build();
1135    *   Instance response = cloudRedisClient.upgradeInstanceAsync(request).get();
1136    * }
1137    * }</pre>
1138    *
1139    * @param request The request object containing all of the parameters for the API call.
1140    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1141    */
upgradeInstanceAsync( UpgradeInstanceRequest request)1142   public final OperationFuture<Instance, OperationMetadata> upgradeInstanceAsync(
1143       UpgradeInstanceRequest request) {
1144     return upgradeInstanceOperationCallable().futureCall(request);
1145   }
1146 
1147   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1148   /**
1149    * Upgrades Redis instance to the newer Redis version specified in the request.
1150    *
1151    * <p>Sample code:
1152    *
1153    * <pre>{@code
1154    * // This snippet has been automatically generated and should be regarded as a code template only.
1155    * // It will require modifications to work:
1156    * // - It may require correct/in-range values for request initialization.
1157    * // - It may require specifying regional endpoints when creating the service client as shown in
1158    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1159    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1160    *   UpgradeInstanceRequest request =
1161    *       UpgradeInstanceRequest.newBuilder()
1162    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1163    *           .setRedisVersion("redisVersion-1972584739")
1164    *           .build();
1165    *   OperationFuture<Instance, OperationMetadata> future =
1166    *       cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
1167    *   // Do something.
1168    *   Instance response = future.get();
1169    * }
1170    * }</pre>
1171    */
1172   public final OperationCallable<UpgradeInstanceRequest, Instance, OperationMetadata>
upgradeInstanceOperationCallable()1173       upgradeInstanceOperationCallable() {
1174     return stub.upgradeInstanceOperationCallable();
1175   }
1176 
1177   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1178   /**
1179    * Upgrades Redis instance to the newer Redis version specified in the request.
1180    *
1181    * <p>Sample code:
1182    *
1183    * <pre>{@code
1184    * // This snippet has been automatically generated and should be regarded as a code template only.
1185    * // It will require modifications to work:
1186    * // - It may require correct/in-range values for request initialization.
1187    * // - It may require specifying regional endpoints when creating the service client as shown in
1188    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1189    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1190    *   UpgradeInstanceRequest request =
1191    *       UpgradeInstanceRequest.newBuilder()
1192    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1193    *           .setRedisVersion("redisVersion-1972584739")
1194    *           .build();
1195    *   ApiFuture<Operation> future = cloudRedisClient.upgradeInstanceCallable().futureCall(request);
1196    *   // Do something.
1197    *   Operation response = future.get();
1198    * }
1199    * }</pre>
1200    */
upgradeInstanceCallable()1201   public final UnaryCallable<UpgradeInstanceRequest, Operation> upgradeInstanceCallable() {
1202     return stub.upgradeInstanceCallable();
1203   }
1204 
1205   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1206   /**
1207    * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
1208    *
1209    * <p>Redis may stop serving during this operation. Instance state will be IMPORTING for entire
1210    * operation. When complete, the instance will contain only data from the imported file.
1211    *
1212    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1213    * call DeleteOperation.
1214    *
1215    * <p>Sample code:
1216    *
1217    * <pre>{@code
1218    * // This snippet has been automatically generated and should be regarded as a code template only.
1219    * // It will require modifications to work:
1220    * // - It may require correct/in-range values for request initialization.
1221    * // - It may require specifying regional endpoints when creating the service client as shown in
1222    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1223    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1224    *   String name = "name3373707";
1225    *   InputConfig inputConfig = InputConfig.newBuilder().build();
1226    *   Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
1227    * }
1228    * }</pre>
1229    *
1230    * @param name Required. Redis instance resource name using the form:
1231    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1232    *     refers to a GCP region.
1233    * @param inputConfig Required. Specify data to be imported.
1234    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1235    */
importInstanceAsync( String name, InputConfig inputConfig)1236   public final OperationFuture<Instance, OperationMetadata> importInstanceAsync(
1237       String name, InputConfig inputConfig) {
1238     ImportInstanceRequest request =
1239         ImportInstanceRequest.newBuilder().setName(name).setInputConfig(inputConfig).build();
1240     return importInstanceAsync(request);
1241   }
1242 
1243   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1244   /**
1245    * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
1246    *
1247    * <p>Redis may stop serving during this operation. Instance state will be IMPORTING for entire
1248    * operation. When complete, the instance will contain only data from the imported file.
1249    *
1250    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1251    * call DeleteOperation.
1252    *
1253    * <p>Sample code:
1254    *
1255    * <pre>{@code
1256    * // This snippet has been automatically generated and should be regarded as a code template only.
1257    * // It will require modifications to work:
1258    * // - It may require correct/in-range values for request initialization.
1259    * // - It may require specifying regional endpoints when creating the service client as shown in
1260    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1261    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1262    *   ImportInstanceRequest request =
1263    *       ImportInstanceRequest.newBuilder()
1264    *           .setName("name3373707")
1265    *           .setInputConfig(InputConfig.newBuilder().build())
1266    *           .build();
1267    *   Instance response = cloudRedisClient.importInstanceAsync(request).get();
1268    * }
1269    * }</pre>
1270    *
1271    * @param request The request object containing all of the parameters for the API call.
1272    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1273    */
importInstanceAsync( ImportInstanceRequest request)1274   public final OperationFuture<Instance, OperationMetadata> importInstanceAsync(
1275       ImportInstanceRequest request) {
1276     return importInstanceOperationCallable().futureCall(request);
1277   }
1278 
1279   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1280   /**
1281    * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
1282    *
1283    * <p>Redis may stop serving during this operation. Instance state will be IMPORTING for entire
1284    * operation. When complete, the instance will contain only data from the imported file.
1285    *
1286    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1287    * call DeleteOperation.
1288    *
1289    * <p>Sample code:
1290    *
1291    * <pre>{@code
1292    * // This snippet has been automatically generated and should be regarded as a code template only.
1293    * // It will require modifications to work:
1294    * // - It may require correct/in-range values for request initialization.
1295    * // - It may require specifying regional endpoints when creating the service client as shown in
1296    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1297    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1298    *   ImportInstanceRequest request =
1299    *       ImportInstanceRequest.newBuilder()
1300    *           .setName("name3373707")
1301    *           .setInputConfig(InputConfig.newBuilder().build())
1302    *           .build();
1303    *   OperationFuture<Instance, OperationMetadata> future =
1304    *       cloudRedisClient.importInstanceOperationCallable().futureCall(request);
1305    *   // Do something.
1306    *   Instance response = future.get();
1307    * }
1308    * }</pre>
1309    */
1310   public final OperationCallable<ImportInstanceRequest, Instance, OperationMetadata>
importInstanceOperationCallable()1311       importInstanceOperationCallable() {
1312     return stub.importInstanceOperationCallable();
1313   }
1314 
1315   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1316   /**
1317    * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
1318    *
1319    * <p>Redis may stop serving during this operation. Instance state will be IMPORTING for entire
1320    * operation. When complete, the instance will contain only data from the imported file.
1321    *
1322    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1323    * call DeleteOperation.
1324    *
1325    * <p>Sample code:
1326    *
1327    * <pre>{@code
1328    * // This snippet has been automatically generated and should be regarded as a code template only.
1329    * // It will require modifications to work:
1330    * // - It may require correct/in-range values for request initialization.
1331    * // - It may require specifying regional endpoints when creating the service client as shown in
1332    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1333    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1334    *   ImportInstanceRequest request =
1335    *       ImportInstanceRequest.newBuilder()
1336    *           .setName("name3373707")
1337    *           .setInputConfig(InputConfig.newBuilder().build())
1338    *           .build();
1339    *   ApiFuture<Operation> future = cloudRedisClient.importInstanceCallable().futureCall(request);
1340    *   // Do something.
1341    *   Operation response = future.get();
1342    * }
1343    * }</pre>
1344    */
importInstanceCallable()1345   public final UnaryCallable<ImportInstanceRequest, Operation> importInstanceCallable() {
1346     return stub.importInstanceCallable();
1347   }
1348 
1349   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1350   /**
1351    * Export Redis instance data into a Redis RDB format file in Cloud Storage.
1352    *
1353    * <p>Redis will continue serving during this operation.
1354    *
1355    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1356    * call DeleteOperation.
1357    *
1358    * <p>Sample code:
1359    *
1360    * <pre>{@code
1361    * // This snippet has been automatically generated and should be regarded as a code template only.
1362    * // It will require modifications to work:
1363    * // - It may require correct/in-range values for request initialization.
1364    * // - It may require specifying regional endpoints when creating the service client as shown in
1365    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1366    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1367    *   String name = "name3373707";
1368    *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
1369    *   Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
1370    * }
1371    * }</pre>
1372    *
1373    * @param name Required. Redis instance resource name using the form:
1374    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1375    *     refers to a GCP region.
1376    * @param outputConfig Required. Specify data to be exported.
1377    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1378    */
exportInstanceAsync( String name, OutputConfig outputConfig)1379   public final OperationFuture<Instance, OperationMetadata> exportInstanceAsync(
1380       String name, OutputConfig outputConfig) {
1381     ExportInstanceRequest request =
1382         ExportInstanceRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build();
1383     return exportInstanceAsync(request);
1384   }
1385 
1386   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1387   /**
1388    * Export Redis instance data into a Redis RDB format file in Cloud Storage.
1389    *
1390    * <p>Redis will continue serving during this operation.
1391    *
1392    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1393    * call DeleteOperation.
1394    *
1395    * <p>Sample code:
1396    *
1397    * <pre>{@code
1398    * // This snippet has been automatically generated and should be regarded as a code template only.
1399    * // It will require modifications to work:
1400    * // - It may require correct/in-range values for request initialization.
1401    * // - It may require specifying regional endpoints when creating the service client as shown in
1402    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1403    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1404    *   ExportInstanceRequest request =
1405    *       ExportInstanceRequest.newBuilder()
1406    *           .setName("name3373707")
1407    *           .setOutputConfig(OutputConfig.newBuilder().build())
1408    *           .build();
1409    *   Instance response = cloudRedisClient.exportInstanceAsync(request).get();
1410    * }
1411    * }</pre>
1412    *
1413    * @param request The request object containing all of the parameters for the API call.
1414    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1415    */
exportInstanceAsync( ExportInstanceRequest request)1416   public final OperationFuture<Instance, OperationMetadata> exportInstanceAsync(
1417       ExportInstanceRequest request) {
1418     return exportInstanceOperationCallable().futureCall(request);
1419   }
1420 
1421   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1422   /**
1423    * Export Redis instance data into a Redis RDB format file in Cloud Storage.
1424    *
1425    * <p>Redis will continue serving during this operation.
1426    *
1427    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1428    * call DeleteOperation.
1429    *
1430    * <p>Sample code:
1431    *
1432    * <pre>{@code
1433    * // This snippet has been automatically generated and should be regarded as a code template only.
1434    * // It will require modifications to work:
1435    * // - It may require correct/in-range values for request initialization.
1436    * // - It may require specifying regional endpoints when creating the service client as shown in
1437    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1438    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1439    *   ExportInstanceRequest request =
1440    *       ExportInstanceRequest.newBuilder()
1441    *           .setName("name3373707")
1442    *           .setOutputConfig(OutputConfig.newBuilder().build())
1443    *           .build();
1444    *   OperationFuture<Instance, OperationMetadata> future =
1445    *       cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
1446    *   // Do something.
1447    *   Instance response = future.get();
1448    * }
1449    * }</pre>
1450    */
1451   public final OperationCallable<ExportInstanceRequest, Instance, OperationMetadata>
exportInstanceOperationCallable()1452       exportInstanceOperationCallable() {
1453     return stub.exportInstanceOperationCallable();
1454   }
1455 
1456   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1457   /**
1458    * Export Redis instance data into a Redis RDB format file in Cloud Storage.
1459    *
1460    * <p>Redis will continue serving during this operation.
1461    *
1462    * <p>The returned operation is automatically deleted after a few hours, so there is no need to
1463    * call DeleteOperation.
1464    *
1465    * <p>Sample code:
1466    *
1467    * <pre>{@code
1468    * // This snippet has been automatically generated and should be regarded as a code template only.
1469    * // It will require modifications to work:
1470    * // - It may require correct/in-range values for request initialization.
1471    * // - It may require specifying regional endpoints when creating the service client as shown in
1472    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1473    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1474    *   ExportInstanceRequest request =
1475    *       ExportInstanceRequest.newBuilder()
1476    *           .setName("name3373707")
1477    *           .setOutputConfig(OutputConfig.newBuilder().build())
1478    *           .build();
1479    *   ApiFuture<Operation> future = cloudRedisClient.exportInstanceCallable().futureCall(request);
1480    *   // Do something.
1481    *   Operation response = future.get();
1482    * }
1483    * }</pre>
1484    */
exportInstanceCallable()1485   public final UnaryCallable<ExportInstanceRequest, Operation> exportInstanceCallable() {
1486     return stub.exportInstanceCallable();
1487   }
1488 
1489   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1490   /**
1491    * Initiates a failover of the primary node to current replica node for a specific STANDARD tier
1492    * Cloud Memorystore for Redis instance.
1493    *
1494    * <p>Sample code:
1495    *
1496    * <pre>{@code
1497    * // This snippet has been automatically generated and should be regarded as a code template only.
1498    * // It will require modifications to work:
1499    * // - It may require correct/in-range values for request initialization.
1500    * // - It may require specifying regional endpoints when creating the service client as shown in
1501    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1502    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1503    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
1504    *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
1505    *       FailoverInstanceRequest.DataProtectionMode.forNumber(0);
1506    *   Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
1507    * }
1508    * }</pre>
1509    *
1510    * @param name Required. Redis instance resource name using the form:
1511    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1512    *     refers to a GCP region.
1513    * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
1514    *     If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
1515    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1516    */
failoverInstanceAsync( InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)1517   public final OperationFuture<Instance, OperationMetadata> failoverInstanceAsync(
1518       InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) {
1519     FailoverInstanceRequest request =
1520         FailoverInstanceRequest.newBuilder()
1521             .setName(name == null ? null : name.toString())
1522             .setDataProtectionMode(dataProtectionMode)
1523             .build();
1524     return failoverInstanceAsync(request);
1525   }
1526 
1527   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1528   /**
1529    * Initiates a failover of the primary node to current replica node for a specific STANDARD tier
1530    * Cloud Memorystore for Redis instance.
1531    *
1532    * <p>Sample code:
1533    *
1534    * <pre>{@code
1535    * // This snippet has been automatically generated and should be regarded as a code template only.
1536    * // It will require modifications to work:
1537    * // - It may require correct/in-range values for request initialization.
1538    * // - It may require specifying regional endpoints when creating the service client as shown in
1539    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1540    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1541    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
1542    *   FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
1543    *       FailoverInstanceRequest.DataProtectionMode.forNumber(0);
1544    *   Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
1545    * }
1546    * }</pre>
1547    *
1548    * @param name Required. Redis instance resource name using the form:
1549    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1550    *     refers to a GCP region.
1551    * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
1552    *     If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
1553    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1554    */
failoverInstanceAsync( String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)1555   public final OperationFuture<Instance, OperationMetadata> failoverInstanceAsync(
1556       String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) {
1557     FailoverInstanceRequest request =
1558         FailoverInstanceRequest.newBuilder()
1559             .setName(name)
1560             .setDataProtectionMode(dataProtectionMode)
1561             .build();
1562     return failoverInstanceAsync(request);
1563   }
1564 
1565   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1566   /**
1567    * Initiates a failover of the primary node to current replica node for a specific STANDARD tier
1568    * Cloud Memorystore for Redis instance.
1569    *
1570    * <p>Sample code:
1571    *
1572    * <pre>{@code
1573    * // This snippet has been automatically generated and should be regarded as a code template only.
1574    * // It will require modifications to work:
1575    * // - It may require correct/in-range values for request initialization.
1576    * // - It may require specifying regional endpoints when creating the service client as shown in
1577    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1578    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1579    *   FailoverInstanceRequest request =
1580    *       FailoverInstanceRequest.newBuilder()
1581    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1582    *           .build();
1583    *   Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
1584    * }
1585    * }</pre>
1586    *
1587    * @param request The request object containing all of the parameters for the API call.
1588    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1589    */
failoverInstanceAsync( FailoverInstanceRequest request)1590   public final OperationFuture<Instance, OperationMetadata> failoverInstanceAsync(
1591       FailoverInstanceRequest request) {
1592     return failoverInstanceOperationCallable().futureCall(request);
1593   }
1594 
1595   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1596   /**
1597    * Initiates a failover of the primary node to current replica node for a specific STANDARD tier
1598    * Cloud Memorystore for Redis instance.
1599    *
1600    * <p>Sample code:
1601    *
1602    * <pre>{@code
1603    * // This snippet has been automatically generated and should be regarded as a code template only.
1604    * // It will require modifications to work:
1605    * // - It may require correct/in-range values for request initialization.
1606    * // - It may require specifying regional endpoints when creating the service client as shown in
1607    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1608    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1609    *   FailoverInstanceRequest request =
1610    *       FailoverInstanceRequest.newBuilder()
1611    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1612    *           .build();
1613    *   OperationFuture<Instance, OperationMetadata> future =
1614    *       cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
1615    *   // Do something.
1616    *   Instance response = future.get();
1617    * }
1618    * }</pre>
1619    */
1620   public final OperationCallable<FailoverInstanceRequest, Instance, OperationMetadata>
failoverInstanceOperationCallable()1621       failoverInstanceOperationCallable() {
1622     return stub.failoverInstanceOperationCallable();
1623   }
1624 
1625   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1626   /**
1627    * Initiates a failover of the primary node to current replica node for a specific STANDARD tier
1628    * Cloud Memorystore for Redis instance.
1629    *
1630    * <p>Sample code:
1631    *
1632    * <pre>{@code
1633    * // This snippet has been automatically generated and should be regarded as a code template only.
1634    * // It will require modifications to work:
1635    * // - It may require correct/in-range values for request initialization.
1636    * // - It may require specifying regional endpoints when creating the service client as shown in
1637    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1638    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1639    *   FailoverInstanceRequest request =
1640    *       FailoverInstanceRequest.newBuilder()
1641    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1642    *           .build();
1643    *   ApiFuture<Operation> future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
1644    *   // Do something.
1645    *   Operation response = future.get();
1646    * }
1647    * }</pre>
1648    */
failoverInstanceCallable()1649   public final UnaryCallable<FailoverInstanceRequest, Operation> failoverInstanceCallable() {
1650     return stub.failoverInstanceCallable();
1651   }
1652 
1653   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1654   /**
1655    * Deletes a specific Redis instance. Instance stops serving and data is deleted.
1656    *
1657    * <p>Sample code:
1658    *
1659    * <pre>{@code
1660    * // This snippet has been automatically generated and should be regarded as a code template only.
1661    * // It will require modifications to work:
1662    * // - It may require correct/in-range values for request initialization.
1663    * // - It may require specifying regional endpoints when creating the service client as shown in
1664    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1665    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1666    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
1667    *   cloudRedisClient.deleteInstanceAsync(name).get();
1668    * }
1669    * }</pre>
1670    *
1671    * @param name Required. Redis instance resource name using the form:
1672    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1673    *     refers to a GCP region.
1674    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1675    */
deleteInstanceAsync(InstanceName name)1676   public final OperationFuture<Empty, OperationMetadata> deleteInstanceAsync(InstanceName name) {
1677     DeleteInstanceRequest request =
1678         DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
1679     return deleteInstanceAsync(request);
1680   }
1681 
1682   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1683   /**
1684    * Deletes a specific Redis instance. Instance stops serving and data is deleted.
1685    *
1686    * <p>Sample code:
1687    *
1688    * <pre>{@code
1689    * // This snippet has been automatically generated and should be regarded as a code template only.
1690    * // It will require modifications to work:
1691    * // - It may require correct/in-range values for request initialization.
1692    * // - It may require specifying regional endpoints when creating the service client as shown in
1693    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1694    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1695    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
1696    *   cloudRedisClient.deleteInstanceAsync(name).get();
1697    * }
1698    * }</pre>
1699    *
1700    * @param name Required. Redis instance resource name using the form:
1701    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1702    *     refers to a GCP region.
1703    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1704    */
deleteInstanceAsync(String name)1705   public final OperationFuture<Empty, OperationMetadata> deleteInstanceAsync(String name) {
1706     DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build();
1707     return deleteInstanceAsync(request);
1708   }
1709 
1710   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1711   /**
1712    * Deletes a specific Redis instance. Instance stops serving and data is deleted.
1713    *
1714    * <p>Sample code:
1715    *
1716    * <pre>{@code
1717    * // This snippet has been automatically generated and should be regarded as a code template only.
1718    * // It will require modifications to work:
1719    * // - It may require correct/in-range values for request initialization.
1720    * // - It may require specifying regional endpoints when creating the service client as shown in
1721    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1722    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1723    *   DeleteInstanceRequest request =
1724    *       DeleteInstanceRequest.newBuilder()
1725    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1726    *           .build();
1727    *   cloudRedisClient.deleteInstanceAsync(request).get();
1728    * }
1729    * }</pre>
1730    *
1731    * @param request The request object containing all of the parameters for the API call.
1732    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1733    */
deleteInstanceAsync( DeleteInstanceRequest request)1734   public final OperationFuture<Empty, OperationMetadata> deleteInstanceAsync(
1735       DeleteInstanceRequest request) {
1736     return deleteInstanceOperationCallable().futureCall(request);
1737   }
1738 
1739   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1740   /**
1741    * Deletes a specific Redis instance. Instance stops serving and data is deleted.
1742    *
1743    * <p>Sample code:
1744    *
1745    * <pre>{@code
1746    * // This snippet has been automatically generated and should be regarded as a code template only.
1747    * // It will require modifications to work:
1748    * // - It may require correct/in-range values for request initialization.
1749    * // - It may require specifying regional endpoints when creating the service client as shown in
1750    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1751    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1752    *   DeleteInstanceRequest request =
1753    *       DeleteInstanceRequest.newBuilder()
1754    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1755    *           .build();
1756    *   OperationFuture<Empty, OperationMetadata> future =
1757    *       cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
1758    *   // Do something.
1759    *   future.get();
1760    * }
1761    * }</pre>
1762    */
1763   public final OperationCallable<DeleteInstanceRequest, Empty, OperationMetadata>
deleteInstanceOperationCallable()1764       deleteInstanceOperationCallable() {
1765     return stub.deleteInstanceOperationCallable();
1766   }
1767 
1768   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1769   /**
1770    * Deletes a specific Redis instance. Instance stops serving and data is deleted.
1771    *
1772    * <p>Sample code:
1773    *
1774    * <pre>{@code
1775    * // This snippet has been automatically generated and should be regarded as a code template only.
1776    * // It will require modifications to work:
1777    * // - It may require correct/in-range values for request initialization.
1778    * // - It may require specifying regional endpoints when creating the service client as shown in
1779    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1780    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1781    *   DeleteInstanceRequest request =
1782    *       DeleteInstanceRequest.newBuilder()
1783    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1784    *           .build();
1785    *   ApiFuture<Operation> future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
1786    *   // Do something.
1787    *   future.get();
1788    * }
1789    * }</pre>
1790    */
deleteInstanceCallable()1791   public final UnaryCallable<DeleteInstanceRequest, Operation> deleteInstanceCallable() {
1792     return stub.deleteInstanceCallable();
1793   }
1794 
1795   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1796   /**
1797    * Reschedule maintenance for a given instance in a given project and location.
1798    *
1799    * <p>Sample code:
1800    *
1801    * <pre>{@code
1802    * // This snippet has been automatically generated and should be regarded as a code template only.
1803    * // It will require modifications to work:
1804    * // - It may require correct/in-range values for request initialization.
1805    * // - It may require specifying regional endpoints when creating the service client as shown in
1806    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1807    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1808    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
1809    *   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
1810    *       RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
1811    *   Timestamp scheduleTime = Timestamp.newBuilder().build();
1812    *   Instance response =
1813    *       cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
1814    * }
1815    * }</pre>
1816    *
1817    * @param name Required. Redis instance resource name using the form:
1818    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1819    *     refers to a GCP region.
1820    * @param rescheduleType Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time
1821    *     as well.
1822    * @param scheduleTime Optional. Timestamp when the maintenance shall be rescheduled to if
1823    *     reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.
1824    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1825    */
rescheduleMaintenanceAsync( InstanceName name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)1826   public final OperationFuture<Instance, OperationMetadata> rescheduleMaintenanceAsync(
1827       InstanceName name,
1828       RescheduleMaintenanceRequest.RescheduleType rescheduleType,
1829       Timestamp scheduleTime) {
1830     RescheduleMaintenanceRequest request =
1831         RescheduleMaintenanceRequest.newBuilder()
1832             .setName(name == null ? null : name.toString())
1833             .setRescheduleType(rescheduleType)
1834             .setScheduleTime(scheduleTime)
1835             .build();
1836     return rescheduleMaintenanceAsync(request);
1837   }
1838 
1839   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1840   /**
1841    * Reschedule maintenance for a given instance in a given project and location.
1842    *
1843    * <p>Sample code:
1844    *
1845    * <pre>{@code
1846    * // This snippet has been automatically generated and should be regarded as a code template only.
1847    * // It will require modifications to work:
1848    * // - It may require correct/in-range values for request initialization.
1849    * // - It may require specifying regional endpoints when creating the service client as shown in
1850    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1851    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1852    *   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
1853    *   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
1854    *       RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
1855    *   Timestamp scheduleTime = Timestamp.newBuilder().build();
1856    *   Instance response =
1857    *       cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
1858    * }
1859    * }</pre>
1860    *
1861    * @param name Required. Redis instance resource name using the form:
1862    *     `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
1863    *     refers to a GCP region.
1864    * @param rescheduleType Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time
1865    *     as well.
1866    * @param scheduleTime Optional. Timestamp when the maintenance shall be rescheduled to if
1867    *     reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.
1868    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1869    */
rescheduleMaintenanceAsync( String name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)1870   public final OperationFuture<Instance, OperationMetadata> rescheduleMaintenanceAsync(
1871       String name,
1872       RescheduleMaintenanceRequest.RescheduleType rescheduleType,
1873       Timestamp scheduleTime) {
1874     RescheduleMaintenanceRequest request =
1875         RescheduleMaintenanceRequest.newBuilder()
1876             .setName(name)
1877             .setRescheduleType(rescheduleType)
1878             .setScheduleTime(scheduleTime)
1879             .build();
1880     return rescheduleMaintenanceAsync(request);
1881   }
1882 
1883   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1884   /**
1885    * Reschedule maintenance for a given instance in a given project and location.
1886    *
1887    * <p>Sample code:
1888    *
1889    * <pre>{@code
1890    * // This snippet has been automatically generated and should be regarded as a code template only.
1891    * // It will require modifications to work:
1892    * // - It may require correct/in-range values for request initialization.
1893    * // - It may require specifying regional endpoints when creating the service client as shown in
1894    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1895    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1896    *   RescheduleMaintenanceRequest request =
1897    *       RescheduleMaintenanceRequest.newBuilder()
1898    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1899    *           .setScheduleTime(Timestamp.newBuilder().build())
1900    *           .build();
1901    *   Instance response = cloudRedisClient.rescheduleMaintenanceAsync(request).get();
1902    * }
1903    * }</pre>
1904    *
1905    * @param request The request object containing all of the parameters for the API call.
1906    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1907    */
rescheduleMaintenanceAsync( RescheduleMaintenanceRequest request)1908   public final OperationFuture<Instance, OperationMetadata> rescheduleMaintenanceAsync(
1909       RescheduleMaintenanceRequest request) {
1910     return rescheduleMaintenanceOperationCallable().futureCall(request);
1911   }
1912 
1913   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1914   /**
1915    * Reschedule maintenance for a given instance in a given project and location.
1916    *
1917    * <p>Sample code:
1918    *
1919    * <pre>{@code
1920    * // This snippet has been automatically generated and should be regarded as a code template only.
1921    * // It will require modifications to work:
1922    * // - It may require correct/in-range values for request initialization.
1923    * // - It may require specifying regional endpoints when creating the service client as shown in
1924    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1925    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1926    *   RescheduleMaintenanceRequest request =
1927    *       RescheduleMaintenanceRequest.newBuilder()
1928    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1929    *           .setScheduleTime(Timestamp.newBuilder().build())
1930    *           .build();
1931    *   OperationFuture<Instance, OperationMetadata> future =
1932    *       cloudRedisClient.rescheduleMaintenanceOperationCallable().futureCall(request);
1933    *   // Do something.
1934    *   Instance response = future.get();
1935    * }
1936    * }</pre>
1937    */
1938   public final OperationCallable<RescheduleMaintenanceRequest, Instance, OperationMetadata>
rescheduleMaintenanceOperationCallable()1939       rescheduleMaintenanceOperationCallable() {
1940     return stub.rescheduleMaintenanceOperationCallable();
1941   }
1942 
1943   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1944   /**
1945    * Reschedule maintenance for a given instance in a given project and location.
1946    *
1947    * <p>Sample code:
1948    *
1949    * <pre>{@code
1950    * // This snippet has been automatically generated and should be regarded as a code template only.
1951    * // It will require modifications to work:
1952    * // - It may require correct/in-range values for request initialization.
1953    * // - It may require specifying regional endpoints when creating the service client as shown in
1954    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1955    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1956    *   RescheduleMaintenanceRequest request =
1957    *       RescheduleMaintenanceRequest.newBuilder()
1958    *           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
1959    *           .setScheduleTime(Timestamp.newBuilder().build())
1960    *           .build();
1961    *   ApiFuture<Operation> future =
1962    *       cloudRedisClient.rescheduleMaintenanceCallable().futureCall(request);
1963    *   // Do something.
1964    *   Operation response = future.get();
1965    * }
1966    * }</pre>
1967    */
1968   public final UnaryCallable<RescheduleMaintenanceRequest, Operation>
rescheduleMaintenanceCallable()1969       rescheduleMaintenanceCallable() {
1970     return stub.rescheduleMaintenanceCallable();
1971   }
1972 
1973   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1974   /**
1975    * Lists information about the supported locations for this service.
1976    *
1977    * <p>Sample code:
1978    *
1979    * <pre>{@code
1980    * // This snippet has been automatically generated and should be regarded as a code template only.
1981    * // It will require modifications to work:
1982    * // - It may require correct/in-range values for request initialization.
1983    * // - It may require specifying regional endpoints when creating the service client as shown in
1984    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1985    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
1986    *   ListLocationsRequest request =
1987    *       ListLocationsRequest.newBuilder()
1988    *           .setName("name3373707")
1989    *           .setFilter("filter-1274492040")
1990    *           .setPageSize(883849137)
1991    *           .setPageToken("pageToken873572522")
1992    *           .build();
1993    *   for (Location element : cloudRedisClient.listLocations(request).iterateAll()) {
1994    *     // doThingsWith(element);
1995    *   }
1996    * }
1997    * }</pre>
1998    *
1999    * @param request The request object containing all of the parameters for the API call.
2000    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2001    */
listLocations(ListLocationsRequest request)2002   public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
2003     return listLocationsPagedCallable().call(request);
2004   }
2005 
2006   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2007   /**
2008    * Lists information about the supported locations for this service.
2009    *
2010    * <p>Sample code:
2011    *
2012    * <pre>{@code
2013    * // This snippet has been automatically generated and should be regarded as a code template only.
2014    * // It will require modifications to work:
2015    * // - It may require correct/in-range values for request initialization.
2016    * // - It may require specifying regional endpoints when creating the service client as shown in
2017    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2018    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
2019    *   ListLocationsRequest request =
2020    *       ListLocationsRequest.newBuilder()
2021    *           .setName("name3373707")
2022    *           .setFilter("filter-1274492040")
2023    *           .setPageSize(883849137)
2024    *           .setPageToken("pageToken873572522")
2025    *           .build();
2026    *   ApiFuture<Location> future =
2027    *       cloudRedisClient.listLocationsPagedCallable().futureCall(request);
2028    *   // Do something.
2029    *   for (Location element : future.get().iterateAll()) {
2030    *     // doThingsWith(element);
2031    *   }
2032    * }
2033    * }</pre>
2034    */
2035   public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable()2036       listLocationsPagedCallable() {
2037     return stub.listLocationsPagedCallable();
2038   }
2039 
2040   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2041   /**
2042    * Lists information about the supported locations for this service.
2043    *
2044    * <p>Sample code:
2045    *
2046    * <pre>{@code
2047    * // This snippet has been automatically generated and should be regarded as a code template only.
2048    * // It will require modifications to work:
2049    * // - It may require correct/in-range values for request initialization.
2050    * // - It may require specifying regional endpoints when creating the service client as shown in
2051    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2052    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
2053    *   ListLocationsRequest request =
2054    *       ListLocationsRequest.newBuilder()
2055    *           .setName("name3373707")
2056    *           .setFilter("filter-1274492040")
2057    *           .setPageSize(883849137)
2058    *           .setPageToken("pageToken873572522")
2059    *           .build();
2060    *   while (true) {
2061    *     ListLocationsResponse response = cloudRedisClient.listLocationsCallable().call(request);
2062    *     for (Location element : response.getLocationsList()) {
2063    *       // doThingsWith(element);
2064    *     }
2065    *     String nextPageToken = response.getNextPageToken();
2066    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
2067    *       request = request.toBuilder().setPageToken(nextPageToken).build();
2068    *     } else {
2069    *       break;
2070    *     }
2071    *   }
2072    * }
2073    * }</pre>
2074    */
listLocationsCallable()2075   public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
2076     return stub.listLocationsCallable();
2077   }
2078 
2079   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2080   /**
2081    * Gets information about a location.
2082    *
2083    * <p>Sample code:
2084    *
2085    * <pre>{@code
2086    * // This snippet has been automatically generated and should be regarded as a code template only.
2087    * // It will require modifications to work:
2088    * // - It may require correct/in-range values for request initialization.
2089    * // - It may require specifying regional endpoints when creating the service client as shown in
2090    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2091    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
2092    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2093    *   Location response = cloudRedisClient.getLocation(request);
2094    * }
2095    * }</pre>
2096    *
2097    * @param request The request object containing all of the parameters for the API call.
2098    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2099    */
getLocation(GetLocationRequest request)2100   public final Location getLocation(GetLocationRequest request) {
2101     return getLocationCallable().call(request);
2102   }
2103 
2104   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2105   /**
2106    * Gets information about a location.
2107    *
2108    * <p>Sample code:
2109    *
2110    * <pre>{@code
2111    * // This snippet has been automatically generated and should be regarded as a code template only.
2112    * // It will require modifications to work:
2113    * // - It may require correct/in-range values for request initialization.
2114    * // - It may require specifying regional endpoints when creating the service client as shown in
2115    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2116    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
2117    *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
2118    *   ApiFuture<Location> future = cloudRedisClient.getLocationCallable().futureCall(request);
2119    *   // Do something.
2120    *   Location response = future.get();
2121    * }
2122    * }</pre>
2123    */
getLocationCallable()2124   public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
2125     return stub.getLocationCallable();
2126   }
2127 
2128   @Override
close()2129   public final void close() {
2130     stub.close();
2131   }
2132 
2133   @Override
shutdown()2134   public void shutdown() {
2135     stub.shutdown();
2136   }
2137 
2138   @Override
isShutdown()2139   public boolean isShutdown() {
2140     return stub.isShutdown();
2141   }
2142 
2143   @Override
isTerminated()2144   public boolean isTerminated() {
2145     return stub.isTerminated();
2146   }
2147 
2148   @Override
shutdownNow()2149   public void shutdownNow() {
2150     stub.shutdownNow();
2151   }
2152 
2153   @Override
awaitTermination(long duration, TimeUnit unit)2154   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
2155     return stub.awaitTermination(duration, unit);
2156   }
2157 
2158   public static class ListInstancesPagedResponse
2159       extends AbstractPagedListResponse<
2160           ListInstancesRequest,
2161           ListInstancesResponse,
2162           Instance,
2163           ListInstancesPage,
2164           ListInstancesFixedSizeCollection> {
2165 
createAsync( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ApiFuture<ListInstancesResponse> futureResponse)2166     public static ApiFuture<ListInstancesPagedResponse> createAsync(
2167         PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context,
2168         ApiFuture<ListInstancesResponse> futureResponse) {
2169       ApiFuture<ListInstancesPage> futurePage =
2170           ListInstancesPage.createEmptyPage().createPageAsync(context, futureResponse);
2171       return ApiFutures.transform(
2172           futurePage,
2173           input -> new ListInstancesPagedResponse(input),
2174           MoreExecutors.directExecutor());
2175     }
2176 
ListInstancesPagedResponse(ListInstancesPage page)2177     private ListInstancesPagedResponse(ListInstancesPage page) {
2178       super(page, ListInstancesFixedSizeCollection.createEmptyCollection());
2179     }
2180   }
2181 
2182   public static class ListInstancesPage
2183       extends AbstractPage<
2184           ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage> {
2185 
ListInstancesPage( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ListInstancesResponse response)2186     private ListInstancesPage(
2187         PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context,
2188         ListInstancesResponse response) {
2189       super(context, response);
2190     }
2191 
createEmptyPage()2192     private static ListInstancesPage createEmptyPage() {
2193       return new ListInstancesPage(null, null);
2194     }
2195 
2196     @Override
createPage( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ListInstancesResponse response)2197     protected ListInstancesPage createPage(
2198         PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context,
2199         ListInstancesResponse response) {
2200       return new ListInstancesPage(context, response);
2201     }
2202 
2203     @Override
createPageAsync( PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context, ApiFuture<ListInstancesResponse> futureResponse)2204     public ApiFuture<ListInstancesPage> createPageAsync(
2205         PageContext<ListInstancesRequest, ListInstancesResponse, Instance> context,
2206         ApiFuture<ListInstancesResponse> futureResponse) {
2207       return super.createPageAsync(context, futureResponse);
2208     }
2209   }
2210 
2211   public static class ListInstancesFixedSizeCollection
2212       extends AbstractFixedSizeCollection<
2213           ListInstancesRequest,
2214           ListInstancesResponse,
2215           Instance,
2216           ListInstancesPage,
2217           ListInstancesFixedSizeCollection> {
2218 
ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize)2219     private ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize) {
2220       super(pages, collectionSize);
2221     }
2222 
createEmptyCollection()2223     private static ListInstancesFixedSizeCollection createEmptyCollection() {
2224       return new ListInstancesFixedSizeCollection(null, 0);
2225     }
2226 
2227     @Override
createCollection( List<ListInstancesPage> pages, int collectionSize)2228     protected ListInstancesFixedSizeCollection createCollection(
2229         List<ListInstancesPage> pages, int collectionSize) {
2230       return new ListInstancesFixedSizeCollection(pages, collectionSize);
2231     }
2232   }
2233 
2234   public static class ListLocationsPagedResponse
2235       extends AbstractPagedListResponse<
2236           ListLocationsRequest,
2237           ListLocationsResponse,
2238           Location,
2239           ListLocationsPage,
2240           ListLocationsFixedSizeCollection> {
2241 
createAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2242     public static ApiFuture<ListLocationsPagedResponse> createAsync(
2243         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2244         ApiFuture<ListLocationsResponse> futureResponse) {
2245       ApiFuture<ListLocationsPage> futurePage =
2246           ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
2247       return ApiFutures.transform(
2248           futurePage,
2249           input -> new ListLocationsPagedResponse(input),
2250           MoreExecutors.directExecutor());
2251     }
2252 
ListLocationsPagedResponse(ListLocationsPage page)2253     private ListLocationsPagedResponse(ListLocationsPage page) {
2254       super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
2255     }
2256   }
2257 
2258   public static class ListLocationsPage
2259       extends AbstractPage<
2260           ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
2261 
ListLocationsPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2262     private ListLocationsPage(
2263         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2264         ListLocationsResponse response) {
2265       super(context, response);
2266     }
2267 
createEmptyPage()2268     private static ListLocationsPage createEmptyPage() {
2269       return new ListLocationsPage(null, null);
2270     }
2271 
2272     @Override
createPage( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ListLocationsResponse response)2273     protected ListLocationsPage createPage(
2274         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2275         ListLocationsResponse response) {
2276       return new ListLocationsPage(context, response);
2277     }
2278 
2279     @Override
createPageAsync( PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, ApiFuture<ListLocationsResponse> futureResponse)2280     public ApiFuture<ListLocationsPage> createPageAsync(
2281         PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
2282         ApiFuture<ListLocationsResponse> futureResponse) {
2283       return super.createPageAsync(context, futureResponse);
2284     }
2285   }
2286 
2287   public static class ListLocationsFixedSizeCollection
2288       extends AbstractFixedSizeCollection<
2289           ListLocationsRequest,
2290           ListLocationsResponse,
2291           Location,
2292           ListLocationsPage,
2293           ListLocationsFixedSizeCollection> {
2294 
ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize)2295     private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
2296       super(pages, collectionSize);
2297     }
2298 
createEmptyCollection()2299     private static ListLocationsFixedSizeCollection createEmptyCollection() {
2300       return new ListLocationsFixedSizeCollection(null, 0);
2301     }
2302 
2303     @Override
createCollection( List<ListLocationsPage> pages, int collectionSize)2304     protected ListLocationsFixedSizeCollection createCollection(
2305         List<ListLocationsPage> pages, int collectionSize) {
2306       return new ListLocationsFixedSizeCollection(pages, collectionSize);
2307     }
2308   }
2309 }
2310