- 1.63.0 (latest)
- 1.62.0
- 1.61.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.9.1
- 1.8.1
- 1.7.2
- 1.6.0-beta
public class NetworksClient implements 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.
Implements
BackgroundResourceStatic Methods
create()
public static final NetworksClient create()
Constructs an instance of NetworksClient with default settings.
Type | Description |
NetworksClient |
Type | Description |
IOException |
create(NetworksSettings settings)
public static final NetworksClient create(NetworksSettings settings)
Constructs an instance of NetworksClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | NetworksSettings |
Type | Description |
NetworksClient |
Type | Description |
IOException |
create(NetworksStub stub)
public static final NetworksClient create(NetworksStub stub)
Constructs an instance of NetworksClient, using the given stub for making calls. This is for advanced usage - prefer using create(NetworksSettings).
Name | Description |
stub | NetworksStub |
Type | Description |
NetworksClient |
Constructors
NetworksClient(NetworksSettings settings)
protected NetworksClient(NetworksSettings settings)
Constructs an instance of NetworksClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | NetworksSettings |
NetworksClient(NetworksStub stub)
protected NetworksClient(NetworksStub stub)
Name | Description |
stub | NetworksStub |
Methods
addPeeringAsync(AddPeeringNetworkRequest request)
public final OperationFuture<Operation,Operation> addPeeringAsync(AddPeeringNetworkRequest request)
Adds a peering to the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
AddPeeringNetworkRequest request =
AddPeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.addPeeringAsync(request).get();
}
Name | Description |
request | AddPeeringNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
public final OperationFuture<Operation,Operation> addPeeringAsync(String project, String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
Adds a peering to the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
NetworksAddPeeringRequest networksAddPeeringRequestResource =
NetworksAddPeeringRequest.newBuilder().build();
Operation response =
networksClient.addPeeringAsync(project, network, networksAddPeeringRequestResource).get();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network resource to add peering to. |
networksAddPeeringRequestResource | NetworksAddPeeringRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
addPeeringCallable()
public final UnaryCallable<AddPeeringNetworkRequest,Operation> addPeeringCallable()
Adds a peering to the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
AddPeeringNetworkRequest request =
AddPeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.addPeeringCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<AddPeeringNetworkRequest,Operation> |
addPeeringOperationCallable()
public final OperationCallable<AddPeeringNetworkRequest,Operation,Operation> addPeeringOperationCallable()
Adds a peering to the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
AddPeeringNetworkRequest request =
AddPeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksAddPeeringRequestResource(NetworksAddPeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.addPeeringOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<AddPeeringNetworkRequest,Operation,Operation> |
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
deleteAsync(DeleteNetworkRequest request)
public final OperationFuture<Operation,Operation> deleteAsync(DeleteNetworkRequest request)
Deletes the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
DeleteNetworkRequest request =
DeleteNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.deleteAsync(request).get();
}
Name | Description |
request | DeleteNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteAsync(String project, String network)
public final OperationFuture<Operation,Operation> deleteAsync(String project, String network)
Deletes the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
Operation response = networksClient.deleteAsync(project, network).get();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network to delete. |
Type | Description |
OperationFuture<Operation,Operation> |
deleteCallable()
public final UnaryCallable<DeleteNetworkRequest,Operation> deleteCallable()
Deletes the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
DeleteNetworkRequest request =
DeleteNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DeleteNetworkRequest,Operation> |
deleteOperationCallable()
public final OperationCallable<DeleteNetworkRequest,Operation,Operation> deleteOperationCallable()
Deletes the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
DeleteNetworkRequest request =
DeleteNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<DeleteNetworkRequest,Operation,Operation> |
get(GetNetworkRequest request)
public final Network get(GetNetworkRequest request)
Returns the specified network. Gets a list of available networks by making a list() 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);
}
Name | Description |
request | GetNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
Network |
get(String project, String network)
public final Network get(String project, String network)
Returns the specified network. Gets a list of available networks by making a list() 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";
String network = "network1843485230";
Network response = networksClient.get(project, network);
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network to return. |
Type | Description |
Network |
getCallable()
public final UnaryCallable<GetNetworkRequest,Network> getCallable()
Returns the specified network. Gets a list of available networks by making a list() 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();
ApiFuture<Network> future = networksClient.getCallable().futureCall(request);
// Do something.
Network response = future.get();
}
Type | Description |
UnaryCallable<GetNetworkRequest,Network> |
getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)
public final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest request)
Returns the effective firewalls on a given network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
GetEffectiveFirewallsNetworkRequest request =
GetEffectiveFirewallsNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.build();
NetworksGetEffectiveFirewallsResponse response =
networksClient.getEffectiveFirewalls(request);
}
Name | Description |
request | GetEffectiveFirewallsNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
NetworksGetEffectiveFirewallsResponse |
getEffectiveFirewalls(String project, String network)
public final NetworksGetEffectiveFirewallsResponse getEffectiveFirewalls(String project, String network)
Returns the effective firewalls on a given network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
NetworksGetEffectiveFirewallsResponse response =
networksClient.getEffectiveFirewalls(project, network);
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network for this request. |
Type | Description |
NetworksGetEffectiveFirewallsResponse |
getEffectiveFirewallsCallable()
public final UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()
Returns the effective firewalls on a given network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
GetEffectiveFirewallsNetworkRequest request =
GetEffectiveFirewallsNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.build();
ApiFuture<NetworksGetEffectiveFirewallsResponse> future =
networksClient.getEffectiveFirewallsCallable().futureCall(request);
// Do something.
NetworksGetEffectiveFirewallsResponse response = future.get();
}
Type | Description |
UnaryCallable<GetEffectiveFirewallsNetworkRequest,NetworksGetEffectiveFirewallsResponse> |
getSettings()
public final NetworksSettings getSettings()
Type | Description |
NetworksSettings |
getStub()
public NetworksStub getStub()
Type | Description |
NetworksStub |
insertAsync(InsertNetworkRequest request)
public final OperationFuture<Operation,Operation> insertAsync(InsertNetworkRequest request)
Creates a network in the specified project using the data included in the request.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
InsertNetworkRequest request =
InsertNetworkRequest.newBuilder()
.setNetworkResource(Network.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.insertAsync(request).get();
}
Name | Description |
request | InsertNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
insertAsync(String project, Network networkResource)
public final OperationFuture<Operation,Operation> insertAsync(String project, Network networkResource)
Creates a network in the specified project using the data included in the request.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
Network networkResource = Network.newBuilder().build();
Operation response = networksClient.insertAsync(project, networkResource).get();
}
Name | Description |
project | String Project ID for this request. |
networkResource | Network The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
insertCallable()
public final UnaryCallable<InsertNetworkRequest,Operation> insertCallable()
Creates a network in the specified project using the data included in the request.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
InsertNetworkRequest request =
InsertNetworkRequest.newBuilder()
.setNetworkResource(Network.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<InsertNetworkRequest,Operation> |
insertOperationCallable()
public final OperationCallable<InsertNetworkRequest,Operation,Operation> insertOperationCallable()
Creates a network in the specified project using the data included in the request.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
InsertNetworkRequest request =
InsertNetworkRequest.newBuilder()
.setNetworkResource(Network.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<InsertNetworkRequest,Operation,Operation> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
list(ListNetworksRequest request)
public final NetworksClient.ListPagedResponse list(ListNetworksRequest request)
Retrieves the list of networks available to the specified project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListNetworksRequest request =
ListNetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
for (Network element : networksClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListNetworksRequest The request object containing all of the parameters for the API call. |
Type | Description |
NetworksClient.ListPagedResponse |
list(String project)
public final NetworksClient.ListPagedResponse list(String project)
Retrieves the list of networks available to the specified project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
for (Network element : networksClient.list(project).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
project | String Project ID for this request. |
Type | Description |
NetworksClient.ListPagedResponse |
listCallable()
public final UnaryCallable<ListNetworksRequest,NetworkList> listCallable()
Retrieves the list of networks available to the specified project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListNetworksRequest request =
ListNetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
while (true) {
NetworkList response = networksClient.listCallable().call(request);
for (Network element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListNetworksRequest,NetworkList> |
listPagedCallable()
public final UnaryCallable<ListNetworksRequest,NetworksClient.ListPagedResponse> listPagedCallable()
Retrieves the list of networks available to the specified project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListNetworksRequest request =
ListNetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
ApiFuture<Network> future = networksClient.listPagedCallable().futureCall(request);
// Do something.
for (Network element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListNetworksRequest,ListPagedResponse> |
listPeeringRoutes(ListPeeringRoutesNetworksRequest request)
public final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(ListPeeringRoutesNetworksRequest request)
Lists the peering routes exchanged over peering connection.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListPeeringRoutesNetworksRequest request =
ListPeeringRoutesNetworksRequest.newBuilder()
.setDirection("direction-962590849")
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setNetwork("network1843485230")
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setPeeringName("peeringName-1170120213")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
for (ExchangedPeeringRoute element : networksClient.listPeeringRoutes(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListPeeringRoutesNetworksRequest The request object containing all of the parameters for the API call. |
Type | Description |
NetworksClient.ListPeeringRoutesPagedResponse |
listPeeringRoutes(String project, String network)
public final NetworksClient.ListPeeringRoutesPagedResponse listPeeringRoutes(String project, String network)
Lists the peering routes exchanged over peering connection.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
for (ExchangedPeeringRoute element :
networksClient.listPeeringRoutes(project, network).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network for this request. |
Type | Description |
NetworksClient.ListPeeringRoutesPagedResponse |
listPeeringRoutesCallable()
public final UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList> listPeeringRoutesCallable()
Lists the peering routes exchanged over peering connection.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListPeeringRoutesNetworksRequest request =
ListPeeringRoutesNetworksRequest.newBuilder()
.setDirection("direction-962590849")
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setNetwork("network1843485230")
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setPeeringName("peeringName-1170120213")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
while (true) {
ExchangedPeeringRoutesList response =
networksClient.listPeeringRoutesCallable().call(request);
for (ExchangedPeeringRoute element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListPeeringRoutesNetworksRequest,ExchangedPeeringRoutesList> |
listPeeringRoutesPagedCallable()
public final UnaryCallable<ListPeeringRoutesNetworksRequest,NetworksClient.ListPeeringRoutesPagedResponse> listPeeringRoutesPagedCallable()
Lists the peering routes exchanged over peering connection.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
ListPeeringRoutesNetworksRequest request =
ListPeeringRoutesNetworksRequest.newBuilder()
.setDirection("direction-962590849")
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setNetwork("network1843485230")
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setPeeringName("peeringName-1170120213")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
ApiFuture<ExchangedPeeringRoute> future =
networksClient.listPeeringRoutesPagedCallable().futureCall(request);
// Do something.
for (ExchangedPeeringRoute element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListPeeringRoutesNetworksRequest,ListPeeringRoutesPagedResponse> |
patchAsync(PatchNetworkRequest request)
public final OperationFuture<Operation,Operation> patchAsync(PatchNetworkRequest request)
Patches the specified network with the data included in the request. Only 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();
}
Name | Description |
request | PatchNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
patchAsync(String project, String network, Network networkResource)
public final OperationFuture<Operation,Operation> patchAsync(String project, String network, Network networkResource)
Patches the specified network with the data included in the request. Only 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();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network to update. |
networkResource | Network The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
patchCallable()
public final UnaryCallable<PatchNetworkRequest,Operation> patchCallable()
Patches the specified network with the data included in the request. Only the following fields can be modified: routingConfig.routingMode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
PatchNetworkRequest request =
PatchNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworkResource(Network.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.patchCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<PatchNetworkRequest,Operation> |
patchOperationCallable()
public final OperationCallable<PatchNetworkRequest,Operation,Operation> patchOperationCallable()
Patches the specified network with the data included in the request. Only 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();
}
Type | Description |
OperationCallable<PatchNetworkRequest,Operation,Operation> |
removePeeringAsync(RemovePeeringNetworkRequest request)
public final OperationFuture<Operation,Operation> removePeeringAsync(RemovePeeringNetworkRequest request)
Removes a peering from the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
RemovePeeringNetworkRequest request =
RemovePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksRemovePeeringRequestResource(
NetworksRemovePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.removePeeringAsync(request).get();
}
Name | Description |
request | RemovePeeringNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
public final OperationFuture<Operation,Operation> removePeeringAsync(String project, String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Removes a peering from the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
NetworksRemovePeeringRequest networksRemovePeeringRequestResource =
NetworksRemovePeeringRequest.newBuilder().build();
Operation response =
networksClient
.removePeeringAsync(project, network, networksRemovePeeringRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network resource to remove peering from. |
networksRemovePeeringRequestResource | NetworksRemovePeeringRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
removePeeringCallable()
public final UnaryCallable<RemovePeeringNetworkRequest,Operation> removePeeringCallable()
Removes a peering from the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
RemovePeeringNetworkRequest request =
RemovePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksRemovePeeringRequestResource(
NetworksRemovePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.removePeeringCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<RemovePeeringNetworkRequest,Operation> |
removePeeringOperationCallable()
public final OperationCallable<RemovePeeringNetworkRequest,Operation,Operation> removePeeringOperationCallable()
Removes a peering from the specified network.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
RemovePeeringNetworkRequest request =
RemovePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksRemovePeeringRequestResource(
NetworksRemovePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.removePeeringOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<RemovePeeringNetworkRequest,Operation,Operation> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)
public final OperationFuture<Operation,Operation> switchToCustomModeAsync(SwitchToCustomModeNetworkRequest request)
Switches the network mode from auto subnet mode to custom subnet mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
SwitchToCustomModeNetworkRequest request =
SwitchToCustomModeNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.switchToCustomModeAsync(request).get();
}
Name | Description |
request | SwitchToCustomModeNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
switchToCustomModeAsync(String project, String network)
public final OperationFuture<Operation,Operation> switchToCustomModeAsync(String project, String network)
Switches the network mode from auto subnet mode to custom subnet mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
Operation response = networksClient.switchToCustomModeAsync(project, network).get();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network to be updated. |
Type | Description |
OperationFuture<Operation,Operation> |
switchToCustomModeCallable()
public final UnaryCallable<SwitchToCustomModeNetworkRequest,Operation> switchToCustomModeCallable()
Switches the network mode from auto subnet mode to custom subnet mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
SwitchToCustomModeNetworkRequest request =
SwitchToCustomModeNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.switchToCustomModeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<SwitchToCustomModeNetworkRequest,Operation> |
switchToCustomModeOperationCallable()
public final OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation> switchToCustomModeOperationCallable()
Switches the network mode from auto subnet mode to custom subnet mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
SwitchToCustomModeNetworkRequest request =
SwitchToCustomModeNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.switchToCustomModeOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<SwitchToCustomModeNetworkRequest,Operation,Operation> |
updatePeeringAsync(UpdatePeeringNetworkRequest request)
public final OperationFuture<Operation,Operation> updatePeeringAsync(UpdatePeeringNetworkRequest request)
Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
UpdatePeeringNetworkRequest request =
UpdatePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksUpdatePeeringRequestResource(
NetworksUpdatePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
Operation response = networksClient.updatePeeringAsync(request).get();
}
Name | Description |
request | UpdatePeeringNetworkRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Operation,Operation> |
updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)
public final OperationFuture<Operation,Operation> updatePeeringAsync(String project, String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource)
Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
String project = "project-309310695";
String network = "network1843485230";
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource =
NetworksUpdatePeeringRequest.newBuilder().build();
Operation response =
networksClient
.updatePeeringAsync(project, network, networksUpdatePeeringRequestResource)
.get();
}
Name | Description |
project | String Project ID for this request. |
network | String Name of the network resource which the updated peering is belonging to. |
networksUpdatePeeringRequestResource | NetworksUpdatePeeringRequest The body resource for this request |
Type | Description |
OperationFuture<Operation,Operation> |
updatePeeringCallable()
public final UnaryCallable<UpdatePeeringNetworkRequest,Operation> updatePeeringCallable()
Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
UpdatePeeringNetworkRequest request =
UpdatePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksUpdatePeeringRequestResource(
NetworksUpdatePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = networksClient.updatePeeringCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<UpdatePeeringNetworkRequest,Operation> |
updatePeeringOperationCallable()
public final OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation> updatePeeringOperationCallable()
Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworksClient networksClient = NetworksClient.create()) {
UpdatePeeringNetworkRequest request =
UpdatePeeringNetworkRequest.newBuilder()
.setNetwork("network1843485230")
.setNetworksUpdatePeeringRequestResource(
NetworksUpdatePeeringRequest.newBuilder().build())
.setProject("project-309310695")
.setRequestId("requestId693933066")
.build();
OperationFuture<Operation, Operation> future =
networksClient.updatePeeringOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
OperationCallable<UpdatePeeringNetworkRequest,Operation,Operation> |