Class NetworksClient (1.64.0)

GitHub RepositoryProduct Reference

Service Description: The Networks 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 and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   Network response = networksClient.get(project, network);
 }
 

Note: close() needs to be called on the NetworksClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

AddPeering

Adds a peering to the specified network.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • addPeeringAsync(AddPeeringNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • addPeeringOperationCallable()

  • addPeeringCallable()

Delete

Deletes the specified network.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAsync(DeleteNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteAsync(String project, String network)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOperationCallable()

  • deleteCallable()

Get

Returns the specified network.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetNetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String network)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

GetEffectiveFirewalls

Returns the effective firewalls on a given network.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getEffectiveFirewalls(String project, String network)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getEffectiveFirewallsCallable()

Insert

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

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • insertAsync(InsertNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • insertAsync(String project, Network networkResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertOperationCallable()

  • insertCallable()

List

Retrieves the list of networks available to the specified project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • list(ListNetworksRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • list(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPagedCallable()

  • listCallable()

ListPeeringRoutes

Lists the peering routes exchanged over peering connection.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listPeeringRoutes(ListPeeringRoutesNetworksRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listPeeringRoutes(String project, String network)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPeeringRoutesPagedCallable()

  • listPeeringRoutesCallable()

Patch

Patches the specified network with the data included in the request. Only routingConfig can be modified.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • patchAsync(PatchNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • patchAsync(String project, String network, Network networkResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • patchOperationCallable()

  • patchCallable()

RemovePeering

Removes a peering from the specified network.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removePeeringAsync(RemovePeeringNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removePeeringOperationCallable()

  • removePeeringCallable()

SwitchToCustomMode

Switches the network mode from auto subnet mode to custom subnet mode.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • switchToCustomModeAsync(String project, String network)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • switchToCustomModeOperationCallable()

  • switchToCustomModeCallable()

UpdatePeering

Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updatePeeringAsync(UpdatePeeringNetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updatePeeringOperationCallable()

  • updatePeeringCallable()

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

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 NetworksSettings networksSettings =
     NetworksSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 NetworksClient networksClient = NetworksClient.create(networksSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 NetworksSettings networksSettings =
     NetworksSettings.newBuilder().setEndpoint(myEndpoint).build();
 NetworksClient networksClient = NetworksClient.create(networksSettings);
 

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

Inheritance

java.lang.Object > NetworksClient

Static Methods

create()

public static final NetworksClient create()

Constructs an instance of NetworksClient with default settings.

Returns
Type Description
NetworksClient
Exceptions
Type Description
IOException

create(NetworksSettings settings)

public static final NetworksClient create(NetworksSettings settings)

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

Parameter
Name Description
settings NetworksSettings
Returns
Type Description
NetworksClient
Exceptions
Type Description
IOException

create(NetworksStub stub)

public static final NetworksClient create(NetworksStub stub)

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

Parameter
Name Description
stub NetworksStub
Returns
Type Description
NetworksClient

Constructors

NetworksClient(NetworksSettings settings)

protected NetworksClient(NetworksSettings settings)

Constructs an instance of NetworksClient, 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
Name Description
settings NetworksSettings

NetworksClient(NetworksStub stub)

protected NetworksClient(NetworksStub stub)
Parameter
Name Description
stub NetworksStub

Methods

addPeeringAsync(AddPeeringNetworkRequest request)

public final OperationFuture<Operation,Operation> addPeeringAsync(AddPeeringNetworkRequest request)

Adds a peering to the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   AddPeeringNetworkRequest request =
       AddPeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.addPeeringAsync(request).get();
 }
 
Parameter
Name Description
request AddPeeringNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)

public final OperationFuture<Operation,Operation> addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)

Adds a peering to the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   NetworksAddPeeringRequest networksAddPeeringRequestResource =
       NetworksAddPeeringRequest.newBuilder().build();
   Operation response =
       networksClient.addPeeringAsync(project, network, networksAddPeeringRequestResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network resource to add peering to.

networksAddPeeringRequestResource NetworksAddPeeringRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

addPeeringCallable()

public final UnaryCallable<AddPeeringNetworkRequest,Operation> addPeeringCallable()

Adds a peering to the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   AddPeeringNetworkRequest request =
       AddPeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.addPeeringCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<AddPeeringNetworkRequest,Operation>

addPeeringOperationCallable()

public final OperationCallable<AddPeeringNetworkRequest,Operation,Operation> addPeeringOperationCallable()

Adds a peering to the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   AddPeeringNetworkRequest request =
       AddPeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.addPeeringOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<AddPeeringNetworkRequest,Operation,Operation>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

deleteAsync(DeleteNetworkRequest request)

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

Deletes the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   DeleteNetworkRequest request =
       DeleteNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.deleteAsync(request).get();
 }
 
Parameter
Name Description
request DeleteNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

deleteAsync(String project, String network)

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

Deletes the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   Operation response = networksClient.deleteAsync(project, network).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network to delete.

Returns
Type Description
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteNetworkRequest,Operation> deleteCallable()

Deletes the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   DeleteNetworkRequest request =
       DeleteNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteNetworkRequest,Operation>

deleteOperationCallable()

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

Deletes the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   DeleteNetworkRequest request =
       DeleteNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteNetworkRequest,Operation,Operation>

get(GetNetworkRequest request)

public final Network get(GetNetworkRequest request)

Returns the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   GetNetworkRequest request =
       GetNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .build();
   Network response = networksClient.get(request);
 }
 
Parameter
Name Description
request GetNetworkRequest

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

Returns
Type Description
Network

get(String project, String network)

public final Network get(String project, String network)

Returns the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   Network response = networksClient.get(project, network);
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network to return.

Returns
Type Description
Network

getCallable()

public final UnaryCallable<GetNetworkRequest,Network> getCallable()

Returns the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   GetNetworkRequest request =
       GetNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .build();
   ApiFuture<Network> future = networksClient.getCallable().futureCall(request);
   // Do something.
   Network response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetNetworkRequest,Network>

getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)

public final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)

Returns the effective firewalls on a given network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   GetEffectiveFirewallsNetworkRequest request =
       GetEffectiveFirewallsNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .build();
   NetworksGetEffectiveFirewallsResponse response =
       networksClient.getEffectiveFirewalls(request);
 }
 
Parameter
Name Description
request GetEffectiveFirewallsNetworkRequest

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

Returns
Type Description
NetworksGetEffectiveFirewallsResponse

getEffectiveFirewalls(String project, String network)

public final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(String project, String network)

Returns the effective firewalls on a given network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   NetworksGetEffectiveFirewallsResponse response =
       networksClient.getEffectiveFirewalls(project, network);
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network for this request.

Returns
Type Description
NetworksGetEffectiveFirewallsResponse

getEffectiveFirewallsCallable()

public final UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()

Returns the effective firewalls on a given network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   GetEffectiveFirewallsNetworkRequest request =
       GetEffectiveFirewallsNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .build();
   ApiFuture<NetworksGetEffectiveFirewallsResponse> future =
       networksClient.getEffectiveFirewallsCallable().futureCall(request);
   // Do something.
   NetworksGetEffectiveFirewallsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse>

getSettings()

public final NetworksSettings getSettings()
Returns
Type Description
NetworksSettings

getStub()

public NetworksStub getStub()
Returns
Type Description
NetworksStub

insertAsync(InsertNetworkRequest request)

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

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

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   InsertNetworkRequest request =
       InsertNetworkRequest.newBuilder()
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.insertAsync(request).get();
 }
 
Parameter
Name Description
request InsertNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

insertAsync(String project, Network networkResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, Network networkResource)

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

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   Network networkResource = Network.newBuilder().build();
   Operation response = networksClient.insertAsync(project, networkResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

networkResource Network

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertNetworkRequest,Operation> insertCallable()

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

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   InsertNetworkRequest request =
       InsertNetworkRequest.newBuilder()
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertNetworkRequest,Operation>

insertOperationCallable()

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

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

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   InsertNetworkRequest request =
       InsertNetworkRequest.newBuilder()
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<InsertNetworkRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

list(ListNetworksRequest request)

public final NetworksClient.ListPagedResponse list(ListNetworksRequest request)

Retrieves the list of networks available to the specified project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListNetworksRequest request =
       ListNetworksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   for (Network element : networksClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListNetworksRequest

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

Returns
Type Description
NetworksClient.ListPagedResponse

list(String project)

public final NetworksClient.ListPagedResponse list(String project)

Retrieves the list of networks available to the specified project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   for (Network element : networksClient.list(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
project String

Project ID for this request.

Returns
Type Description
NetworksClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListNetworksRequest,NetworkList> listCallable()

Retrieves the list of networks available to the specified project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListNetworksRequest request =
       ListNetworksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     NetworkList response = networksClient.listCallable().call(request);
     for (Network element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListNetworksRequest,NetworkList>

listPagedCallable()

public final UnaryCallable<ListNetworksRequest,NetworksClient.ListPagedResponse> listPagedCallable()

Retrieves the list of networks available to the specified project.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListNetworksRequest request =
       ListNetworksRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Network> future = networksClient.listPagedCallable().futureCall(request);
   // Do something.
   for (Network element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListNetworksRequest,ListPagedResponse>

listPeeringRoutes(ListPeeringRoutesNetworksRequest request)

public final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(ListPeeringRoutesNetworksRequest request)

Lists the peering routes exchanged over peering connection.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListPeeringRoutesNetworksRequest request =
       ListPeeringRoutesNetworksRequest.newBuilder()
           .setDirection("direction-962590849")
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setNetwork("network1843485230")
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setPeeringName("peeringName-1170120213")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   for (ExchangedPeeringRoute element : networksClient.listPeeringRoutes(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListPeeringRoutesNetworksRequest

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

Returns
Type Description
NetworksClient.ListPeeringRoutesPagedResponse

listPeeringRoutes(String project, String network)

public final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(String project, String network)

Lists the peering routes exchanged over peering connection.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   for (ExchangedPeeringRoute element :
       networksClient.listPeeringRoutes(project, network).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network for this request.

Returns
Type Description
NetworksClient.ListPeeringRoutesPagedResponse

listPeeringRoutesCallable()

public final UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList> listPeeringRoutesCallable()

Lists the peering routes exchanged over peering connection.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListPeeringRoutesNetworksRequest request =
       ListPeeringRoutesNetworksRequest.newBuilder()
           .setDirection("direction-962590849")
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setNetwork("network1843485230")
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setPeeringName("peeringName-1170120213")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     ExchangedPeeringRoutesList response =
         networksClient.listPeeringRoutesCallable().call(request);
     for (ExchangedPeeringRoute element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList>

listPeeringRoutesPagedCallable()

public final UnaryCallable<ListPeeringRoutesNetworksRequest,NetworksClient.ListPeeringRoutesPagedResponse> listPeeringRoutesPagedCallable()

Lists the peering routes exchanged over peering connection.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   ListPeeringRoutesNetworksRequest request =
       ListPeeringRoutesNetworksRequest.newBuilder()
           .setDirection("direction-962590849")
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setNetwork("network1843485230")
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setPeeringName("peeringName-1170120213")
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<ExchangedPeeringRoute> future =
       networksClient.listPeeringRoutesPagedCallable().futureCall(request);
   // Do something.
   for (ExchangedPeeringRoute element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListPeeringRoutesNetworksRequest,ListPeeringRoutesPagedResponse>

patchAsync(PatchNetworkRequest request)

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

Patches the specified network with the data included in the request. Only routingConfig can be modified.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   PatchNetworkRequest request =
       PatchNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.patchAsync(request).get();
 }
 
Parameter
Name Description
request PatchNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

patchAsync(String project, String network, Network networkResource)

public final OperationFuture<Operation,Operation> patchAsync(String project, String network, Network networkResource)

Patches the specified network with the data included in the request. Only routingConfig can be modified.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   Network networkResource = Network.newBuilder().build();
   Operation response = networksClient.patchAsync(project, network, networkResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network to update.

networkResource Network

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchNetworkRequest,Operation> patchCallable()

Patches the specified network with the data included in the request. Only routingConfig can be modified.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   PatchNetworkRequest request =
       PatchNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.patchCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<PatchNetworkRequest,Operation>

patchOperationCallable()

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

Patches the specified network with the data included in the request. Only routingConfig can be modified.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   PatchNetworkRequest request =
       PatchNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworkResource(Network.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.patchOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<PatchNetworkRequest,Operation,Operation>

removePeeringAsync(RemovePeeringNetworkRequest request)

public final OperationFuture<Operation,Operation> removePeeringAsync(RemovePeeringNetworkRequest request)

Removes a peering from the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   RemovePeeringNetworkRequest request =
       RemovePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksRemovePeeringRequestResource(
               NetworksRemovePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.removePeeringAsync(request).get();
 }
 
Parameter
Name Description
request RemovePeeringNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)

public final OperationFuture<Operation,Operation> removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)

Removes a peering from the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   NetworksRemovePeeringRequest networksRemovePeeringRequestResource =
       NetworksRemovePeeringRequest.newBuilder().build();
   Operation response =
       networksClient
           .removePeeringAsync(project, network, networksRemovePeeringRequestResource)
           .get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network resource to remove peering from.

networksRemovePeeringRequestResource NetworksRemovePeeringRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

removePeeringCallable()

public final UnaryCallable<RemovePeeringNetworkRequest,Operation> removePeeringCallable()

Removes a peering from the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   RemovePeeringNetworkRequest request =
       RemovePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksRemovePeeringRequestResource(
               NetworksRemovePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.removePeeringCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RemovePeeringNetworkRequest,Operation>

removePeeringOperationCallable()

public final OperationCallable<RemovePeeringNetworkRequest,Operation,Operation> removePeeringOperationCallable()

Removes a peering from the specified network.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   RemovePeeringNetworkRequest request =
       RemovePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksRemovePeeringRequestResource(
               NetworksRemovePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.removePeeringOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<RemovePeeringNetworkRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)

public final OperationFuture<Operation,Operation> switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)

Switches the network mode from auto subnet mode to custom subnet mode.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   SwitchToCustomModeNetworkRequest request =
       SwitchToCustomModeNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.switchToCustomModeAsync(request).get();
 }
 
Parameter
Name Description
request SwitchToCustomModeNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

switchToCustomModeAsync(String project, String network)

public final OperationFuture<Operation,Operation> switchToCustomModeAsync(String project, String network)

Switches the network mode from auto subnet mode to custom subnet mode.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   Operation response = networksClient.switchToCustomModeAsync(project, network).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network to be updated.

Returns
Type Description
OperationFuture<Operation,Operation>

switchToCustomModeCallable()

public final UnaryCallable<SwitchToCustomModeNetworkRequest,Operation> switchToCustomModeCallable()

Switches the network mode from auto subnet mode to custom subnet mode.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   SwitchToCustomModeNetworkRequest request =
       SwitchToCustomModeNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.switchToCustomModeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<SwitchToCustomModeNetworkRequest,Operation>

switchToCustomModeOperationCallable()

public final OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation> switchToCustomModeOperationCallable()

Switches the network mode from auto subnet mode to custom subnet mode.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   SwitchToCustomModeNetworkRequest request =
       SwitchToCustomModeNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.switchToCustomModeOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation>

updatePeeringAsync(UpdatePeeringNetworkRequest request)

public final OperationFuture<Operation,Operation> updatePeeringAsync(UpdatePeeringNetworkRequest request)

Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   UpdatePeeringNetworkRequest request =
       UpdatePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksUpdatePeeringRequestResource(
               NetworksUpdatePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = networksClient.updatePeeringAsync(request).get();
 }
 
Parameter
Name Description
request UpdatePeeringNetworkRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)

public final OperationFuture<Operation,Operation> updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)

Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   String project = "project-309310695";
   String network = "network1843485230";
   NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource =
       NetworksUpdatePeeringRequest.newBuilder().build();
   Operation response =
       networksClient
           .updatePeeringAsync(project, network, networksUpdatePeeringRequestResource)
           .get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

network String

Name of the network resource which the updated peering is belonging to.

networksUpdatePeeringRequestResource NetworksUpdatePeeringRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

updatePeeringCallable()

public final UnaryCallable<UpdatePeeringNetworkRequest,Operation> updatePeeringCallable()

Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   UpdatePeeringNetworkRequest request =
       UpdatePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksUpdatePeeringRequestResource(
               NetworksUpdatePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = networksClient.updatePeeringCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdatePeeringNetworkRequest,Operation>

updatePeeringOperationCallable()

public final OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation> updatePeeringOperationCallable()

Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (NetworksClient networksClient = NetworksClient.create()) {
   UpdatePeeringNetworkRequest request =
       UpdatePeeringNetworkRequest.newBuilder()
           .setNetwork("network1843485230")
           .setNetworksUpdatePeeringRequestResource(
               NetworksUpdatePeeringRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       networksClient.updatePeeringOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation>