Class SubnetworksClient (1.64.0)

GitHub RepositoryProduct Reference

Service Description: The Subnetworks API.

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().

Methods
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.

  • aggregatedList(AggregatedListSubnetworksRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • aggregatedList(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • aggregatedListPagedCallable()

  • aggregatedListCallable()

Delete

Deletes the specified subnetwork.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAsync(DeleteSubnetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteAsync(String project, String region, String subnetwork)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOperationCallable()

  • deleteCallable()

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.

  • expandIpCidrRangeAsync(ExpandIpCidrRangeSubnetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • expandIpCidrRangeAsync(String project, String region, String subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • expandIpCidrRangeOperationCallable()

  • expandIpCidrRangeCallable()

Get

Returns the specified subnetwork.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetSubnetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String region, String subnetwork)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

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.

  • getIamPolicy(GetIamPolicySubnetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getIamPolicy(String project, String region, String resource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

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.

  • insertAsync(InsertSubnetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • insertAsync(String project, String region, Subnetwork subnetworkResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertOperationCallable()

  • insertCallable()

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.

  • list(ListSubnetworksRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • list(String project, String region)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPagedCallable()

  • listCallable()

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.

  • listUsable(ListUsableSubnetworksRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listUsable(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listUsablePagedCallable()

  • listUsableCallable()

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.

  • patchAsync(PatchSubnetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • patchAsync(String project, String region, String subnetwork, Subnetwork subnetworkResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • patchOperationCallable()

  • patchCallable()

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.

  • setIamPolicy(SetIamPolicySubnetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

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.

  • setPrivateIpGoogleAccessAsync(SetPrivateIpGoogleAccessSubnetworkRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • setPrivateIpGoogleAccessAsync(String project, String region, String subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setPrivateIpGoogleAccessOperationCallable()

  • setPrivateIpGoogleAccessCallable()

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.

  • testIamPermissions(TestIamPermissionsSubnetworkRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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.

Inheritance

java.lang.Object > SubnetworksClient

Static Methods

create()

public static final SubnetworksClient create()

Constructs an instance of SubnetworksClient with default settings.

Returns
Type Description
SubnetworksClient
Exceptions
Type Description
IOException

create(SubnetworksSettings settings)

public static final SubnetworksClient create(SubnetworksSettings settings)

Constructs an instance of SubnetworksClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings SubnetworksSettings
Returns
Type Description
SubnetworksClient
Exceptions
Type Description
IOException

create(SubnetworksStub stub)

public static final SubnetworksClient create(SubnetworksStub stub)

Constructs an instance of SubnetworksClient, using the given stub for making calls. This is for advanced usage - prefer using create(SubnetworksSettings).

Parameter
Name Description
stub SubnetworksStub
Returns
Type Description
SubnetworksClient

Constructors

SubnetworksClient(SubnetworksSettings settings)

protected SubnetworksClient(SubnetworksSettings settings)

Constructs an instance of SubnetworksClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings SubnetworksSettings

SubnetworksClient(SubnetworksStub stub)

protected SubnetworksClient(SubnetworksStub stub)
Parameter
Name Description
stub SubnetworksStub

Methods

aggregatedList(AggregatedListSubnetworksRequest request)

public final SubnetworksClient.AggregatedListPagedResponse aggregatedList(AggregatedListSubnetworksRequest request)

Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Parameter
Name Description
request AggregatedListSubnetworksRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SubnetworksClient.AggregatedListPagedResponse

aggregatedList(String project)

public final SubnetworksClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Parameter
Name Description
project String

Project ID for this request.

Returns
Type Description
SubnetworksClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListSubnetworksRequest,SubnetworkAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<AggregatedListSubnetworksRequest,SubnetworkAggregatedList>

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListSubnetworksRequest,SubnetworksClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Returns
Type Description
UnaryCallable<AggregatedListSubnetworksRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

deleteAsync(DeleteSubnetworkRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteSubnetworkRequest request)

Deletes the specified 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()) {
   DeleteSubnetworkRequest request =
       DeleteSubnetworkRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setRequestId("requestId693933066")
           .setSubnetwork("subnetwork-1302785042")
           .build();
   Operation response = subnetworksClient.deleteAsync(request).get();
 }
 
Parameter
Name Description
request DeleteSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

deleteAsync(String project, String region, String subnetwork)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String region, String subnetwork)

Deletes the specified 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();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetwork String

Name of the Subnetwork resource to delete.

Returns
Type Description
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteSubnetworkRequest,Operation> deleteCallable()

Deletes the specified 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()) {
   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();
 }
 
Returns
Type Description
UnaryCallable<DeleteSubnetworkRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteSubnetworkRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified 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()) {
   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();
 }
 
Returns
Type Description
OperationCallable<DeleteSubnetworkRequest,Operation,Operation>

expandIpCidrRangeAsync(ExpandIpCidrRangeSubnetworkRequest request)

public final OperationFuture<Operation,Operation> expandIpCidrRangeAsync(ExpandIpCidrRangeSubnetworkRequest request)

Expands the IP CIDR range of the subnetwork to a specified value.

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();
 }
 
Parameter
Name Description
request ExpandIpCidrRangeSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

expandIpCidrRangeAsync(String project, String region, String subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)

public final OperationFuture<Operation,Operation> expandIpCidrRangeAsync(String project, String region, String subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)

Expands the IP CIDR range of the subnetwork to a specified value.

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();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetwork String

Name of the Subnetwork resource to update.

subnetworksExpandIpCidrRangeRequestResource SubnetworksExpandIpCidrRangeRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

expandIpCidrRangeCallable()

public final UnaryCallable<ExpandIpCidrRangeSubnetworkRequest,Operation> expandIpCidrRangeCallable()

Expands the IP CIDR range of the subnetwork to a specified value.

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();
 }
 
Returns
Type Description
UnaryCallable<ExpandIpCidrRangeSubnetworkRequest,Operation>

expandIpCidrRangeOperationCallable()

public final OperationCallable<ExpandIpCidrRangeSubnetworkRequest,Operation,Operation> expandIpCidrRangeOperationCallable()

Expands the IP CIDR range of the subnetwork to a specified value.

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();
 }
 
Returns
Type Description
OperationCallable<ExpandIpCidrRangeSubnetworkRequest,Operation,Operation>

get(GetSubnetworkRequest request)

public final Subnetwork get(GetSubnetworkRequest request)

Returns the specified 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()) {
   GetSubnetworkRequest request =
       GetSubnetworkRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setSubnetwork("subnetwork-1302785042")
           .build();
   Subnetwork response = subnetworksClient.get(request);
 }
 
Parameter
Name Description
request GetSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Subnetwork

get(String project, String region, String subnetwork)

public final Subnetwork get(String project, String region, String subnetwork)

Returns the specified 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);
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetwork String

Name of the Subnetwork resource to return.

Returns
Type Description
Subnetwork

getCallable()

public final UnaryCallable<GetSubnetworkRequest,Subnetwork> getCallable()

Returns the specified 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()) {
   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();
 }
 
Returns
Type Description
UnaryCallable<GetSubnetworkRequest,Subnetwork>

getIamPolicy(GetIamPolicySubnetworkRequest request)

public final Policy getIamPolicy(GetIamPolicySubnetworkRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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);
 }
 
Parameter
Name Description
request GetIamPolicySubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Policy

getIamPolicy(String project, String region, String resource)

public final Policy getIamPolicy(String project, String region, String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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);
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

The name of the region for this request.

resource String

Name or id of the resource for this request.

Returns
Type Description
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicySubnetworkRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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();
 }
 
Returns
Type Description
UnaryCallable<GetIamPolicySubnetworkRequest,Policy>

getSettings()

public final SubnetworksSettings getSettings()
Returns
Type Description
SubnetworksSettings

getStub()

public SubnetworksStub getStub()
Returns
Type Description
SubnetworksStub

insertAsync(InsertSubnetworkRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertSubnetworkRequest request)

Creates a subnetwork in the specified project using the data included in the 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();
 }
 
Parameter
Name Description
request InsertSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

insertAsync(String project, String region, Subnetwork subnetworkResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, String region, Subnetwork subnetworkResource)

Creates a subnetwork in the specified project using the data included in the 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()) {
   String project = "project-309310695";
   String region = "region-934795532";
   Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
   Operation response = subnetworksClient.insertAsync(project, region, subnetworkResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetworkResource Subnetwork

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertSubnetworkRequest,Operation> insertCallable()

Creates a subnetwork in the specified project using the data included in the 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();
   ApiFuture<Operation> future = subnetworksClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertSubnetworkRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertSubnetworkRequest,Operation,Operation> insertOperationCallable()

Creates a subnetwork in the specified project using the data included in the 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();
   OperationFuture<Operation, Operation> future =
       subnetworksClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<InsertSubnetworkRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

list(ListSubnetworksRequest request)

public final SubnetworksClient.ListPagedResponse list(ListSubnetworksRequest request)

Retrieves a list of subnetworks available to the specified 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()) {
   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);
   }
 }
 
Parameter
Name Description
request ListSubnetworksRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SubnetworksClient.ListPagedResponse

list(String project, String region)

public final SubnetworksClient.ListPagedResponse list(String project, String region)

Retrieves a list of subnetworks available to the specified 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";
   String region = "region-934795532";
   for (Subnetwork element : subnetworksClient.list(project, region).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

Returns
Type Description
SubnetworksClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListSubnetworksRequest,SubnetworkList> listCallable()

Retrieves a list of subnetworks available to the specified 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()) {
   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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListSubnetworksRequest,SubnetworkList>

listPagedCallable()

public final UnaryCallable<ListSubnetworksRequest,SubnetworksClient.ListPagedResponse> listPagedCallable()

Retrieves a list of subnetworks available to the specified 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()) {
   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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListSubnetworksRequest,ListPagedResponse>

listUsable(ListUsableSubnetworksRequest request)

public final SubnetworksClient.ListUsablePagedResponse listUsable(ListUsableSubnetworksRequest request)

Retrieves an aggregated list of all usable subnetworks in the 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()) {
   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);
   }
 }
 
