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.asset.v1p2beta1; 18 19 import com.google.api.core.BetaApi; 20 import com.google.api.gax.core.BackgroundResource; 21 import com.google.api.gax.rpc.UnaryCallable; 22 import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStub; 23 import com.google.cloud.asset.v1p2beta1.stub.AssetServiceStubSettings; 24 import com.google.protobuf.Empty; 25 import java.io.IOException; 26 import java.util.concurrent.TimeUnit; 27 import javax.annotation.Generated; 28 29 // AUTO-GENERATED DOCUMENTATION AND CLASS. 30 /** 31 * Service Description: Asset service definition. 32 * 33 * <p>This class provides the ability to make remote calls to the backing service through method 34 * calls that map to API methods. Sample code to get started: 35 * 36 * <pre>{@code 37 * // This snippet has been automatically generated and should be regarded as a code template only. 38 * // It will require modifications to work: 39 * // - It may require correct/in-range values for request initialization. 40 * // - It may require specifying regional endpoints when creating the service client as shown in 41 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 42 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 43 * String parent = "parent-995424086"; 44 * Feed response = assetServiceClient.createFeed(parent); 45 * } 46 * }</pre> 47 * 48 * <p>Note: close() needs to be called on the AssetServiceClient object to clean up resources such 49 * as threads. In the example above, try-with-resources is used, which automatically calls close(). 50 * 51 * <p>The surface of this class includes several types of Java methods for each of the API's 52 * methods: 53 * 54 * <ol> 55 * <li>A "flattened" method. With this type of method, the fields of the request type have been 56 * converted into function parameters. It may be the case that not all fields are available as 57 * parameters, and not every API method will have a flattened method entry point. 58 * <li>A "request object" method. This type of method only takes one parameter, a request object, 59 * which must be constructed before the call. Not every API method will have a request object 60 * method. 61 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 62 * callable object, which can be used to initiate calls to the service. 63 * </ol> 64 * 65 * <p>See the individual methods for example code. 66 * 67 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 68 * these names, this class includes a format method for each type of name, and additionally a parse 69 * method to extract the individual identifiers contained within names that are returned. 70 * 71 * <p>This class can be customized by passing in a custom instance of AssetServiceSettings to 72 * create(). For example: 73 * 74 * <p>To customize credentials: 75 * 76 * <pre>{@code 77 * // This snippet has been automatically generated and should be regarded as a code template only. 78 * // It will require modifications to work: 79 * // - It may require correct/in-range values for request initialization. 80 * // - It may require specifying regional endpoints when creating the service client as shown in 81 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 82 * AssetServiceSettings assetServiceSettings = 83 * AssetServiceSettings.newBuilder() 84 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 85 * .build(); 86 * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings); 87 * }</pre> 88 * 89 * <p>To customize the endpoint: 90 * 91 * <pre>{@code 92 * // This snippet has been automatically generated and should be regarded as a code template only. 93 * // It will require modifications to work: 94 * // - It may require correct/in-range values for request initialization. 95 * // - It may require specifying regional endpoints when creating the service client as shown in 96 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 97 * AssetServiceSettings assetServiceSettings = 98 * AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 99 * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings); 100 * }</pre> 101 * 102 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 103 * the wire: 104 * 105 * <pre>{@code 106 * // This snippet has been automatically generated and should be regarded as a code template only. 107 * // It will require modifications to work: 108 * // - It may require correct/in-range values for request initialization. 109 * // - It may require specifying regional endpoints when creating the service client as shown in 110 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 111 * AssetServiceSettings assetServiceSettings = AssetServiceSettings.newHttpJsonBuilder().build(); 112 * AssetServiceClient assetServiceClient = AssetServiceClient.create(assetServiceSettings); 113 * }</pre> 114 * 115 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 116 */ 117 @BetaApi 118 @Generated("by gapic-generator-java") 119 public class AssetServiceClient implements BackgroundResource { 120 private final AssetServiceSettings settings; 121 private final AssetServiceStub stub; 122 123 /** Constructs an instance of AssetServiceClient with default settings. */ create()124 public static final AssetServiceClient create() throws IOException { 125 return create(AssetServiceSettings.newBuilder().build()); 126 } 127 128 /** 129 * Constructs an instance of AssetServiceClient, using the given settings. The channels are 130 * created based on the settings passed in, or defaults for any settings that are not set. 131 */ create(AssetServiceSettings settings)132 public static final AssetServiceClient create(AssetServiceSettings settings) throws IOException { 133 return new AssetServiceClient(settings); 134 } 135 136 /** 137 * Constructs an instance of AssetServiceClient, using the given stub for making calls. This is 138 * for advanced usage - prefer using create(AssetServiceSettings). 139 */ create(AssetServiceStub stub)140 public static final AssetServiceClient create(AssetServiceStub stub) { 141 return new AssetServiceClient(stub); 142 } 143 144 /** 145 * Constructs an instance of AssetServiceClient, using the given settings. This is protected so 146 * that it is easy to make a subclass, but otherwise, the static factory methods should be 147 * preferred. 148 */ AssetServiceClient(AssetServiceSettings settings)149 protected AssetServiceClient(AssetServiceSettings settings) throws IOException { 150 this.settings = settings; 151 this.stub = ((AssetServiceStubSettings) settings.getStubSettings()).createStub(); 152 } 153 AssetServiceClient(AssetServiceStub stub)154 protected AssetServiceClient(AssetServiceStub stub) { 155 this.settings = null; 156 this.stub = stub; 157 } 158 getSettings()159 public final AssetServiceSettings getSettings() { 160 return settings; 161 } 162 getStub()163 public AssetServiceStub getStub() { 164 return stub; 165 } 166 167 // AUTO-GENERATED DOCUMENTATION AND METHOD. 168 /** 169 * Creates a feed in a parent project/folder/organization to listen to its asset updates. 170 * 171 * <p>Sample code: 172 * 173 * <pre>{@code 174 * // This snippet has been automatically generated and should be regarded as a code template only. 175 * // It will require modifications to work: 176 * // - It may require correct/in-range values for request initialization. 177 * // - It may require specifying regional endpoints when creating the service client as shown in 178 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 179 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 180 * String parent = "parent-995424086"; 181 * Feed response = assetServiceClient.createFeed(parent); 182 * } 183 * }</pre> 184 * 185 * @param parent Required. The name of the project/folder/organization where this feed should be 186 * created in. It can only be an organization number (such as "organizations/123"), a folder 187 * number (such as "folders/123"), a project ID (such as "projects/my-project-id")", or a 188 * project number (such as "projects/12345"). 189 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 190 */ createFeed(String parent)191 public final Feed createFeed(String parent) { 192 CreateFeedRequest request = CreateFeedRequest.newBuilder().setParent(parent).build(); 193 return createFeed(request); 194 } 195 196 // AUTO-GENERATED DOCUMENTATION AND METHOD. 197 /** 198 * Creates a feed in a parent project/folder/organization to listen to its asset updates. 199 * 200 * <p>Sample code: 201 * 202 * <pre>{@code 203 * // This snippet has been automatically generated and should be regarded as a code template only. 204 * // It will require modifications to work: 205 * // - It may require correct/in-range values for request initialization. 206 * // - It may require specifying regional endpoints when creating the service client as shown in 207 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 208 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 209 * CreateFeedRequest request = 210 * CreateFeedRequest.newBuilder() 211 * .setParent("parent-995424086") 212 * .setFeedId("feedId-1278410919") 213 * .setFeed(Feed.newBuilder().build()) 214 * .build(); 215 * Feed response = assetServiceClient.createFeed(request); 216 * } 217 * }</pre> 218 * 219 * @param request The request object containing all of the parameters for the API call. 220 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 221 */ createFeed(CreateFeedRequest request)222 public final Feed createFeed(CreateFeedRequest request) { 223 return createFeedCallable().call(request); 224 } 225 226 // AUTO-GENERATED DOCUMENTATION AND METHOD. 227 /** 228 * Creates a feed in a parent project/folder/organization to listen to its asset updates. 229 * 230 * <p>Sample code: 231 * 232 * <pre>{@code 233 * // This snippet has been automatically generated and should be regarded as a code template only. 234 * // It will require modifications to work: 235 * // - It may require correct/in-range values for request initialization. 236 * // - It may require specifying regional endpoints when creating the service client as shown in 237 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 238 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 239 * CreateFeedRequest request = 240 * CreateFeedRequest.newBuilder() 241 * .setParent("parent-995424086") 242 * .setFeedId("feedId-1278410919") 243 * .setFeed(Feed.newBuilder().build()) 244 * .build(); 245 * ApiFuture<Feed> future = assetServiceClient.createFeedCallable().futureCall(request); 246 * // Do something. 247 * Feed response = future.get(); 248 * } 249 * }</pre> 250 */ createFeedCallable()251 public final UnaryCallable<CreateFeedRequest, Feed> createFeedCallable() { 252 return stub.createFeedCallable(); 253 } 254 255 // AUTO-GENERATED DOCUMENTATION AND METHOD. 256 /** 257 * Gets details about an asset feed. 258 * 259 * <p>Sample code: 260 * 261 * <pre>{@code 262 * // This snippet has been automatically generated and should be regarded as a code template only. 263 * // It will require modifications to work: 264 * // - It may require correct/in-range values for request initialization. 265 * // - It may require specifying regional endpoints when creating the service client as shown in 266 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 267 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 268 * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); 269 * Feed response = assetServiceClient.getFeed(name); 270 * } 271 * }</pre> 272 * 273 * @param name Required. The name of the Feed and it must be in the format of: 274 * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id 275 * organizations/organization_number/feeds/feed_id 276 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 277 */ getFeed(FeedName name)278 public final Feed getFeed(FeedName name) { 279 GetFeedRequest request = 280 GetFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 281 return getFeed(request); 282 } 283 284 // AUTO-GENERATED DOCUMENTATION AND METHOD. 285 /** 286 * Gets details about an asset feed. 287 * 288 * <p>Sample code: 289 * 290 * <pre>{@code 291 * // This snippet has been automatically generated and should be regarded as a code template only. 292 * // It will require modifications to work: 293 * // - It may require correct/in-range values for request initialization. 294 * // - It may require specifying regional endpoints when creating the service client as shown in 295 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 296 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 297 * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); 298 * Feed response = assetServiceClient.getFeed(name); 299 * } 300 * }</pre> 301 * 302 * @param name Required. The name of the Feed and it must be in the format of: 303 * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id 304 * organizations/organization_number/feeds/feed_id 305 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 306 */ getFeed(String name)307 public final Feed getFeed(String name) { 308 GetFeedRequest request = GetFeedRequest.newBuilder().setName(name).build(); 309 return getFeed(request); 310 } 311 312 // AUTO-GENERATED DOCUMENTATION AND METHOD. 313 /** 314 * Gets details about an asset feed. 315 * 316 * <p>Sample code: 317 * 318 * <pre>{@code 319 * // This snippet has been automatically generated and should be regarded as a code template only. 320 * // It will require modifications to work: 321 * // - It may require correct/in-range values for request initialization. 322 * // - It may require specifying regional endpoints when creating the service client as shown in 323 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 324 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 325 * GetFeedRequest request = 326 * GetFeedRequest.newBuilder() 327 * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) 328 * .build(); 329 * Feed response = assetServiceClient.getFeed(request); 330 * } 331 * }</pre> 332 * 333 * @param request The request object containing all of the parameters for the API call. 334 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 335 */ getFeed(GetFeedRequest request)336 public final Feed getFeed(GetFeedRequest request) { 337 return getFeedCallable().call(request); 338 } 339 340 // AUTO-GENERATED DOCUMENTATION AND METHOD. 341 /** 342 * Gets details about an asset feed. 343 * 344 * <p>Sample code: 345 * 346 * <pre>{@code 347 * // This snippet has been automatically generated and should be regarded as a code template only. 348 * // It will require modifications to work: 349 * // - It may require correct/in-range values for request initialization. 350 * // - It may require specifying regional endpoints when creating the service client as shown in 351 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 352 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 353 * GetFeedRequest request = 354 * GetFeedRequest.newBuilder() 355 * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) 356 * .build(); 357 * ApiFuture<Feed> future = assetServiceClient.getFeedCallable().futureCall(request); 358 * // Do something. 359 * Feed response = future.get(); 360 * } 361 * }</pre> 362 */ getFeedCallable()363 public final UnaryCallable<GetFeedRequest, Feed> getFeedCallable() { 364 return stub.getFeedCallable(); 365 } 366 367 // AUTO-GENERATED DOCUMENTATION AND METHOD. 368 /** 369 * Lists all asset feeds in a parent project/folder/organization. 370 * 371 * <p>Sample code: 372 * 373 * <pre>{@code 374 * // This snippet has been automatically generated and should be regarded as a code template only. 375 * // It will require modifications to work: 376 * // - It may require correct/in-range values for request initialization. 377 * // - It may require specifying regional endpoints when creating the service client as shown in 378 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 379 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 380 * String parent = "parent-995424086"; 381 * ListFeedsResponse response = assetServiceClient.listFeeds(parent); 382 * } 383 * }</pre> 384 * 385 * @param parent Required. The parent project/folder/organization whose feeds are to be listed. It 386 * can only be using project/folder/organization number (such as "folders/12345")", or a 387 * project ID (such as "projects/my-project-id"). 388 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 389 */ listFeeds(String parent)390 public final ListFeedsResponse listFeeds(String parent) { 391 ListFeedsRequest request = ListFeedsRequest.newBuilder().setParent(parent).build(); 392 return listFeeds(request); 393 } 394 395 // AUTO-GENERATED DOCUMENTATION AND METHOD. 396 /** 397 * Lists all asset feeds in a parent project/folder/organization. 398 * 399 * <p>Sample code: 400 * 401 * <pre>{@code 402 * // This snippet has been automatically generated and should be regarded as a code template only. 403 * // It will require modifications to work: 404 * // - It may require correct/in-range values for request initialization. 405 * // - It may require specifying regional endpoints when creating the service client as shown in 406 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 407 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 408 * ListFeedsRequest request = 409 * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); 410 * ListFeedsResponse response = assetServiceClient.listFeeds(request); 411 * } 412 * }</pre> 413 * 414 * @param request The request object containing all of the parameters for the API call. 415 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 416 */ listFeeds(ListFeedsRequest request)417 public final ListFeedsResponse listFeeds(ListFeedsRequest request) { 418 return listFeedsCallable().call(request); 419 } 420 421 // AUTO-GENERATED DOCUMENTATION AND METHOD. 422 /** 423 * Lists all asset feeds in a parent project/folder/organization. 424 * 425 * <p>Sample code: 426 * 427 * <pre>{@code 428 * // This snippet has been automatically generated and should be regarded as a code template only. 429 * // It will require modifications to work: 430 * // - It may require correct/in-range values for request initialization. 431 * // - It may require specifying regional endpoints when creating the service client as shown in 432 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 433 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 434 * ListFeedsRequest request = 435 * ListFeedsRequest.newBuilder().setParent("parent-995424086").build(); 436 * ApiFuture<ListFeedsResponse> future = 437 * assetServiceClient.listFeedsCallable().futureCall(request); 438 * // Do something. 439 * ListFeedsResponse response = future.get(); 440 * } 441 * }</pre> 442 */ listFeedsCallable()443 public final UnaryCallable<ListFeedsRequest, ListFeedsResponse> listFeedsCallable() { 444 return stub.listFeedsCallable(); 445 } 446 447 // AUTO-GENERATED DOCUMENTATION AND METHOD. 448 /** 449 * Updates an asset feed configuration. 450 * 451 * <p>Sample code: 452 * 453 * <pre>{@code 454 * // This snippet has been automatically generated and should be regarded as a code template only. 455 * // It will require modifications to work: 456 * // - It may require correct/in-range values for request initialization. 457 * // - It may require specifying regional endpoints when creating the service client as shown in 458 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 459 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 460 * Feed feed = Feed.newBuilder().build(); 461 * Feed response = assetServiceClient.updateFeed(feed); 462 * } 463 * }</pre> 464 * 465 * @param feed Required. The new values of feed details. It must match an existing feed and the 466 * field `name` must be in the format of: projects/project_number/feeds/feed_id or 467 * folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id. 468 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 469 */ updateFeed(Feed feed)470 public final Feed updateFeed(Feed feed) { 471 UpdateFeedRequest request = UpdateFeedRequest.newBuilder().setFeed(feed).build(); 472 return updateFeed(request); 473 } 474 475 // AUTO-GENERATED DOCUMENTATION AND METHOD. 476 /** 477 * Updates an asset feed configuration. 478 * 479 * <p>Sample code: 480 * 481 * <pre>{@code 482 * // This snippet has been automatically generated and should be regarded as a code template only. 483 * // It will require modifications to work: 484 * // - It may require correct/in-range values for request initialization. 485 * // - It may require specifying regional endpoints when creating the service client as shown in 486 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 487 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 488 * UpdateFeedRequest request = 489 * UpdateFeedRequest.newBuilder() 490 * .setFeed(Feed.newBuilder().build()) 491 * .setUpdateMask(FieldMask.newBuilder().build()) 492 * .build(); 493 * Feed response = assetServiceClient.updateFeed(request); 494 * } 495 * }</pre> 496 * 497 * @param request The request object containing all of the parameters for the API call. 498 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 499 */ updateFeed(UpdateFeedRequest request)500 public final Feed updateFeed(UpdateFeedRequest request) { 501 return updateFeedCallable().call(request); 502 } 503 504 // AUTO-GENERATED DOCUMENTATION AND METHOD. 505 /** 506 * Updates an asset feed configuration. 507 * 508 * <p>Sample code: 509 * 510 * <pre>{@code 511 * // This snippet has been automatically generated and should be regarded as a code template only. 512 * // It will require modifications to work: 513 * // - It may require correct/in-range values for request initialization. 514 * // - It may require specifying regional endpoints when creating the service client as shown in 515 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 516 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 517 * UpdateFeedRequest request = 518 * UpdateFeedRequest.newBuilder() 519 * .setFeed(Feed.newBuilder().build()) 520 * .setUpdateMask(FieldMask.newBuilder().build()) 521 * .build(); 522 * ApiFuture<Feed> future = assetServiceClient.updateFeedCallable().futureCall(request); 523 * // Do something. 524 * Feed response = future.get(); 525 * } 526 * }</pre> 527 */ updateFeedCallable()528 public final UnaryCallable<UpdateFeedRequest, Feed> updateFeedCallable() { 529 return stub.updateFeedCallable(); 530 } 531 532 // AUTO-GENERATED DOCUMENTATION AND METHOD. 533 /** 534 * Deletes an asset feed. 535 * 536 * <p>Sample code: 537 * 538 * <pre>{@code 539 * // This snippet has been automatically generated and should be regarded as a code template only. 540 * // It will require modifications to work: 541 * // - It may require correct/in-range values for request initialization. 542 * // - It may require specifying regional endpoints when creating the service client as shown in 543 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 544 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 545 * FeedName name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]"); 546 * assetServiceClient.deleteFeed(name); 547 * } 548 * }</pre> 549 * 550 * @param name Required. The name of the feed and it must be in the format of: 551 * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id 552 * organizations/organization_number/feeds/feed_id 553 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 554 */ deleteFeed(FeedName name)555 public final void deleteFeed(FeedName name) { 556 DeleteFeedRequest request = 557 DeleteFeedRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 558 deleteFeed(request); 559 } 560 561 // AUTO-GENERATED DOCUMENTATION AND METHOD. 562 /** 563 * Deletes an asset feed. 564 * 565 * <p>Sample code: 566 * 567 * <pre>{@code 568 * // This snippet has been automatically generated and should be regarded as a code template only. 569 * // It will require modifications to work: 570 * // - It may require correct/in-range values for request initialization. 571 * // - It may require specifying regional endpoints when creating the service client as shown in 572 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 573 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 574 * String name = FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString(); 575 * assetServiceClient.deleteFeed(name); 576 * } 577 * }</pre> 578 * 579 * @param name Required. The name of the feed and it must be in the format of: 580 * projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id 581 * organizations/organization_number/feeds/feed_id 582 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 583 */ deleteFeed(String name)584 public final void deleteFeed(String name) { 585 DeleteFeedRequest request = DeleteFeedRequest.newBuilder().setName(name).build(); 586 deleteFeed(request); 587 } 588 589 // AUTO-GENERATED DOCUMENTATION AND METHOD. 590 /** 591 * Deletes an asset feed. 592 * 593 * <p>Sample code: 594 * 595 * <pre>{@code 596 * // This snippet has been automatically generated and should be regarded as a code template only. 597 * // It will require modifications to work: 598 * // - It may require correct/in-range values for request initialization. 599 * // - It may require specifying regional endpoints when creating the service client as shown in 600 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 601 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 602 * DeleteFeedRequest request = 603 * DeleteFeedRequest.newBuilder() 604 * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) 605 * .build(); 606 * assetServiceClient.deleteFeed(request); 607 * } 608 * }</pre> 609 * 610 * @param request The request object containing all of the parameters for the API call. 611 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 612 */ deleteFeed(DeleteFeedRequest request)613 public final void deleteFeed(DeleteFeedRequest request) { 614 deleteFeedCallable().call(request); 615 } 616 617 // AUTO-GENERATED DOCUMENTATION AND METHOD. 618 /** 619 * Deletes an asset feed. 620 * 621 * <p>Sample code: 622 * 623 * <pre>{@code 624 * // This snippet has been automatically generated and should be regarded as a code template only. 625 * // It will require modifications to work: 626 * // - It may require correct/in-range values for request initialization. 627 * // - It may require specifying regional endpoints when creating the service client as shown in 628 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 629 * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) { 630 * DeleteFeedRequest request = 631 * DeleteFeedRequest.newBuilder() 632 * .setName(FeedName.ofProjectFeedName("[PROJECT]", "[FEED]").toString()) 633 * .build(); 634 * ApiFuture<Empty> future = assetServiceClient.deleteFeedCallable().futureCall(request); 635 * // Do something. 636 * future.get(); 637 * } 638 * }</pre> 639 */ deleteFeedCallable()640 public final UnaryCallable<DeleteFeedRequest, Empty> deleteFeedCallable() { 641 return stub.deleteFeedCallable(); 642 } 643 644 @Override close()645 public final void close() { 646 stub.close(); 647 } 648 649 @Override shutdown()650 public void shutdown() { 651 stub.shutdown(); 652 } 653 654 @Override isShutdown()655 public boolean isShutdown() { 656 return stub.isShutdown(); 657 } 658 659 @Override isTerminated()660 public boolean isTerminated() { 661 return stub.isTerminated(); 662 } 663 664 @Override shutdownNow()665 public void shutdownNow() { 666 stub.shutdownNow(); 667 } 668 669 @Override awaitTermination(long duration, TimeUnit unit)670 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 671 return stub.awaitTermination(duration, unit); 672 } 673 } 674