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