@Generated(value="by gapic-generator-java") public class NetworkProfilesClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
String project = "project-309310695";
String networkProfile = "networkProfile-2013096037";
NetworkProfile response = networkProfilesClient.get(project, networkProfile);
}
Note: close() needs to be called on the NetworkProfilesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
Get |
Returns the specified network profile. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
List |
Retrieves a list of network profiles available to the specified project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 NetworkProfilesSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NetworkProfilesSettings networkProfilesSettings =
NetworkProfilesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NetworkProfilesClient networkProfilesClient =
NetworkProfilesClient.create(networkProfilesSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NetworkProfilesSettings networkProfilesSettings =
NetworkProfilesSettings.newBuilder().setEndpoint(myEndpoint).build();
NetworkProfilesClient networkProfilesClient =
NetworkProfilesClient.create(networkProfilesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
NetworkProfilesClient.ListFixedSizeCollection |
static class |
NetworkProfilesClient.ListPage |
static class |
NetworkProfilesClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
NetworkProfilesClient(NetworkProfilesSettings settings)
Constructs an instance of NetworkProfilesClient, using the given settings.
|
protected |
NetworkProfilesClient(NetworkProfilesStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NetworkProfilesClient |
create()
Constructs an instance of NetworkProfilesClient with default settings.
|
static NetworkProfilesClient |
create(NetworkProfilesSettings settings)
Constructs an instance of NetworkProfilesClient, using the given settings.
|
static NetworkProfilesClient |
create(NetworkProfilesStub stub)
Constructs an instance of NetworkProfilesClient, using the given stub for making calls.
|
NetworkProfile |
get(GetNetworkProfileRequest request)
Returns the specified network profile.
|
NetworkProfile |
get(String project,
String networkProfile)
Returns the specified network profile.
|
com.google.api.gax.rpc.UnaryCallable<GetNetworkProfileRequest,NetworkProfile> |
getCallable()
Returns the specified network profile.
|
NetworkProfilesSettings |
getSettings() |
NetworkProfilesStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
NetworkProfilesClient.ListPagedResponse |
list(ListNetworkProfilesRequest request)
Retrieves a list of network profiles available to the specified project.
|
NetworkProfilesClient.ListPagedResponse |
list(String project)
Retrieves a list of network profiles available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNetworkProfilesRequest,NetworkProfilesListResponse> |
listCallable()
Retrieves a list of network profiles available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListNetworkProfilesRequest,NetworkProfilesClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of network profiles available to the specified project.
|
void |
shutdown() |
void |
shutdownNow() |
protected NetworkProfilesClient(NetworkProfilesSettings settings) throws IOException
IOExceptionprotected NetworkProfilesClient(NetworkProfilesStub stub)
public static final NetworkProfilesClient create() throws IOException
IOExceptionpublic static final NetworkProfilesClient create(NetworkProfilesSettings settings) throws IOException
IOExceptionpublic static final NetworkProfilesClient create(NetworkProfilesStub stub)
public final NetworkProfilesSettings getSettings()
public NetworkProfilesStub getStub()
public final NetworkProfile get(String project, String networkProfile)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
String project = "project-309310695";
String networkProfile = "networkProfile-2013096037";
NetworkProfile response = networkProfilesClient.get(project, networkProfile);
}
project - Project ID for this request.networkProfile - Name of the network profile to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NetworkProfile get(GetNetworkProfileRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
GetNetworkProfileRequest request =
GetNetworkProfileRequest.newBuilder()
.setNetworkProfile("networkProfile-2013096037")
.setProject("project-309310695")
.build();
NetworkProfile response = networkProfilesClient.get(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNetworkProfileRequest,NetworkProfile> getCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
GetNetworkProfileRequest request =
GetNetworkProfileRequest.newBuilder()
.setNetworkProfile("networkProfile-2013096037")
.setProject("project-309310695")
.build();
ApiFuture<NetworkProfile> future = networkProfilesClient.getCallable().futureCall(request);
// Do something.
NetworkProfile response = future.get();
}
public final NetworkProfilesClient.ListPagedResponse list(String project)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
String project = "project-309310695";
for (NetworkProfile element : networkProfilesClient.list(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final NetworkProfilesClient.ListPagedResponse list(ListNetworkProfilesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
ListNetworkProfilesRequest request =
ListNetworkProfilesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
for (NetworkProfile element : networkProfilesClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListNetworkProfilesRequest,NetworkProfilesClient.ListPagedResponse> listPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
ListNetworkProfilesRequest request =
ListNetworkProfilesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
ApiFuture<NetworkProfile> future =
networkProfilesClient.listPagedCallable().futureCall(request);
// Do something.
for (NetworkProfile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListNetworkProfilesRequest,NetworkProfilesListResponse> listCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.create()) {
ListNetworkProfilesRequest request =
ListNetworkProfilesRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
while (true) {
NetworkProfilesListResponse response = networkProfilesClient.listCallable().call(request);
for (NetworkProfile element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.