|
| 1 | +/* |
| 2 | + * Copyright 2022 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.showcase.v1beta1.samples; |
| 18 | + |
| 19 | +// [START localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async] |
| 20 | +import com.google.api.gax.longrunning.OperationFuture; |
| 21 | +import com.google.protobuf.DescriptorProtos; |
| 22 | +import com.google.showcase.v1beta1.Annotation; |
| 23 | +import com.google.showcase.v1beta1.CollisionsClient; |
| 24 | +import com.google.showcase.v1beta1.Location; |
| 25 | +import com.google.showcase.v1beta1.Request; |
| 26 | + |
| 27 | +public class AsyncDoSomethingLRO { |
| 28 | + |
| 29 | + public static void main(String[] args) throws Exception { |
| 30 | + asyncDoSomethingLRO(); |
| 31 | + } |
| 32 | + |
| 33 | + public static void asyncDoSomethingLRO() throws Exception { |
| 34 | + // This snippet has been automatically generated and should be regarded as a code template only. |
| 35 | + // It will require modifications to work: |
| 36 | + // - It may require correct/in-range values for request initialization. |
| 37 | + // - It may require specifying regional endpoints when creating the service client as shown in |
| 38 | + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 39 | + try (CollisionsClient collisionsClient = CollisionsClient.create()) { |
| 40 | + Request request = |
| 41 | + Request.newBuilder() |
| 42 | + .setName("name3373707") |
| 43 | + .setAnnotation(Annotation.newBuilder().build()) |
| 44 | + .setLocation(Location.newBuilder().build()) |
| 45 | + .build(); |
| 46 | + OperationFuture< |
| 47 | + DescriptorProtos.GeneratedCodeInfo.Annotation, |
| 48 | + DescriptorProtos.SourceCodeInfo.Location> |
| 49 | + future = collisionsClient.doSomethingOperationCallable().futureCall(request); |
| 50 | + // Do something. |
| 51 | + DescriptorProtos.GeneratedCodeInfo.Annotation response = future.get(); |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | +// [END localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async] |
0 commit comments