@Generated(value="by gapic-generator") @BetaApi public class InterconnectLocationClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
}
Note: close() needs to be called on the interconnectLocationClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of InterconnectLocationSettings to create(). For example:
To customize credentials:
InterconnectLocationSettings interconnectLocationSettings =
InterconnectLocationSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InterconnectLocationClient interconnectLocationClient =
InterconnectLocationClient.create(interconnectLocationSettings);
To customize the endpoint:
InterconnectLocationSettings interconnectLocationSettings =
InterconnectLocationSettings.newBuilder().setEndpoint(myEndpoint).build();
InterconnectLocationClient interconnectLocationClient =
InterconnectLocationClient.create(interconnectLocationSettings);
Modifier and Type | Class and Description |
---|---|
static class |
InterconnectLocationClient.ListInterconnectLocationsFixedSizeCollection |
static class |
InterconnectLocationClient.ListInterconnectLocationsPage |
static class |
InterconnectLocationClient.ListInterconnectLocationsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
InterconnectLocationClient(InterconnectLocationSettings settings)
Constructs an instance of InterconnectLocationClient, using the given settings.
|
protected |
InterconnectLocationClient(InterconnectLocationStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InterconnectLocationClient |
create()
Constructs an instance of InterconnectLocationClient with default settings.
|
static InterconnectLocationClient |
create(InterconnectLocationSettings settings)
Constructs an instance of InterconnectLocationClient, using the given settings.
|
static InterconnectLocationClient |
create(InterconnectLocationStub stub)
Constructs an instance of InterconnectLocationClient, using the given stub for making calls.
|
InterconnectLocation |
getInterconnectLocation(GetInterconnectLocationHttpRequest request)
Returns the details for the specified interconnect location.
|
InterconnectLocation |
getInterconnectLocation(ProjectGlobalInterconnectLocationName interconnectLocation)
Returns the details for the specified interconnect location.
|
InterconnectLocation |
getInterconnectLocation(String interconnectLocation)
Returns the details for the specified interconnect location.
|
com.google.api.gax.rpc.UnaryCallable<GetInterconnectLocationHttpRequest,InterconnectLocation> |
getInterconnectLocationCallable()
Returns the details for the specified interconnect location.
|
InterconnectLocationSettings |
getSettings() |
InterconnectLocationStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
InterconnectLocationClient.ListInterconnectLocationsPagedResponse |
listInterconnectLocations(ListInterconnectLocationsHttpRequest request)
Retrieves the list of interconnect locations available to the specified project.
|
InterconnectLocationClient.ListInterconnectLocationsPagedResponse |
listInterconnectLocations(ProjectName project)
Retrieves the list of interconnect locations available to the specified project.
|
InterconnectLocationClient.ListInterconnectLocationsPagedResponse |
listInterconnectLocations(String project)
Retrieves the list of interconnect locations available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListInterconnectLocationsHttpRequest,InterconnectLocationList> |
listInterconnectLocationsCallable()
Retrieves the list of interconnect locations available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListInterconnectLocationsHttpRequest,InterconnectLocationClient.ListInterconnectLocationsPagedResponse> |
listInterconnectLocationsPagedCallable()
Retrieves the list of interconnect locations available to the specified project.
|
void |
shutdown() |
void |
shutdownNow() |
protected InterconnectLocationClient(InterconnectLocationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected InterconnectLocationClient(InterconnectLocationStub stub)
public static final InterconnectLocationClient create() throws IOException
IOException
public static final InterconnectLocationClient create(InterconnectLocationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final InterconnectLocationClient create(InterconnectLocationStub stub)
public final InterconnectLocationSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public InterconnectLocationStub getStub()
@BetaApi public final InterconnectLocation getInterconnectLocation(ProjectGlobalInterconnectLocationName interconnectLocation)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
}
interconnectLocation
- Name of the interconnect location to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectLocation getInterconnectLocation(String interconnectLocation)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation.toString());
}
interconnectLocation
- Name of the interconnect location to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectLocation getInterconnectLocation(GetInterconnectLocationHttpRequest request)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
String formattedInterconnectLocation = ProjectGlobalInterconnectLocationName.format("[PROJECT]", "[INTERCONNECT_LOCATION]");
GetInterconnectLocationHttpRequest request = GetInterconnectLocationHttpRequest.newBuilder()
.setInterconnectLocation(formattedInterconnectLocation)
.build();
InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetInterconnectLocationHttpRequest,InterconnectLocation> getInterconnectLocationCallable()
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
String formattedInterconnectLocation = ProjectGlobalInterconnectLocationName.format("[PROJECT]", "[INTERCONNECT_LOCATION]");
GetInterconnectLocationHttpRequest request = GetInterconnectLocationHttpRequest.newBuilder()
.setInterconnectLocation(formattedInterconnectLocation)
.build();
ApiFuture<InterconnectLocation> future = interconnectLocationClient.getInterconnectLocationCallable().futureCall(request);
// Do something
InterconnectLocation response = future.get();
}
@BetaApi public final InterconnectLocationClient.ListInterconnectLocationsPagedResponse listInterconnectLocations(ProjectName project)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectLocationClient.ListInterconnectLocationsPagedResponse listInterconnectLocations(String project)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectLocationClient.ListInterconnectLocationsPagedResponse listInterconnectLocations(ListInterconnectLocationsHttpRequest request)
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (InterconnectLocation element : interconnectLocationClient.listInterconnectLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInterconnectLocationsHttpRequest,InterconnectLocationClient.ListInterconnectLocationsPagedResponse> listInterconnectLocationsPagedCallable()
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListInterconnectLocationsPagedResponse> future = interconnectLocationClient.listInterconnectLocationsPagedCallable().futureCall(request);
// Do something
for (InterconnectLocation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInterconnectLocationsHttpRequest,InterconnectLocationList> listInterconnectLocationsCallable()
Sample code:
try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectLocationsHttpRequest request = ListInterconnectLocationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
InterconnectLocationList response = interconnectLocationClient.listInterconnectLocationsCallable().call(request);
for (InterconnectLocation element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.