@Generated(value="by gapic-generator") @BetaApi public class InterconnectClient 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 (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Operation response = interconnectClient.deleteInterconnect(interconnect);
}
Note: close() needs to be called on the interconnectClient 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 InterconnectSettings to create(). For example:
To customize credentials:
InterconnectSettings interconnectSettings =
InterconnectSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
InterconnectClient interconnectClient =
InterconnectClient.create(interconnectSettings);
To customize the endpoint:
InterconnectSettings interconnectSettings =
InterconnectSettings.newBuilder().setEndpoint(myEndpoint).build();
InterconnectClient interconnectClient =
InterconnectClient.create(interconnectSettings);
Modifier and Type | Class and Description |
---|---|
static class |
InterconnectClient.ListInterconnectsFixedSizeCollection |
static class |
InterconnectClient.ListInterconnectsPage |
static class |
InterconnectClient.ListInterconnectsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
InterconnectClient(InterconnectSettings settings)
Constructs an instance of InterconnectClient, using the given settings.
|
protected |
InterconnectClient(InterconnectStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static InterconnectClient |
create()
Constructs an instance of InterconnectClient with default settings.
|
static InterconnectClient |
create(InterconnectSettings settings)
Constructs an instance of InterconnectClient, using the given settings.
|
static InterconnectClient |
create(InterconnectStub stub)
Constructs an instance of InterconnectClient, using the given stub for making calls.
|
Operation |
deleteInterconnect(DeleteInterconnectHttpRequest request)
Deletes the specified interconnect.
|
Operation |
deleteInterconnect(ProjectGlobalInterconnectName interconnect)
Deletes the specified interconnect.
|
Operation |
deleteInterconnect(String interconnect)
Deletes the specified interconnect.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInterconnectHttpRequest,Operation> |
deleteInterconnectCallable()
Deletes the specified interconnect.
|
InterconnectsGetDiagnosticsResponse |
getDiagnosticsInterconnect(GetDiagnosticsInterconnectHttpRequest request)
Returns the interconnectDiagnostics for the specified interconnect.
|
InterconnectsGetDiagnosticsResponse |
getDiagnosticsInterconnect(ProjectGlobalInterconnectName interconnect)
Returns the interconnectDiagnostics for the specified interconnect.
|
InterconnectsGetDiagnosticsResponse |
getDiagnosticsInterconnect(String interconnect)
Returns the interconnectDiagnostics for the specified interconnect.
|
com.google.api.gax.rpc.UnaryCallable<GetDiagnosticsInterconnectHttpRequest,InterconnectsGetDiagnosticsResponse> |
getDiagnosticsInterconnectCallable()
Returns the interconnectDiagnostics for the specified interconnect.
|
Interconnect |
getInterconnect(GetInterconnectHttpRequest request)
Returns the specified interconnect.
|
Interconnect |
getInterconnect(ProjectGlobalInterconnectName interconnect)
Returns the specified interconnect.
|
Interconnect |
getInterconnect(String interconnect)
Returns the specified interconnect.
|
com.google.api.gax.rpc.UnaryCallable<GetInterconnectHttpRequest,Interconnect> |
getInterconnectCallable()
Returns the specified interconnect.
|
InterconnectSettings |
getSettings() |
InterconnectStub |
getStub() |
Operation |
insertInterconnect(InsertInterconnectHttpRequest request)
Creates a Interconnect in the specified project using the data included in the request.
|
Operation |
insertInterconnect(ProjectName project,
Interconnect interconnectResource)
Creates a Interconnect in the specified project using the data included in the request.
|
Operation |
insertInterconnect(String project,
Interconnect interconnectResource)
Creates a Interconnect in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertInterconnectHttpRequest,Operation> |
insertInterconnectCallable()
Creates a Interconnect in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
InterconnectClient.ListInterconnectsPagedResponse |
listInterconnects(ListInterconnectsHttpRequest request)
Retrieves the list of interconnect available to the specified project.
|
InterconnectClient.ListInterconnectsPagedResponse |
listInterconnects(ProjectName project)
Retrieves the list of interconnect available to the specified project.
|
InterconnectClient.ListInterconnectsPagedResponse |
listInterconnects(String project)
Retrieves the list of interconnect available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListInterconnectsHttpRequest,InterconnectList> |
listInterconnectsCallable()
Retrieves the list of interconnect available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListInterconnectsHttpRequest,InterconnectClient.ListInterconnectsPagedResponse> |
listInterconnectsPagedCallable()
Retrieves the list of interconnect available to the specified project.
|
Operation |
patchInterconnect(PatchInterconnectHttpRequest request)
Updates the specified interconnect with the data included in the request.
|
Operation |
patchInterconnect(ProjectGlobalInterconnectName interconnect,
Interconnect interconnectResource,
List<String> fieldMask)
Updates the specified interconnect with the data included in the request.
|
Operation |
patchInterconnect(String interconnect,
Interconnect interconnectResource,
List<String> fieldMask)
Updates the specified interconnect with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchInterconnectHttpRequest,Operation> |
patchInterconnectCallable()
Updates the specified interconnect with the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
protected InterconnectClient(InterconnectSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected InterconnectClient(InterconnectStub stub)
public static final InterconnectClient create() throws IOException
IOException
public static final InterconnectClient create(InterconnectSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final InterconnectClient create(InterconnectStub stub)
public final InterconnectSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public InterconnectStub getStub()
@BetaApi public final Operation deleteInterconnect(ProjectGlobalInterconnectName interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Operation response = interconnectClient.deleteInterconnect(interconnect);
}
interconnect
- Name of the interconnect to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInterconnect(String interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Operation response = interconnectClient.deleteInterconnect(interconnect.toString());
}
interconnect
- Name of the interconnect to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteInterconnect(DeleteInterconnectHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
DeleteInterconnectHttpRequest request = DeleteInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
Operation response = interconnectClient.deleteInterconnect(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<DeleteInterconnectHttpRequest,Operation> deleteInterconnectCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
DeleteInterconnectHttpRequest request = DeleteInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
ApiFuture<Operation> future = interconnectClient.deleteInterconnectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Interconnect getInterconnect(ProjectGlobalInterconnectName interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Interconnect response = interconnectClient.getInterconnect(interconnect);
}
interconnect
- Name of the interconnect to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Interconnect getInterconnect(String interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Interconnect response = interconnectClient.getInterconnect(interconnect.toString());
}
interconnect
- Name of the interconnect to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Interconnect getInterconnect(GetInterconnectHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
GetInterconnectHttpRequest request = GetInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
Interconnect response = interconnectClient.getInterconnect(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<GetInterconnectHttpRequest,Interconnect> getInterconnectCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
GetInterconnectHttpRequest request = GetInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
ApiFuture<Interconnect> future = interconnectClient.getInterconnectCallable().futureCall(request);
// Do something
Interconnect response = future.get();
}
@BetaApi public final InterconnectsGetDiagnosticsResponse getDiagnosticsInterconnect(ProjectGlobalInterconnectName interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
InterconnectsGetDiagnosticsResponse response = interconnectClient.getDiagnosticsInterconnect(interconnect);
}
interconnect
- Name of the interconnect resource to query.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectsGetDiagnosticsResponse getDiagnosticsInterconnect(String interconnect)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
InterconnectsGetDiagnosticsResponse response = interconnectClient.getDiagnosticsInterconnect(interconnect.toString());
}
interconnect
- Name of the interconnect resource to query.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectsGetDiagnosticsResponse getDiagnosticsInterconnect(GetDiagnosticsInterconnectHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
GetDiagnosticsInterconnectHttpRequest request = GetDiagnosticsInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
InterconnectsGetDiagnosticsResponse response = interconnectClient.getDiagnosticsInterconnect(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<GetDiagnosticsInterconnectHttpRequest,InterconnectsGetDiagnosticsResponse> getDiagnosticsInterconnectCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
GetDiagnosticsInterconnectHttpRequest request = GetDiagnosticsInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.build();
ApiFuture<InterconnectsGetDiagnosticsResponse> future = interconnectClient.getDiagnosticsInterconnectCallable().futureCall(request);
// Do something
InterconnectsGetDiagnosticsResponse response = future.get();
}
@BetaApi public final Operation insertInterconnect(ProjectName project, Interconnect interconnectResource)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
Operation response = interconnectClient.insertInterconnect(project, interconnectResource);
}
project
- Project ID for this request.interconnectResource
- Represents an Interconnect resource.
An Interconnect resource is a dedicated connection between the GCP network and your on-premises network. For more information, read the Dedicated Interconnect Overview. (== resource_for v1.interconnects ==) (== resource_for beta.interconnects ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInterconnect(String project, Interconnect interconnectResource)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
Operation response = interconnectClient.insertInterconnect(project.toString(), interconnectResource);
}
project
- Project ID for this request.interconnectResource
- Represents an Interconnect resource.
An Interconnect resource is a dedicated connection between the GCP network and your on-premises network. For more information, read the Dedicated Interconnect Overview. (== resource_for v1.interconnects ==) (== resource_for beta.interconnects ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertInterconnect(InsertInterconnectHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder()
.setProject(formattedProject)
.setInterconnectResource(interconnectResource)
.build();
Operation response = interconnectClient.insertInterconnect(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<InsertInterconnectHttpRequest,Operation> insertInterconnectCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder()
.setProject(formattedProject)
.setInterconnectResource(interconnectResource)
.build();
ApiFuture<Operation> future = interconnectClient.insertInterconnectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final InterconnectClient.ListInterconnectsPagedResponse listInterconnects(ProjectName project)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Interconnect element : interconnectClient.listInterconnects(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final InterconnectClient.ListInterconnectsPagedResponse listInterconnects(String project)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Interconnect element : interconnectClient.listInterconnects(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 InterconnectClient.ListInterconnectsPagedResponse listInterconnects(ListInterconnectsHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (Interconnect element : interconnectClient.listInterconnects(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<ListInterconnectsHttpRequest,InterconnectClient.ListInterconnectsPagedResponse> listInterconnectsPagedCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListInterconnectsPagedResponse> future = interconnectClient.listInterconnectsPagedCallable().futureCall(request);
// Do something
for (Interconnect element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListInterconnectsHttpRequest,InterconnectList> listInterconnectsCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListInterconnectsHttpRequest request = ListInterconnectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
InterconnectList response = interconnectClient.listInterconnectsCallable().call(request);
for (Interconnect element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation patchInterconnect(ProjectGlobalInterconnectName interconnect, Interconnect interconnectResource, List<String> fieldMask)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = interconnectClient.patchInterconnect(interconnect, interconnectResource, fieldMask);
}
interconnect
- Name of the interconnect to update.interconnectResource
- Represents an Interconnect resource.
An Interconnect resource is a dedicated connection between the GCP network and your on-premises network. For more information, read the Dedicated Interconnect Overview. (== resource_for v1.interconnects ==) (== resource_for beta.interconnects ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchInterconnect(String interconnect, Interconnect interconnectResource, List<String> fieldMask)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = interconnectClient.patchInterconnect(interconnect.toString(), interconnectResource, fieldMask);
}
interconnect
- Name of the interconnect to update.interconnectResource
- Represents an Interconnect resource.
An Interconnect resource is a dedicated connection between the GCP network and your on-premises network. For more information, read the Dedicated Interconnect Overview. (== resource_for v1.interconnects ==) (== resource_for beta.interconnects ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchInterconnect(PatchInterconnectHttpRequest request)
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchInterconnectHttpRequest request = PatchInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.setInterconnectResource(interconnectResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = interconnectClient.patchInterconnect(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<PatchInterconnectHttpRequest,Operation> patchInterconnectCallable()
Sample code:
try (InterconnectClient interconnectClient = InterconnectClient.create()) {
String formattedInterconnect = ProjectGlobalInterconnectName.format("[PROJECT]", "[INTERCONNECT]");
Interconnect interconnectResource = Interconnect.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchInterconnectHttpRequest request = PatchInterconnectHttpRequest.newBuilder()
.setInterconnect(formattedInterconnect)
.setInterconnectResource(interconnectResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = interconnectClient.patchInterconnectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
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.