• 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.compute.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.longrunning.OperationFuture;
24 import com.google.api.gax.paging.AbstractFixedSizeCollection;
25 import com.google.api.gax.paging.AbstractPage;
26 import com.google.api.gax.paging.AbstractPagedListResponse;
27 import com.google.api.gax.rpc.OperationCallable;
28 import com.google.api.gax.rpc.PageContext;
29 import com.google.api.gax.rpc.UnaryCallable;
30 import com.google.cloud.compute.v1.stub.RegionDisksStub;
31 import com.google.cloud.compute.v1.stub.RegionDisksStubSettings;
32 import com.google.common.util.concurrent.MoreExecutors;
33 import java.io.IOException;
34 import java.util.List;
35 import java.util.concurrent.TimeUnit;
36 import javax.annotation.Generated;
37 
38 // AUTO-GENERATED DOCUMENTATION AND CLASS.
39 /**
40  * Service Description: The RegionDisks API.
41  *
42  * <p>This class provides the ability to make remote calls to the backing service through method
43  * calls that map to API methods. Sample code to get started:
44  *
45  * <pre>{@code
46  * // This snippet has been automatically generated and should be regarded as a code template only.
47  * // It will require modifications to work:
48  * // - It may require correct/in-range values for request initialization.
49  * // - It may require specifying regional endpoints when creating the service client as shown in
50  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
51  * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
52  *   String project = "project-309310695";
53  *   String region = "region-934795532";
54  *   String disk = "disk3083677";
55  *   Disk response = regionDisksClient.get(project, region, disk);
56  * }
57  * }</pre>
58  *
59  * <p>Note: close() needs to be called on the RegionDisksClient object to clean up resources such as
60  * threads. In the example above, try-with-resources is used, which automatically calls close().
61  *
62  * <p>The surface of this class includes several types of Java methods for each of the API's
63  * methods:
64  *
65  * <ol>
66  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
67  *       converted into function parameters. It may be the case that not all fields are available as
68  *       parameters, and not every API method will have a flattened method entry point.
69  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
70  *       which must be constructed before the call. Not every API method will have a request object
71  *       method.
72  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
73  *       callable object, which can be used to initiate calls to the service.
74  * </ol>
75  *
76  * <p>See the individual methods for example code.
77  *
78  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
79  * these names, this class includes a format method for each type of name, and additionally a parse
80  * method to extract the individual identifiers contained within names that are returned.
81  *
82  * <p>This class can be customized by passing in a custom instance of RegionDisksSettings to
83  * create(). For example:
84  *
85  * <p>To customize credentials:
86  *
87  * <pre>{@code
88  * // This snippet has been automatically generated and should be regarded as a code template only.
89  * // It will require modifications to work:
90  * // - It may require correct/in-range values for request initialization.
91  * // - It may require specifying regional endpoints when creating the service client as shown in
92  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
93  * RegionDisksSettings regionDisksSettings =
94  *     RegionDisksSettings.newBuilder()
95  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
96  *         .build();
97  * RegionDisksClient regionDisksClient = RegionDisksClient.create(regionDisksSettings);
98  * }</pre>
99  *
100  * <p>To customize the endpoint:
101  *
102  * <pre>{@code
103  * // This snippet has been automatically generated and should be regarded as a code template only.
104  * // It will require modifications to work:
105  * // - It may require correct/in-range values for request initialization.
106  * // - It may require specifying regional endpoints when creating the service client as shown in
107  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
108  * RegionDisksSettings regionDisksSettings =
109  *     RegionDisksSettings.newBuilder().setEndpoint(myEndpoint).build();
110  * RegionDisksClient regionDisksClient = RegionDisksClient.create(regionDisksSettings);
111  * }</pre>
112  *
113  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
114  */
115 @Generated("by gapic-generator-java")
116 public class RegionDisksClient implements BackgroundResource {
117   private final RegionDisksSettings settings;
118   private final RegionDisksStub stub;
119 
120   /** Constructs an instance of RegionDisksClient with default settings. */
create()121   public static final RegionDisksClient create() throws IOException {
122     return create(RegionDisksSettings.newBuilder().build());
123   }
124 
125   /**
126    * Constructs an instance of RegionDisksClient, using the given settings. The channels are created
127    * based on the settings passed in, or defaults for any settings that are not set.
128    */
create(RegionDisksSettings settings)129   public static final RegionDisksClient create(RegionDisksSettings settings) throws IOException {
130     return new RegionDisksClient(settings);
131   }
132 
133   /**
134    * Constructs an instance of RegionDisksClient, using the given stub for making calls. This is for
135    * advanced usage - prefer using create(RegionDisksSettings).
136    */
create(RegionDisksStub stub)137   public static final RegionDisksClient create(RegionDisksStub stub) {
138     return new RegionDisksClient(stub);
139   }
140 
141   /**
142    * Constructs an instance of RegionDisksClient, using the given settings. This is protected so
143    * that it is easy to make a subclass, but otherwise, the static factory methods should be
144    * preferred.
145    */
RegionDisksClient(RegionDisksSettings settings)146   protected RegionDisksClient(RegionDisksSettings settings) throws IOException {
147     this.settings = settings;
148     this.stub = ((RegionDisksStubSettings) settings.getStubSettings()).createStub();
149   }
150 
RegionDisksClient(RegionDisksStub stub)151   protected RegionDisksClient(RegionDisksStub stub) {
152     this.settings = null;
153     this.stub = stub;
154   }
155 
getSettings()156   public final RegionDisksSettings getSettings() {
157     return settings;
158   }
159 
getStub()160   public RegionDisksStub getStub() {
161     return stub;
162   }
163 
164   // AUTO-GENERATED DOCUMENTATION AND METHOD.
165   /**
166    * Adds existing resource policies to a regional disk. You can only add one policy which will be
167    * applied to this disk for scheduling snapshot creation.
168    *
169    * <p>Sample code:
170    *
171    * <pre>{@code
172    * // This snippet has been automatically generated and should be regarded as a code template only.
173    * // It will require modifications to work:
174    * // - It may require correct/in-range values for request initialization.
175    * // - It may require specifying regional endpoints when creating the service client as shown in
176    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
177    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
178    *   String project = "project-309310695";
179    *   String region = "region-934795532";
180    *   String disk = "disk3083677";
181    *   RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource =
182    *       RegionDisksAddResourcePoliciesRequest.newBuilder().build();
183    *   Operation response =
184    *       regionDisksClient
185    *           .addResourcePoliciesAsync(
186    *               project, region, disk, regionDisksAddResourcePoliciesRequestResource)
187    *           .get();
188    * }
189    * }</pre>
190    *
191    * @param project Project ID for this request.
192    * @param region The name of the region for this request.
193    * @param disk The disk name for this request.
194    * @param regionDisksAddResourcePoliciesRequestResource The body resource for this request
195    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
196    */
addResourcePoliciesAsync( String project, String region, String disk, RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource)197   public final OperationFuture<Operation, Operation> addResourcePoliciesAsync(
198       String project,
199       String region,
200       String disk,
201       RegionDisksAddResourcePoliciesRequest regionDisksAddResourcePoliciesRequestResource) {
202     AddResourcePoliciesRegionDiskRequest request =
203         AddResourcePoliciesRegionDiskRequest.newBuilder()
204             .setProject(project)
205             .setRegion(region)
206             .setDisk(disk)
207             .setRegionDisksAddResourcePoliciesRequestResource(
208                 regionDisksAddResourcePoliciesRequestResource)
209             .build();
210     return addResourcePoliciesAsync(request);
211   }
212 
213   // AUTO-GENERATED DOCUMENTATION AND METHOD.
214   /**
215    * Adds existing resource policies to a regional disk. You can only add one policy which will be
216    * applied to this disk for scheduling snapshot creation.
217    *
218    * <p>Sample code:
219    *
220    * <pre>{@code
221    * // This snippet has been automatically generated and should be regarded as a code template only.
222    * // It will require modifications to work:
223    * // - It may require correct/in-range values for request initialization.
224    * // - It may require specifying regional endpoints when creating the service client as shown in
225    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
226    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
227    *   AddResourcePoliciesRegionDiskRequest request =
228    *       AddResourcePoliciesRegionDiskRequest.newBuilder()
229    *           .setDisk("disk3083677")
230    *           .setProject("project-309310695")
231    *           .setRegion("region-934795532")
232    *           .setRegionDisksAddResourcePoliciesRequestResource(
233    *               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
234    *           .setRequestId("requestId693933066")
235    *           .build();
236    *   Operation response = regionDisksClient.addResourcePoliciesAsync(request).get();
237    * }
238    * }</pre>
239    *
240    * @param request The request object containing all of the parameters for the API call.
241    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
242    */
243   @BetaApi(
244       "The surface for long-running operations is not stable yet and may change in the future.")
addResourcePoliciesAsync( AddResourcePoliciesRegionDiskRequest request)245   public final OperationFuture<Operation, Operation> addResourcePoliciesAsync(
246       AddResourcePoliciesRegionDiskRequest request) {
247     return addResourcePoliciesOperationCallable().futureCall(request);
248   }
249 
250   // AUTO-GENERATED DOCUMENTATION AND METHOD.
251   /**
252    * Adds existing resource policies to a regional disk. You can only add one policy which will be
253    * applied to this disk for scheduling snapshot creation.
254    *
255    * <p>Sample code:
256    *
257    * <pre>{@code
258    * // This snippet has been automatically generated and should be regarded as a code template only.
259    * // It will require modifications to work:
260    * // - It may require correct/in-range values for request initialization.
261    * // - It may require specifying regional endpoints when creating the service client as shown in
262    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
263    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
264    *   AddResourcePoliciesRegionDiskRequest request =
265    *       AddResourcePoliciesRegionDiskRequest.newBuilder()
266    *           .setDisk("disk3083677")
267    *           .setProject("project-309310695")
268    *           .setRegion("region-934795532")
269    *           .setRegionDisksAddResourcePoliciesRequestResource(
270    *               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
271    *           .setRequestId("requestId693933066")
272    *           .build();
273    *   OperationFuture<Operation, Operation> future =
274    *       regionDisksClient.addResourcePoliciesOperationCallable().futureCall(request);
275    *   // Do something.
276    *   Operation response = future.get();
277    * }
278    * }</pre>
279    */
280   public final OperationCallable<AddResourcePoliciesRegionDiskRequest, Operation, Operation>
addResourcePoliciesOperationCallable()281       addResourcePoliciesOperationCallable() {
282     return stub.addResourcePoliciesOperationCallable();
283   }
284 
285   // AUTO-GENERATED DOCUMENTATION AND METHOD.
286   /**
287    * Adds existing resource policies to a regional disk. You can only add one policy which will be
288    * applied to this disk for scheduling snapshot creation.
289    *
290    * <p>Sample code:
291    *
292    * <pre>{@code
293    * // This snippet has been automatically generated and should be regarded as a code template only.
294    * // It will require modifications to work:
295    * // - It may require correct/in-range values for request initialization.
296    * // - It may require specifying regional endpoints when creating the service client as shown in
297    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
298    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
299    *   AddResourcePoliciesRegionDiskRequest request =
300    *       AddResourcePoliciesRegionDiskRequest.newBuilder()
301    *           .setDisk("disk3083677")
302    *           .setProject("project-309310695")
303    *           .setRegion("region-934795532")
304    *           .setRegionDisksAddResourcePoliciesRequestResource(
305    *               RegionDisksAddResourcePoliciesRequest.newBuilder().build())
306    *           .setRequestId("requestId693933066")
307    *           .build();
308    *   ApiFuture<Operation> future =
309    *       regionDisksClient.addResourcePoliciesCallable().futureCall(request);
310    *   // Do something.
311    *   Operation response = future.get();
312    * }
313    * }</pre>
314    */
315   public final UnaryCallable<AddResourcePoliciesRegionDiskRequest, Operation>
addResourcePoliciesCallable()316       addResourcePoliciesCallable() {
317     return stub.addResourcePoliciesCallable();
318   }
319 
320   // AUTO-GENERATED DOCUMENTATION AND METHOD.
321   /**
322    * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider
323    * using snapshots.insert instead, as that method supports more features, such as creating
324    * snapshots in a project different from the source disk project.
325    *
326    * <p>Sample code:
327    *
328    * <pre>{@code
329    * // This snippet has been automatically generated and should be regarded as a code template only.
330    * // It will require modifications to work:
331    * // - It may require correct/in-range values for request initialization.
332    * // - It may require specifying regional endpoints when creating the service client as shown in
333    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
334    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
335    *   String project = "project-309310695";
336    *   String region = "region-934795532";
337    *   String disk = "disk3083677";
338    *   Snapshot snapshotResource = Snapshot.newBuilder().build();
339    *   Operation response =
340    *       regionDisksClient.createSnapshotAsync(project, region, disk, snapshotResource).get();
341    * }
342    * }</pre>
343    *
344    * @param project Project ID for this request.
345    * @param region Name of the region for this request.
346    * @param disk Name of the regional persistent disk to snapshot.
347    * @param snapshotResource The body resource for this request
348    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
349    */
createSnapshotAsync( String project, String region, String disk, Snapshot snapshotResource)350   public final OperationFuture<Operation, Operation> createSnapshotAsync(
351       String project, String region, String disk, Snapshot snapshotResource) {
352     CreateSnapshotRegionDiskRequest request =
353         CreateSnapshotRegionDiskRequest.newBuilder()
354             .setProject(project)
355             .setRegion(region)
356             .setDisk(disk)
357             .setSnapshotResource(snapshotResource)
358             .build();
359     return createSnapshotAsync(request);
360   }
361 
362   // AUTO-GENERATED DOCUMENTATION AND METHOD.
363   /**
364    * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider
365    * using snapshots.insert instead, as that method supports more features, such as creating
366    * snapshots in a project different from the source disk project.
367    *
368    * <p>Sample code:
369    *
370    * <pre>{@code
371    * // This snippet has been automatically generated and should be regarded as a code template only.
372    * // It will require modifications to work:
373    * // - It may require correct/in-range values for request initialization.
374    * // - It may require specifying regional endpoints when creating the service client as shown in
375    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
376    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
377    *   CreateSnapshotRegionDiskRequest request =
378    *       CreateSnapshotRegionDiskRequest.newBuilder()
379    *           .setDisk("disk3083677")
380    *           .setProject("project-309310695")
381    *           .setRegion("region-934795532")
382    *           .setRequestId("requestId693933066")
383    *           .setSnapshotResource(Snapshot.newBuilder().build())
384    *           .build();
385    *   Operation response = regionDisksClient.createSnapshotAsync(request).get();
386    * }
387    * }</pre>
388    *
389    * @param request The request object containing all of the parameters for the API call.
390    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
391    */
392   @BetaApi(
393       "The surface for long-running operations is not stable yet and may change in the future.")
createSnapshotAsync( CreateSnapshotRegionDiskRequest request)394   public final OperationFuture<Operation, Operation> createSnapshotAsync(
395       CreateSnapshotRegionDiskRequest request) {
396     return createSnapshotOperationCallable().futureCall(request);
397   }
398 
399   // AUTO-GENERATED DOCUMENTATION AND METHOD.
400   /**
401    * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider
402    * using snapshots.insert instead, as that method supports more features, such as creating
403    * snapshots in a project different from the source disk project.
404    *
405    * <p>Sample code:
406    *
407    * <pre>{@code
408    * // This snippet has been automatically generated and should be regarded as a code template only.
409    * // It will require modifications to work:
410    * // - It may require correct/in-range values for request initialization.
411    * // - It may require specifying regional endpoints when creating the service client as shown in
412    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
413    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
414    *   CreateSnapshotRegionDiskRequest request =
415    *       CreateSnapshotRegionDiskRequest.newBuilder()
416    *           .setDisk("disk3083677")
417    *           .setProject("project-309310695")
418    *           .setRegion("region-934795532")
419    *           .setRequestId("requestId693933066")
420    *           .setSnapshotResource(Snapshot.newBuilder().build())
421    *           .build();
422    *   OperationFuture<Operation, Operation> future =
423    *       regionDisksClient.createSnapshotOperationCallable().futureCall(request);
424    *   // Do something.
425    *   Operation response = future.get();
426    * }
427    * }</pre>
428    */
429   public final OperationCallable<CreateSnapshotRegionDiskRequest, Operation, Operation>
createSnapshotOperationCallable()430       createSnapshotOperationCallable() {
431     return stub.createSnapshotOperationCallable();
432   }
433 
434   // AUTO-GENERATED DOCUMENTATION AND METHOD.
435   /**
436    * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider
437    * using snapshots.insert instead, as that method supports more features, such as creating
438    * snapshots in a project different from the source disk project.
439    *
440    * <p>Sample code:
441    *
442    * <pre>{@code
443    * // This snippet has been automatically generated and should be regarded as a code template only.
444    * // It will require modifications to work:
445    * // - It may require correct/in-range values for request initialization.
446    * // - It may require specifying regional endpoints when creating the service client as shown in
447    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
448    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
449    *   CreateSnapshotRegionDiskRequest request =
450    *       CreateSnapshotRegionDiskRequest.newBuilder()
451    *           .setDisk("disk3083677")
452    *           .setProject("project-309310695")
453    *           .setRegion("region-934795532")
454    *           .setRequestId("requestId693933066")
455    *           .setSnapshotResource(Snapshot.newBuilder().build())
456    *           .build();
457    *   ApiFuture<Operation> future = regionDisksClient.createSnapshotCallable().futureCall(request);
458    *   // Do something.
459    *   Operation response = future.get();
460    * }
461    * }</pre>
462    */
createSnapshotCallable()463   public final UnaryCallable<CreateSnapshotRegionDiskRequest, Operation> createSnapshotCallable() {
464     return stub.createSnapshotCallable();
465   }
466 
467   // AUTO-GENERATED DOCUMENTATION AND METHOD.
468   /**
469    * Deletes the specified regional persistent disk. Deleting a regional disk removes all the
470    * replicas of its data permanently and is irreversible. However, deleting a disk does not delete
471    * any snapshots previously made from the disk. You must separately delete snapshots.
472    *
473    * <p>Sample code:
474    *
475    * <pre>{@code
476    * // This snippet has been automatically generated and should be regarded as a code template only.
477    * // It will require modifications to work:
478    * // - It may require correct/in-range values for request initialization.
479    * // - It may require specifying regional endpoints when creating the service client as shown in
480    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
481    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
482    *   String project = "project-309310695";
483    *   String region = "region-934795532";
484    *   String disk = "disk3083677";
485    *   Operation response = regionDisksClient.deleteAsync(project, region, disk).get();
486    * }
487    * }</pre>
488    *
489    * @param project Project ID for this request.
490    * @param region Name of the region for this request.
491    * @param disk Name of the regional persistent disk to delete.
492    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
493    */
deleteAsync( String project, String region, String disk)494   public final OperationFuture<Operation, Operation> deleteAsync(
495       String project, String region, String disk) {
496     DeleteRegionDiskRequest request =
497         DeleteRegionDiskRequest.newBuilder()
498             .setProject(project)
499             .setRegion(region)
500             .setDisk(disk)
501             .build();
502     return deleteAsync(request);
503   }
504 
505   // AUTO-GENERATED DOCUMENTATION AND METHOD.
506   /**
507    * Deletes the specified regional persistent disk. Deleting a regional disk removes all the
508    * replicas of its data permanently and is irreversible. However, deleting a disk does not delete
509    * any snapshots previously made from the disk. You must separately delete snapshots.
510    *
511    * <p>Sample code:
512    *
513    * <pre>{@code
514    * // This snippet has been automatically generated and should be regarded as a code template only.
515    * // It will require modifications to work:
516    * // - It may require correct/in-range values for request initialization.
517    * // - It may require specifying regional endpoints when creating the service client as shown in
518    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
519    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
520    *   DeleteRegionDiskRequest request =
521    *       DeleteRegionDiskRequest.newBuilder()
522    *           .setDisk("disk3083677")
523    *           .setProject("project-309310695")
524    *           .setRegion("region-934795532")
525    *           .setRequestId("requestId693933066")
526    *           .build();
527    *   Operation response = regionDisksClient.deleteAsync(request).get();
528    * }
529    * }</pre>
530    *
531    * @param request The request object containing all of the parameters for the API call.
532    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
533    */
534   @BetaApi(
535       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync(DeleteRegionDiskRequest request)536   public final OperationFuture<Operation, Operation> deleteAsync(DeleteRegionDiskRequest request) {
537     return deleteOperationCallable().futureCall(request);
538   }
539 
540   // AUTO-GENERATED DOCUMENTATION AND METHOD.
541   /**
542    * Deletes the specified regional persistent disk. Deleting a regional disk removes all the
543    * replicas of its data permanently and is irreversible. However, deleting a disk does not delete
544    * any snapshots previously made from the disk. You must separately delete snapshots.
545    *
546    * <p>Sample code:
547    *
548    * <pre>{@code
549    * // This snippet has been automatically generated and should be regarded as a code template only.
550    * // It will require modifications to work:
551    * // - It may require correct/in-range values for request initialization.
552    * // - It may require specifying regional endpoints when creating the service client as shown in
553    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
554    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
555    *   DeleteRegionDiskRequest request =
556    *       DeleteRegionDiskRequest.newBuilder()
557    *           .setDisk("disk3083677")
558    *           .setProject("project-309310695")
559    *           .setRegion("region-934795532")
560    *           .setRequestId("requestId693933066")
561    *           .build();
562    *   OperationFuture<Operation, Operation> future =
563    *       regionDisksClient.deleteOperationCallable().futureCall(request);
564    *   // Do something.
565    *   Operation response = future.get();
566    * }
567    * }</pre>
568    */
569   public final OperationCallable<DeleteRegionDiskRequest, Operation, Operation>
deleteOperationCallable()570       deleteOperationCallable() {
571     return stub.deleteOperationCallable();
572   }
573 
574   // AUTO-GENERATED DOCUMENTATION AND METHOD.
575   /**
576    * Deletes the specified regional persistent disk. Deleting a regional disk removes all the
577    * replicas of its data permanently and is irreversible. However, deleting a disk does not delete
578    * any snapshots previously made from the disk. You must separately delete snapshots.
579    *
580    * <p>Sample code:
581    *
582    * <pre>{@code
583    * // This snippet has been automatically generated and should be regarded as a code template only.
584    * // It will require modifications to work:
585    * // - It may require correct/in-range values for request initialization.
586    * // - It may require specifying regional endpoints when creating the service client as shown in
587    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
588    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
589    *   DeleteRegionDiskRequest request =
590    *       DeleteRegionDiskRequest.newBuilder()
591    *           .setDisk("disk3083677")
592    *           .setProject("project-309310695")
593    *           .setRegion("region-934795532")
594    *           .setRequestId("requestId693933066")
595    *           .build();
596    *   ApiFuture<Operation> future = regionDisksClient.deleteCallable().futureCall(request);
597    *   // Do something.
598    *   Operation response = future.get();
599    * }
600    * }</pre>
601    */
deleteCallable()602   public final UnaryCallable<DeleteRegionDiskRequest, Operation> deleteCallable() {
603     return stub.deleteCallable();
604   }
605 
606   // AUTO-GENERATED DOCUMENTATION AND METHOD.
607   /**
608    * Returns a specified regional persistent disk.
609    *
610    * <p>Sample code:
611    *
612    * <pre>{@code
613    * // This snippet has been automatically generated and should be regarded as a code template only.
614    * // It will require modifications to work:
615    * // - It may require correct/in-range values for request initialization.
616    * // - It may require specifying regional endpoints when creating the service client as shown in
617    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
618    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
619    *   String project = "project-309310695";
620    *   String region = "region-934795532";
621    *   String disk = "disk3083677";
622    *   Disk response = regionDisksClient.get(project, region, disk);
623    * }
624    * }</pre>
625    *
626    * @param project Project ID for this request.
627    * @param region Name of the region for this request.
628    * @param disk Name of the regional persistent disk to return.
629    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
630    */
get(String project, String region, String disk)631   public final Disk get(String project, String region, String disk) {
632     GetRegionDiskRequest request =
633         GetRegionDiskRequest.newBuilder()
634             .setProject(project)
635             .setRegion(region)
636             .setDisk(disk)
637             .build();
638     return get(request);
639   }
640 
641   // AUTO-GENERATED DOCUMENTATION AND METHOD.
642   /**
643    * Returns a specified regional persistent disk.
644    *
645    * <p>Sample code:
646    *
647    * <pre>{@code
648    * // This snippet has been automatically generated and should be regarded as a code template only.
649    * // It will require modifications to work:
650    * // - It may require correct/in-range values for request initialization.
651    * // - It may require specifying regional endpoints when creating the service client as shown in
652    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
653    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
654    *   GetRegionDiskRequest request =
655    *       GetRegionDiskRequest.newBuilder()
656    *           .setDisk("disk3083677")
657    *           .setProject("project-309310695")
658    *           .setRegion("region-934795532")
659    *           .build();
660    *   Disk response = regionDisksClient.get(request);
661    * }
662    * }</pre>
663    *
664    * @param request The request object containing all of the parameters for the API call.
665    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
666    */
get(GetRegionDiskRequest request)667   public final Disk get(GetRegionDiskRequest request) {
668     return getCallable().call(request);
669   }
670 
671   // AUTO-GENERATED DOCUMENTATION AND METHOD.
672   /**
673    * Returns a specified regional persistent disk.
674    *
675    * <p>Sample code:
676    *
677    * <pre>{@code
678    * // This snippet has been automatically generated and should be regarded as a code template only.
679    * // It will require modifications to work:
680    * // - It may require correct/in-range values for request initialization.
681    * // - It may require specifying regional endpoints when creating the service client as shown in
682    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
683    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
684    *   GetRegionDiskRequest request =
685    *       GetRegionDiskRequest.newBuilder()
686    *           .setDisk("disk3083677")
687    *           .setProject("project-309310695")
688    *           .setRegion("region-934795532")
689    *           .build();
690    *   ApiFuture<Disk> future = regionDisksClient.getCallable().futureCall(request);
691    *   // Do something.
692    *   Disk response = future.get();
693    * }
694    * }</pre>
695    */
getCallable()696   public final UnaryCallable<GetRegionDiskRequest, Disk> getCallable() {
697     return stub.getCallable();
698   }
699 
700   // AUTO-GENERATED DOCUMENTATION AND METHOD.
701   /**
702    * Gets the access control policy for a resource. May be empty if no such policy or resource
703    * exists.
704    *
705    * <p>Sample code:
706    *
707    * <pre>{@code
708    * // This snippet has been automatically generated and should be regarded as a code template only.
709    * // It will require modifications to work:
710    * // - It may require correct/in-range values for request initialization.
711    * // - It may require specifying regional endpoints when creating the service client as shown in
712    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
713    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
714    *   String project = "project-309310695";
715    *   String region = "region-934795532";
716    *   String resource = "resource-341064690";
717    *   Policy response = regionDisksClient.getIamPolicy(project, region, resource);
718    * }
719    * }</pre>
720    *
721    * @param project Project ID for this request.
722    * @param region The name of the region for this request.
723    * @param resource Name or id of the resource for this request.
724    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
725    */
getIamPolicy(String project, String region, String resource)726   public final Policy getIamPolicy(String project, String region, String resource) {
727     GetIamPolicyRegionDiskRequest request =
728         GetIamPolicyRegionDiskRequest.newBuilder()
729             .setProject(project)
730             .setRegion(region)
731             .setResource(resource)
732             .build();
733     return getIamPolicy(request);
734   }
735 
736   // AUTO-GENERATED DOCUMENTATION AND METHOD.
737   /**
738    * Gets the access control policy for a resource. May be empty if no such policy or resource
739    * exists.
740    *
741    * <p>Sample code:
742    *
743    * <pre>{@code
744    * // This snippet has been automatically generated and should be regarded as a code template only.
745    * // It will require modifications to work:
746    * // - It may require correct/in-range values for request initialization.
747    * // - It may require specifying regional endpoints when creating the service client as shown in
748    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
749    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
750    *   GetIamPolicyRegionDiskRequest request =
751    *       GetIamPolicyRegionDiskRequest.newBuilder()
752    *           .setOptionsRequestedPolicyVersion(-574521795)
753    *           .setProject("project-309310695")
754    *           .setRegion("region-934795532")
755    *           .setResource("resource-341064690")
756    *           .build();
757    *   Policy response = regionDisksClient.getIamPolicy(request);
758    * }
759    * }</pre>
760    *
761    * @param request The request object containing all of the parameters for the API call.
762    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
763    */
getIamPolicy(GetIamPolicyRegionDiskRequest request)764   public final Policy getIamPolicy(GetIamPolicyRegionDiskRequest request) {
765     return getIamPolicyCallable().call(request);
766   }
767 
768   // AUTO-GENERATED DOCUMENTATION AND METHOD.
769   /**
770    * Gets the access control policy for a resource. May be empty if no such policy or resource
771    * exists.
772    *
773    * <p>Sample code:
774    *
775    * <pre>{@code
776    * // This snippet has been automatically generated and should be regarded as a code template only.
777    * // It will require modifications to work:
778    * // - It may require correct/in-range values for request initialization.
779    * // - It may require specifying regional endpoints when creating the service client as shown in
780    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
781    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
782    *   GetIamPolicyRegionDiskRequest request =
783    *       GetIamPolicyRegionDiskRequest.newBuilder()
784    *           .setOptionsRequestedPolicyVersion(-574521795)
785    *           .setProject("project-309310695")
786    *           .setRegion("region-934795532")
787    *           .setResource("resource-341064690")
788    *           .build();
789    *   ApiFuture<Policy> future = regionDisksClient.getIamPolicyCallable().futureCall(request);
790    *   // Do something.
791    *   Policy response = future.get();
792    * }
793    * }</pre>
794    */
getIamPolicyCallable()795   public final UnaryCallable<GetIamPolicyRegionDiskRequest, Policy> getIamPolicyCallable() {
796     return stub.getIamPolicyCallable();
797   }
798 
799   // AUTO-GENERATED DOCUMENTATION AND METHOD.
800   /**
801    * Creates a persistent regional disk in the specified project using the data included in the
802    * request.
803    *
804    * <p>Sample code:
805    *
806    * <pre>{@code
807    * // This snippet has been automatically generated and should be regarded as a code template only.
808    * // It will require modifications to work:
809    * // - It may require correct/in-range values for request initialization.
810    * // - It may require specifying regional endpoints when creating the service client as shown in
811    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
812    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
813    *   String project = "project-309310695";
814    *   String region = "region-934795532";
815    *   Disk diskResource = Disk.newBuilder().build();
816    *   Operation response = regionDisksClient.insertAsync(project, region, diskResource).get();
817    * }
818    * }</pre>
819    *
820    * @param project Project ID for this request.
821    * @param region Name of the region for this request.
822    * @param diskResource The body resource for this request
823    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
824    */
insertAsync( String project, String region, Disk diskResource)825   public final OperationFuture<Operation, Operation> insertAsync(
826       String project, String region, Disk diskResource) {
827     InsertRegionDiskRequest request =
828         InsertRegionDiskRequest.newBuilder()
829             .setProject(project)
830             .setRegion(region)
831             .setDiskResource(diskResource)
832             .build();
833     return insertAsync(request);
834   }
835 
836   // AUTO-GENERATED DOCUMENTATION AND METHOD.
837   /**
838    * Creates a persistent regional disk in the specified project using the data included in the
839    * request.
840    *
841    * <p>Sample code:
842    *
843    * <pre>{@code
844    * // This snippet has been automatically generated and should be regarded as a code template only.
845    * // It will require modifications to work:
846    * // - It may require correct/in-range values for request initialization.
847    * // - It may require specifying regional endpoints when creating the service client as shown in
848    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
849    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
850    *   InsertRegionDiskRequest request =
851    *       InsertRegionDiskRequest.newBuilder()
852    *           .setDiskResource(Disk.newBuilder().build())
853    *           .setProject("project-309310695")
854    *           .setRegion("region-934795532")
855    *           .setRequestId("requestId693933066")
856    *           .setSourceImage("sourceImage-105174528")
857    *           .build();
858    *   Operation response = regionDisksClient.insertAsync(request).get();
859    * }
860    * }</pre>
861    *
862    * @param request The request object containing all of the parameters for the API call.
863    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
864    */
865   @BetaApi(
866       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync(InsertRegionDiskRequest request)867   public final OperationFuture<Operation, Operation> insertAsync(InsertRegionDiskRequest request) {
868     return insertOperationCallable().futureCall(request);
869   }
870 
871   // AUTO-GENERATED DOCUMENTATION AND METHOD.
872   /**
873    * Creates a persistent regional disk in the specified project using the data included in the
874    * request.
875    *
876    * <p>Sample code:
877    *
878    * <pre>{@code
879    * // This snippet has been automatically generated and should be regarded as a code template only.
880    * // It will require modifications to work:
881    * // - It may require correct/in-range values for request initialization.
882    * // - It may require specifying regional endpoints when creating the service client as shown in
883    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
884    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
885    *   InsertRegionDiskRequest request =
886    *       InsertRegionDiskRequest.newBuilder()
887    *           .setDiskResource(Disk.newBuilder().build())
888    *           .setProject("project-309310695")
889    *           .setRegion("region-934795532")
890    *           .setRequestId("requestId693933066")
891    *           .setSourceImage("sourceImage-105174528")
892    *           .build();
893    *   OperationFuture<Operation, Operation> future =
894    *       regionDisksClient.insertOperationCallable().futureCall(request);
895    *   // Do something.
896    *   Operation response = future.get();
897    * }
898    * }</pre>
899    */
900   public final OperationCallable<InsertRegionDiskRequest, Operation, Operation>
insertOperationCallable()901       insertOperationCallable() {
902     return stub.insertOperationCallable();
903   }
904 
905   // AUTO-GENERATED DOCUMENTATION AND METHOD.
906   /**
907    * Creates a persistent regional disk in the specified project using the data included in the
908    * request.
909    *
910    * <p>Sample code:
911    *
912    * <pre>{@code
913    * // This snippet has been automatically generated and should be regarded as a code template only.
914    * // It will require modifications to work:
915    * // - It may require correct/in-range values for request initialization.
916    * // - It may require specifying regional endpoints when creating the service client as shown in
917    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
918    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
919    *   InsertRegionDiskRequest request =
920    *       InsertRegionDiskRequest.newBuilder()
921    *           .setDiskResource(Disk.newBuilder().build())
922    *           .setProject("project-309310695")
923    *           .setRegion("region-934795532")
924    *           .setRequestId("requestId693933066")
925    *           .setSourceImage("sourceImage-105174528")
926    *           .build();
927    *   ApiFuture<Operation> future = regionDisksClient.insertCallable().futureCall(request);
928    *   // Do something.
929    *   Operation response = future.get();
930    * }
931    * }</pre>
932    */
insertCallable()933   public final UnaryCallable<InsertRegionDiskRequest, Operation> insertCallable() {
934     return stub.insertCallable();
935   }
936 
937   // AUTO-GENERATED DOCUMENTATION AND METHOD.
938   /**
939    * Retrieves the list of persistent disks contained within the specified region.
940    *
941    * <p>Sample code:
942    *
943    * <pre>{@code
944    * // This snippet has been automatically generated and should be regarded as a code template only.
945    * // It will require modifications to work:
946    * // - It may require correct/in-range values for request initialization.
947    * // - It may require specifying regional endpoints when creating the service client as shown in
948    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
949    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
950    *   String project = "project-309310695";
951    *   String region = "region-934795532";
952    *   for (Disk element : regionDisksClient.list(project, region).iterateAll()) {
953    *     // doThingsWith(element);
954    *   }
955    * }
956    * }</pre>
957    *
958    * @param project Project ID for this request.
959    * @param region Name of the region for this request.
960    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
961    */
list(String project, String region)962   public final ListPagedResponse list(String project, String region) {
963     ListRegionDisksRequest request =
964         ListRegionDisksRequest.newBuilder().setProject(project).setRegion(region).build();
965     return list(request);
966   }
967 
968   // AUTO-GENERATED DOCUMENTATION AND METHOD.
969   /**
970    * Retrieves the list of persistent disks contained within the specified region.
971    *
972    * <p>Sample code:
973    *
974    * <pre>{@code
975    * // This snippet has been automatically generated and should be regarded as a code template only.
976    * // It will require modifications to work:
977    * // - It may require correct/in-range values for request initialization.
978    * // - It may require specifying regional endpoints when creating the service client as shown in
979    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
980    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
981    *   ListRegionDisksRequest request =
982    *       ListRegionDisksRequest.newBuilder()
983    *           .setFilter("filter-1274492040")
984    *           .setMaxResults(1128457243)
985    *           .setOrderBy("orderBy-1207110587")
986    *           .setPageToken("pageToken873572522")
987    *           .setProject("project-309310695")
988    *           .setRegion("region-934795532")
989    *           .setReturnPartialSuccess(true)
990    *           .build();
991    *   for (Disk element : regionDisksClient.list(request).iterateAll()) {
992    *     // doThingsWith(element);
993    *   }
994    * }
995    * }</pre>
996    *
997    * @param request The request object containing all of the parameters for the API call.
998    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
999    */
list(ListRegionDisksRequest request)1000   public final ListPagedResponse list(ListRegionDisksRequest request) {
1001     return listPagedCallable().call(request);
1002   }
1003 
1004   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1005   /**
1006    * Retrieves the list of persistent disks contained within the specified region.
1007    *
1008    * <p>Sample code:
1009    *
1010    * <pre>{@code
1011    * // This snippet has been automatically generated and should be regarded as a code template only.
1012    * // It will require modifications to work:
1013    * // - It may require correct/in-range values for request initialization.
1014    * // - It may require specifying regional endpoints when creating the service client as shown in
1015    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1016    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1017    *   ListRegionDisksRequest request =
1018    *       ListRegionDisksRequest.newBuilder()
1019    *           .setFilter("filter-1274492040")
1020    *           .setMaxResults(1128457243)
1021    *           .setOrderBy("orderBy-1207110587")
1022    *           .setPageToken("pageToken873572522")
1023    *           .setProject("project-309310695")
1024    *           .setRegion("region-934795532")
1025    *           .setReturnPartialSuccess(true)
1026    *           .build();
1027    *   ApiFuture<Disk> future = regionDisksClient.listPagedCallable().futureCall(request);
1028    *   // Do something.
1029    *   for (Disk element : future.get().iterateAll()) {
1030    *     // doThingsWith(element);
1031    *   }
1032    * }
1033    * }</pre>
1034    */
listPagedCallable()1035   public final UnaryCallable<ListRegionDisksRequest, ListPagedResponse> listPagedCallable() {
1036     return stub.listPagedCallable();
1037   }
1038 
1039   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1040   /**
1041    * Retrieves the list of persistent disks contained within the specified region.
1042    *
1043    * <p>Sample code:
1044    *
1045    * <pre>{@code
1046    * // This snippet has been automatically generated and should be regarded as a code template only.
1047    * // It will require modifications to work:
1048    * // - It may require correct/in-range values for request initialization.
1049    * // - It may require specifying regional endpoints when creating the service client as shown in
1050    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1051    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1052    *   ListRegionDisksRequest request =
1053    *       ListRegionDisksRequest.newBuilder()
1054    *           .setFilter("filter-1274492040")
1055    *           .setMaxResults(1128457243)
1056    *           .setOrderBy("orderBy-1207110587")
1057    *           .setPageToken("pageToken873572522")
1058    *           .setProject("project-309310695")
1059    *           .setRegion("region-934795532")
1060    *           .setReturnPartialSuccess(true)
1061    *           .build();
1062    *   while (true) {
1063    *     DiskList response = regionDisksClient.listCallable().call(request);
1064    *     for (Disk element : response.getItemsList()) {
1065    *       // doThingsWith(element);
1066    *     }
1067    *     String nextPageToken = response.getNextPageToken();
1068    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1069    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1070    *     } else {
1071    *       break;
1072    *     }
1073    *   }
1074    * }
1075    * }</pre>
1076    */
listCallable()1077   public final UnaryCallable<ListRegionDisksRequest, DiskList> listCallable() {
1078     return stub.listCallable();
1079   }
1080 
1081   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1082   /**
1083    * Removes resource policies from a regional disk.
1084    *
1085    * <p>Sample code:
1086    *
1087    * <pre>{@code
1088    * // This snippet has been automatically generated and should be regarded as a code template only.
1089    * // It will require modifications to work:
1090    * // - It may require correct/in-range values for request initialization.
1091    * // - It may require specifying regional endpoints when creating the service client as shown in
1092    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1093    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1094    *   String project = "project-309310695";
1095    *   String region = "region-934795532";
1096    *   String disk = "disk3083677";
1097    *   RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource =
1098    *       RegionDisksRemoveResourcePoliciesRequest.newBuilder().build();
1099    *   Operation response =
1100    *       regionDisksClient
1101    *           .removeResourcePoliciesAsync(
1102    *               project, region, disk, regionDisksRemoveResourcePoliciesRequestResource)
1103    *           .get();
1104    * }
1105    * }</pre>
1106    *
1107    * @param project Project ID for this request.
1108    * @param region The name of the region for this request.
1109    * @param disk The disk name for this request.
1110    * @param regionDisksRemoveResourcePoliciesRequestResource The body resource for this request
1111    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1112    */
removeResourcePoliciesAsync( String project, String region, String disk, RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource)1113   public final OperationFuture<Operation, Operation> removeResourcePoliciesAsync(
1114       String project,
1115       String region,
1116       String disk,
1117       RegionDisksRemoveResourcePoliciesRequest regionDisksRemoveResourcePoliciesRequestResource) {
1118     RemoveResourcePoliciesRegionDiskRequest request =
1119         RemoveResourcePoliciesRegionDiskRequest.newBuilder()
1120             .setProject(project)
1121             .setRegion(region)
1122             .setDisk(disk)
1123             .setRegionDisksRemoveResourcePoliciesRequestResource(
1124                 regionDisksRemoveResourcePoliciesRequestResource)
1125             .build();
1126     return removeResourcePoliciesAsync(request);
1127   }
1128 
1129   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1130   /**
1131    * Removes resource policies from a regional disk.
1132    *
1133    * <p>Sample code:
1134    *
1135    * <pre>{@code
1136    * // This snippet has been automatically generated and should be regarded as a code template only.
1137    * // It will require modifications to work:
1138    * // - It may require correct/in-range values for request initialization.
1139    * // - It may require specifying regional endpoints when creating the service client as shown in
1140    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1141    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1142    *   RemoveResourcePoliciesRegionDiskRequest request =
1143    *       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
1144    *           .setDisk("disk3083677")
1145    *           .setProject("project-309310695")
1146    *           .setRegion("region-934795532")
1147    *           .setRegionDisksRemoveResourcePoliciesRequestResource(
1148    *               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
1149    *           .setRequestId("requestId693933066")
1150    *           .build();
1151    *   Operation response = regionDisksClient.removeResourcePoliciesAsync(request).get();
1152    * }
1153    * }</pre>
1154    *
1155    * @param request The request object containing all of the parameters for the API call.
1156    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1157    */
1158   @BetaApi(
1159       "The surface for long-running operations is not stable yet and may change in the future.")
removeResourcePoliciesAsync( RemoveResourcePoliciesRegionDiskRequest request)1160   public final OperationFuture<Operation, Operation> removeResourcePoliciesAsync(
1161       RemoveResourcePoliciesRegionDiskRequest request) {
1162     return removeResourcePoliciesOperationCallable().futureCall(request);
1163   }
1164 
1165   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1166   /**
1167    * Removes resource policies from a regional disk.
1168    *
1169    * <p>Sample code:
1170    *
1171    * <pre>{@code
1172    * // This snippet has been automatically generated and should be regarded as a code template only.
1173    * // It will require modifications to work:
1174    * // - It may require correct/in-range values for request initialization.
1175    * // - It may require specifying regional endpoints when creating the service client as shown in
1176    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1177    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1178    *   RemoveResourcePoliciesRegionDiskRequest request =
1179    *       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
1180    *           .setDisk("disk3083677")
1181    *           .setProject("project-309310695")
1182    *           .setRegion("region-934795532")
1183    *           .setRegionDisksRemoveResourcePoliciesRequestResource(
1184    *               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
1185    *           .setRequestId("requestId693933066")
1186    *           .build();
1187    *   OperationFuture<Operation, Operation> future =
1188    *       regionDisksClient.removeResourcePoliciesOperationCallable().futureCall(request);
1189    *   // Do something.
1190    *   Operation response = future.get();
1191    * }
1192    * }</pre>
1193    */
1194   public final OperationCallable<RemoveResourcePoliciesRegionDiskRequest, Operation, Operation>
removeResourcePoliciesOperationCallable()1195       removeResourcePoliciesOperationCallable() {
1196     return stub.removeResourcePoliciesOperationCallable();
1197   }
1198 
1199   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1200   /**
1201    * Removes resource policies from a regional disk.
1202    *
1203    * <p>Sample code:
1204    *
1205    * <pre>{@code
1206    * // This snippet has been automatically generated and should be regarded as a code template only.
1207    * // It will require modifications to work:
1208    * // - It may require correct/in-range values for request initialization.
1209    * // - It may require specifying regional endpoints when creating the service client as shown in
1210    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1211    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1212    *   RemoveResourcePoliciesRegionDiskRequest request =
1213    *       RemoveResourcePoliciesRegionDiskRequest.newBuilder()
1214    *           .setDisk("disk3083677")
1215    *           .setProject("project-309310695")
1216    *           .setRegion("region-934795532")
1217    *           .setRegionDisksRemoveResourcePoliciesRequestResource(
1218    *               RegionDisksRemoveResourcePoliciesRequest.newBuilder().build())
1219    *           .setRequestId("requestId693933066")
1220    *           .build();
1221    *   ApiFuture<Operation> future =
1222    *       regionDisksClient.removeResourcePoliciesCallable().futureCall(request);
1223    *   // Do something.
1224    *   Operation response = future.get();
1225    * }
1226    * }</pre>
1227    */
1228   public final UnaryCallable<RemoveResourcePoliciesRegionDiskRequest, Operation>
removeResourcePoliciesCallable()1229       removeResourcePoliciesCallable() {
1230     return stub.removeResourcePoliciesCallable();
1231   }
1232 
1233   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1234   /**
1235    * Resizes the specified regional persistent disk.
1236    *
1237    * <p>Sample code:
1238    *
1239    * <pre>{@code
1240    * // This snippet has been automatically generated and should be regarded as a code template only.
1241    * // It will require modifications to work:
1242    * // - It may require correct/in-range values for request initialization.
1243    * // - It may require specifying regional endpoints when creating the service client as shown in
1244    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1245    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1246    *   String project = "project-309310695";
1247    *   String region = "region-934795532";
1248    *   String disk = "disk3083677";
1249    *   RegionDisksResizeRequest regionDisksResizeRequestResource =
1250    *       RegionDisksResizeRequest.newBuilder().build();
1251    *   Operation response =
1252    *       regionDisksClient
1253    *           .resizeAsync(project, region, disk, regionDisksResizeRequestResource)
1254    *           .get();
1255    * }
1256    * }</pre>
1257    *
1258    * @param project The project ID for this request.
1259    * @param region Name of the region for this request.
1260    * @param disk Name of the regional persistent disk.
1261    * @param regionDisksResizeRequestResource The body resource for this request
1262    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1263    */
resizeAsync( String project, String region, String disk, RegionDisksResizeRequest regionDisksResizeRequestResource)1264   public final OperationFuture<Operation, Operation> resizeAsync(
1265       String project,
1266       String region,
1267       String disk,
1268       RegionDisksResizeRequest regionDisksResizeRequestResource) {
1269     ResizeRegionDiskRequest request =
1270         ResizeRegionDiskRequest.newBuilder()
1271             .setProject(project)
1272             .setRegion(region)
1273             .setDisk(disk)
1274             .setRegionDisksResizeRequestResource(regionDisksResizeRequestResource)
1275             .build();
1276     return resizeAsync(request);
1277   }
1278 
1279   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1280   /**
1281    * Resizes the specified regional persistent disk.
1282    *
1283    * <p>Sample code:
1284    *
1285    * <pre>{@code
1286    * // This snippet has been automatically generated and should be regarded as a code template only.
1287    * // It will require modifications to work:
1288    * // - It may require correct/in-range values for request initialization.
1289    * // - It may require specifying regional endpoints when creating the service client as shown in
1290    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1291    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1292    *   ResizeRegionDiskRequest request =
1293    *       ResizeRegionDiskRequest.newBuilder()
1294    *           .setDisk("disk3083677")
1295    *           .setProject("project-309310695")
1296    *           .setRegion("region-934795532")
1297    *           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
1298    *           .setRequestId("requestId693933066")
1299    *           .build();
1300    *   Operation response = regionDisksClient.resizeAsync(request).get();
1301    * }
1302    * }</pre>
1303    *
1304    * @param request The request object containing all of the parameters for the API call.
1305    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1306    */
1307   @BetaApi(
1308       "The surface for long-running operations is not stable yet and may change in the future.")
resizeAsync(ResizeRegionDiskRequest request)1309   public final OperationFuture<Operation, Operation> resizeAsync(ResizeRegionDiskRequest request) {
1310     return resizeOperationCallable().futureCall(request);
1311   }
1312 
1313   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1314   /**
1315    * Resizes the specified regional persistent disk.
1316    *
1317    * <p>Sample code:
1318    *
1319    * <pre>{@code
1320    * // This snippet has been automatically generated and should be regarded as a code template only.
1321    * // It will require modifications to work:
1322    * // - It may require correct/in-range values for request initialization.
1323    * // - It may require specifying regional endpoints when creating the service client as shown in
1324    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1325    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1326    *   ResizeRegionDiskRequest request =
1327    *       ResizeRegionDiskRequest.newBuilder()
1328    *           .setDisk("disk3083677")
1329    *           .setProject("project-309310695")
1330    *           .setRegion("region-934795532")
1331    *           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
1332    *           .setRequestId("requestId693933066")
1333    *           .build();
1334    *   OperationFuture<Operation, Operation> future =
1335    *       regionDisksClient.resizeOperationCallable().futureCall(request);
1336    *   // Do something.
1337    *   Operation response = future.get();
1338    * }
1339    * }</pre>
1340    */
1341   public final OperationCallable<ResizeRegionDiskRequest, Operation, Operation>
resizeOperationCallable()1342       resizeOperationCallable() {
1343     return stub.resizeOperationCallable();
1344   }
1345 
1346   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1347   /**
1348    * Resizes the specified regional persistent disk.
1349    *
1350    * <p>Sample code:
1351    *
1352    * <pre>{@code
1353    * // This snippet has been automatically generated and should be regarded as a code template only.
1354    * // It will require modifications to work:
1355    * // - It may require correct/in-range values for request initialization.
1356    * // - It may require specifying regional endpoints when creating the service client as shown in
1357    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1358    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1359    *   ResizeRegionDiskRequest request =
1360    *       ResizeRegionDiskRequest.newBuilder()
1361    *           .setDisk("disk3083677")
1362    *           .setProject("project-309310695")
1363    *           .setRegion("region-934795532")
1364    *           .setRegionDisksResizeRequestResource(RegionDisksResizeRequest.newBuilder().build())
1365    *           .setRequestId("requestId693933066")
1366    *           .build();
1367    *   ApiFuture<Operation> future = regionDisksClient.resizeCallable().futureCall(request);
1368    *   // Do something.
1369    *   Operation response = future.get();
1370    * }
1371    * }</pre>
1372    */
resizeCallable()1373   public final UnaryCallable<ResizeRegionDiskRequest, Operation> resizeCallable() {
1374     return stub.resizeCallable();
1375   }
1376 
1377   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1378   /**
1379    * Sets the access control policy on the specified resource. Replaces any existing policy.
1380    *
1381    * <p>Sample code:
1382    *
1383    * <pre>{@code
1384    * // This snippet has been automatically generated and should be regarded as a code template only.
1385    * // It will require modifications to work:
1386    * // - It may require correct/in-range values for request initialization.
1387    * // - It may require specifying regional endpoints when creating the service client as shown in
1388    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1389    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1390    *   String project = "project-309310695";
1391    *   String region = "region-934795532";
1392    *   String resource = "resource-341064690";
1393    *   RegionSetPolicyRequest regionSetPolicyRequestResource =
1394    *       RegionSetPolicyRequest.newBuilder().build();
1395    *   Policy response =
1396    *       regionDisksClient.setIamPolicy(project, region, resource, regionSetPolicyRequestResource);
1397    * }
1398    * }</pre>
1399    *
1400    * @param project Project ID for this request.
1401    * @param region The name of the region for this request.
1402    * @param resource Name or id of the resource for this request.
1403    * @param regionSetPolicyRequestResource The body resource for this request
1404    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1405    */
setIamPolicy( String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)1406   public final Policy setIamPolicy(
1407       String project,
1408       String region,
1409       String resource,
1410       RegionSetPolicyRequest regionSetPolicyRequestResource) {
1411     SetIamPolicyRegionDiskRequest request =
1412         SetIamPolicyRegionDiskRequest.newBuilder()
1413             .setProject(project)
1414             .setRegion(region)
1415             .setResource(resource)
1416             .setRegionSetPolicyRequestResource(regionSetPolicyRequestResource)
1417             .build();
1418     return setIamPolicy(request);
1419   }
1420 
1421   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1422   /**
1423    * Sets the access control policy on the specified resource. Replaces any existing policy.
1424    *
1425    * <p>Sample code:
1426    *
1427    * <pre>{@code
1428    * // This snippet has been automatically generated and should be regarded as a code template only.
1429    * // It will require modifications to work:
1430    * // - It may require correct/in-range values for request initialization.
1431    * // - It may require specifying regional endpoints when creating the service client as shown in
1432    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1433    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1434    *   SetIamPolicyRegionDiskRequest request =
1435    *       SetIamPolicyRegionDiskRequest.newBuilder()
1436    *           .setProject("project-309310695")
1437    *           .setRegion("region-934795532")
1438    *           .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
1439    *           .setResource("resource-341064690")
1440    *           .build();
1441    *   Policy response = regionDisksClient.setIamPolicy(request);
1442    * }
1443    * }</pre>
1444    *
1445    * @param request The request object containing all of the parameters for the API call.
1446    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1447    */
setIamPolicy(SetIamPolicyRegionDiskRequest request)1448   public final Policy setIamPolicy(SetIamPolicyRegionDiskRequest request) {
1449     return setIamPolicyCallable().call(request);
1450   }
1451 
1452   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1453   /**
1454    * Sets the access control policy on the specified resource. Replaces any existing policy.
1455    *
1456    * <p>Sample code:
1457    *
1458    * <pre>{@code
1459    * // This snippet has been automatically generated and should be regarded as a code template only.
1460    * // It will require modifications to work:
1461    * // - It may require correct/in-range values for request initialization.
1462    * // - It may require specifying regional endpoints when creating the service client as shown in
1463    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1464    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1465    *   SetIamPolicyRegionDiskRequest request =
1466    *       SetIamPolicyRegionDiskRequest.newBuilder()
1467    *           .setProject("project-309310695")
1468    *           .setRegion("region-934795532")
1469    *           .setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
1470    *           .setResource("resource-341064690")
1471    *           .build();
1472    *   ApiFuture<Policy> future = regionDisksClient.setIamPolicyCallable().futureCall(request);
1473    *   // Do something.
1474    *   Policy response = future.get();
1475    * }
1476    * }</pre>
1477    */
setIamPolicyCallable()1478   public final UnaryCallable<SetIamPolicyRegionDiskRequest, Policy> setIamPolicyCallable() {
1479     return stub.setIamPolicyCallable();
1480   }
1481 
1482   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1483   /**
1484    * Sets the labels on the target regional disk.
1485    *
1486    * <p>Sample code:
1487    *
1488    * <pre>{@code
1489    * // This snippet has been automatically generated and should be regarded as a code template only.
1490    * // It will require modifications to work:
1491    * // - It may require correct/in-range values for request initialization.
1492    * // - It may require specifying regional endpoints when creating the service client as shown in
1493    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1494    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1495    *   String project = "project-309310695";
1496    *   String region = "region-934795532";
1497    *   String resource = "resource-341064690";
1498    *   RegionSetLabelsRequest regionSetLabelsRequestResource =
1499    *       RegionSetLabelsRequest.newBuilder().build();
1500    *   Operation response =
1501    *       regionDisksClient
1502    *           .setLabelsAsync(project, region, resource, regionSetLabelsRequestResource)
1503    *           .get();
1504    * }
1505    * }</pre>
1506    *
1507    * @param project Project ID for this request.
1508    * @param region The region for this request.
1509    * @param resource Name or id of the resource for this request.
1510    * @param regionSetLabelsRequestResource The body resource for this request
1511    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1512    */
setLabelsAsync( String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)1513   public final OperationFuture<Operation, Operation> setLabelsAsync(
1514       String project,
1515       String region,
1516       String resource,
1517       RegionSetLabelsRequest regionSetLabelsRequestResource) {
1518     SetLabelsRegionDiskRequest request =
1519         SetLabelsRegionDiskRequest.newBuilder()
1520             .setProject(project)
1521             .setRegion(region)
1522             .setResource(resource)
1523             .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
1524             .build();
1525     return setLabelsAsync(request);
1526   }
1527 
1528   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1529   /**
1530    * Sets the labels on the target regional disk.
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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1541    *   SetLabelsRegionDiskRequest request =
1542    *       SetLabelsRegionDiskRequest.newBuilder()
1543    *           .setProject("project-309310695")
1544    *           .setRegion("region-934795532")
1545    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1546    *           .setRequestId("requestId693933066")
1547    *           .setResource("resource-341064690")
1548    *           .build();
1549    *   Operation response = regionDisksClient.setLabelsAsync(request).get();
1550    * }
1551    * }</pre>
1552    *
1553    * @param request The request object containing all of the parameters for the API call.
1554    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1555    */
1556   @BetaApi(
1557       "The surface for long-running operations is not stable yet and may change in the future.")
setLabelsAsync( SetLabelsRegionDiskRequest request)1558   public final OperationFuture<Operation, Operation> setLabelsAsync(
1559       SetLabelsRegionDiskRequest request) {
1560     return setLabelsOperationCallable().futureCall(request);
1561   }
1562 
1563   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1564   /**
1565    * Sets the labels on the target regional disk.
1566    *
1567    * <p>Sample code:
1568    *
1569    * <pre>{@code
1570    * // This snippet has been automatically generated and should be regarded as a code template only.
1571    * // It will require modifications to work:
1572    * // - It may require correct/in-range values for request initialization.
1573    * // - It may require specifying regional endpoints when creating the service client as shown in
1574    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1575    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1576    *   SetLabelsRegionDiskRequest request =
1577    *       SetLabelsRegionDiskRequest.newBuilder()
1578    *           .setProject("project-309310695")
1579    *           .setRegion("region-934795532")
1580    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1581    *           .setRequestId("requestId693933066")
1582    *           .setResource("resource-341064690")
1583    *           .build();
1584    *   OperationFuture<Operation, Operation> future =
1585    *       regionDisksClient.setLabelsOperationCallable().futureCall(request);
1586    *   // Do something.
1587    *   Operation response = future.get();
1588    * }
1589    * }</pre>
1590    */
1591   public final OperationCallable<SetLabelsRegionDiskRequest, Operation, Operation>
setLabelsOperationCallable()1592       setLabelsOperationCallable() {
1593     return stub.setLabelsOperationCallable();
1594   }
1595 
1596   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1597   /**
1598    * Sets the labels on the target regional disk.
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 (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1609    *   SetLabelsRegionDiskRequest request =
1610    *       SetLabelsRegionDiskRequest.newBuilder()
1611    *           .setProject("project-309310695")
1612    *           .setRegion("region-934795532")
1613    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1614    *           .setRequestId("requestId693933066")
1615    *           .setResource("resource-341064690")
1616    *           .build();
1617    *   ApiFuture<Operation> future = regionDisksClient.setLabelsCallable().futureCall(request);
1618    *   // Do something.
1619    *   Operation response = future.get();
1620    * }
1621    * }</pre>
1622    */
setLabelsCallable()1623   public final UnaryCallable<SetLabelsRegionDiskRequest, Operation> setLabelsCallable() {
1624     return stub.setLabelsCallable();
1625   }
1626 
1627   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1628   /**
1629    * Returns permissions that a caller has on the specified resource.
1630    *
1631    * <p>Sample code:
1632    *
1633    * <pre>{@code
1634    * // This snippet has been automatically generated and should be regarded as a code template only.
1635    * // It will require modifications to work:
1636    * // - It may require correct/in-range values for request initialization.
1637    * // - It may require specifying regional endpoints when creating the service client as shown in
1638    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1639    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1640    *   String project = "project-309310695";
1641    *   String region = "region-934795532";
1642    *   String resource = "resource-341064690";
1643    *   TestPermissionsRequest testPermissionsRequestResource =
1644    *       TestPermissionsRequest.newBuilder().build();
1645    *   TestPermissionsResponse response =
1646    *       regionDisksClient.testIamPermissions(
1647    *           project, region, resource, testPermissionsRequestResource);
1648    * }
1649    * }</pre>
1650    *
1651    * @param project Project ID for this request.
1652    * @param region The name of the region for this request.
1653    * @param resource Name or id of the resource for this request.
1654    * @param testPermissionsRequestResource The body resource for this request
1655    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1656    */
testIamPermissions( String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)1657   public final TestPermissionsResponse testIamPermissions(
1658       String project,
1659       String region,
1660       String resource,
1661       TestPermissionsRequest testPermissionsRequestResource) {
1662     TestIamPermissionsRegionDiskRequest request =
1663         TestIamPermissionsRegionDiskRequest.newBuilder()
1664             .setProject(project)
1665             .setRegion(region)
1666             .setResource(resource)
1667             .setTestPermissionsRequestResource(testPermissionsRequestResource)
1668             .build();
1669     return testIamPermissions(request);
1670   }
1671 
1672   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1673   /**
1674    * Returns permissions that a caller has on the specified resource.
1675    *
1676    * <p>Sample code:
1677    *
1678    * <pre>{@code
1679    * // This snippet has been automatically generated and should be regarded as a code template only.
1680    * // It will require modifications to work:
1681    * // - It may require correct/in-range values for request initialization.
1682    * // - It may require specifying regional endpoints when creating the service client as shown in
1683    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1684    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1685    *   TestIamPermissionsRegionDiskRequest request =
1686    *       TestIamPermissionsRegionDiskRequest.newBuilder()
1687    *           .setProject("project-309310695")
1688    *           .setRegion("region-934795532")
1689    *           .setResource("resource-341064690")
1690    *           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
1691    *           .build();
1692    *   TestPermissionsResponse response = regionDisksClient.testIamPermissions(request);
1693    * }
1694    * }</pre>
1695    *
1696    * @param request The request object containing all of the parameters for the API call.
1697    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1698    */
testIamPermissions( TestIamPermissionsRegionDiskRequest request)1699   public final TestPermissionsResponse testIamPermissions(
1700       TestIamPermissionsRegionDiskRequest request) {
1701     return testIamPermissionsCallable().call(request);
1702   }
1703 
1704   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1705   /**
1706    * Returns permissions that a caller has on the specified resource.
1707    *
1708    * <p>Sample code:
1709    *
1710    * <pre>{@code
1711    * // This snippet has been automatically generated and should be regarded as a code template only.
1712    * // It will require modifications to work:
1713    * // - It may require correct/in-range values for request initialization.
1714    * // - It may require specifying regional endpoints when creating the service client as shown in
1715    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1716    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1717    *   TestIamPermissionsRegionDiskRequest request =
1718    *       TestIamPermissionsRegionDiskRequest.newBuilder()
1719    *           .setProject("project-309310695")
1720    *           .setRegion("region-934795532")
1721    *           .setResource("resource-341064690")
1722    *           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
1723    *           .build();
1724    *   ApiFuture<TestPermissionsResponse> future =
1725    *       regionDisksClient.testIamPermissionsCallable().futureCall(request);
1726    *   // Do something.
1727    *   TestPermissionsResponse response = future.get();
1728    * }
1729    * }</pre>
1730    */
1731   public final UnaryCallable<TestIamPermissionsRegionDiskRequest, TestPermissionsResponse>
testIamPermissionsCallable()1732       testIamPermissionsCallable() {
1733     return stub.testIamPermissionsCallable();
1734   }
1735 
1736   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1737   /**
1738    * Update the specified disk with the data included in the request. Update is performed only on
1739    * selected fields included as part of update-mask. Only the following fields can be modified:
1740    * user_license.
1741    *
1742    * <p>Sample code:
1743    *
1744    * <pre>{@code
1745    * // This snippet has been automatically generated and should be regarded as a code template only.
1746    * // It will require modifications to work:
1747    * // - It may require correct/in-range values for request initialization.
1748    * // - It may require specifying regional endpoints when creating the service client as shown in
1749    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1750    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1751    *   String project = "project-309310695";
1752    *   String region = "region-934795532";
1753    *   String disk = "disk3083677";
1754    *   Disk diskResource = Disk.newBuilder().build();
1755    *   Operation response = regionDisksClient.updateAsync(project, region, disk, diskResource).get();
1756    * }
1757    * }</pre>
1758    *
1759    * @param project Project ID for this request.
1760    * @param region The name of the region for this request.
1761    * @param disk The disk name for this request.
1762    * @param diskResource The body resource for this request
1763    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1764    */
updateAsync( String project, String region, String disk, Disk diskResource)1765   public final OperationFuture<Operation, Operation> updateAsync(
1766       String project, String region, String disk, Disk diskResource) {
1767     UpdateRegionDiskRequest request =
1768         UpdateRegionDiskRequest.newBuilder()
1769             .setProject(project)
1770             .setRegion(region)
1771             .setDisk(disk)
1772             .setDiskResource(diskResource)
1773             .build();
1774     return updateAsync(request);
1775   }
1776 
1777   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1778   /**
1779    * Update the specified disk with the data included in the request. Update is performed only on
1780    * selected fields included as part of update-mask. Only the following fields can be modified:
1781    * user_license.
1782    *
1783    * <p>Sample code:
1784    *
1785    * <pre>{@code
1786    * // This snippet has been automatically generated and should be regarded as a code template only.
1787    * // It will require modifications to work:
1788    * // - It may require correct/in-range values for request initialization.
1789    * // - It may require specifying regional endpoints when creating the service client as shown in
1790    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1791    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1792    *   UpdateRegionDiskRequest request =
1793    *       UpdateRegionDiskRequest.newBuilder()
1794    *           .setDisk("disk3083677")
1795    *           .setDiskResource(Disk.newBuilder().build())
1796    *           .setPaths("paths106438894")
1797    *           .setProject("project-309310695")
1798    *           .setRegion("region-934795532")
1799    *           .setRequestId("requestId693933066")
1800    *           .setUpdateMask("updateMask-296147115")
1801    *           .build();
1802    *   Operation response = regionDisksClient.updateAsync(request).get();
1803    * }
1804    * }</pre>
1805    *
1806    * @param request The request object containing all of the parameters for the API call.
1807    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1808    */
1809   @BetaApi(
1810       "The surface for long-running operations is not stable yet and may change in the future.")
updateAsync(UpdateRegionDiskRequest request)1811   public final OperationFuture<Operation, Operation> updateAsync(UpdateRegionDiskRequest request) {
1812     return updateOperationCallable().futureCall(request);
1813   }
1814 
1815   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1816   /**
1817    * Update the specified disk with the data included in the request. Update is performed only on
1818    * selected fields included as part of update-mask. Only the following fields can be modified:
1819    * user_license.
1820    *
1821    * <p>Sample code:
1822    *
1823    * <pre>{@code
1824    * // This snippet has been automatically generated and should be regarded as a code template only.
1825    * // It will require modifications to work:
1826    * // - It may require correct/in-range values for request initialization.
1827    * // - It may require specifying regional endpoints when creating the service client as shown in
1828    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1829    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1830    *   UpdateRegionDiskRequest request =
1831    *       UpdateRegionDiskRequest.newBuilder()
1832    *           .setDisk("disk3083677")
1833    *           .setDiskResource(Disk.newBuilder().build())
1834    *           .setPaths("paths106438894")
1835    *           .setProject("project-309310695")
1836    *           .setRegion("region-934795532")
1837    *           .setRequestId("requestId693933066")
1838    *           .setUpdateMask("updateMask-296147115")
1839    *           .build();
1840    *   OperationFuture<Operation, Operation> future =
1841    *       regionDisksClient.updateOperationCallable().futureCall(request);
1842    *   // Do something.
1843    *   Operation response = future.get();
1844    * }
1845    * }</pre>
1846    */
1847   public final OperationCallable<UpdateRegionDiskRequest, Operation, Operation>
updateOperationCallable()1848       updateOperationCallable() {
1849     return stub.updateOperationCallable();
1850   }
1851 
1852   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1853   /**
1854    * Update the specified disk with the data included in the request. Update is performed only on
1855    * selected fields included as part of update-mask. Only the following fields can be modified:
1856    * user_license.
1857    *
1858    * <p>Sample code:
1859    *
1860    * <pre>{@code
1861    * // This snippet has been automatically generated and should be regarded as a code template only.
1862    * // It will require modifications to work:
1863    * // - It may require correct/in-range values for request initialization.
1864    * // - It may require specifying regional endpoints when creating the service client as shown in
1865    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1866    * try (RegionDisksClient regionDisksClient = RegionDisksClient.create()) {
1867    *   UpdateRegionDiskRequest request =
1868    *       UpdateRegionDiskRequest.newBuilder()
1869    *           .setDisk("disk3083677")
1870    *           .setDiskResource(Disk.newBuilder().build())
1871    *           .setPaths("paths106438894")
1872    *           .setProject("project-309310695")
1873    *           .setRegion("region-934795532")
1874    *           .setRequestId("requestId693933066")
1875    *           .setUpdateMask("updateMask-296147115")
1876    *           .build();
1877    *   ApiFuture<Operation> future = regionDisksClient.updateCallable().futureCall(request);
1878    *   // Do something.
1879    *   Operation response = future.get();
1880    * }
1881    * }</pre>
1882    */
updateCallable()1883   public final UnaryCallable<UpdateRegionDiskRequest, Operation> updateCallable() {
1884     return stub.updateCallable();
1885   }
1886 
1887   @Override
close()1888   public final void close() {
1889     stub.close();
1890   }
1891 
1892   @Override
shutdown()1893   public void shutdown() {
1894     stub.shutdown();
1895   }
1896 
1897   @Override
isShutdown()1898   public boolean isShutdown() {
1899     return stub.isShutdown();
1900   }
1901 
1902   @Override
isTerminated()1903   public boolean isTerminated() {
1904     return stub.isTerminated();
1905   }
1906 
1907   @Override
shutdownNow()1908   public void shutdownNow() {
1909     stub.shutdownNow();
1910   }
1911 
1912   @Override
awaitTermination(long duration, TimeUnit unit)1913   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1914     return stub.awaitTermination(duration, unit);
1915   }
1916 
1917   public static class ListPagedResponse
1918       extends AbstractPagedListResponse<
1919           ListRegionDisksRequest, DiskList, Disk, ListPage, ListFixedSizeCollection> {
1920 
createAsync( PageContext<ListRegionDisksRequest, DiskList, Disk> context, ApiFuture<DiskList> futureResponse)1921     public static ApiFuture<ListPagedResponse> createAsync(
1922         PageContext<ListRegionDisksRequest, DiskList, Disk> context,
1923         ApiFuture<DiskList> futureResponse) {
1924       ApiFuture<ListPage> futurePage =
1925           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
1926       return ApiFutures.transform(
1927           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
1928     }
1929 
ListPagedResponse(ListPage page)1930     private ListPagedResponse(ListPage page) {
1931       super(page, ListFixedSizeCollection.createEmptyCollection());
1932     }
1933   }
1934 
1935   public static class ListPage
1936       extends AbstractPage<ListRegionDisksRequest, DiskList, Disk, ListPage> {
1937 
ListPage( PageContext<ListRegionDisksRequest, DiskList, Disk> context, DiskList response)1938     private ListPage(
1939         PageContext<ListRegionDisksRequest, DiskList, Disk> context, DiskList response) {
1940       super(context, response);
1941     }
1942 
createEmptyPage()1943     private static ListPage createEmptyPage() {
1944       return new ListPage(null, null);
1945     }
1946 
1947     @Override
createPage( PageContext<ListRegionDisksRequest, DiskList, Disk> context, DiskList response)1948     protected ListPage createPage(
1949         PageContext<ListRegionDisksRequest, DiskList, Disk> context, DiskList response) {
1950       return new ListPage(context, response);
1951     }
1952 
1953     @Override
createPageAsync( PageContext<ListRegionDisksRequest, DiskList, Disk> context, ApiFuture<DiskList> futureResponse)1954     public ApiFuture<ListPage> createPageAsync(
1955         PageContext<ListRegionDisksRequest, DiskList, Disk> context,
1956         ApiFuture<DiskList> futureResponse) {
1957       return super.createPageAsync(context, futureResponse);
1958     }
1959   }
1960 
1961   public static class ListFixedSizeCollection
1962       extends AbstractFixedSizeCollection<
1963           ListRegionDisksRequest, DiskList, Disk, ListPage, ListFixedSizeCollection> {
1964 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1965     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
1966       super(pages, collectionSize);
1967     }
1968 
createEmptyCollection()1969     private static ListFixedSizeCollection createEmptyCollection() {
1970       return new ListFixedSizeCollection(null, 0);
1971     }
1972 
1973     @Override
createCollection(List<ListPage> pages, int collectionSize)1974     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1975       return new ListFixedSizeCollection(pages, collectionSize);
1976     }
1977   }
1978 }
1979