Class InterconnectsClient (1.12.0)

public class InterconnectsClient implements BackgroundResource

Service Description: The Interconnects API.

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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   String interconnect = "interconnect-849140594";
   Interconnect response = interconnectsClient.get(project, interconnect);
 }
 

Note: close() needs to be called on the InterconnectsClient 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:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

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 InterconnectsSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 InterconnectsSettings interconnectsSettings =
     InterconnectsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 InterconnectsClient interconnectsClient = InterconnectsClient.create(interconnectsSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 InterconnectsSettings interconnectsSettings =
     InterconnectsSettings.newBuilder().setEndpoint(myEndpoint).build();
 InterconnectsClient interconnectsClient = InterconnectsClient.create(interconnectsSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > InterconnectsClient

Implements

BackgroundResource

Static Methods

create()

public static final InterconnectsClient create()

Constructs an instance of InterconnectsClient with default settings.

Returns
TypeDescription
InterconnectsClient
Exceptions
TypeDescription
IOException

create(InterconnectsSettings settings)

public static final InterconnectsClient create(InterconnectsSettings settings)

Constructs an instance of InterconnectsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsInterconnectsSettings
Returns
TypeDescription
InterconnectsClient
Exceptions
TypeDescription
IOException

create(InterconnectsStub stub)

public static final InterconnectsClient create(InterconnectsStub stub)

Constructs an instance of InterconnectsClient, using the given stub for making calls. This is for advanced usage - prefer using create(InterconnectsSettings).

Parameter
NameDescription
stubInterconnectsStub
Returns
TypeDescription
InterconnectsClient

Constructors

InterconnectsClient(InterconnectsSettings settings)

protected InterconnectsClient(InterconnectsSettings settings)

Constructs an instance of InterconnectsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsInterconnectsSettings

InterconnectsClient(InterconnectsStub stub)

protected InterconnectsClient(InterconnectsStub stub)
Parameter
NameDescription
stubInterconnectsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

deleteAsync(DeleteInterconnectRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteInterconnectRequest request)

Deletes the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   DeleteInterconnectRequest request =
       DeleteInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = interconnectsClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteInterconnectRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String interconnect)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String interconnect)

Deletes the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   String interconnect = "interconnect-849140594";
   Operation response = interconnectsClient.deleteAsync(project, interconnect).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

interconnectString

Name of the interconnect to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteInterconnectRequest,Operation> deleteCallable()

Deletes the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   DeleteInterconnectRequest request =
       DeleteInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = interconnectsClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteInterconnectRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteInterconnectRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   DeleteInterconnectRequest request =
       DeleteInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       interconnectsClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteInterconnectRequest,Operation,Operation>

get(GetInterconnectRequest request)

public final Interconnect get(GetInterconnectRequest request)

Returns the specified interconnect. Get a list of available interconnects by making a list() request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   GetInterconnectRequest request =
       GetInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .build();
   Interconnect response = interconnectsClient.get(request);
 }
 
Parameter
NameDescription
requestGetInterconnectRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Interconnect

get(String project, String interconnect)

public final Interconnect get(String project, String interconnect)

Returns the specified interconnect. Get a list of available interconnects by making a list() request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   String interconnect = "interconnect-849140594";
   Interconnect response = interconnectsClient.get(project, interconnect);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

interconnectString

Name of the interconnect to return.

Returns
TypeDescription
Interconnect

getCallable()

public final UnaryCallable<GetInterconnectRequest,Interconnect> getCallable()

Returns the specified interconnect. Get a list of available interconnects by making a list() request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   GetInterconnectRequest request =
       GetInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .build();
   ApiFuture<Interconnect> future = interconnectsClient.getCallable().futureCall(request);
   // Do something.
   Interconnect response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetInterconnectRequest,Interconnect>

getDiagnostics(GetDiagnosticsInterconnectRequest request)

public final InterconnectsGetDiagnosticsResponse getDiagnostics(GetDiagnosticsInterconnectRequest request)

Returns the interconnectDiagnostics for the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   GetDiagnosticsInterconnectRequest request =
       GetDiagnosticsInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .build();
   InterconnectsGetDiagnosticsResponse response = interconnectsClient.getDiagnostics(request);
 }
 
Parameter
NameDescription
requestGetDiagnosticsInterconnectRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InterconnectsGetDiagnosticsResponse

getDiagnostics(String project, String interconnect)

public final InterconnectsGetDiagnosticsResponse getDiagnostics(String project, String interconnect)

Returns the interconnectDiagnostics for the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   String interconnect = "interconnect-849140594";
   InterconnectsGetDiagnosticsResponse response =
       interconnectsClient.getDiagnostics(project, interconnect);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

