@Generated(value="by gapic-generator-java") public class NetworksClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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().
| Method | Description | Method Variants |
|---|---|---|
AddPeering |
Adds a peering to the specified network. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Delete |
Deletes the specified network. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified network. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return 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.
| Modifier and Type | Class and 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 |
| Modifier | Constructor and Description |
|---|---|
protected |
NetworksClient(NetworksSettings settings)
Constructs an instance of NetworksClient, using the given settings.
|
protected |
NetworksClient(NetworksStub stub) |
| Modifier and Type | Method and 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(String project,
String network)
Switches the network mode from auto subnet mode to custom subnet mode.
|
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.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(String project,
String network,
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)
Updates the specified network peering with the data included in the request.
|
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.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.
|
protected NetworksClient(NetworksSettings settings) throws IOException
IOExceptionprotected NetworksClient(NetworksStub stub)
public static final NetworksClient create() throws IOException
IOExceptionpublic static final NetworksClient create(NetworksSettings settings) throws IOException
IOExceptionpublic static final NetworksClient create(NetworksStub stub)
public final NetworksSettings getSettings()
public NetworksStub getStub()
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
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();
}
project - Project ID for this request.network - Name of the network resource to add peering to.networksAddPeeringRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> addPeeringAsync(AddPeeringNetworkRequest 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()) {
AddPeeringNetworkRequest request =
AddPeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.addPeeringAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<AddPeeringNetworkRequest,Operation,Operation> addPeeringOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<AddPeeringNetworkRequest,Operation> addPeeringCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String 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();
}
project - Project ID for this request.network - Name of the network to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteNetworkRequest 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()) {
DeleteNetworkRequest request =
DeleteNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.deleteAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteNetworkRequest,Operation,Operation> deleteOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteNetworkRequest,Operation> deleteCallable()
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();
}
public final Network get(String project, String 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);
}
project - Project ID for this request.network - Name of the network to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Network get(GetNetworkRequest 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()) {
GetNetworkRequest request =
GetNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.build();
Network response = networksClient.get(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNetworkRequest,Network> getCallable()
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();
}
public final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(String project, String 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);
}
project - Project ID for this request.network - Name of the network for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest 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()) {
GetEffectiveFirewallsNetworkRequest request =
GetEffectiveFirewallsNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.build();
NetworksGetEffectiveFirewallsResponse response =
networksClient.getEffectiveFirewalls(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, Network networkResource)
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();
}
project - Project ID for this request.networkResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertNetworkRequest 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<InsertNetworkRequest,Operation,Operation> insertOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertNetworkRequest,Operation> insertCallable()
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();
}
public final NetworksClient.ListPagedResponse list(String 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);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NetworksClient.ListPagedResponse list(ListNetworksRequest 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()) {
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListNetworksRequest,NetworksClient.ListPagedResponse> listPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListNetworksRequest,NetworkList> listCallable()
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;
}
}
}
public final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(String project, String 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";
for (ExchangedPeeringRoute element :
networksClient.listPeeringRoutes(project, network).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.network - Name of the network for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(ListPeeringRoutesNetworksRequest 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()) {
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPeeringRoutesNetworksRequest,NetworksClient.ListPeeringRoutesPagedResponse> listPeeringRoutesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList> listPeeringRoutesCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(String project, String network, Network networkResource)
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();
}
project - Project ID for this request.network - Name of the network to update.networkResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(PatchNetworkRequest 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()) {
PatchNetworkRequest request =
PatchNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworkResource(Network.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.patchAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<PatchNetworkRequest,Operation,Operation> patchOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<PatchNetworkRequest,Operation> patchCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
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();
}
project - Project ID for this request.network - Name of the network resource to remove peering from.networksRemovePeeringRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> removePeeringAsync(RemovePeeringNetworkRequest 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()) {
RemovePeeringNetworkRequest request =
RemovePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksRemovePeeringRequestResource(
NetworksRemovePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.removePeeringAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RemovePeeringNetworkRequest,Operation,Operation> removePeeringOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<RemovePeeringNetworkRequest,Operation> removePeeringCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> switchToCustomModeAsync(String project, String 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.switchToCustomModeAsync(project, network).get();
}
project - Project ID for this request.network - Name of the network to be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> switchToCustomModeAsync(SwitchToCustomModeNetworkRequest 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()) {
SwitchToCustomModeNetworkRequest request =
SwitchToCustomModeNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.switchToCustomModeAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation> switchToCustomModeOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<SwitchToCustomModeNetworkRequest,Operation> switchToCustomModeCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)
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();
}
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 requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> updatePeeringAsync(UpdatePeeringNetworkRequest 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()) {
UpdatePeeringNetworkRequest request =
UpdatePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksUpdatePeeringRequestResource(
NetworksUpdatePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.updatePeeringAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation> updatePeeringOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdatePeeringNetworkRequest,Operation> updatePeeringCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.