@Generated(value="by gapic-generator") @BetaApi public class NetworkClient extends Object implements 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:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
}
Note: close() needs to be called on the networkClient 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:
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 NetworkSettings to create(). For example:
To customize credentials:
NetworkSettings networkSettings =
NetworkSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NetworkClient networkClient =
NetworkClient.create(networkSettings);
To customize the endpoint:
NetworkSettings networkSettings =
NetworkSettings.newBuilder().setEndpoint(myEndpoint).build();
NetworkClient networkClient =
NetworkClient.create(networkSettings);
Modifier and Type | Class and Description |
---|---|
static class |
NetworkClient.ListNetworksFixedSizeCollection |
static class |
NetworkClient.ListNetworksPage |
static class |
NetworkClient.ListNetworksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
NetworkClient(NetworkSettings settings)
Constructs an instance of NetworkClient, using the given settings.
|
protected |
NetworkClient(NetworkStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addPeeringNetwork(AddPeeringNetworkHttpRequest request)
Adds a peering to the specified network.
|
Operation |
addPeeringNetwork(ProjectGlobalNetworkName network,
NetworksAddPeeringRequest networksAddPeeringRequestResource)
Adds a peering to the specified network.
|
Operation |
addPeeringNetwork(String network,
NetworksAddPeeringRequest networksAddPeeringRequestResource)
Adds a peering to the specified network.
|
UnaryCallable<AddPeeringNetworkHttpRequest,Operation> |
addPeeringNetworkCallable()
Adds a peering to the specified network.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NetworkClient |
create()
Constructs an instance of NetworkClient with default settings.
|
static NetworkClient |
create(NetworkSettings settings)
Constructs an instance of NetworkClient, using the given settings.
|
static NetworkClient |
create(NetworkStub stub)
Constructs an instance of NetworkClient, using the given stub for making calls.
|
Operation |
deleteNetwork(DeleteNetworkHttpRequest request)
Deletes the specified network.
|
Operation |
deleteNetwork(ProjectGlobalNetworkName network)
Deletes the specified network.
|
Operation |
deleteNetwork(String network)
Deletes the specified network.
|
UnaryCallable<DeleteNetworkHttpRequest,Operation> |
deleteNetworkCallable()
Deletes the specified network.
|
Network |
getNetwork(GetNetworkHttpRequest request)
Returns the specified network.
|
Network |
getNetwork(ProjectGlobalNetworkName network)
Returns the specified network.
|
Network |
getNetwork(String network)
Returns the specified network.
|
UnaryCallable<GetNetworkHttpRequest,Network> |
getNetworkCallable()
Returns the specified network.
|
NetworkSettings |
getSettings() |
NetworkStub |
getStub() |
Operation |
insertNetwork(InsertNetworkHttpRequest request)
Creates a network in the specified project using the data included in the request.
|
Operation |
insertNetwork(ProjectName project,
Network networkResource)
Creates a network in the specified project using the data included in the request.
|
Operation |
insertNetwork(String project,
Network networkResource)
Creates a network in the specified project using the data included in the request.
|
UnaryCallable<InsertNetworkHttpRequest,Operation> |
insertNetworkCallable()
Creates a network in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
NetworkClient.ListNetworksPagedResponse |
listNetworks(ListNetworksHttpRequest request)
Retrieves the list of networks available to the specified project.
|
NetworkClient.ListNetworksPagedResponse |
listNetworks(ProjectName project)
Retrieves the list of networks available to the specified project.
|
NetworkClient.ListNetworksPagedResponse |
listNetworks(String project)
Retrieves the list of networks available to the specified project.
|
UnaryCallable<ListNetworksHttpRequest,NetworkList> |
listNetworksCallable()
Retrieves the list of networks available to the specified project.
|
UnaryCallable<ListNetworksHttpRequest,NetworkClient.ListNetworksPagedResponse> |
listNetworksPagedCallable()
Retrieves the list of networks available to the specified project.
|
Operation |
patchNetwork(PatchNetworkHttpRequest request)
Patches the specified network with the data included in the request.
|
Operation |
patchNetwork(ProjectGlobalNetworkName network,
Network networkResource,
List<String> fieldMask)
Patches the specified network with the data included in the request.
|
Operation |
patchNetwork(String network,
Network networkResource,
List<String> fieldMask)
Patches the specified network with the data included in the request.
|
UnaryCallable<PatchNetworkHttpRequest,Operation> |
patchNetworkCallable()
Patches the specified network with the data included in the request.
|
Operation |
removePeeringNetwork(ProjectGlobalNetworkName network,
NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Removes a peering from the specified network.
|
Operation |
removePeeringNetwork(RemovePeeringNetworkHttpRequest request)
Removes a peering from the specified network.
|
Operation |
removePeeringNetwork(String network,
NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Removes a peering from the specified network.
|
UnaryCallable<RemovePeeringNetworkHttpRequest,Operation> |
removePeeringNetworkCallable()
Removes a peering from the specified network.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
switchToCustomModeNetwork(ProjectGlobalNetworkName network)
Switches the network mode from auto subnet mode to custom subnet mode.
|
Operation |
switchToCustomModeNetwork(String network)
Switches the network mode from auto subnet mode to custom subnet mode.
|
Operation |
switchToCustomModeNetwork(SwitchToCustomModeNetworkHttpRequest request)
Switches the network mode from auto subnet mode to custom subnet mode.
|
UnaryCallable<SwitchToCustomModeNetworkHttpRequest,Operation> |
switchToCustomModeNetworkCallable()
Switches the network mode from auto subnet mode to custom subnet mode.
|
protected NetworkClient(NetworkSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected NetworkClient(NetworkStub stub)
public static final NetworkClient create() throws IOException
IOException
public static final NetworkClient create(NetworkSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final NetworkClient create(NetworkStub stub)
public final NetworkSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public NetworkStub getStub()
@BetaApi public final Operation addPeeringNetwork(ProjectGlobalNetworkName network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
}
network
- Name of the network resource to add peering to.networksAddPeeringRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation addPeeringNetwork(String network, NetworksAddPeeringRequest networksAddPeeringRequestResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
Operation response = networkClient.addPeeringNetwork(network.toString(), networksAddPeeringRequestResource);
}
network
- Name of the network resource to add peering to.networksAddPeeringRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation addPeeringNetwork(AddPeeringNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
AddPeeringNetworkHttpRequest request = AddPeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource)
.build();
Operation response = networkClient.addPeeringNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<AddPeeringNetworkHttpRequest,Operation> addPeeringNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
AddPeeringNetworkHttpRequest request = AddPeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksAddPeeringRequestResource(networksAddPeeringRequestResource)
.build();
ApiFuture<Operation> future = networkClient.addPeeringNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteNetwork(ProjectGlobalNetworkName network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Operation response = networkClient.deleteNetwork(network);
}
network
- Name of the network to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteNetwork(String network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Operation response = networkClient.deleteNetwork(network.toString());
}
network
- Name of the network to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteNetwork(DeleteNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
DeleteNetworkHttpRequest request = DeleteNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
Operation response = networkClient.deleteNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteNetworkHttpRequest,Operation> deleteNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
DeleteNetworkHttpRequest request = DeleteNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
ApiFuture<Operation> future = networkClient.deleteNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Network getNetwork(ProjectGlobalNetworkName network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Network response = networkClient.getNetwork(network);
}
network
- Name of the network to return.ApiException
- if the remote call fails@BetaApi public final Network getNetwork(String network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Network response = networkClient.getNetwork(network.toString());
}
network
- Name of the network to return.ApiException
- if the remote call fails@BetaApi public final Network getNetwork(GetNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
GetNetworkHttpRequest request = GetNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
Network response = networkClient.getNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetNetworkHttpRequest,Network> getNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
GetNetworkHttpRequest request = GetNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
ApiFuture<Network> future = networkClient.getNetworkCallable().futureCall(request);
// Do something
Network response = future.get();
}
@BetaApi public final Operation insertNetwork(ProjectName project, Network networkResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Network networkResource = Network.newBuilder().build();
Operation response = networkClient.insertNetwork(project, networkResource);
}
project
- Project ID for this request.networkResource
- Represents a Network resource. Read Virtual Private Cloud (VPC) Network
Overview for more information. (== resource_for v1.networks ==) (== resource_for
beta.networks ==)ApiException
- if the remote call fails@BetaApi public final Operation insertNetwork(String project, Network networkResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Network networkResource = Network.newBuilder().build();
Operation response = networkClient.insertNetwork(project.toString(), networkResource);
}
project
- Project ID for this request.networkResource
- Represents a Network resource. Read Virtual Private Cloud (VPC) Network
Overview for more information. (== resource_for v1.networks ==) (== resource_for
beta.networks ==)ApiException
- if the remote call fails@BetaApi public final Operation insertNetwork(InsertNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Network networkResource = Network.newBuilder().build();
InsertNetworkHttpRequest request = InsertNetworkHttpRequest.newBuilder()
.setProject(formattedProject)
.setNetworkResource(networkResource)
.build();
Operation response = networkClient.insertNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertNetworkHttpRequest,Operation> insertNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Network networkResource = Network.newBuilder().build();
InsertNetworkHttpRequest request = InsertNetworkHttpRequest.newBuilder()
.setProject(formattedProject)
.setNetworkResource(networkResource)
.build();
ApiFuture<Operation> future = networkClient.insertNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final NetworkClient.ListNetworksPagedResponse listNetworks(ProjectName project)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Network element : networkClient.listNetworks(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final NetworkClient.ListNetworksPagedResponse listNetworks(String project)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (Network element : networkClient.listNetworks(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final NetworkClient.ListNetworksPagedResponse listNetworks(ListNetworksHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (Network element : networkClient.listNetworks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListNetworksHttpRequest,NetworkClient.ListNetworksPagedResponse> listNetworksPagedCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListNetworksPagedResponse> future = networkClient.listNetworksPagedCallable().futureCall(request);
// Do something
for (Network element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListNetworksHttpRequest,NetworkList> listNetworksCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListNetworksHttpRequest request = ListNetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
NetworkList response = networkClient.listNetworksCallable().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;
}
}
}
@BetaApi public final Operation patchNetwork(ProjectGlobalNetworkName network, Network networkResource, List<String> fieldMask)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Network networkResource = Network.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = networkClient.patchNetwork(network, networkResource, fieldMask);
}
network
- Name of the network to update.networkResource
- Represents a Network resource. Read Virtual Private Cloud (VPC) Network
Overview for more information. (== resource_for v1.networks ==) (== resource_for
beta.networks ==)fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation patchNetwork(String network, Network networkResource, List<String> fieldMask)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Network networkResource = Network.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = networkClient.patchNetwork(network.toString(), networkResource, fieldMask);
}
network
- Name of the network to update.networkResource
- Represents a Network resource. Read Virtual Private Cloud (VPC) Network
Overview for more information. (== resource_for v1.networks ==) (== resource_for
beta.networks ==)fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation patchNetwork(PatchNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
Network networkResource = Network.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchNetworkHttpRequest request = PatchNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworkResource(networkResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = networkClient.patchNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<PatchNetworkHttpRequest,Operation> patchNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
Network networkResource = Network.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchNetworkHttpRequest request = PatchNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworkResource(networkResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = networkClient.patchNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation removePeeringNetwork(ProjectGlobalNetworkName network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
Operation response = networkClient.removePeeringNetwork(network, networksRemovePeeringRequestResource);
}
network
- Name of the network resource to remove peering from.networksRemovePeeringRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation removePeeringNetwork(String network, NetworksRemovePeeringRequest networksRemovePeeringRequestResource)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
Operation response = networkClient.removePeeringNetwork(network.toString(), networksRemovePeeringRequestResource);
}
network
- Name of the network resource to remove peering from.networksRemovePeeringRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation removePeeringNetwork(RemovePeeringNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
RemovePeeringNetworkHttpRequest request = RemovePeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource)
.build();
Operation response = networkClient.removePeeringNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<RemovePeeringNetworkHttpRequest,Operation> removePeeringNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksRemovePeeringRequest networksRemovePeeringRequestResource = NetworksRemovePeeringRequest.newBuilder().build();
RemovePeeringNetworkHttpRequest request = RemovePeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksRemovePeeringRequestResource(networksRemovePeeringRequestResource)
.build();
ApiFuture<Operation> future = networkClient.removePeeringNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation switchToCustomModeNetwork(ProjectGlobalNetworkName network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Operation response = networkClient.switchToCustomModeNetwork(network);
}
network
- Name of the network to be updated.ApiException
- if the remote call fails@BetaApi public final Operation switchToCustomModeNetwork(String network)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
Operation response = networkClient.switchToCustomModeNetwork(network.toString());
}
network
- Name of the network to be updated.ApiException
- if the remote call fails@BetaApi public final Operation switchToCustomModeNetwork(SwitchToCustomModeNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
SwitchToCustomModeNetworkHttpRequest request = SwitchToCustomModeNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
Operation response = networkClient.switchToCustomModeNetwork(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SwitchToCustomModeNetworkHttpRequest,Operation> switchToCustomModeNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
SwitchToCustomModeNetworkHttpRequest request = SwitchToCustomModeNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.build();
ApiFuture<Operation> future = networkClient.switchToCustomModeNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.