interconnectString

Name of the interconnect resource to query.

Returns
TypeDescription
InterconnectsGetDiagnosticsResponse

getDiagnosticsCallable()

public final UnaryCallable<GetDiagnosticsInterconnectRequest,InterconnectsGetDiagnosticsResponse> getDiagnosticsCallable()

Returns the interconnectDiagnostics for the specified interconnect.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   GetDiagnosticsInterconnectRequest request =
       GetDiagnosticsInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setProject("project-309310695")
           .build();
   ApiFuture<InterconnectsGetDiagnosticsResponse> future =
       interconnectsClient.getDiagnosticsCallable().futureCall(request);
   // Do something.
   InterconnectsGetDiagnosticsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetDiagnosticsInterconnectRequest,InterconnectsGetDiagnosticsResponse>

getSettings()

public final InterconnectsSettings getSettings()
Returns
TypeDescription
InterconnectsSettings

getStub()

public InterconnectsStub getStub()
Returns
TypeDescription
InterconnectsStub

insertAsync(InsertInterconnectRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertInterconnectRequest request)

Creates a Interconnect in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   InsertInterconnectRequest request =
       InsertInterconnectRequest.newBuilder()
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = interconnectsClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertInterconnectRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, Interconnect interconnectResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, Interconnect interconnectResource)

Creates a Interconnect in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   Interconnect interconnectResource = Interconnect.newBuilder().build();
   Operation response = interconnectsClient.insertAsync(project, interconnectResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

interconnectResourceInterconnect

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertInterconnectRequest,Operation> insertCallable()

Creates a Interconnect in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   InsertInterconnectRequest request =
       InsertInterconnectRequest.newBuilder()
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = interconnectsClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertInterconnectRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertInterconnectRequest,Operation,Operation> insertOperationCallable()

Creates a Interconnect in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   InsertInterconnectRequest request =
       InsertInterconnectRequest.newBuilder()
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       interconnectsClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertInterconnectRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListInterconnectsRequest request)

public final InterconnectsClient.ListPagedResponse list(ListInterconnectsRequest request)

Retrieves the list of interconnect available to the specified project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   ListInterconnectsRequest request =
       ListInterconnectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   for (Interconnect element : interconnectsClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListInterconnectsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InterconnectsClient.ListPagedResponse

list(String project)

public final InterconnectsClient.ListPagedResponse list(String project)

Retrieves the list of interconnect available to the specified project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   for (Interconnect element : interconnectsClient.list(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
InterconnectsClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListInterconnectsRequest,InterconnectList> listCallable()

Retrieves the list of interconnect available to the specified project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   ListInterconnectsRequest request =
       ListInterconnectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     InterconnectList response = interconnectsClient.listCallable().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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInterconnectsRequest,InterconnectList>

listPagedCallable()

public final UnaryCallable<ListInterconnectsRequest,InterconnectsClient.ListPagedResponse> listPagedCallable()

Retrieves the list of interconnect available to the specified project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   ListInterconnectsRequest request =
       ListInterconnectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Interconnect> future = interconnectsClient.listPagedCallable().futureCall(request);
   // Do something.
   for (Interconnect element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInterconnectsRequest,ListPagedResponse>

patchAsync(PatchInterconnectRequest request)

public final OperationFuture<Operation,Operation> patchAsync(PatchInterconnectRequest request)

Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   PatchInterconnectRequest request =
       PatchInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = interconnectsClient.patchAsync(request).get();
 }
 
Parameter
NameDescription
requestPatchInterconnectRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchAsync(String project, String interconnect, Interconnect interconnectResource)

public final OperationFuture<Operation,Operation> patchAsync(String project, String interconnect, Interconnect interconnectResource)

Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   String project = "project-309310695";
   String interconnect = "interconnect-849140594";
   Interconnect interconnectResource = Interconnect.newBuilder().build();
   Operation response =
       interconnectsClient.patchAsync(project, interconnect, interconnectResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

interconnectString

Name of the interconnect to update.

interconnectResourceInterconnect

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchInterconnectRequest,Operation> patchCallable()

Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   PatchInterconnectRequest request =
       PatchInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = interconnectsClient.patchCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<PatchInterconnectRequest,Operation>

patchOperationCallable()

public final OperationCallable<PatchInterconnectRequest,Operation,Operation> patchOperationCallable()

Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (InterconnectsClient interconnectsClient = InterconnectsClient.create()) {
   PatchInterconnectRequest request =
       PatchInterconnectRequest.newBuilder()
           .setInterconnect("interconnect-849140594")
           .setInterconnectResource(Interconnect.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       interconnectsClient.patchOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<PatchInterconnectRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()