Parameter
Name Description
request ListUsableSubnetworksRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SubnetworksClient.ListUsablePagedResponse

listUsable(String project)

public final SubnetworksClient.ListUsablePagedResponse listUsable(String project)

Retrieves an aggregated list of all usable subnetworks in the 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);
   }
 }
 
Parameter
Name Description
project String

Project ID for this request.

Returns
Type Description
SubnetworksClient.ListUsablePagedResponse

listUsableCallable()

public final UnaryCallable<ListUsableSubnetworksRequest,UsableSubnetworksAggregatedList> listUsableCallable()

Retrieves an aggregated list of all usable subnetworks in the 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()) {
   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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListUsableSubnetworksRequest,UsableSubnetworksAggregatedList>

listUsablePagedCallable()

public final UnaryCallable<ListUsableSubnetworksRequest,SubnetworksClient.ListUsablePagedResponse> listUsablePagedCallable()

Retrieves an aggregated list of all usable subnetworks in the 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()) {
   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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListUsableSubnetworksRequest,ListUsablePagedResponse>

patchAsync(PatchSubnetworkRequest request)

public final OperationFuture<Operation,Operation> patchAsync(PatchSubnetworkRequest request)

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.

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();
 }
 
Parameter
Name Description
request PatchSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

patchAsync(String project, String region, String subnetwork, Subnetwork subnetworkResource)

