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