@Generated(value="by gapic-generator") @BetaApi public class NetworkEndpointGroupClient 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 (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
Operation response = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup, networkEndpointGroupsAttachEndpointsRequestResource);
}
Note: close() needs to be called on the networkEndpointGroupClient 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 NetworkEndpointGroupSettings to create(). For example:
To customize credentials:
NetworkEndpointGroupSettings networkEndpointGroupSettings =
NetworkEndpointGroupSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NetworkEndpointGroupClient networkEndpointGroupClient =
NetworkEndpointGroupClient.create(networkEndpointGroupSettings);
To customize the endpoint:
NetworkEndpointGroupSettings networkEndpointGroupSettings =
NetworkEndpointGroupSettings.newBuilder().setEndpoint(myEndpoint).build();
NetworkEndpointGroupClient networkEndpointGroupClient =
NetworkEndpointGroupClient.create(networkEndpointGroupSettings);
Modifier and Type | Class and Description |
---|---|
static class |
NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsFixedSizeCollection |
static class |
NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPage |
static class |
NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPagedResponse |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointGroupsFixedSizeCollection |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointGroupsPage |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointGroupsPagedResponse |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsFixedSizeCollection |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPage |
static class |
NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
NetworkEndpointGroupClient(NetworkEndpointGroupSettings settings)
Constructs an instance of NetworkEndpointGroupClient, using the given settings.
|
protected |
NetworkEndpointGroupClient(NetworkEndpointGroupStub stub) |
protected NetworkEndpointGroupClient(NetworkEndpointGroupSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected NetworkEndpointGroupClient(NetworkEndpointGroupStub stub)
public static final NetworkEndpointGroupClient create() throws IOException
IOException
public static final NetworkEndpointGroupClient create(NetworkEndpointGroupSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final NetworkEndpointGroupClient create(NetworkEndpointGroupStub stub)
public final NetworkEndpointGroupSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public NetworkEndpointGroupStub getStub()
@BetaApi public final NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPagedResponse aggregatedListNetworkEndpointGroups(ProjectName project)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NetworkEndpointGroupsScopedList element : networkEndpointGroupClient.aggregatedListNetworkEndpointGroups(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPagedResponse aggregatedListNetworkEndpointGroups(String project)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (NetworkEndpointGroupsScopedList element : networkEndpointGroupClient.aggregatedListNetworkEndpointGroups(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPagedResponse aggregatedListNetworkEndpointGroups(AggregatedListNetworkEndpointGroupsHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNetworkEndpointGroupsHttpRequest request = AggregatedListNetworkEndpointGroupsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (NetworkEndpointGroupsScopedList element : networkEndpointGroupClient.aggregatedListNetworkEndpointGroups(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<AggregatedListNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupClient.AggregatedListNetworkEndpointGroupsPagedResponse> aggregatedListNetworkEndpointGroupsPagedCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNetworkEndpointGroupsHttpRequest request = AggregatedListNetworkEndpointGroupsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListNetworkEndpointGroupsPagedResponse> future = networkEndpointGroupClient.aggregatedListNetworkEndpointGroupsPagedCallable().futureCall(request);
// Do something
for (NetworkEndpointGroupsScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<AggregatedListNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupAggregatedList> aggregatedListNetworkEndpointGroupsCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListNetworkEndpointGroupsHttpRequest request = AggregatedListNetworkEndpointGroupsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
NetworkEndpointGroupAggregatedList response = networkEndpointGroupClient.aggregatedListNetworkEndpointGroupsCallable().call(request);
for (NetworkEndpointGroupsScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation attachNetworkEndpointsNetworkEndpointGroup(ProjectZoneNetworkEndpointGroupName networkEndpointGroup, NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
Operation response = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup, networkEndpointGroupsAttachEndpointsRequestResource);
}
networkEndpointGroup
- The name of the network endpoint group where you are attaching
network endpoints to. It should comply with RFC1035.networkEndpointGroupsAttachEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation attachNetworkEndpointsNetworkEndpointGroup(String networkEndpointGroup, NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
Operation response = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup.toString(), networkEndpointGroupsAttachEndpointsRequestResource);
}
networkEndpointGroup
- The name of the network endpoint group where you are attaching
network endpoints to. It should comply with RFC1035.networkEndpointGroupsAttachEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation attachNetworkEndpointsNetworkEndpointGroup(AttachNetworkEndpointsNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
AttachNetworkEndpointsNetworkEndpointGroupHttpRequest request = AttachNetworkEndpointsNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsAttachEndpointsRequestResource(networkEndpointGroupsAttachEndpointsRequestResource)
.build();
Operation response = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<AttachNetworkEndpointsNetworkEndpointGroupHttpRequest,Operation> attachNetworkEndpointsNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
AttachNetworkEndpointsNetworkEndpointGroupHttpRequest request = AttachNetworkEndpointsNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsAttachEndpointsRequestResource(networkEndpointGroupsAttachEndpointsRequestResource)
.build();
ApiFuture<Operation> future = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroupCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteNetworkEndpointGroup(ProjectZoneNetworkEndpointGroupName networkEndpointGroup)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
Operation response = networkEndpointGroupClient.deleteNetworkEndpointGroup(networkEndpointGroup);
}
networkEndpointGroup
- The name of the network endpoint group to delete. It should comply
with RFC1035.ApiException
- if the remote call fails@BetaApi public final Operation deleteNetworkEndpointGroup(String networkEndpointGroup)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
Operation response = networkEndpointGroupClient.deleteNetworkEndpointGroup(networkEndpointGroup.toString());
}
networkEndpointGroup
- The name of the network endpoint group to delete. It should comply
with RFC1035.ApiException
- if the remote call fails@BetaApi public final Operation deleteNetworkEndpointGroup(DeleteNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
DeleteNetworkEndpointGroupHttpRequest request = DeleteNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.build();
Operation response = networkEndpointGroupClient.deleteNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteNetworkEndpointGroupHttpRequest,Operation> deleteNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
DeleteNetworkEndpointGroupHttpRequest request = DeleteNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.build();
ApiFuture<Operation> future = networkEndpointGroupClient.deleteNetworkEndpointGroupCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation detachNetworkEndpointsNetworkEndpointGroup(ProjectZoneNetworkEndpointGroupName networkEndpointGroup, NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = NetworkEndpointGroupsDetachEndpointsRequest.newBuilder().build();
Operation response = networkEndpointGroupClient.detachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup, networkEndpointGroupsDetachEndpointsRequestResource);
}
networkEndpointGroup
- The name of the network endpoint group where you are removing
network endpoints. It should comply with RFC1035.networkEndpointGroupsDetachEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation detachNetworkEndpointsNetworkEndpointGroup(String networkEndpointGroup, NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = NetworkEndpointGroupsDetachEndpointsRequest.newBuilder().build();
Operation response = networkEndpointGroupClient.detachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup.toString(), networkEndpointGroupsDetachEndpointsRequestResource);
}
networkEndpointGroup
- The name of the network endpoint group where you are removing
network endpoints. It should comply with RFC1035.networkEndpointGroupsDetachEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation detachNetworkEndpointsNetworkEndpointGroup(DetachNetworkEndpointsNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = NetworkEndpointGroupsDetachEndpointsRequest.newBuilder().build();
DetachNetworkEndpointsNetworkEndpointGroupHttpRequest request = DetachNetworkEndpointsNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsDetachEndpointsRequestResource(networkEndpointGroupsDetachEndpointsRequestResource)
.build();
Operation response = networkEndpointGroupClient.detachNetworkEndpointsNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DetachNetworkEndpointsNetworkEndpointGroupHttpRequest,Operation> detachNetworkEndpointsNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = NetworkEndpointGroupsDetachEndpointsRequest.newBuilder().build();
DetachNetworkEndpointsNetworkEndpointGroupHttpRequest request = DetachNetworkEndpointsNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsDetachEndpointsRequestResource(networkEndpointGroupsDetachEndpointsRequestResource)
.build();
ApiFuture<Operation> future = networkEndpointGroupClient.detachNetworkEndpointsNetworkEndpointGroupCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final NetworkEndpointGroup getNetworkEndpointGroup(ProjectZoneNetworkEndpointGroupName networkEndpointGroup)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroup response = networkEndpointGroupClient.getNetworkEndpointGroup(networkEndpointGroup);
}
networkEndpointGroup
- The name of the network endpoint group. It should comply with
RFC1035.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroup getNetworkEndpointGroup(String networkEndpointGroup)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroup response = networkEndpointGroupClient.getNetworkEndpointGroup(networkEndpointGroup.toString());
}
networkEndpointGroup
- The name of the network endpoint group. It should comply with
RFC1035.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroup getNetworkEndpointGroup(GetNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
GetNetworkEndpointGroupHttpRequest request = GetNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.build();
NetworkEndpointGroup response = networkEndpointGroupClient.getNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetNetworkEndpointGroupHttpRequest,NetworkEndpointGroup> getNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
GetNetworkEndpointGroupHttpRequest request = GetNetworkEndpointGroupHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.build();
ApiFuture<NetworkEndpointGroup> future = networkEndpointGroupClient.getNetworkEndpointGroupCallable().futureCall(request);
// Do something
NetworkEndpointGroup response = future.get();
}
@BetaApi public final Operation insertNetworkEndpointGroup(ProjectZoneName zone, NetworkEndpointGroup networkEndpointGroupResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
NetworkEndpointGroup networkEndpointGroupResource = NetworkEndpointGroup.newBuilder().build();
Operation response = networkEndpointGroupClient.insertNetworkEndpointGroup(zone, networkEndpointGroupResource);
}
zone
- The name of the zone where you want to create the network endpoint group. It should
comply with RFC1035.networkEndpointGroupResource
- Represents a collection of network endpoints.ApiException
- if the remote call fails@BetaApi public final Operation insertNetworkEndpointGroup(String zone, NetworkEndpointGroup networkEndpointGroupResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
NetworkEndpointGroup networkEndpointGroupResource = NetworkEndpointGroup.newBuilder().build();
Operation response = networkEndpointGroupClient.insertNetworkEndpointGroup(zone.toString(), networkEndpointGroupResource);
}
zone
- The name of the zone where you want to create the network endpoint group. It should
comply with RFC1035.networkEndpointGroupResource
- Represents a collection of network endpoints.ApiException
- if the remote call fails@BetaApi public final Operation insertNetworkEndpointGroup(InsertNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
NetworkEndpointGroup networkEndpointGroupResource = NetworkEndpointGroup.newBuilder().build();
InsertNetworkEndpointGroupHttpRequest request = InsertNetworkEndpointGroupHttpRequest.newBuilder()
.setZone(formattedZone)
.setNetworkEndpointGroupResource(networkEndpointGroupResource)
.build();
Operation response = networkEndpointGroupClient.insertNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertNetworkEndpointGroupHttpRequest,Operation> insertNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
NetworkEndpointGroup networkEndpointGroupResource = NetworkEndpointGroup.newBuilder().build();
InsertNetworkEndpointGroupHttpRequest request = InsertNetworkEndpointGroupHttpRequest.newBuilder()
.setZone(formattedZone)
.setNetworkEndpointGroupResource(networkEndpointGroupResource)
.build();
ApiFuture<Operation> future = networkEndpointGroupClient.insertNetworkEndpointGroupCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointGroupsPagedResponse listNetworkEndpointGroups(ProjectZoneName zone)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (NetworkEndpointGroup element : networkEndpointGroupClient.listNetworkEndpointGroups(zone).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone where the network endpoint group is located. It should comply
with RFC1035.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointGroupsPagedResponse listNetworkEndpointGroups(String zone)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (NetworkEndpointGroup element : networkEndpointGroupClient.listNetworkEndpointGroups(zone.toString()).iterateAll()) {
// doThingsWith(element);
}
}
zone
- The name of the zone where the network endpoint group is located. It should comply
with RFC1035.ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointGroupsPagedResponse listNetworkEndpointGroups(ListNetworkEndpointGroupsHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointGroupsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
for (NetworkEndpointGroup element : networkEndpointGroupClient.listNetworkEndpointGroups(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<ListNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupClient.ListNetworkEndpointGroupsPagedResponse> listNetworkEndpointGroupsPagedCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointGroupsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
ApiFuture<ListNetworkEndpointGroupsPagedResponse> future = networkEndpointGroupClient.listNetworkEndpointGroupsPagedCallable().futureCall(request);
// Do something
for (NetworkEndpointGroup element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupList> listNetworkEndpointGroupsCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointGroupsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
while (true) {
NetworkEndpointGroupList response = networkEndpointGroupClient.listNetworkEndpointGroupsCallable().call(request);
for (NetworkEndpointGroup element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPagedResponse listNetworkEndpointsNetworkEndpointGroups(ProjectZoneNetworkEndpointGroupName networkEndpointGroup, NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource = NetworkEndpointGroupsListEndpointsRequest.newBuilder().build();
for (NetworkEndpointWithHealthStatus element : networkEndpointGroupClient.listNetworkEndpointsNetworkEndpointGroups(networkEndpointGroup, networkEndpointGroupsListEndpointsRequestResource).iterateAll()) {
// doThingsWith(element);
}
}
networkEndpointGroup
- The name of the network endpoint group from which you want to
generate a list of included network endpoints. It should comply with RFC1035.networkEndpointGroupsListEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPagedResponse listNetworkEndpointsNetworkEndpointGroups(String networkEndpointGroup, NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource = NetworkEndpointGroupsListEndpointsRequest.newBuilder().build();
for (NetworkEndpointWithHealthStatus element : networkEndpointGroupClient.listNetworkEndpointsNetworkEndpointGroups(networkEndpointGroup.toString(), networkEndpointGroupsListEndpointsRequestResource).iterateAll()) {
// doThingsWith(element);
}
}
networkEndpointGroup
- The name of the network endpoint group from which you want to
generate a list of included network endpoints. It should comply with RFC1035.networkEndpointGroupsListEndpointsRequestResource
- ApiException
- if the remote call fails@BetaApi public final NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPagedResponse listNetworkEndpointsNetworkEndpointGroups(ListNetworkEndpointsNetworkEndpointGroupsHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource = NetworkEndpointGroupsListEndpointsRequest.newBuilder().build();
ListNetworkEndpointsNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointsNetworkEndpointGroupsHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsListEndpointsRequestResource(networkEndpointGroupsListEndpointsRequestResource)
.build();
for (NetworkEndpointWithHealthStatus element : networkEndpointGroupClient.listNetworkEndpointsNetworkEndpointGroups(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<ListNetworkEndpointsNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupClient.ListNetworkEndpointsNetworkEndpointGroupsPagedResponse> listNetworkEndpointsNetworkEndpointGroupsPagedCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource = NetworkEndpointGroupsListEndpointsRequest.newBuilder().build();
ListNetworkEndpointsNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointsNetworkEndpointGroupsHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsListEndpointsRequestResource(networkEndpointGroupsListEndpointsRequestResource)
.build();
ApiFuture<ListNetworkEndpointsNetworkEndpointGroupsPagedResponse> future = networkEndpointGroupClient.listNetworkEndpointsNetworkEndpointGroupsPagedCallable().futureCall(request);
// Do something
for (NetworkEndpointWithHealthStatus element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListNetworkEndpointsNetworkEndpointGroupsHttpRequest,NetworkEndpointGroupsListNetworkEndpoints> listNetworkEndpointsNetworkEndpointGroupsCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedNetworkEndpointGroup = ProjectZoneNetworkEndpointGroupName.format("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
NetworkEndpointGroupsListEndpointsRequest networkEndpointGroupsListEndpointsRequestResource = NetworkEndpointGroupsListEndpointsRequest.newBuilder().build();
ListNetworkEndpointsNetworkEndpointGroupsHttpRequest request = ListNetworkEndpointsNetworkEndpointGroupsHttpRequest.newBuilder()
.setNetworkEndpointGroup(formattedNetworkEndpointGroup)
.setNetworkEndpointGroupsListEndpointsRequestResource(networkEndpointGroupsListEndpointsRequestResource)
.build();
while (true) {
NetworkEndpointGroupsListNetworkEndpoints response = networkEndpointGroupClient.listNetworkEndpointsNetworkEndpointGroupsCallable().call(request);
for (NetworkEndpointWithHealthStatus element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final TestPermissionsResponse testIamPermissionsNetworkEndpointGroup(ProjectZoneNetworkEndpointGroupResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupResourceName resource = ProjectZoneNetworkEndpointGroupResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = networkEndpointGroupClient.testIamPermissionsNetworkEndpointGroup(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsNetworkEndpointGroup(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
ProjectZoneNetworkEndpointGroupResourceName resource = ProjectZoneNetworkEndpointGroupResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = networkEndpointGroupClient.testIamPermissionsNetworkEndpointGroup(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsNetworkEndpointGroup(TestIamPermissionsNetworkEndpointGroupHttpRequest request)
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedResource = ProjectZoneNetworkEndpointGroupResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsNetworkEndpointGroupHttpRequest request = TestIamPermissionsNetworkEndpointGroupHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = networkEndpointGroupClient.testIamPermissionsNetworkEndpointGroup(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<TestIamPermissionsNetworkEndpointGroupHttpRequest,TestPermissionsResponse> testIamPermissionsNetworkEndpointGroupCallable()
Sample code:
try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
String formattedResource = ProjectZoneNetworkEndpointGroupResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsNetworkEndpointGroupHttpRequest request = TestIamPermissionsNetworkEndpointGroupHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = networkEndpointGroupClient.testIamPermissionsNetworkEndpointGroupCallable().futureCall(request);
// Do something
TestPermissionsResponse 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.