Class NetworksClient
- java.lang.Object
-
- com.google.cloud.compute.v1.NetworksClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class NetworksClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NetworksClient.ListFixedSizeCollection
static class
NetworksClient.ListPage
static class
NetworksClient.ListPagedResponse
static class
NetworksClient.ListPeeringRoutesFixedSizeCollection
static class
NetworksClient.ListPeeringRoutesPage
static class
NetworksClient.ListPeeringRoutesPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
NetworksClient(NetworksSettings settings)
Constructs an instance of NetworksClient, using the given settings.protected
NetworksClient(NetworksStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addPeeringAsync(AddPeeringNetworkRequest request)
Adds a peering to the specified network.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
Adds a peering to the specified network.com.google.api.gax.rpc.UnaryCallable<AddPeeringNetworkRequest,Operation>
addPeeringCallable()
Adds a peering to the specified network.com.google.api.gax.rpc.OperationCallable<AddPeeringNetworkRequest,Operation,Operation>
addPeeringOperationCallable()
Adds a peering to the specified network.boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static NetworksClient
create()
Constructs an instance of NetworksClient with default settings.static NetworksClient
create(NetworksSettings settings)
Constructs an instance of NetworksClient, using the given settings.static NetworksClient
create(NetworksStub stub)
Constructs an instance of NetworksClient, using the given stub for making calls.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
deleteAsync(DeleteNetworkRequest request)
Deletes the specified network.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
deleteAsync(String project, String network)
Deletes the specified network.com.google.api.gax.rpc.UnaryCallable<DeleteNetworkRequest,Operation>
deleteCallable()
Deletes the specified network.com.google.api.gax.rpc.OperationCallable<DeleteNetworkRequest,Operation,Operation>
deleteOperationCallable()
Deletes the specified network.Network
get(GetNetworkRequest request)
Returns the specified network.Network
get(String project, String network)
Returns the specified network.com.google.api.gax.rpc.UnaryCallable<GetNetworkRequest,Network>
getCallable()
Returns the specified network.NetworksGetEffectiveFirewallsResponse
getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)
Returns the effective firewalls on a given network.NetworksGetEffectiveFirewallsResponse
getEffectiveFirewalls(String project, String network)
Returns the effective firewalls on a given network.com.google.api.gax.rpc.UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse>
getEffectiveFirewallsCallable()
Returns the effective firewalls on a given network.NetworksSettings
getSettings()
NetworksStub
getStub()
com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
insertAsync(InsertNetworkRequest request)
Creates a network in the specified project using the data included in the request.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
insertAsync(String project, Network networkResource)
Creates a network in the specified project using the data included in the request.com.google.api.gax.rpc.UnaryCallable<InsertNetworkRequest,Operation>
insertCallable()
Creates a network in the specified project using the data included in the request.com.google.api.gax.rpc.OperationCallable<InsertNetworkRequest,Operation,Operation>
insertOperationCallable()
Creates a network in the specified project using the data included in the request.boolean
isShutdown()
boolean
isTerminated()
NetworksClient.ListPagedResponse
list(ListNetworksRequest request)
Retrieves the list of networks available to the specified project.NetworksClient.ListPagedResponse
list(String project)
Retrieves the list of networks available to the specified project.com.google.api.gax.rpc.UnaryCallable<ListNetworksRequest,NetworkList>
listCallable()
Retrieves the list of networks available to the specified project.com.google.api.gax.rpc.UnaryCallable<ListNetworksRequest,NetworksClient.ListPagedResponse>
listPagedCallable()
Retrieves the list of networks available to the specified project.NetworksClient.ListPeeringRoutesPagedResponse
listPeeringRoutes(ListPeeringRoutesNetworksRequest request)
Lists the peering routes exchanged over peering connection.NetworksClient.ListPeeringRoutesPagedResponse
listPeeringRoutes(String project, String network)
Lists the peering routes exchanged over peering connection.com.google.api.gax.rpc.UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList>
listPeeringRoutesCallable()
Lists the peering routes exchanged over peering connection.com.google.api.gax.rpc.UnaryCallable<ListPeeringRoutesNetworksRequest,NetworksClient.ListPeeringRoutesPagedResponse>
listPeeringRoutesPagedCallable()
Lists the peering routes exchanged over peering connection.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
patchAsync(PatchNetworkRequest request)
Patches the specified network with the data included in the request.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
patchAsync(String project, String network, Network networkResource)
Patches the specified network with the data included in the request.com.google.api.gax.rpc.UnaryCallable<PatchNetworkRequest,Operation>
patchCallable()
Patches the specified network with the data included in the request.com.google.api.gax.rpc.OperationCallable<PatchNetworkRequest,Operation,Operation>
patchOperationCallable()
Patches the specified network with the data included in the request.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removePeeringAsync(RemovePeeringNetworkRequest request)
Removes a peering from the specified network.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Removes a peering from the specified network.com.google.api.gax.rpc.UnaryCallable<RemovePeeringNetworkRequest,Operation>
removePeeringCallable()
Removes a peering from the specified network.com.google.api.gax.rpc.OperationCallable<RemovePeeringNetworkRequest,Operation,Operation>
removePeeringOperationCallable()
Removes a peering from the specified network.void
shutdown()
void
shutdownNow()
com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)
Switches the network mode from auto subnet mode to custom subnet mode.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
switchToCustomModeAsync(String project, String network)
Switches the network mode from auto subnet mode to custom subnet mode.com.google.api.gax.rpc.UnaryCallable<SwitchToCustomModeNetworkRequest,Operation>
switchToCustomModeCallable()
Switches the network mode from auto subnet mode to custom subnet mode.com.google.api.gax.rpc.OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation>
switchToCustomModeOperationCallable()
Switches the network mode from auto subnet mode to custom subnet mode.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
updatePeeringAsync(UpdatePeeringNetworkRequest request)
Updates the specified network peering with the data included in the request.com.google.api.gax.longrunning.OperationFuture<Operation,Operation>
updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)
Updates the specified network peering with the data included in the request.com.google.api.gax.rpc.UnaryCallable<UpdatePeeringNetworkRequest,Operation>
updatePeeringCallable()
Updates the specified network peering with the data included in the request.com.google.api.gax.rpc.OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation>
updatePeeringOperationCallable()
Updates the specified network peering with the data included in the request.
-
-
-
Constructor Detail
-
NetworksClient
protected NetworksClient(NetworksSettings settings) throws IOException
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.- Throws:
IOException
-
NetworksClient
protected NetworksClient(NetworksStub stub)
-
-
Method Detail
-
create
public static final NetworksClient create() throws IOException
Constructs an instance of NetworksClient with default settings.- Throws:
IOException
-
create
public static final NetworksClient create(NetworksSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final NetworksSettings getSettings()
-
getStub
public NetworksStub getStub()
-
addPeeringAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network resource to add peering to.networksAddPeeringRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addPeeringAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addPeeringOperationCallable
public final com.google.api.gax.rpc.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(); }
-
addPeeringCallable
public final com.google.api.gax.rpc.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(); }
-
deleteAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network to delete.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteOperationCallable
public final com.google.api.gax.rpc.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(); }
-
deleteCallable
public final com.google.api.gax.rpc.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(); }
-
get
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:
project
- Project ID for this request.network
- Name of the network to return.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
get
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCallable
public final com.google.api.gax.rpc.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(); }
-
getEffectiveFirewalls
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:
project
- Project ID for this request.network
- Name of the network for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEffectiveFirewalls
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEffectiveFirewallsCallable
public final com.google.api.gax.rpc.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(); }
-
insertAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.networkResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertOperationCallable
public final com.google.api.gax.rpc.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(); }
-
insertCallable
public final com.google.api.gax.rpc.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(); }
-
list
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); } }
- Parameters:
project
- Project ID for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
list
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listCallable
public final com.google.api.gax.rpc.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; } } }
-
listPeeringRoutes
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:
project
- Project ID for this request.network
- Name of the network for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPeeringRoutes
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPeeringRoutesPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listPeeringRoutesCallable
public final com.google.api.gax.rpc.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; } } }
-
patchAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network to update.networkResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
patchAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
patchOperationCallable
public final com.google.api.gax.rpc.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(); }
-
patchCallable
public final com.google.api.gax.rpc.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(); }
-
removePeeringAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network resource to remove peering from.networksRemovePeeringRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removePeeringAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removePeeringOperationCallable
public final com.google.api.gax.rpc.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(); }
-
removePeeringCallable
public final com.google.api.gax.rpc.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(); }
-
switchToCustomModeAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
switchToCustomModeAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
switchToCustomModeOperationCallable
public final com.google.api.gax.rpc.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(); }
-
switchToCustomModeCallable
public final com.google.api.gax.rpc.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(); }
-
updatePeeringAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.network
- Name of the network resource which the updated peering is belonging to.networksUpdatePeeringRequestResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updatePeeringAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updatePeeringOperationCallable
public final com.google.api.gax.rpc.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(); }
-
updatePeeringCallable
public final com.google.api.gax.rpc.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-