• 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.SslCertificatesStub;
31 import com.google.cloud.compute.v1.stub.SslCertificatesStubSettings;
32 import com.google.common.util.concurrent.MoreExecutors;
33 import java.io.IOException;
34 import java.util.List;
35 import java.util.Map;
36 import java.util.concurrent.TimeUnit;
37 import javax.annotation.Generated;
38 
39 // AUTO-GENERATED DOCUMENTATION AND CLASS.
40 /**
41  * Service Description: The SslCertificates API.
42  *
43  * <p>This class provides the ability to make remote calls to the backing service through method
44  * calls that map to API methods. Sample code to get started:
45  *
46  * <pre>{@code
47  * // This snippet has been automatically generated and should be regarded as a code template only.
48  * // It will require modifications to work:
49  * // - It may require correct/in-range values for request initialization.
50  * // - It may require specifying regional endpoints when creating the service client as shown in
51  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
52  * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
53  *   String project = "project-309310695";
54  *   String sslCertificate = "sslCertificate-1304941589";
55  *   SslCertificate response = sslCertificatesClient.get(project, sslCertificate);
56  * }
57  * }</pre>
58  *
59  * <p>Note: close() needs to be called on the SslCertificatesClient object to clean up resources
60  * such as threads. In the example above, try-with-resources is used, which automatically calls
61  * close().
62  *
63  * <p>The surface of this class includes several types of Java methods for each of the API's
64  * methods:
65  *
66  * <ol>
67  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
68  *       converted into function parameters. It may be the case that not all fields are available as
69  *       parameters, and not every API method will have a flattened method entry point.
70  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
71  *       which must be constructed before the call. Not every API method will have a request object
72  *       method.
73  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
74  *       callable object, which can be used to initiate calls to the service.
75  * </ol>
76  *
77  * <p>See the individual methods for example code.
78  *
79  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
80  * these names, this class includes a format method for each type of name, and additionally a parse
81  * method to extract the individual identifiers contained within names that are returned.
82  *
83  * <p>This class can be customized by passing in a custom instance of SslCertificatesSettings to
84  * create(). For example:
85  *
86  * <p>To customize credentials:
87  *
88  * <pre>{@code
89  * // This snippet has been automatically generated and should be regarded as a code template only.
90  * // It will require modifications to work:
91  * // - It may require correct/in-range values for request initialization.
92  * // - It may require specifying regional endpoints when creating the service client as shown in
93  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
94  * SslCertificatesSettings sslCertificatesSettings =
95  *     SslCertificatesSettings.newBuilder()
96  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
97  *         .build();
98  * SslCertificatesClient sslCertificatesClient =
99  *     SslCertificatesClient.create(sslCertificatesSettings);
100  * }</pre>
101  *
102  * <p>To customize the endpoint:
103  *
104  * <pre>{@code
105  * // This snippet has been automatically generated and should be regarded as a code template only.
106  * // It will require modifications to work:
107  * // - It may require correct/in-range values for request initialization.
108  * // - It may require specifying regional endpoints when creating the service client as shown in
109  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
110  * SslCertificatesSettings sslCertificatesSettings =
111  *     SslCertificatesSettings.newBuilder().setEndpoint(myEndpoint).build();
112  * SslCertificatesClient sslCertificatesClient =
113  *     SslCertificatesClient.create(sslCertificatesSettings);
114  * }</pre>
115  *
116  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
117  */
118 @Generated("by gapic-generator-java")
119 public class SslCertificatesClient implements BackgroundResource {
120   private final SslCertificatesSettings settings;
121   private final SslCertificatesStub stub;
122 
123   /** Constructs an instance of SslCertificatesClient with default settings. */
create()124   public static final SslCertificatesClient create() throws IOException {
125     return create(SslCertificatesSettings.newBuilder().build());
126   }
127 
128   /**
129    * Constructs an instance of SslCertificatesClient, using the given settings. The channels are
130    * created based on the settings passed in, or defaults for any settings that are not set.
131    */
create(SslCertificatesSettings settings)132   public static final SslCertificatesClient create(SslCertificatesSettings settings)
133       throws IOException {
134     return new SslCertificatesClient(settings);
135   }
136 
137   /**
138    * Constructs an instance of SslCertificatesClient, using the given stub for making calls. This is
139    * for advanced usage - prefer using create(SslCertificatesSettings).
140    */
create(SslCertificatesStub stub)141   public static final SslCertificatesClient create(SslCertificatesStub stub) {
142     return new SslCertificatesClient(stub);
143   }
144 
145   /**
146    * Constructs an instance of SslCertificatesClient, using the given settings. This is protected so
147    * that it is easy to make a subclass, but otherwise, the static factory methods should be
148    * preferred.
149    */
SslCertificatesClient(SslCertificatesSettings settings)150   protected SslCertificatesClient(SslCertificatesSettings settings) throws IOException {
151     this.settings = settings;
152     this.stub = ((SslCertificatesStubSettings) settings.getStubSettings()).createStub();
153   }
154 
SslCertificatesClient(SslCertificatesStub stub)155   protected SslCertificatesClient(SslCertificatesStub stub) {
156     this.settings = null;
157     this.stub = stub;
158   }
159 
getSettings()160   public final SslCertificatesSettings getSettings() {
161     return settings;
162   }
163 
getStub()164   public SslCertificatesStub getStub() {
165     return stub;
166   }
167 
168   // AUTO-GENERATED DOCUMENTATION AND METHOD.
169   /**
170    * Retrieves the list of all SslCertificate resources, regional and global, available to the
171    * specified project.
172    *
173    * <p>Sample code:
174    *
175    * <pre>{@code
176    * // This snippet has been automatically generated and should be regarded as a code template only.
177    * // It will require modifications to work:
178    * // - It may require correct/in-range values for request initialization.
179    * // - It may require specifying regional endpoints when creating the service client as shown in
180    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
181    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
182    *   String project = "project-309310695";
183    *   for (Map.Entry<String, SslCertificatesScopedList> element :
184    *       sslCertificatesClient.aggregatedList(project).iterateAll()) {
185    *     // doThingsWith(element);
186    *   }
187    * }
188    * }</pre>
189    *
190    * @param project Name of the project scoping this request.
191    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
192    */
aggregatedList(String project)193   public final AggregatedListPagedResponse aggregatedList(String project) {
194     AggregatedListSslCertificatesRequest request =
195         AggregatedListSslCertificatesRequest.newBuilder().setProject(project).build();
196     return aggregatedList(request);
197   }
198 
199   // AUTO-GENERATED DOCUMENTATION AND METHOD.
200   /**
201    * Retrieves the list of all SslCertificate resources, regional and global, available to the
202    * specified project.
203    *
204    * <p>Sample code:
205    *
206    * <pre>{@code
207    * // This snippet has been automatically generated and should be regarded as a code template only.
208    * // It will require modifications to work:
209    * // - It may require correct/in-range values for request initialization.
210    * // - It may require specifying regional endpoints when creating the service client as shown in
211    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
212    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
213    *   AggregatedListSslCertificatesRequest request =
214    *       AggregatedListSslCertificatesRequest.newBuilder()
215    *           .setFilter("filter-1274492040")
216    *           .setIncludeAllScopes(true)
217    *           .setMaxResults(1128457243)
218    *           .setOrderBy("orderBy-1207110587")
219    *           .setPageToken("pageToken873572522")
220    *           .setProject("project-309310695")
221    *           .setReturnPartialSuccess(true)
222    *           .build();
223    *   for (Map.Entry<String, SslCertificatesScopedList> element :
224    *       sslCertificatesClient.aggregatedList(request).iterateAll()) {
225    *     // doThingsWith(element);
226    *   }
227    * }
228    * }</pre>
229    *
230    * @param request The request object containing all of the parameters for the API call.
231    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
232    */
aggregatedList( AggregatedListSslCertificatesRequest request)233   public final AggregatedListPagedResponse aggregatedList(
234       AggregatedListSslCertificatesRequest request) {
235     return aggregatedListPagedCallable().call(request);
236   }
237 
238   // AUTO-GENERATED DOCUMENTATION AND METHOD.
239   /**
240    * Retrieves the list of all SslCertificate resources, regional and global, available to the
241    * specified project.
242    *
243    * <p>Sample code:
244    *
245    * <pre>{@code
246    * // This snippet has been automatically generated and should be regarded as a code template only.
247    * // It will require modifications to work:
248    * // - It may require correct/in-range values for request initialization.
249    * // - It may require specifying regional endpoints when creating the service client as shown in
250    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
251    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
252    *   AggregatedListSslCertificatesRequest request =
253    *       AggregatedListSslCertificatesRequest.newBuilder()
254    *           .setFilter("filter-1274492040")
255    *           .setIncludeAllScopes(true)
256    *           .setMaxResults(1128457243)
257    *           .setOrderBy("orderBy-1207110587")
258    *           .setPageToken("pageToken873572522")
259    *           .setProject("project-309310695")
260    *           .setReturnPartialSuccess(true)
261    *           .build();
262    *   ApiFuture<Map.Entry<String, SslCertificatesScopedList>> future =
263    *       sslCertificatesClient.aggregatedListPagedCallable().futureCall(request);
264    *   // Do something.
265    *   for (Map.Entry<String, SslCertificatesScopedList> element : future.get().iterateAll()) {
266    *     // doThingsWith(element);
267    *   }
268    * }
269    * }</pre>
270    */
271   public final UnaryCallable<AggregatedListSslCertificatesRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()272       aggregatedListPagedCallable() {
273     return stub.aggregatedListPagedCallable();
274   }
275 
276   // AUTO-GENERATED DOCUMENTATION AND METHOD.
277   /**
278    * Retrieves the list of all SslCertificate resources, regional and global, available to the
279    * specified project.
280    *
281    * <p>Sample code:
282    *
283    * <pre>{@code
284    * // This snippet has been automatically generated and should be regarded as a code template only.
285    * // It will require modifications to work:
286    * // - It may require correct/in-range values for request initialization.
287    * // - It may require specifying regional endpoints when creating the service client as shown in
288    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
289    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
290    *   AggregatedListSslCertificatesRequest request =
291    *       AggregatedListSslCertificatesRequest.newBuilder()
292    *           .setFilter("filter-1274492040")
293    *           .setIncludeAllScopes(true)
294    *           .setMaxResults(1128457243)
295    *           .setOrderBy("orderBy-1207110587")
296    *           .setPageToken("pageToken873572522")
297    *           .setProject("project-309310695")
298    *           .setReturnPartialSuccess(true)
299    *           .build();
300    *   while (true) {
301    *     SslCertificateAggregatedList response =
302    *         sslCertificatesClient.aggregatedListCallable().call(request);
303    *     for (Map.Entry<String, SslCertificatesScopedList> element : response.getItemsList()) {
304    *       // doThingsWith(element);
305    *     }
306    *     String nextPageToken = response.getNextPageToken();
307    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
308    *       request = request.toBuilder().setPageToken(nextPageToken).build();
309    *     } else {
310    *       break;
311    *     }
312    *   }
313    * }
314    * }</pre>
315    */
316   public final UnaryCallable<AggregatedListSslCertificatesRequest, SslCertificateAggregatedList>
aggregatedListCallable()317       aggregatedListCallable() {
318     return stub.aggregatedListCallable();
319   }
320 
321   // AUTO-GENERATED DOCUMENTATION AND METHOD.
322   /**
323    * Deletes the specified SslCertificate resource.
324    *
325    * <p>Sample code:
326    *
327    * <pre>{@code
328    * // This snippet has been automatically generated and should be regarded as a code template only.
329    * // It will require modifications to work:
330    * // - It may require correct/in-range values for request initialization.
331    * // - It may require specifying regional endpoints when creating the service client as shown in
332    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
333    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
334    *   String project = "project-309310695";
335    *   String sslCertificate = "sslCertificate-1304941589";
336    *   Operation response = sslCertificatesClient.deleteAsync(project, sslCertificate).get();
337    * }
338    * }</pre>
339    *
340    * @param project Project ID for this request.
341    * @param sslCertificate Name of the SslCertificate resource to delete.
342    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
343    */
deleteAsync( String project, String sslCertificate)344   public final OperationFuture<Operation, Operation> deleteAsync(
345       String project, String sslCertificate) {
346     DeleteSslCertificateRequest request =
347         DeleteSslCertificateRequest.newBuilder()
348             .setProject(project)
349             .setSslCertificate(sslCertificate)
350             .build();
351     return deleteAsync(request);
352   }
353 
354   // AUTO-GENERATED DOCUMENTATION AND METHOD.
355   /**
356    * Deletes the specified SslCertificate resource.
357    *
358    * <p>Sample code:
359    *
360    * <pre>{@code
361    * // This snippet has been automatically generated and should be regarded as a code template only.
362    * // It will require modifications to work:
363    * // - It may require correct/in-range values for request initialization.
364    * // - It may require specifying regional endpoints when creating the service client as shown in
365    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
366    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
367    *   DeleteSslCertificateRequest request =
368    *       DeleteSslCertificateRequest.newBuilder()
369    *           .setProject("project-309310695")
370    *           .setRequestId("requestId693933066")
371    *           .setSslCertificate("sslCertificate-1304941589")
372    *           .build();
373    *   Operation response = sslCertificatesClient.deleteAsync(request).get();
374    * }
375    * }</pre>
376    *
377    * @param request The request object containing all of the parameters for the API call.
378    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
379    */
380   @BetaApi(
381       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteSslCertificateRequest request)382   public final OperationFuture<Operation, Operation> deleteAsync(
383       DeleteSslCertificateRequest request) {
384     return deleteOperationCallable().futureCall(request);
385   }
386 
387   // AUTO-GENERATED DOCUMENTATION AND METHOD.
388   /**
389    * Deletes the specified SslCertificate resource.
390    *
391    * <p>Sample code:
392    *
393    * <pre>{@code
394    * // This snippet has been automatically generated and should be regarded as a code template only.
395    * // It will require modifications to work:
396    * // - It may require correct/in-range values for request initialization.
397    * // - It may require specifying regional endpoints when creating the service client as shown in
398    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
399    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
400    *   DeleteSslCertificateRequest request =
401    *       DeleteSslCertificateRequest.newBuilder()
402    *           .setProject("project-309310695")
403    *           .setRequestId("requestId693933066")
404    *           .setSslCertificate("sslCertificate-1304941589")
405    *           .build();
406    *   OperationFuture<Operation, Operation> future =
407    *       sslCertificatesClient.deleteOperationCallable().futureCall(request);
408    *   // Do something.
409    *   Operation response = future.get();
410    * }
411    * }</pre>
412    */
413   public final OperationCallable<DeleteSslCertificateRequest, Operation, Operation>
deleteOperationCallable()414       deleteOperationCallable() {
415     return stub.deleteOperationCallable();
416   }
417 
418   // AUTO-GENERATED DOCUMENTATION AND METHOD.
419   /**
420    * Deletes the specified SslCertificate resource.
421    *
422    * <p>Sample code:
423    *
424    * <pre>{@code
425    * // This snippet has been automatically generated and should be regarded as a code template only.
426    * // It will require modifications to work:
427    * // - It may require correct/in-range values for request initialization.
428    * // - It may require specifying regional endpoints when creating the service client as shown in
429    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
430    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
431    *   DeleteSslCertificateRequest request =
432    *       DeleteSslCertificateRequest.newBuilder()
433    *           .setProject("project-309310695")
434    *           .setRequestId("requestId693933066")
435    *           .setSslCertificate("sslCertificate-1304941589")
436    *           .build();
437    *   ApiFuture<Operation> future = sslCertificatesClient.deleteCallable().futureCall(request);
438    *   // Do something.
439    *   Operation response = future.get();
440    * }
441    * }</pre>
442    */
deleteCallable()443   public final UnaryCallable<DeleteSslCertificateRequest, Operation> deleteCallable() {
444     return stub.deleteCallable();
445   }
446 
447   // AUTO-GENERATED DOCUMENTATION AND METHOD.
448   /**
449    * Returns the specified SslCertificate resource.
450    *
451    * <p>Sample code:
452    *
453    * <pre>{@code
454    * // This snippet has been automatically generated and should be regarded as a code template only.
455    * // It will require modifications to work:
456    * // - It may require correct/in-range values for request initialization.
457    * // - It may require specifying regional endpoints when creating the service client as shown in
458    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
459    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
460    *   String project = "project-309310695";
461    *   String sslCertificate = "sslCertificate-1304941589";
462    *   SslCertificate response = sslCertificatesClient.get(project, sslCertificate);
463    * }
464    * }</pre>
465    *
466    * @param project Project ID for this request.
467    * @param sslCertificate Name of the SslCertificate resource to return.
468    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
469    */
get(String project, String sslCertificate)470   public final SslCertificate get(String project, String sslCertificate) {
471     GetSslCertificateRequest request =
472         GetSslCertificateRequest.newBuilder()
473             .setProject(project)
474             .setSslCertificate(sslCertificate)
475             .build();
476     return get(request);
477   }
478 
479   // AUTO-GENERATED DOCUMENTATION AND METHOD.
480   /**
481    * Returns the specified SslCertificate resource.
482    *
483    * <p>Sample code:
484    *
485    * <pre>{@code
486    * // This snippet has been automatically generated and should be regarded as a code template only.
487    * // It will require modifications to work:
488    * // - It may require correct/in-range values for request initialization.
489    * // - It may require specifying regional endpoints when creating the service client as shown in
490    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
491    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
492    *   GetSslCertificateRequest request =
493    *       GetSslCertificateRequest.newBuilder()
494    *           .setProject("project-309310695")
495    *           .setSslCertificate("sslCertificate-1304941589")
496    *           .build();
497    *   SslCertificate response = sslCertificatesClient.get(request);
498    * }
499    * }</pre>
500    *
501    * @param request The request object containing all of the parameters for the API call.
502    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
503    */
get(GetSslCertificateRequest request)504   public final SslCertificate get(GetSslCertificateRequest request) {
505     return getCallable().call(request);
506   }
507 
508   // AUTO-GENERATED DOCUMENTATION AND METHOD.
509   /**
510    * Returns the specified SslCertificate resource.
511    *
512    * <p>Sample code:
513    *
514    * <pre>{@code
515    * // This snippet has been automatically generated and should be regarded as a code template only.
516    * // It will require modifications to work:
517    * // - It may require correct/in-range values for request initialization.
518    * // - It may require specifying regional endpoints when creating the service client as shown in
519    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
520    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
521    *   GetSslCertificateRequest request =
522    *       GetSslCertificateRequest.newBuilder()
523    *           .setProject("project-309310695")
524    *           .setSslCertificate("sslCertificate-1304941589")
525    *           .build();
526    *   ApiFuture<SslCertificate> future = sslCertificatesClient.getCallable().futureCall(request);
527    *   // Do something.
528    *   SslCertificate response = future.get();
529    * }
530    * }</pre>
531    */
getCallable()532   public final UnaryCallable<GetSslCertificateRequest, SslCertificate> getCallable() {
533     return stub.getCallable();
534   }
535 
536   // AUTO-GENERATED DOCUMENTATION AND METHOD.
537   /**
538    * Creates a SslCertificate resource in the specified project using the data included in the
539    * request.
540    *
541    * <p>Sample code:
542    *
543    * <pre>{@code
544    * // This snippet has been automatically generated and should be regarded as a code template only.
545    * // It will require modifications to work:
546    * // - It may require correct/in-range values for request initialization.
547    * // - It may require specifying regional endpoints when creating the service client as shown in
548    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
549    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
550    *   String project = "project-309310695";
551    *   SslCertificate sslCertificateResource = SslCertificate.newBuilder().build();
552    *   Operation response = sslCertificatesClient.insertAsync(project, sslCertificateResource).get();
553    * }
554    * }</pre>
555    *
556    * @param project Project ID for this request.
557    * @param sslCertificateResource The body resource for this request
558    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
559    */
insertAsync( String project, SslCertificate sslCertificateResource)560   public final OperationFuture<Operation, Operation> insertAsync(
561       String project, SslCertificate sslCertificateResource) {
562     InsertSslCertificateRequest request =
563         InsertSslCertificateRequest.newBuilder()
564             .setProject(project)
565             .setSslCertificateResource(sslCertificateResource)
566             .build();
567     return insertAsync(request);
568   }
569 
570   // AUTO-GENERATED DOCUMENTATION AND METHOD.
571   /**
572    * Creates a SslCertificate resource in the specified project using the data included in the
573    * request.
574    *
575    * <p>Sample code:
576    *
577    * <pre>{@code
578    * // This snippet has been automatically generated and should be regarded as a code template only.
579    * // It will require modifications to work:
580    * // - It may require correct/in-range values for request initialization.
581    * // - It may require specifying regional endpoints when creating the service client as shown in
582    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
583    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
584    *   InsertSslCertificateRequest request =
585    *       InsertSslCertificateRequest.newBuilder()
586    *           .setProject("project-309310695")
587    *           .setRequestId("requestId693933066")
588    *           .setSslCertificateResource(SslCertificate.newBuilder().build())
589    *           .build();
590    *   Operation response = sslCertificatesClient.insertAsync(request).get();
591    * }
592    * }</pre>
593    *
594    * @param request The request object containing all of the parameters for the API call.
595    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
596    */
597   @BetaApi(
598       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertSslCertificateRequest request)599   public final OperationFuture<Operation, Operation> insertAsync(
600       InsertSslCertificateRequest request) {
601     return insertOperationCallable().futureCall(request);
602   }
603 
604   // AUTO-GENERATED DOCUMENTATION AND METHOD.
605   /**
606    * Creates a SslCertificate resource in the specified project using the data included in the
607    * request.
608    *
609    * <p>Sample code:
610    *
611    * <pre>{@code
612    * // This snippet has been automatically generated and should be regarded as a code template only.
613    * // It will require modifications to work:
614    * // - It may require correct/in-range values for request initialization.
615    * // - It may require specifying regional endpoints when creating the service client as shown in
616    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
617    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
618    *   InsertSslCertificateRequest request =
619    *       InsertSslCertificateRequest.newBuilder()
620    *           .setProject("project-309310695")
621    *           .setRequestId("requestId693933066")
622    *           .setSslCertificateResource(SslCertificate.newBuilder().build())
623    *           .build();
624    *   OperationFuture<Operation, Operation> future =
625    *       sslCertificatesClient.insertOperationCallable().futureCall(request);
626    *   // Do something.
627    *   Operation response = future.get();
628    * }
629    * }</pre>
630    */
631   public final OperationCallable<InsertSslCertificateRequest, Operation, Operation>
insertOperationCallable()632       insertOperationCallable() {
633     return stub.insertOperationCallable();
634   }
635 
636   // AUTO-GENERATED DOCUMENTATION AND METHOD.
637   /**
638    * Creates a SslCertificate resource in the specified project using the data included in the
639    * request.
640    *
641    * <p>Sample code:
642    *
643    * <pre>{@code
644    * // This snippet has been automatically generated and should be regarded as a code template only.
645    * // It will require modifications to work:
646    * // - It may require correct/in-range values for request initialization.
647    * // - It may require specifying regional endpoints when creating the service client as shown in
648    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
649    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
650    *   InsertSslCertificateRequest request =
651    *       InsertSslCertificateRequest.newBuilder()
652    *           .setProject("project-309310695")
653    *           .setRequestId("requestId693933066")
654    *           .setSslCertificateResource(SslCertificate.newBuilder().build())
655    *           .build();
656    *   ApiFuture<Operation> future = sslCertificatesClient.insertCallable().futureCall(request);
657    *   // Do something.
658    *   Operation response = future.get();
659    * }
660    * }</pre>
661    */
insertCallable()662   public final UnaryCallable<InsertSslCertificateRequest, Operation> insertCallable() {
663     return stub.insertCallable();
664   }
665 
666   // AUTO-GENERATED DOCUMENTATION AND METHOD.
667   /**
668    * Retrieves the list of SslCertificate resources available to the specified project.
669    *
670    * <p>Sample code:
671    *
672    * <pre>{@code
673    * // This snippet has been automatically generated and should be regarded as a code template only.
674    * // It will require modifications to work:
675    * // - It may require correct/in-range values for request initialization.
676    * // - It may require specifying regional endpoints when creating the service client as shown in
677    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
678    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
679    *   String project = "project-309310695";
680    *   for (SslCertificate element : sslCertificatesClient.list(project).iterateAll()) {
681    *     // doThingsWith(element);
682    *   }
683    * }
684    * }</pre>
685    *
686    * @param project Project ID for this request.
687    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
688    */
list(String project)689   public final ListPagedResponse list(String project) {
690     ListSslCertificatesRequest request =
691         ListSslCertificatesRequest.newBuilder().setProject(project).build();
692     return list(request);
693   }
694 
695   // AUTO-GENERATED DOCUMENTATION AND METHOD.
696   /**
697    * Retrieves the list of SslCertificate resources available to the specified project.
698    *
699    * <p>Sample code:
700    *
701    * <pre>{@code
702    * // This snippet has been automatically generated and should be regarded as a code template only.
703    * // It will require modifications to work:
704    * // - It may require correct/in-range values for request initialization.
705    * // - It may require specifying regional endpoints when creating the service client as shown in
706    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
707    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
708    *   ListSslCertificatesRequest request =
709    *       ListSslCertificatesRequest.newBuilder()
710    *           .setFilter("filter-1274492040")
711    *           .setMaxResults(1128457243)
712    *           .setOrderBy("orderBy-1207110587")
713    *           .setPageToken("pageToken873572522")
714    *           .setProject("project-309310695")
715    *           .setReturnPartialSuccess(true)
716    *           .build();
717    *   for (SslCertificate element : sslCertificatesClient.list(request).iterateAll()) {
718    *     // doThingsWith(element);
719    *   }
720    * }
721    * }</pre>
722    *
723    * @param request The request object containing all of the parameters for the API call.
724    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
725    */
list(ListSslCertificatesRequest request)726   public final ListPagedResponse list(ListSslCertificatesRequest request) {
727     return listPagedCallable().call(request);
728   }
729 
730   // AUTO-GENERATED DOCUMENTATION AND METHOD.
731   /**
732    * Retrieves the list of SslCertificate resources available to the specified project.
733    *
734    * <p>Sample code:
735    *
736    * <pre>{@code
737    * // This snippet has been automatically generated and should be regarded as a code template only.
738    * // It will require modifications to work:
739    * // - It may require correct/in-range values for request initialization.
740    * // - It may require specifying regional endpoints when creating the service client as shown in
741    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
742    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
743    *   ListSslCertificatesRequest request =
744    *       ListSslCertificatesRequest.newBuilder()
745    *           .setFilter("filter-1274492040")
746    *           .setMaxResults(1128457243)
747    *           .setOrderBy("orderBy-1207110587")
748    *           .setPageToken("pageToken873572522")
749    *           .setProject("project-309310695")
750    *           .setReturnPartialSuccess(true)
751    *           .build();
752    *   ApiFuture<SslCertificate> future =
753    *       sslCertificatesClient.listPagedCallable().futureCall(request);
754    *   // Do something.
755    *   for (SslCertificate element : future.get().iterateAll()) {
756    *     // doThingsWith(element);
757    *   }
758    * }
759    * }</pre>
760    */
listPagedCallable()761   public final UnaryCallable<ListSslCertificatesRequest, ListPagedResponse> listPagedCallable() {
762     return stub.listPagedCallable();
763   }
764 
765   // AUTO-GENERATED DOCUMENTATION AND METHOD.
766   /**
767    * Retrieves the list of SslCertificate resources available to the specified project.
768    *
769    * <p>Sample code:
770    *
771    * <pre>{@code
772    * // This snippet has been automatically generated and should be regarded as a code template only.
773    * // It will require modifications to work:
774    * // - It may require correct/in-range values for request initialization.
775    * // - It may require specifying regional endpoints when creating the service client as shown in
776    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
777    * try (SslCertificatesClient sslCertificatesClient = SslCertificatesClient.create()) {
778    *   ListSslCertificatesRequest request =
779    *       ListSslCertificatesRequest.newBuilder()
780    *           .setFilter("filter-1274492040")
781    *           .setMaxResults(1128457243)
782    *           .setOrderBy("orderBy-1207110587")
783    *           .setPageToken("pageToken873572522")
784    *           .setProject("project-309310695")
785    *           .setReturnPartialSuccess(true)
786    *           .build();
787    *   while (true) {
788    *     SslCertificateList response = sslCertificatesClient.listCallable().call(request);
789    *     for (SslCertificate element : response.getItemsList()) {
790    *       // doThingsWith(element);
791    *     }
792    *     String nextPageToken = response.getNextPageToken();
793    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
794    *       request = request.toBuilder().setPageToken(nextPageToken).build();
795    *     } else {
796    *       break;
797    *     }
798    *   }
799    * }
800    * }</pre>
801    */
listCallable()802   public final UnaryCallable<ListSslCertificatesRequest, SslCertificateList> listCallable() {
803     return stub.listCallable();
804   }
805 
806   @Override
close()807   public final void close() {
808     stub.close();
809   }
810 
811   @Override
shutdown()812   public void shutdown() {
813     stub.shutdown();
814   }
815 
816   @Override
isShutdown()817   public boolean isShutdown() {
818     return stub.isShutdown();
819   }
820 
821   @Override
isTerminated()822   public boolean isTerminated() {
823     return stub.isTerminated();
824   }
825 
826   @Override
shutdownNow()827   public void shutdownNow() {
828     stub.shutdownNow();
829   }
830 
831   @Override
awaitTermination(long duration, TimeUnit unit)832   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
833     return stub.awaitTermination(duration, unit);
834   }
835 
836   public static class AggregatedListPagedResponse
837       extends AbstractPagedListResponse<
838           AggregatedListSslCertificatesRequest,
839           SslCertificateAggregatedList,
840           Map.Entry<String, SslCertificatesScopedList>,
841           AggregatedListPage,
842           AggregatedListFixedSizeCollection> {
843 
createAsync( PageContext< AggregatedListSslCertificatesRequest, SslCertificateAggregatedList, Map.Entry<String, SslCertificatesScopedList>> context, ApiFuture<SslCertificateAggregatedList> futureResponse)844     public static ApiFuture<AggregatedListPagedResponse> createAsync(
845         PageContext<
846                 AggregatedListSslCertificatesRequest,
847                 SslCertificateAggregatedList,
848                 Map.Entry<String, SslCertificatesScopedList>>
849             context,
850         ApiFuture<SslCertificateAggregatedList> futureResponse) {
851       ApiFuture<AggregatedListPage> futurePage =
852           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
853       return ApiFutures.transform(
854           futurePage,
855           input -> new AggregatedListPagedResponse(input),
856           MoreExecutors.directExecutor());
857     }
858 
AggregatedListPagedResponse(AggregatedListPage page)859     private AggregatedListPagedResponse(AggregatedListPage page) {
860       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
861     }
862   }
863 
864   public static class AggregatedListPage
865       extends AbstractPage<
866           AggregatedListSslCertificatesRequest,
867           SslCertificateAggregatedList,
868           Map.Entry<String, SslCertificatesScopedList>,
869           AggregatedListPage> {
870 
AggregatedListPage( PageContext< AggregatedListSslCertificatesRequest, SslCertificateAggregatedList, Map.Entry<String, SslCertificatesScopedList>> context, SslCertificateAggregatedList response)871     private AggregatedListPage(
872         PageContext<
873                 AggregatedListSslCertificatesRequest,
874                 SslCertificateAggregatedList,
875                 Map.Entry<String, SslCertificatesScopedList>>
876             context,
877         SslCertificateAggregatedList response) {
878       super(context, response);
879     }
880 
createEmptyPage()881     private static AggregatedListPage createEmptyPage() {
882       return new AggregatedListPage(null, null);
883     }
884 
885     @Override
createPage( PageContext< AggregatedListSslCertificatesRequest, SslCertificateAggregatedList, Map.Entry<String, SslCertificatesScopedList>> context, SslCertificateAggregatedList response)886     protected AggregatedListPage createPage(
887         PageContext<
888                 AggregatedListSslCertificatesRequest,
889                 SslCertificateAggregatedList,
890                 Map.Entry<String, SslCertificatesScopedList>>
891             context,
892         SslCertificateAggregatedList response) {
893       return new AggregatedListPage(context, response);
894     }
895 
896     @Override
createPageAsync( PageContext< AggregatedListSslCertificatesRequest, SslCertificateAggregatedList, Map.Entry<String, SslCertificatesScopedList>> context, ApiFuture<SslCertificateAggregatedList> futureResponse)897     public ApiFuture<AggregatedListPage> createPageAsync(
898         PageContext<
899                 AggregatedListSslCertificatesRequest,
900                 SslCertificateAggregatedList,
901                 Map.Entry<String, SslCertificatesScopedList>>
902             context,
903         ApiFuture<SslCertificateAggregatedList> futureResponse) {
904       return super.createPageAsync(context, futureResponse);
905     }
906   }
907 
908   public static class AggregatedListFixedSizeCollection
909       extends AbstractFixedSizeCollection<
910           AggregatedListSslCertificatesRequest,
911           SslCertificateAggregatedList,
912           Map.Entry<String, SslCertificatesScopedList>,
913           AggregatedListPage,
914           AggregatedListFixedSizeCollection> {
915 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)916     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
917       super(pages, collectionSize);
918     }
919 
createEmptyCollection()920     private static AggregatedListFixedSizeCollection createEmptyCollection() {
921       return new AggregatedListFixedSizeCollection(null, 0);
922     }
923 
924     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)925     protected AggregatedListFixedSizeCollection createCollection(
926         List<AggregatedListPage> pages, int collectionSize) {
927       return new AggregatedListFixedSizeCollection(pages, collectionSize);
928     }
929   }
930 
931   public static class ListPagedResponse
932       extends AbstractPagedListResponse<
933           ListSslCertificatesRequest,
934           SslCertificateList,
935           SslCertificate,
936           ListPage,
937           ListFixedSizeCollection> {
938 
createAsync( PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context, ApiFuture<SslCertificateList> futureResponse)939     public static ApiFuture<ListPagedResponse> createAsync(
940         PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context,
941         ApiFuture<SslCertificateList> futureResponse) {
942       ApiFuture<ListPage> futurePage =
943           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
944       return ApiFutures.transform(
945           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
946     }
947 
ListPagedResponse(ListPage page)948     private ListPagedResponse(ListPage page) {
949       super(page, ListFixedSizeCollection.createEmptyCollection());
950     }
951   }
952 
953   public static class ListPage
954       extends AbstractPage<
955           ListSslCertificatesRequest, SslCertificateList, SslCertificate, ListPage> {
956 
ListPage( PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context, SslCertificateList response)957     private ListPage(
958         PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context,
959         SslCertificateList response) {
960       super(context, response);
961     }
962 
createEmptyPage()963     private static ListPage createEmptyPage() {
964       return new ListPage(null, null);
965     }
966 
967     @Override
createPage( PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context, SslCertificateList response)968     protected ListPage createPage(
969         PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context,
970         SslCertificateList response) {
971       return new ListPage(context, response);
972     }
973 
974     @Override
createPageAsync( PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context, ApiFuture<SslCertificateList> futureResponse)975     public ApiFuture<ListPage> createPageAsync(
976         PageContext<ListSslCertificatesRequest, SslCertificateList, SslCertificate> context,
977         ApiFuture<SslCertificateList> futureResponse) {
978       return super.createPageAsync(context, futureResponse);
979     }
980   }
981 
982   public static class ListFixedSizeCollection
983       extends AbstractFixedSizeCollection<
984           ListSslCertificatesRequest,
985           SslCertificateList,
986           SslCertificate,
987           ListPage,
988           ListFixedSizeCollection> {
989 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)990     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
991       super(pages, collectionSize);
992     }
993 
createEmptyCollection()994     private static ListFixedSizeCollection createEmptyCollection() {
995       return new ListFixedSizeCollection(null, 0);
996     }
997 
998     @Override
createCollection(List<ListPage> pages, int collectionSize)999     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1000       return new ListFixedSizeCollection(pages, collectionSize);
1001     }
1002   }
1003 }
1004