use of com.google.cloud.location.Location in project gapic-generator-java by googleapis.
the class SyncGetLocation method syncGetLocation.
public static void syncGetLocation() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = keyManagementServiceClient.getLocation(request);
}
}
use of com.google.cloud.location.Location in project gapic-generator-java by googleapis.
the class AsyncListLocations method asyncListLocations.
public static void asyncListLocations() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ListLocationsRequest request = ListLocationsRequest.newBuilder().setName("name3373707").setFilter("filter-1274492040").setPageSize(883849137).setPageToken("pageToken873572522").build();
ApiFuture<Location> future = keyManagementServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.cloud.location.Location in project java-security-private-ca by googleapis.
the class CertificateAuthorityServiceClientTest method getLocationTest.
@Test
public void getLocationTest() throws Exception {
Location expectedResponse = Location.newBuilder().setName("name3373707").setLocationId("locationId1541836720").setDisplayName("displayName1714148973").putAllLabels(new HashMap<String, String>()).setMetadata(Any.newBuilder().build()).build();
mockLocations.addResponse(expectedResponse);
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location actualResponse = client.getLocation(request);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLocations.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.location.Location in project gapic-generator-java by googleapis.
the class AsyncGetLocation method asyncGetLocation.
public static void asyncGetLocation() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = keyManagementServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
}
use of com.google.cloud.location.Location in project gapic-generator-java by googleapis.
the class AsyncListLocationsPaged method asyncListLocationsPaged.
public static void asyncListLocationsPaged() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ListLocationsRequest request = ListLocationsRequest.newBuilder().setName("name3373707").setFilter("filter-1274492040").setPageSize(883849137).setPageToken("pageToken873572522").build();
while (true) {
ListLocationsResponse response = keyManagementServiceClient.listLocationsCallable().call(request);
for (Location element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
Aggregations