Class SubnetworksClient
- java.lang.Object
-
- com.google.cloud.compute.v1.SubnetworksClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class SubnetworksClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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
-
Constructor Summary
Constructors Modifier Constructor Description protected
SubnetworksClient(SubnetworksStub stub)
protected
SubnetworksClient(SubnetworksSettings settings)
Constructs an instance of SubnetworksClient, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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(SubnetworksStub stub)
Constructs an instance of SubnetworksClient, using the given stub for making calls.static SubnetworksClient
create(SubnetworksSettings settings)
Constructs an instance of SubnetworksClient, using the given settings.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(TestIamPermissionsSubnetworkRequest request)
Returns permissions that a caller has on the specified resource.TestPermissionsResponse
testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)
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.
-
-
-
Constructor Detail
-
SubnetworksClient
protected SubnetworksClient(SubnetworksSettings settings) throws IOException
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.- Throws:
IOException
-
SubnetworksClient
protected SubnetworksClient(SubnetworksStub stub)
-
-
Method Detail
-
create
public static final SubnetworksClient create() throws IOException
Constructs an instance of SubnetworksClient with default settings.- Throws:
IOException
-
create
public static final SubnetworksClient create(SubnetworksSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final SubnetworksSettings getSettings()
-
getStub
public SubnetworksStub getStub()
-
aggregatedList
public final SubnetworksClient.AggregatedListPagedResponse aggregatedList(String project)
Retrieves an aggregated list of subnetworks.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); } }
- Parameters:
project
- Project ID for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
aggregatedList
public final SubnetworksClient.AggregatedListPagedResponse aggregatedList(AggregatedListSubnetworksRequest request)
Retrieves an aggregated list of subnetworks.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) .build(); for (Map.Entry<String, SubnetworksScopedList> element : subnetworksClient.aggregatedList(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
aggregatedListPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksRequest,SubnetworksClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
Retrieves an aggregated list of subnetworks.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) .build(); ApiFuture<Map.Entry<String, SubnetworksScopedList>> future = subnetworksClient.aggregatedListPagedCallable().futureCall(request); // Do something. for (Map.Entry<String, SubnetworksScopedList> element : future.get().iterateAll()) { // doThingsWith(element); } }
-
aggregatedListCallable
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksRequest,SubnetworkAggregatedList> aggregatedListCallable()
Retrieves an aggregated list of subnetworks.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) .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; } } }
-
deleteAsync
public final com.google.api.gax.longrunning.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:
project
- Project ID for this request.region
- Name of the region scoping this request.subnetwork
- Name of the Subnetwork resource to delete.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteOperationCallable
public final com.google.api.gax.rpc.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(); }
-
deleteCallable
public final com.google.api.gax.rpc.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(); }
-
expandIpCidrRangeAsync
public final 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.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:
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 request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
expandIpCidrRangeAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
expandIpCidrRangeOperationCallable
public final com.google.api.gax.rpc.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(); }
-
expandIpCidrRangeCallable
public final com.google.api.gax.rpc.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(); }
-
get
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:
project
- Project ID for this request.region
- Name of the region scoping this request.subnetwork
- Name of the Subnetwork resource to return.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
get
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCallable
public final com.google.api.gax.rpc.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(); }
-
getIamPolicy
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:
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.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicy
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicyCallable
public final com.google.api.gax.rpc.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(); }
-
insertAsync
public final 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.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:
project
- Project ID for this request.region
- Name of the region scoping this request.subnetworkResource
- The body resource for this request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final 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.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
insertOperationCallable
public final com.google.api.gax.rpc.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(); }
-
insertCallable
public final com.google.api.gax.rpc.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(); }
-
list
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:
project
- Project ID for this request.region
- Name of the region scoping this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
list
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listCallable
public final com.google.api.gax.rpc.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; } } }
-
listUsable
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); } }
- Parameters:
project
- Project ID for this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listUsable
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listUsablePagedCallable
public final com.google.api.gax.rpc.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); } }
-
listUsableCallable
public final com.google.api.gax.rpc.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; } } }
-
patchAsync
public final 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. 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:
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 request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
patchAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
patchOperationCallable
public final com.google.api.gax.rpc.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(); }
-
patchCallable
public final com.google.api.gax.rpc.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(); }
-
setIamPolicy
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:
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 request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicy
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicyCallable
public final com.google.api.gax.rpc.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(); }
-
setPrivateIpGoogleAccessAsync
public final 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.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:
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 request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setPrivateIpGoogleAccessAsync
@BetaApi("The surface for long-running operations is not stable yet and may change in the future.") public final 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.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setPrivateIpGoogleAccessOperationCallable
public final 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.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(); }
-
setPrivateIpGoogleAccessCallable
public final 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.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(); }
-
testIamPermissions
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:
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 request- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissions
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-