• 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.SecurityPoliciesStub;
31 import com.google.cloud.compute.v1.stub.SecurityPoliciesStubSettings;
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 SecurityPolicies 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 (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
53  *   String project = "project-309310695";
54  *   String securityPolicy = "securityPolicy-788621166";
55  *   SecurityPolicy response = securityPoliciesClient.get(project, securityPolicy);
56  * }
57  * }</pre>
58  *
59  * <p>Note: close() needs to be called on the SecurityPoliciesClient 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 SecurityPoliciesSettings 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  * SecurityPoliciesSettings securityPoliciesSettings =
95  *     SecurityPoliciesSettings.newBuilder()
96  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
97  *         .build();
98  * SecurityPoliciesClient securityPoliciesClient =
99  *     SecurityPoliciesClient.create(securityPoliciesSettings);
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  * SecurityPoliciesSettings securityPoliciesSettings =
111  *     SecurityPoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
112  * SecurityPoliciesClient securityPoliciesClient =
113  *     SecurityPoliciesClient.create(securityPoliciesSettings);
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 SecurityPoliciesClient implements BackgroundResource {
120   private final SecurityPoliciesSettings settings;
121   private final SecurityPoliciesStub stub;
122 
123   /** Constructs an instance of SecurityPoliciesClient with default settings. */
create()124   public static final SecurityPoliciesClient create() throws IOException {
125     return create(SecurityPoliciesSettings.newBuilder().build());
126   }
127 
128   /**
129    * Constructs an instance of SecurityPoliciesClient, 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(SecurityPoliciesSettings settings)132   public static final SecurityPoliciesClient create(SecurityPoliciesSettings settings)
133       throws IOException {
134     return new SecurityPoliciesClient(settings);
135   }
136 
137   /**
138    * Constructs an instance of SecurityPoliciesClient, using the given stub for making calls. This
139    * is for advanced usage - prefer using create(SecurityPoliciesSettings).
140    */
create(SecurityPoliciesStub stub)141   public static final SecurityPoliciesClient create(SecurityPoliciesStub stub) {
142     return new SecurityPoliciesClient(stub);
143   }
144 
145   /**
146    * Constructs an instance of SecurityPoliciesClient, using the given settings. This is protected
147    * so that it is easy to make a subclass, but otherwise, the static factory methods should be
148    * preferred.
149    */
SecurityPoliciesClient(SecurityPoliciesSettings settings)150   protected SecurityPoliciesClient(SecurityPoliciesSettings settings) throws IOException {
151     this.settings = settings;
152     this.stub = ((SecurityPoliciesStubSettings) settings.getStubSettings()).createStub();
153   }
154 
SecurityPoliciesClient(SecurityPoliciesStub stub)155   protected SecurityPoliciesClient(SecurityPoliciesStub stub) {
156     this.settings = null;
157     this.stub = stub;
158   }
159 
getSettings()160   public final SecurityPoliciesSettings getSettings() {
161     return settings;
162   }
163 
getStub()164   public SecurityPoliciesStub getStub() {
165     return stub;
166   }
167 
168   // AUTO-GENERATED DOCUMENTATION AND METHOD.
169   /**
170    * Inserts a rule into a security policy.
171    *
172    * <p>Sample code:
173    *
174    * <pre>{@code
175    * // This snippet has been automatically generated and should be regarded as a code template only.
176    * // It will require modifications to work:
177    * // - It may require correct/in-range values for request initialization.
178    * // - It may require specifying regional endpoints when creating the service client as shown in
179    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
180    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
181    *   String project = "project-309310695";
182    *   String securityPolicy = "securityPolicy-788621166";
183    *   SecurityPolicyRule securityPolicyRuleResource = SecurityPolicyRule.newBuilder().build();
184    *   Operation response =
185    *       securityPoliciesClient
186    *           .addRuleAsync(project, securityPolicy, securityPolicyRuleResource)
187    *           .get();
188    * }
189    * }</pre>
190    *
191    * @param project Project ID for this request.
192    * @param securityPolicy Name of the security policy to update.
193    * @param securityPolicyRuleResource The body resource for this request
194    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
195    */
addRuleAsync( String project, String securityPolicy, SecurityPolicyRule securityPolicyRuleResource)196   public final OperationFuture<Operation, Operation> addRuleAsync(
197       String project, String securityPolicy, SecurityPolicyRule securityPolicyRuleResource) {
198     AddRuleSecurityPolicyRequest request =
199         AddRuleSecurityPolicyRequest.newBuilder()
200             .setProject(project)
201             .setSecurityPolicy(securityPolicy)
202             .setSecurityPolicyRuleResource(securityPolicyRuleResource)
203             .build();
204     return addRuleAsync(request);
205   }
206 
207   // AUTO-GENERATED DOCUMENTATION AND METHOD.
208   /**
209    * Inserts a rule into a security policy.
210    *
211    * <p>Sample code:
212    *
213    * <pre>{@code
214    * // This snippet has been automatically generated and should be regarded as a code template only.
215    * // It will require modifications to work:
216    * // - It may require correct/in-range values for request initialization.
217    * // - It may require specifying regional endpoints when creating the service client as shown in
218    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
219    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
220    *   AddRuleSecurityPolicyRequest request =
221    *       AddRuleSecurityPolicyRequest.newBuilder()
222    *           .setProject("project-309310695")
223    *           .setSecurityPolicy("securityPolicy-788621166")
224    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
225    *           .setValidateOnly(true)
226    *           .build();
227    *   Operation response = securityPoliciesClient.addRuleAsync(request).get();
228    * }
229    * }</pre>
230    *
231    * @param request The request object containing all of the parameters for the API call.
232    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
233    */
234   @BetaApi(
235       "The surface for long-running operations is not stable yet and may change in the future.")
addRuleAsync( AddRuleSecurityPolicyRequest request)236   public final OperationFuture<Operation, Operation> addRuleAsync(
237       AddRuleSecurityPolicyRequest request) {
238     return addRuleOperationCallable().futureCall(request);
239   }
240 
241   // AUTO-GENERATED DOCUMENTATION AND METHOD.
242   /**
243    * Inserts a rule into a security policy.
244    *
245    * <p>Sample code:
246    *
247    * <pre>{@code
248    * // This snippet has been automatically generated and should be regarded as a code template only.
249    * // It will require modifications to work:
250    * // - It may require correct/in-range values for request initialization.
251    * // - It may require specifying regional endpoints when creating the service client as shown in
252    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
253    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
254    *   AddRuleSecurityPolicyRequest request =
255    *       AddRuleSecurityPolicyRequest.newBuilder()
256    *           .setProject("project-309310695")
257    *           .setSecurityPolicy("securityPolicy-788621166")
258    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
259    *           .setValidateOnly(true)
260    *           .build();
261    *   OperationFuture<Operation, Operation> future =
262    *       securityPoliciesClient.addRuleOperationCallable().futureCall(request);
263    *   // Do something.
264    *   Operation response = future.get();
265    * }
266    * }</pre>
267    */
268   public final OperationCallable<AddRuleSecurityPolicyRequest, Operation, Operation>
addRuleOperationCallable()269       addRuleOperationCallable() {
270     return stub.addRuleOperationCallable();
271   }
272 
273   // AUTO-GENERATED DOCUMENTATION AND METHOD.
274   /**
275    * Inserts a rule into a security policy.
276    *
277    * <p>Sample code:
278    *
279    * <pre>{@code
280    * // This snippet has been automatically generated and should be regarded as a code template only.
281    * // It will require modifications to work:
282    * // - It may require correct/in-range values for request initialization.
283    * // - It may require specifying regional endpoints when creating the service client as shown in
284    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
285    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
286    *   AddRuleSecurityPolicyRequest request =
287    *       AddRuleSecurityPolicyRequest.newBuilder()
288    *           .setProject("project-309310695")
289    *           .setSecurityPolicy("securityPolicy-788621166")
290    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
291    *           .setValidateOnly(true)
292    *           .build();
293    *   ApiFuture<Operation> future = securityPoliciesClient.addRuleCallable().futureCall(request);
294    *   // Do something.
295    *   Operation response = future.get();
296    * }
297    * }</pre>
298    */
addRuleCallable()299   public final UnaryCallable<AddRuleSecurityPolicyRequest, Operation> addRuleCallable() {
300     return stub.addRuleCallable();
301   }
302 
303   // AUTO-GENERATED DOCUMENTATION AND METHOD.
304   /**
305    * Retrieves the list of all SecurityPolicy resources, regional and global, available to the
306    * specified project.
307    *
308    * <p>Sample code:
309    *
310    * <pre>{@code
311    * // This snippet has been automatically generated and should be regarded as a code template only.
312    * // It will require modifications to work:
313    * // - It may require correct/in-range values for request initialization.
314    * // - It may require specifying regional endpoints when creating the service client as shown in
315    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
316    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
317    *   String project = "project-309310695";
318    *   for (Map.Entry<String, SecurityPoliciesScopedList> element :
319    *       securityPoliciesClient.aggregatedList(project).iterateAll()) {
320    *     // doThingsWith(element);
321    *   }
322    * }
323    * }</pre>
324    *
325    * @param project Name of the project scoping this request.
326    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
327    */
aggregatedList(String project)328   public final AggregatedListPagedResponse aggregatedList(String project) {
329     AggregatedListSecurityPoliciesRequest request =
330         AggregatedListSecurityPoliciesRequest.newBuilder().setProject(project).build();
331     return aggregatedList(request);
332   }
333 
334   // AUTO-GENERATED DOCUMENTATION AND METHOD.
335   /**
336    * Retrieves the list of all SecurityPolicy resources, regional and global, available to the
337    * specified project.
338    *
339    * <p>Sample code:
340    *
341    * <pre>{@code
342    * // This snippet has been automatically generated and should be regarded as a code template only.
343    * // It will require modifications to work:
344    * // - It may require correct/in-range values for request initialization.
345    * // - It may require specifying regional endpoints when creating the service client as shown in
346    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
347    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
348    *   AggregatedListSecurityPoliciesRequest request =
349    *       AggregatedListSecurityPoliciesRequest.newBuilder()
350    *           .setFilter("filter-1274492040")
351    *           .setIncludeAllScopes(true)
352    *           .setMaxResults(1128457243)
353    *           .setOrderBy("orderBy-1207110587")
354    *           .setPageToken("pageToken873572522")
355    *           .setProject("project-309310695")
356    *           .setReturnPartialSuccess(true)
357    *           .build();
358    *   for (Map.Entry<String, SecurityPoliciesScopedList> element :
359    *       securityPoliciesClient.aggregatedList(request).iterateAll()) {
360    *     // doThingsWith(element);
361    *   }
362    * }
363    * }</pre>
364    *
365    * @param request The request object containing all of the parameters for the API call.
366    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
367    */
aggregatedList( AggregatedListSecurityPoliciesRequest request)368   public final AggregatedListPagedResponse aggregatedList(
369       AggregatedListSecurityPoliciesRequest request) {
370     return aggregatedListPagedCallable().call(request);
371   }
372 
373   // AUTO-GENERATED DOCUMENTATION AND METHOD.
374   /**
375    * Retrieves the list of all SecurityPolicy resources, regional and global, available to the
376    * specified project.
377    *
378    * <p>Sample code:
379    *
380    * <pre>{@code
381    * // This snippet has been automatically generated and should be regarded as a code template only.
382    * // It will require modifications to work:
383    * // - It may require correct/in-range values for request initialization.
384    * // - It may require specifying regional endpoints when creating the service client as shown in
385    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
386    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
387    *   AggregatedListSecurityPoliciesRequest request =
388    *       AggregatedListSecurityPoliciesRequest.newBuilder()
389    *           .setFilter("filter-1274492040")
390    *           .setIncludeAllScopes(true)
391    *           .setMaxResults(1128457243)
392    *           .setOrderBy("orderBy-1207110587")
393    *           .setPageToken("pageToken873572522")
394    *           .setProject("project-309310695")
395    *           .setReturnPartialSuccess(true)
396    *           .build();
397    *   ApiFuture<Map.Entry<String, SecurityPoliciesScopedList>> future =
398    *       securityPoliciesClient.aggregatedListPagedCallable().futureCall(request);
399    *   // Do something.
400    *   for (Map.Entry<String, SecurityPoliciesScopedList> element : future.get().iterateAll()) {
401    *     // doThingsWith(element);
402    *   }
403    * }
404    * }</pre>
405    */
406   public final UnaryCallable<AggregatedListSecurityPoliciesRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()407       aggregatedListPagedCallable() {
408     return stub.aggregatedListPagedCallable();
409   }
410 
411   // AUTO-GENERATED DOCUMENTATION AND METHOD.
412   /**
413    * Retrieves the list of all SecurityPolicy resources, regional and global, available to the
414    * specified 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 (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
425    *   AggregatedListSecurityPoliciesRequest request =
426    *       AggregatedListSecurityPoliciesRequest.newBuilder()
427    *           .setFilter("filter-1274492040")
428    *           .setIncludeAllScopes(true)
429    *           .setMaxResults(1128457243)
430    *           .setOrderBy("orderBy-1207110587")
431    *           .setPageToken("pageToken873572522")
432    *           .setProject("project-309310695")
433    *           .setReturnPartialSuccess(true)
434    *           .build();
435    *   while (true) {
436    *     SecurityPoliciesAggregatedList response =
437    *         securityPoliciesClient.aggregatedListCallable().call(request);
438    *     for (Map.Entry<String, SecurityPoliciesScopedList> element : response.getItemsList()) {
439    *       // doThingsWith(element);
440    *     }
441    *     String nextPageToken = response.getNextPageToken();
442    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
443    *       request = request.toBuilder().setPageToken(nextPageToken).build();
444    *     } else {
445    *       break;
446    *     }
447    *   }
448    * }
449    * }</pre>
450    */
451   public final UnaryCallable<AggregatedListSecurityPoliciesRequest, SecurityPoliciesAggregatedList>
aggregatedListCallable()452       aggregatedListCallable() {
453     return stub.aggregatedListCallable();
454   }
455 
456   // AUTO-GENERATED DOCUMENTATION AND METHOD.
457   /**
458    * Deletes the specified policy.
459    *
460    * <p>Sample code:
461    *
462    * <pre>{@code
463    * // This snippet has been automatically generated and should be regarded as a code template only.
464    * // It will require modifications to work:
465    * // - It may require correct/in-range values for request initialization.
466    * // - It may require specifying regional endpoints when creating the service client as shown in
467    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
468    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
469    *   String project = "project-309310695";
470    *   String securityPolicy = "securityPolicy-788621166";
471    *   Operation response = securityPoliciesClient.deleteAsync(project, securityPolicy).get();
472    * }
473    * }</pre>
474    *
475    * @param project Project ID for this request.
476    * @param securityPolicy Name of the security policy to delete.
477    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
478    */
deleteAsync( String project, String securityPolicy)479   public final OperationFuture<Operation, Operation> deleteAsync(
480       String project, String securityPolicy) {
481     DeleteSecurityPolicyRequest request =
482         DeleteSecurityPolicyRequest.newBuilder()
483             .setProject(project)
484             .setSecurityPolicy(securityPolicy)
485             .build();
486     return deleteAsync(request);
487   }
488 
489   // AUTO-GENERATED DOCUMENTATION AND METHOD.
490   /**
491    * Deletes the specified policy.
492    *
493    * <p>Sample code:
494    *
495    * <pre>{@code
496    * // This snippet has been automatically generated and should be regarded as a code template only.
497    * // It will require modifications to work:
498    * // - It may require correct/in-range values for request initialization.
499    * // - It may require specifying regional endpoints when creating the service client as shown in
500    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
501    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
502    *   DeleteSecurityPolicyRequest request =
503    *       DeleteSecurityPolicyRequest.newBuilder()
504    *           .setProject("project-309310695")
505    *           .setRequestId("requestId693933066")
506    *           .setSecurityPolicy("securityPolicy-788621166")
507    *           .build();
508    *   Operation response = securityPoliciesClient.deleteAsync(request).get();
509    * }
510    * }</pre>
511    *
512    * @param request The request object containing all of the parameters for the API call.
513    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
514    */
515   @BetaApi(
516       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteSecurityPolicyRequest request)517   public final OperationFuture<Operation, Operation> deleteAsync(
518       DeleteSecurityPolicyRequest request) {
519     return deleteOperationCallable().futureCall(request);
520   }
521 
522   // AUTO-GENERATED DOCUMENTATION AND METHOD.
523   /**
524    * Deletes the specified policy.
525    *
526    * <p>Sample code:
527    *
528    * <pre>{@code
529    * // This snippet has been automatically generated and should be regarded as a code template only.
530    * // It will require modifications to work:
531    * // - It may require correct/in-range values for request initialization.
532    * // - It may require specifying regional endpoints when creating the service client as shown in
533    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
534    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
535    *   DeleteSecurityPolicyRequest request =
536    *       DeleteSecurityPolicyRequest.newBuilder()
537    *           .setProject("project-309310695")
538    *           .setRequestId("requestId693933066")
539    *           .setSecurityPolicy("securityPolicy-788621166")
540    *           .build();
541    *   OperationFuture<Operation, Operation> future =
542    *       securityPoliciesClient.deleteOperationCallable().futureCall(request);
543    *   // Do something.
544    *   Operation response = future.get();
545    * }
546    * }</pre>
547    */
548   public final OperationCallable<DeleteSecurityPolicyRequest, Operation, Operation>
deleteOperationCallable()549       deleteOperationCallable() {
550     return stub.deleteOperationCallable();
551   }
552 
553   // AUTO-GENERATED DOCUMENTATION AND METHOD.
554   /**
555    * Deletes the specified policy.
556    *
557    * <p>Sample code:
558    *
559    * <pre>{@code
560    * // This snippet has been automatically generated and should be regarded as a code template only.
561    * // It will require modifications to work:
562    * // - It may require correct/in-range values for request initialization.
563    * // - It may require specifying regional endpoints when creating the service client as shown in
564    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
565    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
566    *   DeleteSecurityPolicyRequest request =
567    *       DeleteSecurityPolicyRequest.newBuilder()
568    *           .setProject("project-309310695")
569    *           .setRequestId("requestId693933066")
570    *           .setSecurityPolicy("securityPolicy-788621166")
571    *           .build();
572    *   ApiFuture<Operation> future = securityPoliciesClient.deleteCallable().futureCall(request);
573    *   // Do something.
574    *   Operation response = future.get();
575    * }
576    * }</pre>
577    */
deleteCallable()578   public final UnaryCallable<DeleteSecurityPolicyRequest, Operation> deleteCallable() {
579     return stub.deleteCallable();
580   }
581 
582   // AUTO-GENERATED DOCUMENTATION AND METHOD.
583   /**
584    * List all of the ordered rules present in a single specified policy.
585    *
586    * <p>Sample code:
587    *
588    * <pre>{@code
589    * // This snippet has been automatically generated and should be regarded as a code template only.
590    * // It will require modifications to work:
591    * // - It may require correct/in-range values for request initialization.
592    * // - It may require specifying regional endpoints when creating the service client as shown in
593    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
594    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
595    *   String project = "project-309310695";
596    *   String securityPolicy = "securityPolicy-788621166";
597    *   SecurityPolicy response = securityPoliciesClient.get(project, securityPolicy);
598    * }
599    * }</pre>
600    *
601    * @param project Project ID for this request.
602    * @param securityPolicy Name of the security policy to get.
603    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
604    */
get(String project, String securityPolicy)605   public final SecurityPolicy get(String project, String securityPolicy) {
606     GetSecurityPolicyRequest request =
607         GetSecurityPolicyRequest.newBuilder()
608             .setProject(project)
609             .setSecurityPolicy(securityPolicy)
610             .build();
611     return get(request);
612   }
613 
614   // AUTO-GENERATED DOCUMENTATION AND METHOD.
615   /**
616    * List all of the ordered rules present in a single specified policy.
617    *
618    * <p>Sample code:
619    *
620    * <pre>{@code
621    * // This snippet has been automatically generated and should be regarded as a code template only.
622    * // It will require modifications to work:
623    * // - It may require correct/in-range values for request initialization.
624    * // - It may require specifying regional endpoints when creating the service client as shown in
625    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
626    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
627    *   GetSecurityPolicyRequest request =
628    *       GetSecurityPolicyRequest.newBuilder()
629    *           .setProject("project-309310695")
630    *           .setSecurityPolicy("securityPolicy-788621166")
631    *           .build();
632    *   SecurityPolicy response = securityPoliciesClient.get(request);
633    * }
634    * }</pre>
635    *
636    * @param request The request object containing all of the parameters for the API call.
637    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
638    */
get(GetSecurityPolicyRequest request)639   public final SecurityPolicy get(GetSecurityPolicyRequest request) {
640     return getCallable().call(request);
641   }
642 
643   // AUTO-GENERATED DOCUMENTATION AND METHOD.
644   /**
645    * List all of the ordered rules present in a single specified policy.
646    *
647    * <p>Sample code:
648    *
649    * <pre>{@code
650    * // This snippet has been automatically generated and should be regarded as a code template only.
651    * // It will require modifications to work:
652    * // - It may require correct/in-range values for request initialization.
653    * // - It may require specifying regional endpoints when creating the service client as shown in
654    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
655    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
656    *   GetSecurityPolicyRequest request =
657    *       GetSecurityPolicyRequest.newBuilder()
658    *           .setProject("project-309310695")
659    *           .setSecurityPolicy("securityPolicy-788621166")
660    *           .build();
661    *   ApiFuture<SecurityPolicy> future = securityPoliciesClient.getCallable().futureCall(request);
662    *   // Do something.
663    *   SecurityPolicy response = future.get();
664    * }
665    * }</pre>
666    */
getCallable()667   public final UnaryCallable<GetSecurityPolicyRequest, SecurityPolicy> getCallable() {
668     return stub.getCallable();
669   }
670 
671   // AUTO-GENERATED DOCUMENTATION AND METHOD.
672   /**
673    * Gets a rule at the specified priority.
674    *
675    * <p>Sample code:
676    *
677    * <pre>{@code
678    * // This snippet has been automatically generated and should be regarded as a code template only.
679    * // It will require modifications to work:
680    * // - It may require correct/in-range values for request initialization.
681    * // - It may require specifying regional endpoints when creating the service client as shown in
682    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
683    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
684    *   String project = "project-309310695";
685    *   String securityPolicy = "securityPolicy-788621166";
686    *   SecurityPolicyRule response = securityPoliciesClient.getRule(project, securityPolicy);
687    * }
688    * }</pre>
689    *
690    * @param project Project ID for this request.
691    * @param securityPolicy Name of the security policy to which the queried rule belongs.
692    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
693    */
getRule(String project, String securityPolicy)694   public final SecurityPolicyRule getRule(String project, String securityPolicy) {
695     GetRuleSecurityPolicyRequest request =
696         GetRuleSecurityPolicyRequest.newBuilder()
697             .setProject(project)
698             .setSecurityPolicy(securityPolicy)
699             .build();
700     return getRule(request);
701   }
702 
703   // AUTO-GENERATED DOCUMENTATION AND METHOD.
704   /**
705    * Gets a rule at the specified priority.
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 (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
716    *   GetRuleSecurityPolicyRequest request =
717    *       GetRuleSecurityPolicyRequest.newBuilder()
718    *           .setPriority(-1165461084)
719    *           .setProject("project-309310695")
720    *           .setSecurityPolicy("securityPolicy-788621166")
721    *           .build();
722    *   SecurityPolicyRule response = securityPoliciesClient.getRule(request);
723    * }
724    * }</pre>
725    *
726    * @param request The request object containing all of the parameters for the API call.
727    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
728    */
getRule(GetRuleSecurityPolicyRequest request)729   public final SecurityPolicyRule getRule(GetRuleSecurityPolicyRequest request) {
730     return getRuleCallable().call(request);
731   }
732 
733   // AUTO-GENERATED DOCUMENTATION AND METHOD.
734   /**
735    * Gets a rule at the specified priority.
736    *
737    * <p>Sample code:
738    *
739    * <pre>{@code
740    * // This snippet has been automatically generated and should be regarded as a code template only.
741    * // It will require modifications to work:
742    * // - It may require correct/in-range values for request initialization.
743    * // - It may require specifying regional endpoints when creating the service client as shown in
744    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
745    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
746    *   GetRuleSecurityPolicyRequest request =
747    *       GetRuleSecurityPolicyRequest.newBuilder()
748    *           .setPriority(-1165461084)
749    *           .setProject("project-309310695")
750    *           .setSecurityPolicy("securityPolicy-788621166")
751    *           .build();
752    *   ApiFuture<SecurityPolicyRule> future =
753    *       securityPoliciesClient.getRuleCallable().futureCall(request);
754    *   // Do something.
755    *   SecurityPolicyRule response = future.get();
756    * }
757    * }</pre>
758    */
getRuleCallable()759   public final UnaryCallable<GetRuleSecurityPolicyRequest, SecurityPolicyRule> getRuleCallable() {
760     return stub.getRuleCallable();
761   }
762 
763   // AUTO-GENERATED DOCUMENTATION AND METHOD.
764   /**
765    * Creates a new policy in the specified project using the data included in the request.
766    *
767    * <p>Sample code:
768    *
769    * <pre>{@code
770    * // This snippet has been automatically generated and should be regarded as a code template only.
771    * // It will require modifications to work:
772    * // - It may require correct/in-range values for request initialization.
773    * // - It may require specifying regional endpoints when creating the service client as shown in
774    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
775    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
776    *   String project = "project-309310695";
777    *   SecurityPolicy securityPolicyResource = SecurityPolicy.newBuilder().build();
778    *   Operation response =
779    *       securityPoliciesClient.insertAsync(project, securityPolicyResource).get();
780    * }
781    * }</pre>
782    *
783    * @param project Project ID for this request.
784    * @param securityPolicyResource The body resource for this request
785    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
786    */
insertAsync( String project, SecurityPolicy securityPolicyResource)787   public final OperationFuture<Operation, Operation> insertAsync(
788       String project, SecurityPolicy securityPolicyResource) {
789     InsertSecurityPolicyRequest request =
790         InsertSecurityPolicyRequest.newBuilder()
791             .setProject(project)
792             .setSecurityPolicyResource(securityPolicyResource)
793             .build();
794     return insertAsync(request);
795   }
796 
797   // AUTO-GENERATED DOCUMENTATION AND METHOD.
798   /**
799    * Creates a new policy in the specified project using the data included in the request.
800    *
801    * <p>Sample code:
802    *
803    * <pre>{@code
804    * // This snippet has been automatically generated and should be regarded as a code template only.
805    * // It will require modifications to work:
806    * // - It may require correct/in-range values for request initialization.
807    * // - It may require specifying regional endpoints when creating the service client as shown in
808    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
809    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
810    *   InsertSecurityPolicyRequest request =
811    *       InsertSecurityPolicyRequest.newBuilder()
812    *           .setProject("project-309310695")
813    *           .setRequestId("requestId693933066")
814    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
815    *           .setValidateOnly(true)
816    *           .build();
817    *   Operation response = securityPoliciesClient.insertAsync(request).get();
818    * }
819    * }</pre>
820    *
821    * @param request The request object containing all of the parameters for the API call.
822    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
823    */
824   @BetaApi(
825       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertSecurityPolicyRequest request)826   public final OperationFuture<Operation, Operation> insertAsync(
827       InsertSecurityPolicyRequest request) {
828     return insertOperationCallable().futureCall(request);
829   }
830 
831   // AUTO-GENERATED DOCUMENTATION AND METHOD.
832   /**
833    * Creates a new policy in the specified project using the data included in the request.
834    *
835    * <p>Sample code:
836    *
837    * <pre>{@code
838    * // This snippet has been automatically generated and should be regarded as a code template only.
839    * // It will require modifications to work:
840    * // - It may require correct/in-range values for request initialization.
841    * // - It may require specifying regional endpoints when creating the service client as shown in
842    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
843    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
844    *   InsertSecurityPolicyRequest request =
845    *       InsertSecurityPolicyRequest.newBuilder()
846    *           .setProject("project-309310695")
847    *           .setRequestId("requestId693933066")
848    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
849    *           .setValidateOnly(true)
850    *           .build();
851    *   OperationFuture<Operation, Operation> future =
852    *       securityPoliciesClient.insertOperationCallable().futureCall(request);
853    *   // Do something.
854    *   Operation response = future.get();
855    * }
856    * }</pre>
857    */
858   public final OperationCallable<InsertSecurityPolicyRequest, Operation, Operation>
insertOperationCallable()859       insertOperationCallable() {
860     return stub.insertOperationCallable();
861   }
862 
863   // AUTO-GENERATED DOCUMENTATION AND METHOD.
864   /**
865    * Creates a new policy in the specified project using the data included in the request.
866    *
867    * <p>Sample code:
868    *
869    * <pre>{@code
870    * // This snippet has been automatically generated and should be regarded as a code template only.
871    * // It will require modifications to work:
872    * // - It may require correct/in-range values for request initialization.
873    * // - It may require specifying regional endpoints when creating the service client as shown in
874    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
875    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
876    *   InsertSecurityPolicyRequest request =
877    *       InsertSecurityPolicyRequest.newBuilder()
878    *           .setProject("project-309310695")
879    *           .setRequestId("requestId693933066")
880    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
881    *           .setValidateOnly(true)
882    *           .build();
883    *   ApiFuture<Operation> future = securityPoliciesClient.insertCallable().futureCall(request);
884    *   // Do something.
885    *   Operation response = future.get();
886    * }
887    * }</pre>
888    */
insertCallable()889   public final UnaryCallable<InsertSecurityPolicyRequest, Operation> insertCallable() {
890     return stub.insertCallable();
891   }
892 
893   // AUTO-GENERATED DOCUMENTATION AND METHOD.
894   /**
895    * List all the policies that have been configured for the specified project.
896    *
897    * <p>Sample code:
898    *
899    * <pre>{@code
900    * // This snippet has been automatically generated and should be regarded as a code template only.
901    * // It will require modifications to work:
902    * // - It may require correct/in-range values for request initialization.
903    * // - It may require specifying regional endpoints when creating the service client as shown in
904    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
905    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
906    *   String project = "project-309310695";
907    *   for (SecurityPolicy element : securityPoliciesClient.list(project).iterateAll()) {
908    *     // doThingsWith(element);
909    *   }
910    * }
911    * }</pre>
912    *
913    * @param project Project ID for this request.
914    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
915    */
list(String project)916   public final ListPagedResponse list(String project) {
917     ListSecurityPoliciesRequest request =
918         ListSecurityPoliciesRequest.newBuilder().setProject(project).build();
919     return list(request);
920   }
921 
922   // AUTO-GENERATED DOCUMENTATION AND METHOD.
923   /**
924    * List all the policies that have been configured for the specified project.
925    *
926    * <p>Sample code:
927    *
928    * <pre>{@code
929    * // This snippet has been automatically generated and should be regarded as a code template only.
930    * // It will require modifications to work:
931    * // - It may require correct/in-range values for request initialization.
932    * // - It may require specifying regional endpoints when creating the service client as shown in
933    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
934    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
935    *   ListSecurityPoliciesRequest request =
936    *       ListSecurityPoliciesRequest.newBuilder()
937    *           .setFilter("filter-1274492040")
938    *           .setMaxResults(1128457243)
939    *           .setOrderBy("orderBy-1207110587")
940    *           .setPageToken("pageToken873572522")
941    *           .setProject("project-309310695")
942    *           .setReturnPartialSuccess(true)
943    *           .build();
944    *   for (SecurityPolicy element : securityPoliciesClient.list(request).iterateAll()) {
945    *     // doThingsWith(element);
946    *   }
947    * }
948    * }</pre>
949    *
950    * @param request The request object containing all of the parameters for the API call.
951    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
952    */
list(ListSecurityPoliciesRequest request)953   public final ListPagedResponse list(ListSecurityPoliciesRequest request) {
954     return listPagedCallable().call(request);
955   }
956 
957   // AUTO-GENERATED DOCUMENTATION AND METHOD.
958   /**
959    * List all the policies that have been configured for the specified project.
960    *
961    * <p>Sample code:
962    *
963    * <pre>{@code
964    * // This snippet has been automatically generated and should be regarded as a code template only.
965    * // It will require modifications to work:
966    * // - It may require correct/in-range values for request initialization.
967    * // - It may require specifying regional endpoints when creating the service client as shown in
968    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
969    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
970    *   ListSecurityPoliciesRequest request =
971    *       ListSecurityPoliciesRequest.newBuilder()
972    *           .setFilter("filter-1274492040")
973    *           .setMaxResults(1128457243)
974    *           .setOrderBy("orderBy-1207110587")
975    *           .setPageToken("pageToken873572522")
976    *           .setProject("project-309310695")
977    *           .setReturnPartialSuccess(true)
978    *           .build();
979    *   ApiFuture<SecurityPolicy> future =
980    *       securityPoliciesClient.listPagedCallable().futureCall(request);
981    *   // Do something.
982    *   for (SecurityPolicy element : future.get().iterateAll()) {
983    *     // doThingsWith(element);
984    *   }
985    * }
986    * }</pre>
987    */
listPagedCallable()988   public final UnaryCallable<ListSecurityPoliciesRequest, ListPagedResponse> listPagedCallable() {
989     return stub.listPagedCallable();
990   }
991 
992   // AUTO-GENERATED DOCUMENTATION AND METHOD.
993   /**
994    * List all the policies that have been configured for the specified project.
995    *
996    * <p>Sample code:
997    *
998    * <pre>{@code
999    * // This snippet has been automatically generated and should be regarded as a code template only.
1000    * // It will require modifications to work:
1001    * // - It may require correct/in-range values for request initialization.
1002    * // - It may require specifying regional endpoints when creating the service client as shown in
1003    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1004    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1005    *   ListSecurityPoliciesRequest request =
1006    *       ListSecurityPoliciesRequest.newBuilder()
1007    *           .setFilter("filter-1274492040")
1008    *           .setMaxResults(1128457243)
1009    *           .setOrderBy("orderBy-1207110587")
1010    *           .setPageToken("pageToken873572522")
1011    *           .setProject("project-309310695")
1012    *           .setReturnPartialSuccess(true)
1013    *           .build();
1014    *   while (true) {
1015    *     SecurityPolicyList response = securityPoliciesClient.listCallable().call(request);
1016    *     for (SecurityPolicy element : response.getItemsList()) {
1017    *       // doThingsWith(element);
1018    *     }
1019    *     String nextPageToken = response.getNextPageToken();
1020    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1021    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1022    *     } else {
1023    *       break;
1024    *     }
1025    *   }
1026    * }
1027    * }</pre>
1028    */
listCallable()1029   public final UnaryCallable<ListSecurityPoliciesRequest, SecurityPolicyList> listCallable() {
1030     return stub.listCallable();
1031   }
1032 
1033   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1034   /**
1035    * Gets the current list of preconfigured Web Application Firewall (WAF) expressions.
1036    *
1037    * <p>Sample code:
1038    *
1039    * <pre>{@code
1040    * // This snippet has been automatically generated and should be regarded as a code template only.
1041    * // It will require modifications to work:
1042    * // - It may require correct/in-range values for request initialization.
1043    * // - It may require specifying regional endpoints when creating the service client as shown in
1044    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1045    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1046    *   String project = "project-309310695";
1047    *   SecurityPoliciesListPreconfiguredExpressionSetsResponse response =
1048    *       securityPoliciesClient.listPreconfiguredExpressionSets(project);
1049    * }
1050    * }</pre>
1051    *
1052    * @param project Project ID for this request.
1053    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1054    */
1055   public final SecurityPoliciesListPreconfiguredExpressionSetsResponse
listPreconfiguredExpressionSets(String project)1056       listPreconfiguredExpressionSets(String project) {
1057     ListPreconfiguredExpressionSetsSecurityPoliciesRequest request =
1058         ListPreconfiguredExpressionSetsSecurityPoliciesRequest.newBuilder()
1059             .setProject(project)
1060             .build();
1061     return listPreconfiguredExpressionSets(request);
1062   }
1063 
1064   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1065   /**
1066    * Gets the current list of preconfigured Web Application Firewall (WAF) expressions.
1067    *
1068    * <p>Sample code:
1069    *
1070    * <pre>{@code
1071    * // This snippet has been automatically generated and should be regarded as a code template only.
1072    * // It will require modifications to work:
1073    * // - It may require correct/in-range values for request initialization.
1074    * // - It may require specifying regional endpoints when creating the service client as shown in
1075    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1076    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1077    *   ListPreconfiguredExpressionSetsSecurityPoliciesRequest request =
1078    *       ListPreconfiguredExpressionSetsSecurityPoliciesRequest.newBuilder()
1079    *           .setFilter("filter-1274492040")
1080    *           .setMaxResults(1128457243)
1081    *           .setOrderBy("orderBy-1207110587")
1082    *           .setPageToken("pageToken873572522")
1083    *           .setProject("project-309310695")
1084    *           .setReturnPartialSuccess(true)
1085    *           .build();
1086    *   SecurityPoliciesListPreconfiguredExpressionSetsResponse response =
1087    *       securityPoliciesClient.listPreconfiguredExpressionSets(request);
1088    * }
1089    * }</pre>
1090    *
1091    * @param request The request object containing all of the parameters for the API call.
1092    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1093    */
1094   public final SecurityPoliciesListPreconfiguredExpressionSetsResponse
listPreconfiguredExpressionSets( ListPreconfiguredExpressionSetsSecurityPoliciesRequest request)1095       listPreconfiguredExpressionSets(
1096           ListPreconfiguredExpressionSetsSecurityPoliciesRequest request) {
1097     return listPreconfiguredExpressionSetsCallable().call(request);
1098   }
1099 
1100   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1101   /**
1102    * Gets the current list of preconfigured Web Application Firewall (WAF) expressions.
1103    *
1104    * <p>Sample code:
1105    *
1106    * <pre>{@code
1107    * // This snippet has been automatically generated and should be regarded as a code template only.
1108    * // It will require modifications to work:
1109    * // - It may require correct/in-range values for request initialization.
1110    * // - It may require specifying regional endpoints when creating the service client as shown in
1111    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1112    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1113    *   ListPreconfiguredExpressionSetsSecurityPoliciesRequest request =
1114    *       ListPreconfiguredExpressionSetsSecurityPoliciesRequest.newBuilder()
1115    *           .setFilter("filter-1274492040")
1116    *           .setMaxResults(1128457243)
1117    *           .setOrderBy("orderBy-1207110587")
1118    *           .setPageToken("pageToken873572522")
1119    *           .setProject("project-309310695")
1120    *           .setReturnPartialSuccess(true)
1121    *           .build();
1122    *   ApiFuture<SecurityPoliciesListPreconfiguredExpressionSetsResponse> future =
1123    *       securityPoliciesClient.listPreconfiguredExpressionSetsCallable().futureCall(request);
1124    *   // Do something.
1125    *   SecurityPoliciesListPreconfiguredExpressionSetsResponse response = future.get();
1126    * }
1127    * }</pre>
1128    */
1129   public final UnaryCallable<
1130           ListPreconfiguredExpressionSetsSecurityPoliciesRequest,
1131           SecurityPoliciesListPreconfiguredExpressionSetsResponse>
listPreconfiguredExpressionSetsCallable()1132       listPreconfiguredExpressionSetsCallable() {
1133     return stub.listPreconfiguredExpressionSetsCallable();
1134   }
1135 
1136   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1137   /**
1138    * Patches the specified policy with the data included in the request. To clear fields in the
1139    * rule, leave the fields empty and specify them in the updateMask. This cannot be used to be
1140    * update the rules in the policy. Please use the per rule methods like addRule, patchRule, and
1141    * removeRule instead.
1142    *
1143    * <p>Sample code:
1144    *
1145    * <pre>{@code
1146    * // This snippet has been automatically generated and should be regarded as a code template only.
1147    * // It will require modifications to work:
1148    * // - It may require correct/in-range values for request initialization.
1149    * // - It may require specifying regional endpoints when creating the service client as shown in
1150    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1151    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1152    *   String project = "project-309310695";
1153    *   String securityPolicy = "securityPolicy-788621166";
1154    *   SecurityPolicy securityPolicyResource = SecurityPolicy.newBuilder().build();
1155    *   Operation response =
1156    *       securityPoliciesClient.patchAsync(project, securityPolicy, securityPolicyResource).get();
1157    * }
1158    * }</pre>
1159    *
1160    * @param project Project ID for this request.
1161    * @param securityPolicy Name of the security policy to update.
1162    * @param securityPolicyResource The body resource for this request
1163    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1164    */
patchAsync( String project, String securityPolicy, SecurityPolicy securityPolicyResource)1165   public final OperationFuture<Operation, Operation> patchAsync(
1166       String project, String securityPolicy, SecurityPolicy securityPolicyResource) {
1167     PatchSecurityPolicyRequest request =
1168         PatchSecurityPolicyRequest.newBuilder()
1169             .setProject(project)
1170             .setSecurityPolicy(securityPolicy)
1171             .setSecurityPolicyResource(securityPolicyResource)
1172             .build();
1173     return patchAsync(request);
1174   }
1175 
1176   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1177   /**
1178    * Patches the specified policy with the data included in the request. To clear fields in the
1179    * rule, leave the fields empty and specify them in the updateMask. This cannot be used to be
1180    * update the rules in the policy. Please use the per rule methods like addRule, patchRule, and
1181    * removeRule instead.
1182    *
1183    * <p>Sample code:
1184    *
1185    * <pre>{@code
1186    * // This snippet has been automatically generated and should be regarded as a code template only.
1187    * // It will require modifications to work:
1188    * // - It may require correct/in-range values for request initialization.
1189    * // - It may require specifying regional endpoints when creating the service client as shown in
1190    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1191    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1192    *   PatchSecurityPolicyRequest request =
1193    *       PatchSecurityPolicyRequest.newBuilder()
1194    *           .setProject("project-309310695")
1195    *           .setRequestId("requestId693933066")
1196    *           .setSecurityPolicy("securityPolicy-788621166")
1197    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
1198    *           .build();
1199    *   Operation response = securityPoliciesClient.patchAsync(request).get();
1200    * }
1201    * }</pre>
1202    *
1203    * @param request The request object containing all of the parameters for the API call.
1204    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1205    */
1206   @BetaApi(
1207       "The surface for long-running operations is not stable yet and may change in the future.")
patchAsync( PatchSecurityPolicyRequest request)1208   public final OperationFuture<Operation, Operation> patchAsync(
1209       PatchSecurityPolicyRequest request) {
1210     return patchOperationCallable().futureCall(request);
1211   }
1212 
1213   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1214   /**
1215    * Patches the specified policy with the data included in the request. To clear fields in the
1216    * rule, leave the fields empty and specify them in the updateMask. This cannot be used to be
1217    * update the rules in the policy. Please use the per rule methods like addRule, patchRule, and
1218    * removeRule instead.
1219    *
1220    * <p>Sample code:
1221    *
1222    * <pre>{@code
1223    * // This snippet has been automatically generated and should be regarded as a code template only.
1224    * // It will require modifications to work:
1225    * // - It may require correct/in-range values for request initialization.
1226    * // - It may require specifying regional endpoints when creating the service client as shown in
1227    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1228    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1229    *   PatchSecurityPolicyRequest request =
1230    *       PatchSecurityPolicyRequest.newBuilder()
1231    *           .setProject("project-309310695")
1232    *           .setRequestId("requestId693933066")
1233    *           .setSecurityPolicy("securityPolicy-788621166")
1234    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
1235    *           .build();
1236    *   OperationFuture<Operation, Operation> future =
1237    *       securityPoliciesClient.patchOperationCallable().futureCall(request);
1238    *   // Do something.
1239    *   Operation response = future.get();
1240    * }
1241    * }</pre>
1242    */
1243   public final OperationCallable<PatchSecurityPolicyRequest, Operation, Operation>
patchOperationCallable()1244       patchOperationCallable() {
1245     return stub.patchOperationCallable();
1246   }
1247 
1248   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1249   /**
1250    * Patches the specified policy with the data included in the request. To clear fields in the
1251    * rule, leave the fields empty and specify them in the updateMask. This cannot be used to be
1252    * update the rules in the policy. Please use the per rule methods like addRule, patchRule, and
1253    * removeRule instead.
1254    *
1255    * <p>Sample code:
1256    *
1257    * <pre>{@code
1258    * // This snippet has been automatically generated and should be regarded as a code template only.
1259    * // It will require modifications to work:
1260    * // - It may require correct/in-range values for request initialization.
1261    * // - It may require specifying regional endpoints when creating the service client as shown in
1262    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1263    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1264    *   PatchSecurityPolicyRequest request =
1265    *       PatchSecurityPolicyRequest.newBuilder()
1266    *           .setProject("project-309310695")
1267    *           .setRequestId("requestId693933066")
1268    *           .setSecurityPolicy("securityPolicy-788621166")
1269    *           .setSecurityPolicyResource(SecurityPolicy.newBuilder().build())
1270    *           .build();
1271    *   ApiFuture<Operation> future = securityPoliciesClient.patchCallable().futureCall(request);
1272    *   // Do something.
1273    *   Operation response = future.get();
1274    * }
1275    * }</pre>
1276    */
patchCallable()1277   public final UnaryCallable<PatchSecurityPolicyRequest, Operation> patchCallable() {
1278     return stub.patchCallable();
1279   }
1280 
1281   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1282   /**
1283    * Patches a rule at the specified priority.
1284    *
1285    * <p>Sample code:
1286    *
1287    * <pre>{@code
1288    * // This snippet has been automatically generated and should be regarded as a code template only.
1289    * // It will require modifications to work:
1290    * // - It may require correct/in-range values for request initialization.
1291    * // - It may require specifying regional endpoints when creating the service client as shown in
1292    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1293    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1294    *   String project = "project-309310695";
1295    *   String securityPolicy = "securityPolicy-788621166";
1296    *   SecurityPolicyRule securityPolicyRuleResource = SecurityPolicyRule.newBuilder().build();
1297    *   Operation response =
1298    *       securityPoliciesClient
1299    *           .patchRuleAsync(project, securityPolicy, securityPolicyRuleResource)
1300    *           .get();
1301    * }
1302    * }</pre>
1303    *
1304    * @param project Project ID for this request.
1305    * @param securityPolicy Name of the security policy to update.
1306    * @param securityPolicyRuleResource The body resource for this request
1307    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1308    */
patchRuleAsync( String project, String securityPolicy, SecurityPolicyRule securityPolicyRuleResource)1309   public final OperationFuture<Operation, Operation> patchRuleAsync(
1310       String project, String securityPolicy, SecurityPolicyRule securityPolicyRuleResource) {
1311     PatchRuleSecurityPolicyRequest request =
1312         PatchRuleSecurityPolicyRequest.newBuilder()
1313             .setProject(project)
1314             .setSecurityPolicy(securityPolicy)
1315             .setSecurityPolicyRuleResource(securityPolicyRuleResource)
1316             .build();
1317     return patchRuleAsync(request);
1318   }
1319 
1320   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1321   /**
1322    * Patches a rule at the specified priority.
1323    *
1324    * <p>Sample code:
1325    *
1326    * <pre>{@code
1327    * // This snippet has been automatically generated and should be regarded as a code template only.
1328    * // It will require modifications to work:
1329    * // - It may require correct/in-range values for request initialization.
1330    * // - It may require specifying regional endpoints when creating the service client as shown in
1331    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1332    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1333    *   PatchRuleSecurityPolicyRequest request =
1334    *       PatchRuleSecurityPolicyRequest.newBuilder()
1335    *           .setPriority(-1165461084)
1336    *           .setProject("project-309310695")
1337    *           .setSecurityPolicy("securityPolicy-788621166")
1338    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
1339    *           .setValidateOnly(true)
1340    *           .build();
1341    *   Operation response = securityPoliciesClient.patchRuleAsync(request).get();
1342    * }
1343    * }</pre>
1344    *
1345    * @param request The request object containing all of the parameters for the API call.
1346    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1347    */
1348   @BetaApi(
1349       "The surface for long-running operations is not stable yet and may change in the future.")
patchRuleAsync( PatchRuleSecurityPolicyRequest request)1350   public final OperationFuture<Operation, Operation> patchRuleAsync(
1351       PatchRuleSecurityPolicyRequest request) {
1352     return patchRuleOperationCallable().futureCall(request);
1353   }
1354 
1355   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1356   /**
1357    * Patches a rule at the specified priority.
1358    *
1359    * <p>Sample code:
1360    *
1361    * <pre>{@code
1362    * // This snippet has been automatically generated and should be regarded as a code template only.
1363    * // It will require modifications to work:
1364    * // - It may require correct/in-range values for request initialization.
1365    * // - It may require specifying regional endpoints when creating the service client as shown in
1366    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1367    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1368    *   PatchRuleSecurityPolicyRequest request =
1369    *       PatchRuleSecurityPolicyRequest.newBuilder()
1370    *           .setPriority(-1165461084)
1371    *           .setProject("project-309310695")
1372    *           .setSecurityPolicy("securityPolicy-788621166")
1373    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
1374    *           .setValidateOnly(true)
1375    *           .build();
1376    *   OperationFuture<Operation, Operation> future =
1377    *       securityPoliciesClient.patchRuleOperationCallable().futureCall(request);
1378    *   // Do something.
1379    *   Operation response = future.get();
1380    * }
1381    * }</pre>
1382    */
1383   public final OperationCallable<PatchRuleSecurityPolicyRequest, Operation, Operation>
patchRuleOperationCallable()1384       patchRuleOperationCallable() {
1385     return stub.patchRuleOperationCallable();
1386   }
1387 
1388   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1389   /**
1390    * Patches a rule at the specified priority.
1391    *
1392    * <p>Sample code:
1393    *
1394    * <pre>{@code
1395    * // This snippet has been automatically generated and should be regarded as a code template only.
1396    * // It will require modifications to work:
1397    * // - It may require correct/in-range values for request initialization.
1398    * // - It may require specifying regional endpoints when creating the service client as shown in
1399    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1400    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1401    *   PatchRuleSecurityPolicyRequest request =
1402    *       PatchRuleSecurityPolicyRequest.newBuilder()
1403    *           .setPriority(-1165461084)
1404    *           .setProject("project-309310695")
1405    *           .setSecurityPolicy("securityPolicy-788621166")
1406    *           .setSecurityPolicyRuleResource(SecurityPolicyRule.newBuilder().build())
1407    *           .setValidateOnly(true)
1408    *           .build();
1409    *   ApiFuture<Operation> future = securityPoliciesClient.patchRuleCallable().futureCall(request);
1410    *   // Do something.
1411    *   Operation response = future.get();
1412    * }
1413    * }</pre>
1414    */
patchRuleCallable()1415   public final UnaryCallable<PatchRuleSecurityPolicyRequest, Operation> patchRuleCallable() {
1416     return stub.patchRuleCallable();
1417   }
1418 
1419   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1420   /**
1421    * Deletes a rule at the specified priority.
1422    *
1423    * <p>Sample code:
1424    *
1425    * <pre>{@code
1426    * // This snippet has been automatically generated and should be regarded as a code template only.
1427    * // It will require modifications to work:
1428    * // - It may require correct/in-range values for request initialization.
1429    * // - It may require specifying regional endpoints when creating the service client as shown in
1430    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1431    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1432    *   String project = "project-309310695";
1433    *   String securityPolicy = "securityPolicy-788621166";
1434    *   Operation response = securityPoliciesClient.removeRuleAsync(project, securityPolicy).get();
1435    * }
1436    * }</pre>
1437    *
1438    * @param project Project ID for this request.
1439    * @param securityPolicy Name of the security policy to update.
1440    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1441    */
removeRuleAsync( String project, String securityPolicy)1442   public final OperationFuture<Operation, Operation> removeRuleAsync(
1443       String project, String securityPolicy) {
1444     RemoveRuleSecurityPolicyRequest request =
1445         RemoveRuleSecurityPolicyRequest.newBuilder()
1446             .setProject(project)
1447             .setSecurityPolicy(securityPolicy)
1448             .build();
1449     return removeRuleAsync(request);
1450   }
1451 
1452   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1453   /**
1454    * Deletes a rule at the specified priority.
1455    *
1456    * <p>Sample code:
1457    *
1458    * <pre>{@code
1459    * // This snippet has been automatically generated and should be regarded as a code template only.
1460    * // It will require modifications to work:
1461    * // - It may require correct/in-range values for request initialization.
1462    * // - It may require specifying regional endpoints when creating the service client as shown in
1463    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1464    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1465    *   RemoveRuleSecurityPolicyRequest request =
1466    *       RemoveRuleSecurityPolicyRequest.newBuilder()
1467    *           .setPriority(-1165461084)
1468    *           .setProject("project-309310695")
1469    *           .setSecurityPolicy("securityPolicy-788621166")
1470    *           .build();
1471    *   Operation response = securityPoliciesClient.removeRuleAsync(request).get();
1472    * }
1473    * }</pre>
1474    *
1475    * @param request The request object containing all of the parameters for the API call.
1476    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1477    */
1478   @BetaApi(
1479       "The surface for long-running operations is not stable yet and may change in the future.")
removeRuleAsync( RemoveRuleSecurityPolicyRequest request)1480   public final OperationFuture<Operation, Operation> removeRuleAsync(
1481       RemoveRuleSecurityPolicyRequest request) {
1482     return removeRuleOperationCallable().futureCall(request);
1483   }
1484 
1485   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1486   /**
1487    * Deletes a rule at the specified priority.
1488    *
1489    * <p>Sample code:
1490    *
1491    * <pre>{@code
1492    * // This snippet has been automatically generated and should be regarded as a code template only.
1493    * // It will require modifications to work:
1494    * // - It may require correct/in-range values for request initialization.
1495    * // - It may require specifying regional endpoints when creating the service client as shown in
1496    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1497    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1498    *   RemoveRuleSecurityPolicyRequest request =
1499    *       RemoveRuleSecurityPolicyRequest.newBuilder()
1500    *           .setPriority(-1165461084)
1501    *           .setProject("project-309310695")
1502    *           .setSecurityPolicy("securityPolicy-788621166")
1503    *           .build();
1504    *   OperationFuture<Operation, Operation> future =
1505    *       securityPoliciesClient.removeRuleOperationCallable().futureCall(request);
1506    *   // Do something.
1507    *   Operation response = future.get();
1508    * }
1509    * }</pre>
1510    */
1511   public final OperationCallable<RemoveRuleSecurityPolicyRequest, Operation, Operation>
removeRuleOperationCallable()1512       removeRuleOperationCallable() {
1513     return stub.removeRuleOperationCallable();
1514   }
1515 
1516   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1517   /**
1518    * Deletes a rule at the specified priority.
1519    *
1520    * <p>Sample code:
1521    *
1522    * <pre>{@code
1523    * // This snippet has been automatically generated and should be regarded as a code template only.
1524    * // It will require modifications to work:
1525    * // - It may require correct/in-range values for request initialization.
1526    * // - It may require specifying regional endpoints when creating the service client as shown in
1527    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1528    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1529    *   RemoveRuleSecurityPolicyRequest request =
1530    *       RemoveRuleSecurityPolicyRequest.newBuilder()
1531    *           .setPriority(-1165461084)
1532    *           .setProject("project-309310695")
1533    *           .setSecurityPolicy("securityPolicy-788621166")
1534    *           .build();
1535    *   ApiFuture<Operation> future = securityPoliciesClient.removeRuleCallable().futureCall(request);
1536    *   // Do something.
1537    *   Operation response = future.get();
1538    * }
1539    * }</pre>
1540    */
removeRuleCallable()1541   public final UnaryCallable<RemoveRuleSecurityPolicyRequest, Operation> removeRuleCallable() {
1542     return stub.removeRuleCallable();
1543   }
1544 
1545   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1546   /**
1547    * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources
1548    * documentation.
1549    *
1550    * <p>Sample code:
1551    *
1552    * <pre>{@code
1553    * // This snippet has been automatically generated and should be regarded as a code template only.
1554    * // It will require modifications to work:
1555    * // - It may require correct/in-range values for request initialization.
1556    * // - It may require specifying regional endpoints when creating the service client as shown in
1557    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1558    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1559    *   String project = "project-309310695";
1560    *   String resource = "resource-341064690";
1561    *   GlobalSetLabelsRequest globalSetLabelsRequestResource =
1562    *       GlobalSetLabelsRequest.newBuilder().build();
1563    *   Operation response =
1564    *       securityPoliciesClient
1565    *           .setLabelsAsync(project, resource, globalSetLabelsRequestResource)
1566    *           .get();
1567    * }
1568    * }</pre>
1569    *
1570    * @param project Project ID for this request.
1571    * @param resource Name or id of the resource for this request.
1572    * @param globalSetLabelsRequestResource The body resource for this request
1573    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1574    */
setLabelsAsync( String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource)1575   public final OperationFuture<Operation, Operation> setLabelsAsync(
1576       String project, String resource, GlobalSetLabelsRequest globalSetLabelsRequestResource) {
1577     SetLabelsSecurityPolicyRequest request =
1578         SetLabelsSecurityPolicyRequest.newBuilder()
1579             .setProject(project)
1580             .setResource(resource)
1581             .setGlobalSetLabelsRequestResource(globalSetLabelsRequestResource)
1582             .build();
1583     return setLabelsAsync(request);
1584   }
1585 
1586   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1587   /**
1588    * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources
1589    * documentation.
1590    *
1591    * <p>Sample code:
1592    *
1593    * <pre>{@code
1594    * // This snippet has been automatically generated and should be regarded as a code template only.
1595    * // It will require modifications to work:
1596    * // - It may require correct/in-range values for request initialization.
1597    * // - It may require specifying regional endpoints when creating the service client as shown in
1598    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1599    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1600    *   SetLabelsSecurityPolicyRequest request =
1601    *       SetLabelsSecurityPolicyRequest.newBuilder()
1602    *           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
1603    *           .setProject("project-309310695")
1604    *           .setResource("resource-341064690")
1605    *           .build();
1606    *   Operation response = securityPoliciesClient.setLabelsAsync(request).get();
1607    * }
1608    * }</pre>
1609    *
1610    * @param request The request object containing all of the parameters for the API call.
1611    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1612    */
1613   @BetaApi(
1614       "The surface for long-running operations is not stable yet and may change in the future.")
setLabelsAsync( SetLabelsSecurityPolicyRequest request)1615   public final OperationFuture<Operation, Operation> setLabelsAsync(
1616       SetLabelsSecurityPolicyRequest request) {
1617     return setLabelsOperationCallable().futureCall(request);
1618   }
1619 
1620   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1621   /**
1622    * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources
1623    * documentation.
1624    *
1625    * <p>Sample code:
1626    *
1627    * <pre>{@code
1628    * // This snippet has been automatically generated and should be regarded as a code template only.
1629    * // It will require modifications to work:
1630    * // - It may require correct/in-range values for request initialization.
1631    * // - It may require specifying regional endpoints when creating the service client as shown in
1632    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1633    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1634    *   SetLabelsSecurityPolicyRequest request =
1635    *       SetLabelsSecurityPolicyRequest.newBuilder()
1636    *           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
1637    *           .setProject("project-309310695")
1638    *           .setResource("resource-341064690")
1639    *           .build();
1640    *   OperationFuture<Operation, Operation> future =
1641    *       securityPoliciesClient.setLabelsOperationCallable().futureCall(request);
1642    *   // Do something.
1643    *   Operation response = future.get();
1644    * }
1645    * }</pre>
1646    */
1647   public final OperationCallable<SetLabelsSecurityPolicyRequest, Operation, Operation>
setLabelsOperationCallable()1648       setLabelsOperationCallable() {
1649     return stub.setLabelsOperationCallable();
1650   }
1651 
1652   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1653   /**
1654    * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources
1655    * documentation.
1656    *
1657    * <p>Sample code:
1658    *
1659    * <pre>{@code
1660    * // This snippet has been automatically generated and should be regarded as a code template only.
1661    * // It will require modifications to work:
1662    * // - It may require correct/in-range values for request initialization.
1663    * // - It may require specifying regional endpoints when creating the service client as shown in
1664    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1665    * try (SecurityPoliciesClient securityPoliciesClient = SecurityPoliciesClient.create()) {
1666    *   SetLabelsSecurityPolicyRequest request =
1667    *       SetLabelsSecurityPolicyRequest.newBuilder()
1668    *           .setGlobalSetLabelsRequestResource(GlobalSetLabelsRequest.newBuilder().build())
1669    *           .setProject("project-309310695")
1670    *           .setResource("resource-341064690")
1671    *           .build();
1672    *   ApiFuture<Operation> future = securityPoliciesClient.setLabelsCallable().futureCall(request);
1673    *   // Do something.
1674    *   Operation response = future.get();
1675    * }
1676    * }</pre>
1677    */
setLabelsCallable()1678   public final UnaryCallable<SetLabelsSecurityPolicyRequest, Operation> setLabelsCallable() {
1679     return stub.setLabelsCallable();
1680   }
1681 
1682   @Override
close()1683   public final void close() {
1684     stub.close();
1685   }
1686 
1687   @Override
shutdown()1688   public void shutdown() {
1689     stub.shutdown();
1690   }
1691 
1692   @Override
isShutdown()1693   public boolean isShutdown() {
1694     return stub.isShutdown();
1695   }
1696 
1697   @Override
isTerminated()1698   public boolean isTerminated() {
1699     return stub.isTerminated();
1700   }
1701 
1702   @Override
shutdownNow()1703   public void shutdownNow() {
1704     stub.shutdownNow();
1705   }
1706 
1707   @Override
awaitTermination(long duration, TimeUnit unit)1708   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1709     return stub.awaitTermination(duration, unit);
1710   }
1711 
1712   public static class AggregatedListPagedResponse
1713       extends AbstractPagedListResponse<
1714           AggregatedListSecurityPoliciesRequest,
1715           SecurityPoliciesAggregatedList,
1716           Map.Entry<String, SecurityPoliciesScopedList>,
1717           AggregatedListPage,
1718           AggregatedListFixedSizeCollection> {
1719 
createAsync( PageContext< AggregatedListSecurityPoliciesRequest, SecurityPoliciesAggregatedList, Map.Entry<String, SecurityPoliciesScopedList>> context, ApiFuture<SecurityPoliciesAggregatedList> futureResponse)1720     public static ApiFuture<AggregatedListPagedResponse> createAsync(
1721         PageContext<
1722                 AggregatedListSecurityPoliciesRequest,
1723                 SecurityPoliciesAggregatedList,
1724                 Map.Entry<String, SecurityPoliciesScopedList>>
1725             context,
1726         ApiFuture<SecurityPoliciesAggregatedList> futureResponse) {
1727       ApiFuture<AggregatedListPage> futurePage =
1728           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
1729       return ApiFutures.transform(
1730           futurePage,
1731           input -> new AggregatedListPagedResponse(input),
1732           MoreExecutors.directExecutor());
1733     }
1734 
AggregatedListPagedResponse(AggregatedListPage page)1735     private AggregatedListPagedResponse(AggregatedListPage page) {
1736       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
1737     }
1738   }
1739 
1740   public static class AggregatedListPage
1741       extends AbstractPage<
1742           AggregatedListSecurityPoliciesRequest,
1743           SecurityPoliciesAggregatedList,
1744           Map.Entry<String, SecurityPoliciesScopedList>,
1745           AggregatedListPage> {
1746 
AggregatedListPage( PageContext< AggregatedListSecurityPoliciesRequest, SecurityPoliciesAggregatedList, Map.Entry<String, SecurityPoliciesScopedList>> context, SecurityPoliciesAggregatedList response)1747     private AggregatedListPage(
1748         PageContext<
1749                 AggregatedListSecurityPoliciesRequest,
1750                 SecurityPoliciesAggregatedList,
1751                 Map.Entry<String, SecurityPoliciesScopedList>>
1752             context,
1753         SecurityPoliciesAggregatedList response) {
1754       super(context, response);
1755     }
1756 
createEmptyPage()1757     private static AggregatedListPage createEmptyPage() {
1758       return new AggregatedListPage(null, null);
1759     }
1760 
1761     @Override
createPage( PageContext< AggregatedListSecurityPoliciesRequest, SecurityPoliciesAggregatedList, Map.Entry<String, SecurityPoliciesScopedList>> context, SecurityPoliciesAggregatedList response)1762     protected AggregatedListPage createPage(
1763         PageContext<
1764                 AggregatedListSecurityPoliciesRequest,
1765                 SecurityPoliciesAggregatedList,
1766                 Map.Entry<String, SecurityPoliciesScopedList>>
1767             context,
1768         SecurityPoliciesAggregatedList response) {
1769       return new AggregatedListPage(context, response);
1770     }
1771 
1772     @Override
createPageAsync( PageContext< AggregatedListSecurityPoliciesRequest, SecurityPoliciesAggregatedList, Map.Entry<String, SecurityPoliciesScopedList>> context, ApiFuture<SecurityPoliciesAggregatedList> futureResponse)1773     public ApiFuture<AggregatedListPage> createPageAsync(
1774         PageContext<
1775                 AggregatedListSecurityPoliciesRequest,
1776                 SecurityPoliciesAggregatedList,
1777                 Map.Entry<String, SecurityPoliciesScopedList>>
1778             context,
1779         ApiFuture<SecurityPoliciesAggregatedList> futureResponse) {
1780       return super.createPageAsync(context, futureResponse);
1781     }
1782   }
1783 
1784   public static class AggregatedListFixedSizeCollection
1785       extends AbstractFixedSizeCollection<
1786           AggregatedListSecurityPoliciesRequest,
1787           SecurityPoliciesAggregatedList,
1788           Map.Entry<String, SecurityPoliciesScopedList>,
1789           AggregatedListPage,
1790           AggregatedListFixedSizeCollection> {
1791 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1792     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
1793       super(pages, collectionSize);
1794     }
1795 
createEmptyCollection()1796     private static AggregatedListFixedSizeCollection createEmptyCollection() {
1797       return new AggregatedListFixedSizeCollection(null, 0);
1798     }
1799 
1800     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)1801     protected AggregatedListFixedSizeCollection createCollection(
1802         List<AggregatedListPage> pages, int collectionSize) {
1803       return new AggregatedListFixedSizeCollection(pages, collectionSize);
1804     }
1805   }
1806 
1807   public static class ListPagedResponse
1808       extends AbstractPagedListResponse<
1809           ListSecurityPoliciesRequest,
1810           SecurityPolicyList,
1811           SecurityPolicy,
1812           ListPage,
1813           ListFixedSizeCollection> {
1814 
createAsync( PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context, ApiFuture<SecurityPolicyList> futureResponse)1815     public static ApiFuture<ListPagedResponse> createAsync(
1816         PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context,
1817         ApiFuture<SecurityPolicyList> futureResponse) {
1818       ApiFuture<ListPage> futurePage =
1819           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
1820       return ApiFutures.transform(
1821           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
1822     }
1823 
ListPagedResponse(ListPage page)1824     private ListPagedResponse(ListPage page) {
1825       super(page, ListFixedSizeCollection.createEmptyCollection());
1826     }
1827   }
1828 
1829   public static class ListPage
1830       extends AbstractPage<
1831           ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy, ListPage> {
1832 
ListPage( PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context, SecurityPolicyList response)1833     private ListPage(
1834         PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context,
1835         SecurityPolicyList response) {
1836       super(context, response);
1837     }
1838 
createEmptyPage()1839     private static ListPage createEmptyPage() {
1840       return new ListPage(null, null);
1841     }
1842 
1843     @Override
createPage( PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context, SecurityPolicyList response)1844     protected ListPage createPage(
1845         PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context,
1846         SecurityPolicyList response) {
1847       return new ListPage(context, response);
1848     }
1849 
1850     @Override
createPageAsync( PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context, ApiFuture<SecurityPolicyList> futureResponse)1851     public ApiFuture<ListPage> createPageAsync(
1852         PageContext<ListSecurityPoliciesRequest, SecurityPolicyList, SecurityPolicy> context,
1853         ApiFuture<SecurityPolicyList> futureResponse) {
1854       return super.createPageAsync(context, futureResponse);
1855     }
1856   }
1857 
1858   public static class ListFixedSizeCollection
1859       extends AbstractFixedSizeCollection<
1860           ListSecurityPoliciesRequest,
1861           SecurityPolicyList,
1862           SecurityPolicy,
1863           ListPage,
1864           ListFixedSizeCollection> {
1865 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1866     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
1867       super(pages, collectionSize);
1868     }
1869 
createEmptyCollection()1870     private static ListFixedSizeCollection createEmptyCollection() {
1871       return new ListFixedSizeCollection(null, 0);
1872     }
1873 
1874     @Override
createCollection(List<ListPage> pages, int collectionSize)1875     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1876       return new ListFixedSizeCollection(pages, collectionSize);
1877     }
1878   }
1879 }
1880