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