@Generated(value="by gapic-generator") @BetaApi public class SubnetworkClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
}
Note: close() needs to be called on the subnetworkClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SubnetworkSettings to create(). For example:
To customize credentials:
SubnetworkSettings subnetworkSettings =
SubnetworkSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SubnetworkClient subnetworkClient =
SubnetworkClient.create(subnetworkSettings);
To customize the endpoint:
SubnetworkSettings subnetworkSettings =
SubnetworkSettings.newBuilder().setEndpoint(myEndpoint).build();
SubnetworkClient subnetworkClient =
SubnetworkClient.create(subnetworkSettings);
Modifier and Type | Class and Description |
---|---|
static class |
SubnetworkClient.AggregatedListSubnetworksFixedSizeCollection |
static class |
SubnetworkClient.AggregatedListSubnetworksPage |
static class |
SubnetworkClient.AggregatedListSubnetworksPagedResponse |
static class |
SubnetworkClient.ListSubnetworksFixedSizeCollection |
static class |
SubnetworkClient.ListSubnetworksPage |
static class |
SubnetworkClient.ListSubnetworksPagedResponse |
static class |
SubnetworkClient.ListUsableSubnetworksFixedSizeCollection |
static class |
SubnetworkClient.ListUsableSubnetworksPage |
static class |
SubnetworkClient.ListUsableSubnetworksPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
SubnetworkClient(SubnetworkSettings settings)
Constructs an instance of SubnetworkClient, using the given settings.
|
protected |
SubnetworkClient(SubnetworkStub stub) |
Modifier and Type | Method and Description |
---|---|
SubnetworkClient.AggregatedListSubnetworksPagedResponse |
aggregatedListSubnetworks(AggregatedListSubnetworksHttpRequest request)
Retrieves an aggregated list of subnetworks.
|
SubnetworkClient.AggregatedListSubnetworksPagedResponse |
aggregatedListSubnetworks(ProjectName project)
Retrieves an aggregated list of subnetworks.
|
SubnetworkClient.AggregatedListSubnetworksPagedResponse |
aggregatedListSubnetworks(String project)
Retrieves an aggregated list of subnetworks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksHttpRequest,SubnetworkAggregatedList> |
aggregatedListSubnetworksCallable()
Retrieves an aggregated list of subnetworks.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksHttpRequest,SubnetworkClient.AggregatedListSubnetworksPagedResponse> |
aggregatedListSubnetworksPagedCallable()
Retrieves an aggregated list of subnetworks.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SubnetworkClient |
create()
Constructs an instance of SubnetworkClient with default settings.
|
static SubnetworkClient |
create(SubnetworkSettings settings)
Constructs an instance of SubnetworkClient, using the given settings.
|
static SubnetworkClient |
create(SubnetworkStub stub)
Constructs an instance of SubnetworkClient, using the given stub for making calls.
|
Operation |
deleteSubnetwork(DeleteSubnetworkHttpRequest request)
Deletes the specified subnetwork.
|
Operation |
deleteSubnetwork(ProjectRegionSubnetworkName subnetwork)
Deletes the specified subnetwork.
|
Operation |
deleteSubnetwork(String subnetwork)
Deletes the specified subnetwork.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSubnetworkHttpRequest,Operation> |
deleteSubnetworkCallable()
Deletes the specified subnetwork.
|
Operation |
expandIpCidrRangeSubnetwork(ExpandIpCidrRangeSubnetworkHttpRequest request)
Expands the IP CIDR range of the subnetwork to a specified value.
|
Operation |
expandIpCidrRangeSubnetwork(ProjectRegionSubnetworkName subnetwork,
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
Expands the IP CIDR range of the subnetwork to a specified value.
|
Operation |
expandIpCidrRangeSubnetwork(String subnetwork,
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
Expands the IP CIDR range of the subnetwork to a specified value.
|
com.google.api.gax.rpc.UnaryCallable<ExpandIpCidrRangeSubnetworkHttpRequest,Operation> |
expandIpCidrRangeSubnetworkCallable()
Expands the IP CIDR range of the subnetwork to a specified value.
|
Policy |
getIamPolicySubnetwork(GetIamPolicySubnetworkHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicySubnetwork(ProjectRegionSubnetworkResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicySubnetwork(String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicySubnetworkHttpRequest,Policy> |
getIamPolicySubnetworkCallable()
Gets the access control policy for a resource.
|
SubnetworkSettings |
getSettings() |
SubnetworkStub |
getStub() |
Subnetwork |
getSubnetwork(GetSubnetworkHttpRequest request)
Returns the specified subnetwork.
|
Subnetwork |
getSubnetwork(ProjectRegionSubnetworkName subnetwork)
Returns the specified subnetwork.
|
Subnetwork |
getSubnetwork(String subnetwork)
Returns the specified subnetwork.
|
com.google.api.gax.rpc.UnaryCallable<GetSubnetworkHttpRequest,Subnetwork> |
getSubnetworkCallable()
Returns the specified subnetwork.
|
Operation |
insertSubnetwork(InsertSubnetworkHttpRequest request)
Creates a subnetwork in the specified project using the data included in the request.
|
Operation |
insertSubnetwork(ProjectRegionName region,
Subnetwork subnetworkResource)
Creates a subnetwork in the specified project using the data included in the request.
|
Operation |
insertSubnetwork(String region,
Subnetwork subnetworkResource)
Creates a subnetwork in the specified project using the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<InsertSubnetworkHttpRequest,Operation> |
insertSubnetworkCallable()
Creates a subnetwork in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
SubnetworkClient.ListSubnetworksPagedResponse |
listSubnetworks(ListSubnetworksHttpRequest request)
Retrieves a list of subnetworks available to the specified project.
|
SubnetworkClient.ListSubnetworksPagedResponse |
listSubnetworks(ProjectRegionName region)
Retrieves a list of subnetworks available to the specified project.
|
SubnetworkClient.ListSubnetworksPagedResponse |
listSubnetworks(String region)
Retrieves a list of subnetworks available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubnetworksHttpRequest,SubnetworkList> |
listSubnetworksCallable()
Retrieves a list of subnetworks available to the specified project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubnetworksHttpRequest,SubnetworkClient.ListSubnetworksPagedResponse> |
listSubnetworksPagedCallable()
Retrieves a list of subnetworks available to the specified project.
|
SubnetworkClient.ListUsableSubnetworksPagedResponse |
listUsableSubnetworks(ListUsableSubnetworksHttpRequest request)
Retrieves an aggregated list of all usable subnetworks in the project.
|
SubnetworkClient.ListUsableSubnetworksPagedResponse |
listUsableSubnetworks(ProjectName project)
Retrieves an aggregated list of all usable subnetworks in the project.
|
SubnetworkClient.ListUsableSubnetworksPagedResponse |
listUsableSubnetworks(String project)
Retrieves an aggregated list of all usable subnetworks in the project.
|
com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksHttpRequest,UsableSubnetworksAggregatedList> |
listUsableSubnetworksCallable()
Retrieves an aggregated list of all usable subnetworks in the project.
|
com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksHttpRequest,SubnetworkClient.ListUsableSubnetworksPagedResponse> |
listUsableSubnetworksPagedCallable()
Retrieves an aggregated list of all usable subnetworks in the project.
|
Operation |
patchSubnetwork(PatchSubnetworkHttpRequest request)
Patches the specified subnetwork with the data included in the request.
|
Operation |
patchSubnetwork(ProjectRegionSubnetworkName subnetwork,
Subnetwork subnetworkResource,
List<String> fieldMask)
Patches the specified subnetwork with the data included in the request.
|
Operation |
patchSubnetwork(String subnetwork,
Subnetwork subnetworkResource,
List<String> fieldMask)
Patches the specified subnetwork with the data included in the request.
|
com.google.api.gax.rpc.UnaryCallable<PatchSubnetworkHttpRequest,Operation> |
patchSubnetworkCallable()
Patches the specified subnetwork with the data included in the request.
|
Policy |
setIamPolicySubnetwork(ProjectRegionSubnetworkResourceName resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicySubnetwork(SetIamPolicySubnetworkHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicySubnetwork(String resource,
RegionSetPolicyRequest regionSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicySubnetworkHttpRequest,Policy> |
setIamPolicySubnetworkCallable()
Sets the access control policy on the specified resource.
|
Operation |
setPrivateIpGoogleAccessSubnetwork(ProjectRegionSubnetworkName subnetwork,
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
Operation |
setPrivateIpGoogleAccessSubnetwork(SetPrivateIpGoogleAccessSubnetworkHttpRequest request)
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
Operation |
setPrivateIpGoogleAccessSubnetwork(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<SetPrivateIpGoogleAccessSubnetworkHttpRequest,Operation> |
setPrivateIpGoogleAccessSubnetworkCallable()
Set whether VMs in this subnet can access Google services without assigning external IP
addresses through Private Google Access.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsSubnetwork(ProjectRegionSubnetworkResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsSubnetwork(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsSubnetwork(TestIamPermissionsSubnetworkHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsSubnetworkHttpRequest,TestPermissionsResponse> |
testIamPermissionsSubnetworkCallable()
Returns permissions that a caller has on the specified resource.
|
protected SubnetworkClient(SubnetworkSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected SubnetworkClient(SubnetworkStub stub)
public static final SubnetworkClient create() throws IOException
IOException
public static final SubnetworkClient create(SubnetworkSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final SubnetworkClient create(SubnetworkStub stub)
public final SubnetworkSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public SubnetworkStub getStub()
@BetaApi public final SubnetworkClient.AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks(ProjectName project)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks(String project)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.AggregatedListSubnetworksPagedResponse aggregatedListSubnetworks(AggregatedListSubnetworksHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (SubnetworksScopedList element : subnetworkClient.aggregatedListSubnetworks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksHttpRequest,SubnetworkClient.AggregatedListSubnetworksPagedResponse> aggregatedListSubnetworksPagedCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListSubnetworksPagedResponse> future = subnetworkClient.aggregatedListSubnetworksPagedCallable().futureCall(request);
// Do something
for (SubnetworksScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListSubnetworksHttpRequest,SubnetworkAggregatedList> aggregatedListSubnetworksCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListSubnetworksHttpRequest request = AggregatedListSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
SubnetworkAggregatedList response = subnetworkClient.aggregatedListSubnetworksCallable().call(request);
for (SubnetworksScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteSubnetwork(ProjectRegionSubnetworkName subnetwork)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
}
subnetwork
- Name of the Subnetwork resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteSubnetwork(String subnetwork)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Operation response = subnetworkClient.deleteSubnetwork(subnetwork.toString());
}
subnetwork
- Name of the Subnetwork resource to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteSubnetwork(DeleteSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
DeleteSubnetworkHttpRequest request = DeleteSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.build();
Operation response = subnetworkClient.deleteSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteSubnetworkHttpRequest,Operation> deleteSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
DeleteSubnetworkHttpRequest request = DeleteSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.build();
ApiFuture<Operation> future = subnetworkClient.deleteSubnetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation expandIpCidrRangeSubnetwork(ProjectRegionSubnetworkName subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(subnetwork, subnetworksExpandIpCidrRangeRequestResource);
}
subnetwork
- Name of the Subnetwork resource to update.subnetworksExpandIpCidrRangeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation expandIpCidrRangeSubnetwork(String subnetwork, SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(subnetwork.toString(), subnetworksExpandIpCidrRangeRequestResource);
}
subnetwork
- Name of the Subnetwork resource to update.subnetworksExpandIpCidrRangeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation expandIpCidrRangeSubnetwork(ExpandIpCidrRangeSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
ExpandIpCidrRangeSubnetworkHttpRequest request = ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworksExpandIpCidrRangeRequestResource(subnetworksExpandIpCidrRangeRequestResource)
.build();
Operation response = subnetworkClient.expandIpCidrRangeSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ExpandIpCidrRangeSubnetworkHttpRequest,Operation> expandIpCidrRangeSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksExpandIpCidrRangeRequest subnetworksExpandIpCidrRangeRequestResource = SubnetworksExpandIpCidrRangeRequest.newBuilder().build();
ExpandIpCidrRangeSubnetworkHttpRequest request = ExpandIpCidrRangeSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworksExpandIpCidrRangeRequestResource(subnetworksExpandIpCidrRangeRequestResource)
.build();
ApiFuture<Operation> future = subnetworkClient.expandIpCidrRangeSubnetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Subnetwork getSubnetwork(ProjectRegionSubnetworkName subnetwork)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork response = subnetworkClient.getSubnetwork(subnetwork);
}
subnetwork
- Name of the Subnetwork resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Subnetwork getSubnetwork(String subnetwork)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork response = subnetworkClient.getSubnetwork(subnetwork.toString());
}
subnetwork
- Name of the Subnetwork resource to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Subnetwork getSubnetwork(GetSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
GetSubnetworkHttpRequest request = GetSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.build();
Subnetwork response = subnetworkClient.getSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetSubnetworkHttpRequest,Subnetwork> getSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
GetSubnetworkHttpRequest request = GetSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.build();
ApiFuture<Subnetwork> future = subnetworkClient.getSubnetworkCallable().futureCall(request);
// Do something
Subnetwork response = future.get();
}
@BetaApi public final Policy getIamPolicySubnetwork(ProjectRegionSubnetworkResourceName resource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
Policy response = subnetworkClient.getIamPolicySubnetwork(resource);
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicySubnetwork(String resource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
Policy response = subnetworkClient.getIamPolicySubnetwork(resource.toString());
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicySubnetwork(GetIamPolicySubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
GetIamPolicySubnetworkHttpRequest request = GetIamPolicySubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = subnetworkClient.getIamPolicySubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicySubnetworkHttpRequest,Policy> getIamPolicySubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
GetIamPolicySubnetworkHttpRequest request = GetIamPolicySubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = subnetworkClient.getIamPolicySubnetworkCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation insertSubnetwork(ProjectRegionName region, Subnetwork subnetworkResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
Operation response = subnetworkClient.insertSubnetwork(region, subnetworkResource);
}
region
- Name of the region scoping this request.subnetworkResource
- Represents a Subnetwork resource.
A subnetwork (also known as a subnet) is a logical partition of a Virtual Private Cloud network with one primary IP range and zero or more secondary IP ranges. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for beta.subnetworks ==) (== resource_for v1.subnetworks ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertSubnetwork(String region, Subnetwork subnetworkResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
Operation response = subnetworkClient.insertSubnetwork(region.toString(), subnetworkResource);
}
region
- Name of the region scoping this request.subnetworkResource
- Represents a Subnetwork resource.
A subnetwork (also known as a subnet) is a logical partition of a Virtual Private Cloud network with one primary IP range and zero or more secondary IP ranges. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for beta.subnetworks ==) (== resource_for v1.subnetworks ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertSubnetwork(InsertSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setSubnetworkResource(subnetworkResource)
.build();
Operation response = subnetworkClient.insertSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertSubnetworkHttpRequest,Operation> insertSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
InsertSubnetworkHttpRequest request = InsertSubnetworkHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setSubnetworkResource(subnetworkResource)
.build();
ApiFuture<Operation> future = subnetworkClient.insertSubnetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final SubnetworkClient.ListSubnetworksPagedResponse listSubnetworks(ProjectRegionName region)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Subnetwork element : subnetworkClient.listSubnetworks(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.ListSubnetworksPagedResponse listSubnetworks(String region)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Subnetwork element : subnetworkClient.listSubnetworks(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.ListSubnetworksPagedResponse listSubnetworks(ListSubnetworksHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (Subnetwork element : subnetworkClient.listSubnetworks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListSubnetworksHttpRequest,SubnetworkClient.ListSubnetworksPagedResponse> listSubnetworksPagedCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListSubnetworksPagedResponse> future = subnetworkClient.listSubnetworksPagedCallable().futureCall(request);
// Do something
for (Subnetwork element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListSubnetworksHttpRequest,SubnetworkList> listSubnetworksCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListSubnetworksHttpRequest request = ListSubnetworksHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
SubnetworkList response = subnetworkClient.listSubnetworksCallable().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;
}
}
}
@BetaApi public final SubnetworkClient.ListUsableSubnetworksPagedResponse listUsableSubnetworks(ProjectName project)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UsableSubnetwork element : subnetworkClient.listUsableSubnetworks(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.ListUsableSubnetworksPagedResponse listUsableSubnetworks(String project)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (UsableSubnetwork element : subnetworkClient.listUsableSubnetworks(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final SubnetworkClient.ListUsableSubnetworksPagedResponse listUsableSubnetworks(ListUsableSubnetworksHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUsableSubnetworksHttpRequest request = ListUsableSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (UsableSubnetwork element : subnetworkClient.listUsableSubnetworks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksHttpRequest,SubnetworkClient.ListUsableSubnetworksPagedResponse> listUsableSubnetworksPagedCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUsableSubnetworksHttpRequest request = ListUsableSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListUsableSubnetworksPagedResponse> future = subnetworkClient.listUsableSubnetworksPagedCallable().futureCall(request);
// Do something
for (UsableSubnetwork element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListUsableSubnetworksHttpRequest,UsableSubnetworksAggregatedList> listUsableSubnetworksCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListUsableSubnetworksHttpRequest request = ListUsableSubnetworksHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
UsableSubnetworksAggregatedList response = subnetworkClient.listUsableSubnetworksCallable().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;
}
}
}
@BetaApi public final Operation patchSubnetwork(ProjectRegionSubnetworkName subnetwork, Subnetwork subnetworkResource, List<String> fieldMask)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = subnetworkClient.patchSubnetwork(subnetwork, subnetworkResource, fieldMask);
}
subnetwork
- Name of the Subnetwork resource to patch.subnetworkResource
- Represents a Subnetwork resource.
A subnetwork (also known as a subnet) is a logical partition of a Virtual Private Cloud network with one primary IP range and zero or more secondary IP ranges. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for beta.subnetworks ==) (== resource_for v1.subnetworks ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchSubnetwork(String subnetwork, Subnetwork subnetworkResource, List<String> fieldMask)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = subnetworkClient.patchSubnetwork(subnetwork.toString(), subnetworkResource, fieldMask);
}
subnetwork
- Name of the Subnetwork resource to patch.subnetworkResource
- Represents a Subnetwork resource.
A subnetwork (also known as a subnet) is a logical partition of a Virtual Private Cloud network with one primary IP range and zero or more secondary IP ranges. For more information, read Virtual Private Cloud (VPC) Network. (== resource_for beta.subnetworks ==) (== resource_for v1.subnetworks ==)
fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation patchSubnetwork(PatchSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchSubnetworkHttpRequest request = PatchSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworkResource(subnetworkResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = subnetworkClient.patchSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<PatchSubnetworkHttpRequest,Operation> patchSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
Subnetwork subnetworkResource = Subnetwork.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchSubnetworkHttpRequest request = PatchSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworkResource(subnetworkResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = subnetworkClient.patchSubnetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Policy setIamPolicySubnetwork(ProjectRegionSubnetworkResourceName resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
Policy response = subnetworkClient.setIamPolicySubnetwork(resource, regionSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.regionSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicySubnetwork(String resource, RegionSetPolicyRequest regionSetPolicyRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
Policy response = subnetworkClient.setIamPolicySubnetwork(resource.toString(), regionSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.regionSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicySubnetwork(SetIamPolicySubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
SetIamPolicySubnetworkHttpRequest request = SetIamPolicySubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetPolicyRequestResource(regionSetPolicyRequestResource)
.build();
Policy response = subnetworkClient.setIamPolicySubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicySubnetworkHttpRequest,Policy> setIamPolicySubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetPolicyRequest regionSetPolicyRequestResource = RegionSetPolicyRequest.newBuilder().build();
SetIamPolicySubnetworkHttpRequest request = SetIamPolicySubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetPolicyRequestResource(regionSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = subnetworkClient.setIamPolicySubnetworkCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation setPrivateIpGoogleAccessSubnetwork(ProjectRegionSubnetworkName subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource);
}
subnetwork
- Name of the Subnetwork resource.subnetworksSetPrivateIpGoogleAccessRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setPrivateIpGoogleAccessSubnetwork(String subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(subnetwork.toString(), subnetworksSetPrivateIpGoogleAccessRequestResource);
}
subnetwork
- Name of the Subnetwork resource.subnetworksSetPrivateIpGoogleAccessRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setPrivateIpGoogleAccessSubnetwork(SetPrivateIpGoogleAccessSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
SetPrivateIpGoogleAccessSubnetworkHttpRequest request = SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworksSetPrivateIpGoogleAccessRequestResource(subnetworksSetPrivateIpGoogleAccessRequestResource)
.build();
Operation response = subnetworkClient.setPrivateIpGoogleAccessSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetPrivateIpGoogleAccessSubnetworkHttpRequest,Operation> setPrivateIpGoogleAccessSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedSubnetwork = ProjectRegionSubnetworkName.format("[PROJECT]", "[REGION]", "[SUBNETWORK]");
SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = SubnetworksSetPrivateIpGoogleAccessRequest.newBuilder().build();
SetPrivateIpGoogleAccessSubnetworkHttpRequest request = SetPrivateIpGoogleAccessSubnetworkHttpRequest.newBuilder()
.setSubnetwork(formattedSubnetwork)
.setSubnetworksSetPrivateIpGoogleAccessRequestResource(subnetworksSetPrivateIpGoogleAccessRequestResource)
.build();
ApiFuture<Operation> future = subnetworkClient.setPrivateIpGoogleAccessSubnetworkCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsSubnetwork(ProjectRegionSubnetworkResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = subnetworkClient.testIamPermissionsSubnetwork(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsSubnetwork(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
ProjectRegionSubnetworkResourceName resource = ProjectRegionSubnetworkResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = subnetworkClient.testIamPermissionsSubnetwork(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsSubnetwork(TestIamPermissionsSubnetworkHttpRequest request)
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsSubnetworkHttpRequest request = TestIamPermissionsSubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = subnetworkClient.testIamPermissionsSubnetwork(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsSubnetworkHttpRequest,TestPermissionsResponse> testIamPermissionsSubnetworkCallable()
Sample code:
try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
String formattedResource = ProjectRegionSubnetworkResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsSubnetworkHttpRequest request = TestIamPermissionsSubnetworkHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = subnetworkClient.testIamPermissionsSubnetworkCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.