|
32 | 32 | import com.google.common.util.concurrent.MoreExecutors; |
33 | 33 | import java.io.IOException; |
34 | 34 | import java.util.List; |
| 35 | +import java.util.Map; |
35 | 36 | import java.util.concurrent.TimeUnit; |
36 | 37 | import javax.annotation.Generated; |
37 | 38 |
|
@@ -164,6 +165,159 @@ public TargetTcpProxiesStub getStub() { |
164 | 165 | return stub; |
165 | 166 | } |
166 | 167 |
|
| 168 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 169 | + /** |
| 170 | + * Retrieves the list of all TargetTcpProxy resources, regional and global, available to the |
| 171 | + * specified project. |
| 172 | + * |
| 173 | + * <p>Sample code: |
| 174 | + * |
| 175 | + * <pre>{@code |
| 176 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 177 | + * // It will require modifications to work: |
| 178 | + * // - It may require correct/in-range values for request initialization. |
| 179 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 180 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 181 | + * try (TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.create()) { |
| 182 | + * String project = "project-309310695"; |
| 183 | + * for (Map.Entry<String, TargetTcpProxiesScopedList> element : |
| 184 | + * targetTcpProxiesClient.aggregatedList(project).iterateAll()) { |
| 185 | + * // doThingsWith(element); |
| 186 | + * } |
| 187 | + * } |
| 188 | + * }</pre> |
| 189 | + * |
| 190 | + * @param project Name of the project scoping this request. |
| 191 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 192 | + */ |
| 193 | + public final AggregatedListPagedResponse aggregatedList(String project) { |
| 194 | + AggregatedListTargetTcpProxiesRequest request = |
| 195 | + AggregatedListTargetTcpProxiesRequest.newBuilder().setProject(project).build(); |
| 196 | + return aggregatedList(request); |
| 197 | + } |
| 198 | + |
| 199 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 200 | + /** |
| 201 | + * Retrieves the list of all TargetTcpProxy resources, regional and global, available to the |
| 202 | + * specified project. |
| 203 | + * |
| 204 | + * <p>Sample code: |
| 205 | + * |
| 206 | + * <pre>{@code |
| 207 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 208 | + * // It will require modifications to work: |
| 209 | + * // - It may require correct/in-range values for request initialization. |
| 210 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 211 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 212 | + * try (TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.create()) { |
| 213 | + * AggregatedListTargetTcpProxiesRequest request = |
| 214 | + * AggregatedListTargetTcpProxiesRequest.newBuilder() |
| 215 | + * .setFilter("filter-1274492040") |
| 216 | + * .setIncludeAllScopes(true) |
| 217 | + * .setMaxResults(1128457243) |
| 218 | + * .setOrderBy("orderBy-1207110587") |
| 219 | + * .setPageToken("pageToken873572522") |
| 220 | + * .setProject("project-309310695") |
| 221 | + * .setReturnPartialSuccess(true) |
| 222 | + * .build(); |
| 223 | + * for (Map.Entry<String, TargetTcpProxiesScopedList> element : |
| 224 | + * targetTcpProxiesClient.aggregatedList(request).iterateAll()) { |
| 225 | + * // doThingsWith(element); |
| 226 | + * } |
| 227 | + * } |
| 228 | + * }</pre> |
| 229 | + * |
| 230 | + * @param request The request object containing all of the parameters for the API call. |
| 231 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 232 | + */ |
| 233 | + public final AggregatedListPagedResponse aggregatedList( |
| 234 | + AggregatedListTargetTcpProxiesRequest request) { |
| 235 | + return aggregatedListPagedCallable().call(request); |
| 236 | + } |
| 237 | + |
| 238 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 239 | + /** |
| 240 | + * Retrieves the list of all TargetTcpProxy resources, regional and global, available to the |
| 241 | + * specified project. |
| 242 | + * |
| 243 | + * <p>Sample code: |
| 244 | + * |
| 245 | + * <pre>{@code |
| 246 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 247 | + * // It will require modifications to work: |
| 248 | + * // - It may require correct/in-range values for request initialization. |
| 249 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 250 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 251 | + * try (TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.create()) { |
| 252 | + * AggregatedListTargetTcpProxiesRequest request = |
| 253 | + * AggregatedListTargetTcpProxiesRequest.newBuilder() |
| 254 | + * .setFilter("filter-1274492040") |
| 255 | + * .setIncludeAllScopes(true) |
| 256 | + * .setMaxResults(1128457243) |
| 257 | + * .setOrderBy("orderBy-1207110587") |
| 258 | + * .setPageToken("pageToken873572522") |
| 259 | + * .setProject("project-309310695") |
| 260 | + * .setReturnPartialSuccess(true) |
| 261 | + * .build(); |
| 262 | + * ApiFuture<Map.Entry<String, TargetTcpProxiesScopedList>> future = |
| 263 | + * targetTcpProxiesClient.aggregatedListPagedCallable().futureCall(request); |
| 264 | + * // Do something. |
| 265 | + * for (Map.Entry<String, TargetTcpProxiesScopedList> element : future.get().iterateAll()) { |
| 266 | + * // doThingsWith(element); |
| 267 | + * } |
| 268 | + * } |
| 269 | + * }</pre> |
| 270 | + */ |
| 271 | + public final UnaryCallable<AggregatedListTargetTcpProxiesRequest, AggregatedListPagedResponse> |
| 272 | + aggregatedListPagedCallable() { |
| 273 | + return stub.aggregatedListPagedCallable(); |
| 274 | + } |
| 275 | + |
| 276 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 277 | + /** |
| 278 | + * Retrieves the list of all TargetTcpProxy resources, regional and global, available to the |
| 279 | + * specified project. |
| 280 | + * |
| 281 | + * <p>Sample code: |
| 282 | + * |
| 283 | + * <pre>{@code |
| 284 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 285 | + * // It will require modifications to work: |
| 286 | + * // - It may require correct/in-range values for request initialization. |
| 287 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 288 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 289 | + * try (TargetTcpProxiesClient targetTcpProxiesClient = TargetTcpProxiesClient.create()) { |
| 290 | + * AggregatedListTargetTcpProxiesRequest request = |
| 291 | + * AggregatedListTargetTcpProxiesRequest.newBuilder() |
| 292 | + * .setFilter("filter-1274492040") |
| 293 | + * .setIncludeAllScopes(true) |
| 294 | + * .setMaxResults(1128457243) |
| 295 | + * .setOrderBy("orderBy-1207110587") |
| 296 | + * .setPageToken("pageToken873572522") |
| 297 | + * .setProject("project-309310695") |
| 298 | + * .setReturnPartialSuccess(true) |
| 299 | + * .build(); |
| 300 | + * while (true) { |
| 301 | + * TargetTcpProxyAggregatedList response = |
| 302 | + * targetTcpProxiesClient.aggregatedListCallable().call(request); |
| 303 | + * for (Map.Entry<String, TargetTcpProxiesScopedList> element : response.getItemsList()) { |
| 304 | + * // doThingsWith(element); |
| 305 | + * } |
| 306 | + * String nextPageToken = response.getNextPageToken(); |
| 307 | + * if (!Strings.isNullOrEmpty(nextPageToken)) { |
| 308 | + * request = request.toBuilder().setPageToken(nextPageToken).build(); |
| 309 | + * } else { |
| 310 | + * break; |
| 311 | + * } |
| 312 | + * } |
| 313 | + * } |
| 314 | + * }</pre> |
| 315 | + */ |
| 316 | + public final UnaryCallable<AggregatedListTargetTcpProxiesRequest, TargetTcpProxyAggregatedList> |
| 317 | + aggregatedListCallable() { |
| 318 | + return stub.aggregatedListCallable(); |
| 319 | + } |
| 320 | + |
167 | 321 | // AUTO-GENERATED DOCUMENTATION AND METHOD. |
168 | 322 | /** |
169 | 323 | * Deletes the specified TargetTcpProxy resource. |
@@ -974,6 +1128,101 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted |
974 | 1128 | return stub.awaitTermination(duration, unit); |
975 | 1129 | } |
976 | 1130 |
|
| 1131 | + public static class AggregatedListPagedResponse |
| 1132 | + extends AbstractPagedListResponse< |
| 1133 | + AggregatedListTargetTcpProxiesRequest, |
| 1134 | + TargetTcpProxyAggregatedList, |
| 1135 | + Map.Entry<String, TargetTcpProxiesScopedList>, |
| 1136 | + AggregatedListPage, |
| 1137 | + AggregatedListFixedSizeCollection> { |
| 1138 | + |
| 1139 | + public static ApiFuture<AggregatedListPagedResponse> createAsync( |
| 1140 | + PageContext< |
| 1141 | + AggregatedListTargetTcpProxiesRequest, |
| 1142 | + TargetTcpProxyAggregatedList, |
| 1143 | + Map.Entry<String, TargetTcpProxiesScopedList>> |
| 1144 | + context, |
| 1145 | + ApiFuture<TargetTcpProxyAggregatedList> futureResponse) { |
| 1146 | + ApiFuture<AggregatedListPage> futurePage = |
| 1147 | + AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); |
| 1148 | + return ApiFutures.transform( |
| 1149 | + futurePage, |
| 1150 | + input -> new AggregatedListPagedResponse(input), |
| 1151 | + MoreExecutors.directExecutor()); |
| 1152 | + } |
| 1153 | + |
| 1154 | + private AggregatedListPagedResponse(AggregatedListPage page) { |
| 1155 | + super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); |
| 1156 | + } |
| 1157 | + } |
| 1158 | + |
| 1159 | + public static class AggregatedListPage |
| 1160 | + extends AbstractPage< |
| 1161 | + AggregatedListTargetTcpProxiesRequest, |
| 1162 | + TargetTcpProxyAggregatedList, |
| 1163 | + Map.Entry<String, TargetTcpProxiesScopedList>, |
| 1164 | + AggregatedListPage> { |
| 1165 | + |
| 1166 | + private AggregatedListPage( |
| 1167 | + PageContext< |
| 1168 | + AggregatedListTargetTcpProxiesRequest, |
| 1169 | + TargetTcpProxyAggregatedList, |
| 1170 | + Map.Entry<String, TargetTcpProxiesScopedList>> |
| 1171 | + context, |
| 1172 | + TargetTcpProxyAggregatedList response) { |
| 1173 | + super(context, response); |
| 1174 | + } |
| 1175 | + |
| 1176 | + private static AggregatedListPage createEmptyPage() { |
| 1177 | + return new AggregatedListPage(null, null); |
| 1178 | + } |
| 1179 | + |
| 1180 | + @Override |
| 1181 | + protected AggregatedListPage createPage( |
| 1182 | + PageContext< |
| 1183 | + AggregatedListTargetTcpProxiesRequest, |
| 1184 | + TargetTcpProxyAggregatedList, |
| 1185 | + Map.Entry<String, TargetTcpProxiesScopedList>> |
| 1186 | + context, |
| 1187 | + TargetTcpProxyAggregatedList response) { |
| 1188 | + return new AggregatedListPage(context, response); |
| 1189 | + } |
| 1190 | + |
| 1191 | + @Override |
| 1192 | + public ApiFuture<AggregatedListPage> createPageAsync( |
| 1193 | + PageContext< |
| 1194 | + AggregatedListTargetTcpProxiesRequest, |
| 1195 | + TargetTcpProxyAggregatedList, |
| 1196 | + Map.Entry<String, TargetTcpProxiesScopedList>> |
| 1197 | + context, |
| 1198 | + ApiFuture<TargetTcpProxyAggregatedList> futureResponse) { |
| 1199 | + return super.createPageAsync(context, futureResponse); |
| 1200 | + } |
| 1201 | + } |
| 1202 | + |
| 1203 | + public static class AggregatedListFixedSizeCollection |
| 1204 | + extends AbstractFixedSizeCollection< |
| 1205 | + AggregatedListTargetTcpProxiesRequest, |
| 1206 | + TargetTcpProxyAggregatedList, |
| 1207 | + Map.Entry<String, TargetTcpProxiesScopedList>, |
| 1208 | + AggregatedListPage, |
| 1209 | + AggregatedListFixedSizeCollection> { |
| 1210 | + |
| 1211 | + private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { |
| 1212 | + super(pages, collectionSize); |
| 1213 | + } |
| 1214 | + |
| 1215 | + private static AggregatedListFixedSizeCollection createEmptyCollection() { |
| 1216 | + return new AggregatedListFixedSizeCollection(null, 0); |
| 1217 | + } |
| 1218 | + |
| 1219 | + @Override |
| 1220 | + protected AggregatedListFixedSizeCollection createCollection( |
| 1221 | + List<AggregatedListPage> pages, int collectionSize) { |
| 1222 | + return new AggregatedListFixedSizeCollection(pages, collectionSize); |
| 1223 | + } |
| 1224 | + } |
| 1225 | + |
977 | 1226 | public static class ListPagedResponse |
978 | 1227 | extends AbstractPagedListResponse< |
979 | 1228 | ListTargetTcpProxiesRequest, |
|
0 commit comments