Class NetworksClient (1.51.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
MethodDescriptionMethod 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 the following fields can be modified: routingConfig.routingMode.

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
TypeDescription
NetworksClient
Exceptions
TypeDescription
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
NameDescription
settingsNetworksSettings
Returns
TypeDescription
NetworksClient
Exceptions
TypeDescription
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
NameDescription
stubNetworksStub
Returns
TypeDescription
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
NameDescription
settingsNetworksSettings

NetworksClient(NetworksStub stub)

protected NetworksClient(NetworksStub stub)
Parameter
NameDescription
stubNetworksStub

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
NameDescription
requestAddPeeringNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network resource to add peering to.

networksAddPeeringRequestResourceNetworksAddPeeringRequest

The body resource for this request

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationCallable<AddPeeringNetworkRequest,Operation,Operation>

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(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
NameDescription
requestDeleteNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network to delete.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestGetNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network to return.

Returns
TypeDescription
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
TypeDescription
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
NameDescription
requestGetEffectiveFirewallsNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network for this request.

Returns
TypeDescription
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
TypeDescription
UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse>

getSettings()

public final NetworksSettings getSettings()
Returns
TypeDescription
NetworksSettings

getStub()

public NetworksStub getStub()
Returns
TypeDescription
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
NameDescription
requestInsertNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkResourceNetwork

The body resource for this request

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationCallable<InsertNetworkRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
requestListNetworksRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestListPeeringRoutesNetworksRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network for this request.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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 the following fields can be modified: routingConfig.routingMode.

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
NameDescription
requestPatchNetworkRequest

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

Returns
TypeDescription
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 the following fields can be modified: routingConfig.routingMode.

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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network to update.

networkResourceNetwork

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchNetworkRequest,Operation> patchCallable()

Patches the specified network with the data included in the request. Only the following fields can be modified: routingConfig.routingMode.

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
TypeDescription
UnaryCallable<PatchNetworkRequest,Operation>

patchOperationCallable()

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

Patches the specified network with the data included in the request. Only the following fields can be modified: routingConfig.routingMode.

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
TypeDescription
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
NameDescription
requestRemovePeeringNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network resource to remove peering from.

networksRemovePeeringRequestResourceNetworksRemovePeeringRequest

The body resource for this request

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestSwitchToCustomModeNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

Name of the network to be updated.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestUpdatePeeringNetworkRequest

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

Returns
TypeDescription
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
NameDescription
projectString

Project ID for this request.

networkString

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

networksUpdatePeeringRequestResourceNetworksUpdatePeeringRequest

The body resource for this request

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation>