|
28 | 28 | import com.google.api.gax.rpc.OperationCallable;
|
29 | 29 | import com.google.api.gax.rpc.PageContext;
|
30 | 30 | import com.google.api.gax.rpc.UnaryCallable;
|
| 31 | +import com.google.cloud.location.GetLocationRequest; |
| 32 | +import com.google.cloud.location.ListLocationsRequest; |
| 33 | +import com.google.cloud.location.ListLocationsResponse; |
| 34 | +import com.google.cloud.location.Location; |
31 | 35 | import com.google.common.util.concurrent.MoreExecutors;
|
32 | 36 | import com.google.devtools.artifactregistry.v1.stub.ArtifactRegistryStub;
|
33 | 37 | import com.google.devtools.artifactregistry.v1.stub.ArtifactRegistryStubSettings;
|
@@ -3035,6 +3039,162 @@ public final ProjectSettings updateProjectSettings(UpdateProjectSettingsRequest
|
3035 | 3039 | return stub.updateProjectSettingsCallable();
|
3036 | 3040 | }
|
3037 | 3041 |
|
| 3042 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 3043 | + /** |
| 3044 | + * Lists information about the supported locations for this service. |
| 3045 | + * |
| 3046 | + * <p>Sample code: |
| 3047 | + * |
| 3048 | + * <pre>{@code |
| 3049 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 3050 | + * // It will require modifications to work: |
| 3051 | + * // - It may require correct/in-range values for request initialization. |
| 3052 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 3053 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 3054 | + * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { |
| 3055 | + * ListLocationsRequest request = |
| 3056 | + * ListLocationsRequest.newBuilder() |
| 3057 | + * .setName("name3373707") |
| 3058 | + * .setFilter("filter-1274492040") |
| 3059 | + * .setPageSize(883849137) |
| 3060 | + * .setPageToken("pageToken873572522") |
| 3061 | + * .build(); |
| 3062 | + * for (Location element : artifactRegistryClient.listLocations(request).iterateAll()) { |
| 3063 | + * // doThingsWith(element); |
| 3064 | + * } |
| 3065 | + * } |
| 3066 | + * }</pre> |
| 3067 | + * |
| 3068 | + * @param request The request object containing all of the parameters for the API call. |
| 3069 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 3070 | + */ |
| 3071 | + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { |
| 3072 | + return listLocationsPagedCallable().call(request); |
| 3073 | + } |
| 3074 | + |
| 3075 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 3076 | + /** |
| 3077 | + * Lists information about the supported locations for this service. |
| 3078 | + * |
| 3079 | + * <p>Sample code: |
| 3080 | + * |
| 3081 | + * <pre>{@code |
| 3082 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 3083 | + * // It will require modifications to work: |
| 3084 | + * // - It may require correct/in-range values for request initialization. |
| 3085 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 3086 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 3087 | + * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { |
| 3088 | + * ListLocationsRequest request = |
| 3089 | + * ListLocationsRequest.newBuilder() |
| 3090 | + * .setName("name3373707") |
| 3091 | + * .setFilter("filter-1274492040") |
| 3092 | + * .setPageSize(883849137) |
| 3093 | + * .setPageToken("pageToken873572522") |
| 3094 | + * .build(); |
| 3095 | + * ApiFuture<Location> future = |
| 3096 | + * artifactRegistryClient.listLocationsPagedCallable().futureCall(request); |
| 3097 | + * // Do something. |
| 3098 | + * for (Location element : future.get().iterateAll()) { |
| 3099 | + * // doThingsWith(element); |
| 3100 | + * } |
| 3101 | + * } |
| 3102 | + * }</pre> |
| 3103 | + */ |
| 3104 | + public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> |
| 3105 | + listLocationsPagedCallable() { |
| 3106 | + return stub.listLocationsPagedCallable(); |
| 3107 | + } |
| 3108 | + |
| 3109 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 3110 | + /** |
| 3111 | + * Lists information about the supported locations for this service. |
| 3112 | + * |
| 3113 | + * <p>Sample code: |
| 3114 | + * |
| 3115 | + * <pre>{@code |
| 3116 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 3117 | + * // It will require modifications to work: |
| 3118 | + * // - It may require correct/in-range values for request initialization. |
| 3119 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 3120 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 3121 | + * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { |
| 3122 | + * ListLocationsRequest request = |
| 3123 | + * ListLocationsRequest.newBuilder() |
| 3124 | + * .setName("name3373707") |
| 3125 | + * .setFilter("filter-1274492040") |
| 3126 | + * .setPageSize(883849137) |
| 3127 | + * .setPageToken("pageToken873572522") |
| 3128 | + * .build(); |
| 3129 | + * while (true) { |
| 3130 | + * ListLocationsResponse response = |
| 3131 | + * artifactRegistryClient.listLocationsCallable().call(request); |
| 3132 | + * for (Location element : response.getLocationsList()) { |
| 3133 | + * // doThingsWith(element); |
| 3134 | + * } |
| 3135 | + * String nextPageToken = response.getNextPageToken(); |
| 3136 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 3137 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 3138 | + * } else { |
| 3139 | + * break; |
| 3140 | + * } |
| 3141 | + * } |
| 3142 | + * } |
| 3143 | + * }</pre> |
| 3144 | + */ |
| 3145 | + public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { |
| 3146 | + return stub.listLocationsCallable(); |
| 3147 | + } |
| 3148 | + |
| 3149 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 3150 | + /** |
| 3151 | + * Gets information about a location. |
| 3152 | + * |
| 3153 | + * <p>Sample code: |
| 3154 | + * |
| 3155 | + * <pre>{@code |
| 3156 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 3157 | + * // It will require modifications to work: |
| 3158 | + * // - It may require correct/in-range values for request initialization. |
| 3159 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 3160 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 3161 | + * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { |
| 3162 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 3163 | + * Location response = artifactRegistryClient.getLocation(request); |
| 3164 | + * } |
| 3165 | + * }</pre> |
| 3166 | + * |
| 3167 | + * @param request The request object containing all of the parameters for the API call. |
| 3168 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 3169 | + */ |
| 3170 | + public final Location getLocation(GetLocationRequest request) { |
| 3171 | + return getLocationCallable().call(request); |
| 3172 | + } |
| 3173 | + |
| 3174 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 3175 | + /** |
| 3176 | + * Gets information about a location. |
| 3177 | + * |
| 3178 | + * <p>Sample code: |
| 3179 | + * |
| 3180 | + * <pre>{@code |
| 3181 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 3182 | + * // It will require modifications to work: |
| 3183 | + * // - It may require correct/in-range values for request initialization. |
| 3184 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 3185 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 3186 | + * try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) { |
| 3187 | + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); |
| 3188 | + * ApiFuture<Location> future = artifactRegistryClient.getLocationCallable().futureCall(request); |
| 3189 | + * // Do something. |
| 3190 | + * Location response = future.get(); |
| 3191 | + * } |
| 3192 | + * }</pre> |
| 3193 | + */ |
| 3194 | + public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() { |
| 3195 | + return stub.getLocationCallable(); |
| 3196 | + } |
| 3197 | + |
3038 | 3198 | @Override
|
3039 | 3199 | public final void close() {
|
3040 | 3200 | stub.close();
|
@@ -3496,4 +3656,80 @@ protected ListTagsFixedSizeCollection createCollection(
|
3496 | 3656 | return new ListTagsFixedSizeCollection(pages, collectionSize);
|
3497 | 3657 | }
|
3498 | 3658 | }
|
| 3659 | + |
| 3660 | + public static class ListLocationsPagedResponse |
| 3661 | + extends AbstractPagedListResponse< |
| 3662 | + ListLocationsRequest, |
| 3663 | + ListLocationsResponse, |
| 3664 | + Location, |
| 3665 | + ListLocationsPage, |
| 3666 | + ListLocationsFixedSizeCollection> { |
| 3667 | + |
| 3668 | + public static ApiFuture<ListLocationsPagedResponse> createAsync( |
| 3669 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 3670 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 3671 | + ApiFuture<ListLocationsPage> futurePage = |
| 3672 | + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 3673 | + return ApiFutures.transform( |
| 3674 | + futurePage, |
| 3675 | + input -> new ListLocationsPagedResponse(input), |
| 3676 | + MoreExecutors.directExecutor()); |
| 3677 | + } |
| 3678 | + |
| 3679 | + private ListLocationsPagedResponse(ListLocationsPage page) { |
| 3680 | + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); |
| 3681 | + } |
| 3682 | + } |
| 3683 | + |
| 3684 | + public static class ListLocationsPage |
| 3685 | + extends AbstractPage< |
| 3686 | + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { |
| 3687 | + |
| 3688 | + private ListLocationsPage( |
| 3689 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 3690 | + ListLocationsResponse response) { |
| 3691 | + super(context, response); |
| 3692 | + } |
| 3693 | + |
| 3694 | + private static ListLocationsPage createEmptyPage() { |
| 3695 | + return new ListLocationsPage(null, null); |
| 3696 | + } |
| 3697 | + |
| 3698 | + @Override |
| 3699 | + protected ListLocationsPage createPage( |
| 3700 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 3701 | + ListLocationsResponse response) { |
| 3702 | + return new ListLocationsPage(context, response); |
| 3703 | + } |
| 3704 | + |
| 3705 | + @Override |
| 3706 | + public ApiFuture<ListLocationsPage> createPageAsync( |
| 3707 | + PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, |
| 3708 | + ApiFuture<ListLocationsResponse> futureResponse) { |
| 3709 | + return super.createPageAsync(context, futureResponse); |
| 3710 | + } |
| 3711 | + } |
| 3712 | + |
| 3713 | + public static class ListLocationsFixedSizeCollection |
| 3714 | + extends AbstractFixedSizeCollection< |
| 3715 | + ListLocationsRequest, |
| 3716 | + ListLocationsResponse, |
| 3717 | + Location, |
| 3718 | + ListLocationsPage, |
| 3719 | + ListLocationsFixedSizeCollection> { |
| 3720 | + |
| 3721 | + private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { |
| 3722 | + super(pages, collectionSize); |
| 3723 | + } |
| 3724 | + |
| 3725 | + private static ListLocationsFixedSizeCollection createEmptyCollection() { |
| 3726 | + return new ListLocationsFixedSizeCollection(null, 0); |
| 3727 | + } |
| 3728 | + |
| 3729 | + @Override |
| 3730 | + protected ListLocationsFixedSizeCollection createCollection( |
| 3731 | + List<ListLocationsPage> pages, int collectionSize) { |
| 3732 | + return new ListLocationsFixedSizeCollection(pages, collectionSize); |
| 3733 | + } |
| 3734 | + } |
3499 | 3735 | }
|
0 commit comments