@Generated(value="by gapic-generator") @BetaApi public class NetworkClient 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:
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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.UnaryCallable<ListNetworksHttpRequest,NetworkList> |
listNetworksCallable()
Retrieves the list of networks available to the specified project.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.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.
|
com.google.api.gax.rpc.UnaryCallable<SwitchToCustomModeNetworkHttpRequest,Operation> |
switchToCustomModeNetworkCallable()
Switches the network mode from auto subnet mode to custom subnet mode.
|
Operation |
updatePeeringNetwork(ProjectGlobalNetworkName network,
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource,
List<String> fieldMask)
Updates the specified network peering with the data included in the request Only the following
fields can be modified: NetworkPeering.export_custom_routes, and
NetworkPeering.import_custom_routes
|
Operation |
updatePeeringNetwork(String network,
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource,
List<String> fieldMask)
Updates the specified network peering with the data included in the request Only the following
fields can be modified: NetworkPeering.export_custom_routes, and
NetworkPeering.import_custom_routes
|
Operation |
updatePeeringNetwork(UpdatePeeringNetworkHttpRequest request)
Updates the specified network peering with the data included in the request Only the following
fields can be modified: NetworkPeering.export_custom_routes, and
NetworkPeering.import_custom_routes
|
com.google.api.gax.rpc.UnaryCallable<UpdatePeeringNetworkHttpRequest,Operation> |
updatePeeringNetworkCallable()
Updates the specified network peering with the data included in the request Only the following
fields can be modified: NetworkPeering.export_custom_routes, and
NetworkPeering.import_custom_routes
|
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
- com.google.api.gax.rpc.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
- com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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 VPC Network resource.
Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for v1.networks ==) (== resource_for beta.networks ==)
com.google.api.gax.rpc.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 VPC Network resource.
Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for v1.networks ==) (== resource_for beta.networks ==)
com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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 com.google.api.gax.rpc.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 VPC Network resource.
Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network. (== 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.com.google.api.gax.rpc.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 VPC Network resource.
Networks connect resources to each other and to the internet. For more information, read Virtual Private Cloud (VPC) Network. (== 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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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
- com.google.api.gax.rpc.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
- com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.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();
}
@BetaApi public final Operation updatePeeringNetwork(ProjectGlobalNetworkName network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource, List<String> fieldMask)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource = NetworksUpdatePeeringRequest.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = networkClient.updatePeeringNetwork(network, networksUpdatePeeringRequestResource, fieldMask);
}
network
- Name of the network resource which the updated peering is belonging to.networksUpdatePeeringRequestResource
- 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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updatePeeringNetwork(String network, NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource, List<String> fieldMask)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource = NetworksUpdatePeeringRequest.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = networkClient.updatePeeringNetwork(network.toString(), networksUpdatePeeringRequestResource, fieldMask);
}
network
- Name of the network resource which the updated peering is belonging to.networksUpdatePeeringRequestResource
- 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.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation updatePeeringNetwork(UpdatePeeringNetworkHttpRequest request)
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource = NetworksUpdatePeeringRequest.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdatePeeringNetworkHttpRequest request = UpdatePeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksUpdatePeeringRequestResource(networksUpdatePeeringRequestResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = networkClient.updatePeeringNetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<UpdatePeeringNetworkHttpRequest,Operation> updatePeeringNetworkCallable()
Sample code:
try (NetworkClient networkClient = NetworkClient.create()) {
String formattedNetwork = ProjectGlobalNetworkName.format("[PROJECT]", "[NETWORK]");
NetworksUpdatePeeringRequest networksUpdatePeeringRequestResource = NetworksUpdatePeeringRequest.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdatePeeringNetworkHttpRequest request = UpdatePeeringNetworkHttpRequest.newBuilder()
.setNetwork(formattedNetwork)
.setNetworksUpdatePeeringRequestResource(networksUpdatePeeringRequestResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = networkClient.updatePeeringNetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.