@Generated(value="by gapic-generator-java") public class SubnetworksClient 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
Subnetwork response = subnetworksClient.get(project, region, subnetwork);
}
Note: close() needs to be called on the SubnetworksClient 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 |
|---|---|---|
AggregatedList |
Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. |
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.
|
Delete |
Deletes the specified subnetwork. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExpandIpCidrRange |
Expands the IP CIDR range of the subnetwork to a specified value. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified subnetwork. |
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.
|
GetIamPolicy |
Gets the access control policy for a resource. May be empty if no such policy or resource exists. |
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.
|
Insert |
Creates a subnetwork in the specified project using the data included in the request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
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 subnetworks 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.
|
ListUsable |
Retrieves an aggregated list of all usable subnetworks in the 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.
|
Patch |
Patches the specified subnetwork with the data included in the request. Only certain fields can be updated with a patch request as indicated in the field descriptions. You must specify the current fingerprint of the subnetwork resource being patched. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replaces any existing policy. |
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.
|
SetPrivateIpGoogleAccess |
Set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. |
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 SubnetworksSettings 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
SubnetworksSettings subnetworksSettings =
SubnetworksSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SubnetworksClient subnetworksClient = SubnetworksClient.create(subnetworksSettings);
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
SubnetworksSettings subnetworksSettings =
SubnetworksSettings.newBuilder().setEndpoint(myEndpoint).build();
SubnetworksClient subnetworksClient = SubnetworksClient.create(subnetworksSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SubnetworksClient.AggregatedListFixedSizeCollection |
static class |
SubnetworksClient.AggregatedListPage |
static class |
SubnetworksClient.AggregatedListPagedResponse |
static class |
SubnetworksClient.ListFixedSizeCollection |
static class |
SubnetworksClient.ListPage |
static class |
SubnetworksClient.ListPagedResponse |
static class |
SubnetworksClient.ListUsableFixedSizeCollection |
static class |
SubnetworksClient.ListUsablePage |
static class |
SubnetworksClient.ListUsablePagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SubnetworksClient(SubnetworksSettings settings)
Constructs an instance of SubnetworksClient, using the given settings.
|
protected |
SubnetworksClient(SubnetworksStub stub) |
| Modifier and Type | Method and Description |
|---|---|
SubnetworksClient.AggregatedListPagedResponse |
aggregatedList(AggregatedListSubnetworksRequest request)
Retrieves an aggregated list of subnetworks.
|
SubnetworksClient.AggregatedListPagedResponse |
aggregatedList(String project)
Retrieves an aggregated list of subnetworks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksRequest,SubnetworkAggregatedList> |
aggregatedListCallable()
Retrieves an aggregated list of subnetworks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksRequest,SubnetworksClient.AggregatedListPagedResponse> |
aggregatedListPagedCallable()
Retrieves an aggregated list of subnetworks.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SubnetworksClient |
create()
Constructs an instance of SubnetworksClient with default settings.
|
static SubnetworksClient |
create(SubnetworksSettings settings)
Constructs an instance of SubnetworksClient, using the given settings.
|
static SubnetworksClient |
create(SubnetworksStub stub)
Constructs an instance of SubnetworksClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(DeleteSubnetworkRequest request)
Deletes the specified subnetwork.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(String project,
String region,
String subnetwork)
Deletes the specified subnetwork.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSubnetworkRequest,Operation> |
deleteCallable()
Deletes the specified subnetwork.
|
com.google.api.gax.rpc.OperationCallable<DeleteSubnetworkRequest,Operation,Operation> |
deleteOperationCallable()
Deletes the specified subnetwork.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
expandIpCidrRangeAsync(ExpandIpCidrRangeSubnetworkRequest request)
Expands the IP CIDR range of the subnetwork to a specified value.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
expandIpCidrRangeAsync(String project,
String region,
String subnetwork,
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
Expands the IP CIDR range of the subnetwork to a specified value.
|
com.google.api.gax.rpc.UnaryCallable<ExpandIpCidrRangeSubnetworkRequest,Operation> |
expandIpCidrRangeCallable()
Expands the IP CIDR range of the subnetwork to a specified value.
|
com.google.api.gax.rpc.OperationCallable<ExpandIpCidrRangeSubnetworkRequest,Operation,Operation> |
expandIpCidrRangeOperationCallable()
Expands the IP CIDR range of the subnetwork to a specified value.
|
Subnetwork |
get(GetSubnetworkRequest request)
Returns the specified subnetwork.
|
Subnetwork |
get(String project,
String region,
String subnetwork)
Returns the specified subnetwork.
|
com.google.api.gax.rpc.UnaryCallable<GetSubnetworkRequest,Subnetwork> |
getCallable()
Returns the specified subnetwork.
|
Policy |
getIamPolicy(GetIamPolicySubnetworkRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicy(String project,
String region,
String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicySubnetworkRequest,Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
SubnetworksSettings |
getSettings() |
SubnetworksStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(InsertSubnetworkRequest request)
Creates a subnetwork in the specified project using the data included in the request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(String project,
String region,
Subnetwork subnetworkResource)
Creates a subnetwork in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertSubnetworkRequest,Operation> |
insertCallable()
Creates a subnetwork in the specified project using the data included in the request.
|
com.google.api.gax.rpc.OperationCallable<InsertSubnetworkRequest,Operation,Operation> |
insertOperationCallable()
Creates a subnetwork in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
SubnetworksClient.ListPagedResponse |
list(ListSubnetworksRequest request)
Retrieves a list of subnetworks available to the specified project.
|
SubnetworksClient.ListPagedResponse |
list(String project,
String region)
Retrieves a list of subnetworks available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubnetworksRequest,SubnetworkList> |
listCallable()
Retrieves a list of subnetworks available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubnetworksRequest,SubnetworksClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of subnetworks available to the specified project.
|
SubnetworksClient.ListUsablePagedResponse |
listUsable(ListUsableSubnetworksRequest request)
Retrieves an aggregated list of all usable subnetworks in the project.
|
SubnetworksClient.ListUsablePagedResponse |
listUsable(String project)
Retrieves an aggregated list of all usable subnetworks in the project.
|
com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksRequest,UsableSubnetworksAggregatedList> |
listUsableCallable()
Retrieves an aggregated list of all usable subnetworks in the project.
|
com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksRequest,SubnetworksClient.ListUsablePagedResponse> |
listUsablePagedCallable()
Retrieves an aggregated list of all usable subnetworks in the project.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
patchAsync(PatchSubnetworkRequest request)
Patches the specified subnetwork with the data included in the request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
patchAsync(String project,
String region,
String subnetwork,
Subnetwork subnetworkResource)
Patches the specified subnetwork with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchSubnetworkRequest,Operation> |
patchCallable()
Patches the specified subnetwork with the data included in the request.
|
com.google.api.gax.rpc.OperationCallable<PatchSubnetworkRequest,Operation,Operation> |
patchOperationCallable()
Patches the specified subnetwork with the data included in the request.
|
Policy |
setIamPolicy(SetIamPolicySubnetworkRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicy(String project,
String region,
String resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicySubnetworkRequest,Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setPrivateIpGoogleAccessAsync(SetPrivateIpGoogleAccessSubnetworkRequest request)
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setPrivateIpGoogleAccessAsync(String project,
String region,
String subnetwork,
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
com.google.api.gax.rpc.UnaryCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation> |
setPrivateIpGoogleAccessCallable()
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
com.google.api.gax.rpc.OperationCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation,Operation> |
setPrivateIpGoogleAccessOperationCallable()
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissions(String project,
String region,
String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissions(TestIamPermissionsSubnetworkRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsSubnetworkRequest,TestPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected SubnetworksClient(SubnetworksSettings settings) throws IOException
IOExceptionprotected SubnetworksClient(SubnetworksStub stub)
public static final SubnetworksClient create() throws IOException
IOExceptionpublic static final SubnetworksClient create(SubnetworksSettings settings) throws IOException
IOExceptionpublic static final SubnetworksClient create(SubnetworksStub stub)
public final SubnetworksSettings getSettings()
public SubnetworksStub getStub()
public final SubnetworksClient.AggregatedListPagedResponse aggregatedList(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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
for (Map.Entry<String, SubnetworksScopedList> element :
subnetworksClient.aggregatedList(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SubnetworksClient.AggregatedListPagedResponse aggregatedList(AggregatedListSubnetworksRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
AggregatedListSubnetworksRequest request =
AggregatedListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
for (Map.Entry<String, SubnetworksScopedList> element :
subnetworksClient.aggregatedList(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<AggregatedListSubnetworksRequest,SubnetworksClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
AggregatedListSubnetworksRequest request =
AggregatedListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
ApiFuture<Map.Entry<String, SubnetworksScopedList>> future =
subnetworksClient.aggregatedListPagedCallable().futureCall(request);
// Do something.
for (Map.Entry<String, SubnetworksScopedList> element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksRequest,SubnetworkAggregatedList> aggregatedListCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
AggregatedListSubnetworksRequest request =
AggregatedListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
while (true) {
SubnetworkAggregatedList response =
subnetworksClient.aggregatedListCallable().call(request);
for (Map.Entry<String, SubnetworksScopedList> element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String region, String subnetwork)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
Operation response = subnetworksClient.deleteAsync(project, region, subnetwork).get();
}
project - Project ID for this request.region - Name of the region scoping this request.subnetwork - Name of the Subnetwork resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
DeleteSubnetworkRequest request =
DeleteSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.build();
Operation response = subnetworksClient.deleteAsync(request).get();
}
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.OperationCallable<DeleteSubnetworkRequest,Operation,Operation> deleteOperationCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
DeleteSubnetworkRequest request =
DeleteSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.build();
OperationFuture<Operation, Operation> future =
subnetworksClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteSubnetworkRequest,Operation> deleteCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
DeleteSubnetworkRequest request =
DeleteSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.build();
ApiFuture<Operation> future = subnetworksClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> expandIpCidrRangeAsync(String project, String region, String subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource =
SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
Operation response =
subnetworksClient
.expandIpCidrRangeAsync(
project, region, subnetwork, subnetworksExpandIpCidrRangeRequestResource)
.get();
}
project - Project ID for this request.region - Name of the region scoping this request.subnetwork - Name of the Subnetwork resource to update.subnetworksExpandIpCidrRangeRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> expandIpCidrRangeAsync(ExpandIpCidrRangeSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ExpandIpCidrRangeSubnetworkRequest request =
ExpandIpCidrRangeSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksExpandIpCidrRangeRequestResource(
SubnetworksExpandIpCidrRangeRequest.newBuilder().build())
.build();
Operation response = subnetworksClient.expandIpCidrRangeAsync(request).get();
}
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.OperationCallable<ExpandIpCidrRangeSubnetworkRequest,Operation,Operation> expandIpCidrRangeOperationCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ExpandIpCidrRangeSubnetworkRequest request =
ExpandIpCidrRangeSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksExpandIpCidrRangeRequestResource(
SubnetworksExpandIpCidrRangeRequest.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
subnetworksClient.expandIpCidrRangeOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExpandIpCidrRangeSubnetworkRequest,Operation> expandIpCidrRangeCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ExpandIpCidrRangeSubnetworkRequest request =
ExpandIpCidrRangeSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksExpandIpCidrRangeRequestResource(
SubnetworksExpandIpCidrRangeRequest.newBuilder().build())
.build();
ApiFuture<Operation> future =
subnetworksClient.expandIpCidrRangeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Subnetwork get(String project, String region, String subnetwork)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
Subnetwork response = subnetworksClient.get(project, region, subnetwork);
}
project - Project ID for this request.region - Name of the region scoping this request.subnetwork - Name of the Subnetwork resource to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subnetwork get(GetSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
GetSubnetworkRequest request =
GetSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setSubnetwork("subnetwork-1302785042")
.build();
Subnetwork response = subnetworksClient.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<GetSubnetworkRequest,Subnetwork> 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
GetSubnetworkRequest request =
GetSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setSubnetwork("subnetwork-1302785042")
.build();
ApiFuture<Subnetwork> future = subnetworksClient.getCallable().futureCall(request);
// Do something.
Subnetwork response = future.get();
}
public final Policy getIamPolicy(String project, String region, String resource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
Policy response = subnetworksClient.getIamPolicy(project, region, resource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy getIamPolicy(GetIamPolicySubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
GetIamPolicySubnetworkRequest request =
GetIamPolicySubnetworkRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.build();
Policy response = subnetworksClient.getIamPolicy(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<GetIamPolicySubnetworkRequest,Policy> getIamPolicyCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
GetIamPolicySubnetworkRequest request =
GetIamPolicySubnetworkRequest.newBuilder()
.setOptionsRequestedPolicyVersion(-574521795)
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = subnetworksClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String region, Subnetwork subnetworkResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
Operation response = subnetworksClient.insertAsync(project, region, subnetworkResource).get();
}
project - Project ID for this request.region - Name of the region scoping this request.subnetworkResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
InsertSubnetworkRequest request =
InsertSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
Operation response = subnetworksClient.insertAsync(request).get();
}
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.OperationCallable<InsertSubnetworkRequest,Operation,Operation> insertOperationCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
InsertSubnetworkRequest request =
InsertSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
subnetworksClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertSubnetworkRequest,Operation> insertCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
InsertSubnetworkRequest request =
InsertSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
ApiFuture<Operation> future = subnetworksClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final SubnetworksClient.ListPagedResponse list(String project, String region)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
for (Subnetwork element : subnetworksClient.list(project, region).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.region - Name of the region scoping this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SubnetworksClient.ListPagedResponse list(ListSubnetworksRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListSubnetworksRequest request =
ListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
for (Subnetwork element : subnetworksClient.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<ListSubnetworksRequest,SubnetworksClient.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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListSubnetworksRequest request =
ListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
ApiFuture<Subnetwork> future = subnetworksClient.listPagedCallable().futureCall(request);
// Do something.
for (Subnetwork element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSubnetworksRequest,SubnetworkList> 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListSubnetworksRequest request =
ListSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
while (true) {
SubnetworkList response = subnetworksClient.listCallable().call(request);
for (Subnetwork element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SubnetworksClient.ListUsablePagedResponse listUsable(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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
for (UsableSubnetwork element : subnetworksClient.listUsable(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SubnetworksClient.ListUsablePagedResponse listUsable(ListUsableSubnetworksRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListUsableSubnetworksRequest request =
ListUsableSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
for (UsableSubnetwork element : subnetworksClient.listUsable(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<ListUsableSubnetworksRequest,SubnetworksClient.ListUsablePagedResponse> listUsablePagedCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListUsableSubnetworksRequest request =
ListUsableSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
ApiFuture<UsableSubnetwork> future =
subnetworksClient.listUsablePagedCallable().futureCall(request);
// Do something.
for (UsableSubnetwork element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksRequest,UsableSubnetworksAggregatedList> listUsableCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
ListUsableSubnetworksRequest request =
ListUsableSubnetworksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.build();
while (true) {
UsableSubnetworksAggregatedList response =
subnetworksClient.listUsableCallable().call(request);
for (UsableSubnetwork element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(String project, String region, String subnetwork, Subnetwork subnetworkResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
Operation response =
subnetworksClient.patchAsync(project, region, subnetwork, subnetworkResource).get();
}
project - Project ID for this request.region - Name of the region scoping this request.subnetwork - Name of the Subnetwork resource to patch.subnetworkResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> patchAsync(PatchSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
PatchSubnetworkRequest request =
PatchSubnetworkRequest.newBuilder()
.setDrainTimeoutSeconds(1431448922)
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
Operation response = subnetworksClient.patchAsync(request).get();
}
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.OperationCallable<PatchSubnetworkRequest,Operation,Operation> patchOperationCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
PatchSubnetworkRequest request =
PatchSubnetworkRequest.newBuilder()
.setDrainTimeoutSeconds(1431448922)
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
subnetworksClient.patchOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<PatchSubnetworkRequest,Operation> patchCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
PatchSubnetworkRequest request =
PatchSubnetworkRequest.newBuilder()
.setDrainTimeoutSeconds(1431448922)
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworkResource(Subnetwork.newBuilder().build())
.build();
ApiFuture<Operation> future = subnetworksClient.patchCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Policy setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
RegionSetPolicyRequest regionSetPolicyRequestResource =
RegionSetPolicyRequest.newBuilder().build();
Policy response =
subnetworksClient.setIamPolicy(project, region, resource, regionSetPolicyRequestResource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.regionSetPolicyRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final Policy setIamPolicy(SetIamPolicySubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
SetIamPolicySubnetworkRequest request =
SetIamPolicySubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
.setResource("resource-341064690")
.build();
Policy response = subnetworksClient.setIamPolicy(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<SetIamPolicySubnetworkRequest,Policy> setIamPolicyCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
SetIamPolicySubnetworkRequest request =
SetIamPolicySubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetPolicyRequestResource(RegionSetPolicyRequest.newBuilder().build())
.setResource("resource-341064690")
.build();
ApiFuture<Policy> future = subnetworksClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setPrivateIpGoogleAccessAsync(String project, String region, String subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String subnetwork = "subnetwork-1302785042";
SubnetworksSetPrivateIpGoogleAccessRequest
subnetworksSetPrivateIpGoogleAccessRequestResource =
SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
Operation response =
subnetworksClient
.setPrivateIpGoogleAccessAsync(
project, region, subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource)
.get();
}
project - Project ID for this request.region - Name of the region scoping this request.subnetwork - Name of the Subnetwork resource.subnetworksSetPrivateIpGoogleAccessRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setPrivateIpGoogleAccessAsync(SetPrivateIpGoogleAccessSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
SetPrivateIpGoogleAccessSubnetworkRequest request =
SetPrivateIpGoogleAccessSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksSetPrivateIpGoogleAccessRequestResource(
SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build())
.build();
Operation response = subnetworksClient.setPrivateIpGoogleAccessAsync(request).get();
}
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.OperationCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation,Operation> setPrivateIpGoogleAccessOperationCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
SetPrivateIpGoogleAccessSubnetworkRequest request =
SetPrivateIpGoogleAccessSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksSetPrivateIpGoogleAccessRequestResource(
SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
subnetworksClient.setPrivateIpGoogleAccessOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation> setPrivateIpGoogleAccessCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
SetPrivateIpGoogleAccessSubnetworkRequest request =
SetPrivateIpGoogleAccessSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setSubnetwork("subnetwork-1302785042")
.setSubnetworksSetPrivateIpGoogleAccessRequestResource(
SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build())
.build();
ApiFuture<Operation> future =
subnetworksClient.setPrivateIpGoogleAccessCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
TestPermissionsRequest testPermissionsRequestResource =
TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response =
subnetworksClient.testIamPermissions(
project, region, resource, testPermissionsRequestResource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.testPermissionsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final TestPermissionsResponse testIamPermissions(TestIamPermissionsSubnetworkRequest 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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
TestIamPermissionsSubnetworkRequest request =
TestIamPermissionsSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
TestPermissionsResponse response = subnetworksClient.testIamPermissions(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<TestIamPermissionsSubnetworkRequest,TestPermissionsResponse> testIamPermissionsCallable()
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 (SubnetworksClient subnetworksClient = SubnetworksClient.create()) {
TestIamPermissionsSubnetworkRequest request =
TestIamPermissionsSubnetworkRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
ApiFuture<TestPermissionsResponse> future =
subnetworksClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestPermissionsResponse response = future.get();
}
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 © 2024 Google LLC. All rights reserved.