public final OperationFuture<Operation,Operation> patchAsync(String project, String region, String subnetwork, Subnetwork subnetworkResource)

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.

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();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetwork String

Name of the Subnetwork resource to patch.

subnetworkResource Subnetwork

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchSubnetworkRequest,Operation> patchCallable()

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.

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();
 }
 
Returns
Type Description
UnaryCallable<PatchSubnetworkRequest,Operation>

patchOperationCallable()

public final OperationCallable<PatchSubnetworkRequest,Operation,Operation> patchOperationCallable()

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.

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();
 }
 
Returns
Type Description
OperationCallable<PatchSubnetworkRequest,Operation,Operation>

setIamPolicy(SetIamPolicySubnetworkRequest request)

public final Policy setIamPolicy(SetIamPolicySubnetworkRequest request)

Sets the access control policy on the specified resource. Replaces any existing policy.

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);
 }
 
Parameter
Name Description
request SetIamPolicySubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Policy

setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String region, String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing policy.

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);
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

The name of the region for this request.

resource String

Name or id of the resource for this request.

regionSetPolicyRequestResource RegionSetPolicyRequest

The body resource for this request

Returns
Type Description
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicySubnetworkRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing policy.

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();
 }
 
Returns
Type Description
UnaryCallable<SetIamPolicySubnetworkRequest,Policy>

setPrivateIpGoogleAccessAsync(SetPrivateIpGoogleAccessSubnetworkRequest request)

public final 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.

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();
 }
 
Parameter
Name Description
request SetPrivateIpGoogleAccessSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Operation,Operation>

setPrivateIpGoogleAccessAsync(String project, String region, String subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)

public final 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.

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();
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

Name of the region scoping this request.

subnetwork String

Name of the Subnetwork resource.

subnetworksSetPrivateIpGoogleAccessRequestResource SubnetworksSetPrivateIpGoogleAccessRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

setPrivateIpGoogleAccessCallable()

public final UnaryCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation> setPrivateIpGoogleAccessCallable()

Set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access.

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();
 }
 
Returns
Type Description
UnaryCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation>

setPrivateIpGoogleAccessOperationCallable()

public final OperationCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation,Operation> setPrivateIpGoogleAccessOperationCallable()

Set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access.

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();
 }
 
Returns
Type Description
OperationCallable<SetPrivateIpGoogleAccessSubnetworkRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsSubnetworkRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsSubnetworkRequest request)

Returns permissions that a caller has on the specified 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()) {
   TestIamPermissionsSubnetworkRequest request =
       TestIamPermissionsSubnetworkRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   TestPermissionsResponse response = subnetworksClient.testIamPermissions(request);
 }
 
Parameter
Name Description
request TestIamPermissionsSubnetworkRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
TestPermissionsResponse

testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified 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";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       subnetworksClient.testIamPermissions(
           project, region, resource, testPermissionsRequestResource);
 }
 
Parameters
Name Description
project String

Project ID for this request.

region String

The name of the region for this request.

resource String

Name or id of the resource for this request.

testPermissionsRequestResource TestPermissionsRequest

The body resource for this request

Returns
Type Description
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsSubnetworkRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified 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()) {
   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();
 }
 
Returns
Type Description
UnaryCallable<TestIamPermissionsSubnetworkRequest,TestPermissionsResponse>