- 1.55.0 (latest)
- 1.54.0
- 1.53.0
- 1.52.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.1.10
GitHub Repository | Product Reference |
Service Description: The Reachability service in the Google Cloud Network Management API provides services that analyze the reachability within a single Google Virtual Private Cloud (VPC) network, between peered VPC networks, between VPC and on-premises networks, or between VPC networks and internet hosts. A reachability analysis is based on Google Cloud network configurations.
You can use the analysis results to verify these configurations and to troubleshoot connectivity issues.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ConnectivityTestName name = ConnectivityTestName.of("[PROJECT]", "[TEST]");
ConnectivityTest response = reachabilityServiceClient.getConnectivityTest(name);
}
Note: close() needs to be called on the ReachabilityServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
Method | Description | Method Variants |
---|---|---|
ListConnectivityTests |
Lists all Connectivity Tests owned by a project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetConnectivityTest |
Gets the details of a specific Connectivity Test. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateConnectivityTest |
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in If the endpoint specifications in |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateConnectivityTest |
Updates the configuration of an existing If the endpoint specifications in If the endpoint specifications in |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RerunConnectivityTest |
Rerun an existing Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteConnectivityTest |
Deletes a specific |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ReachabilityServiceSettings 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
ReachabilityServiceSettings reachabilityServiceSettings =
ReachabilityServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReachabilityServiceClient reachabilityServiceClient =
ReachabilityServiceClient.create(reachabilityServiceSettings);
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
ReachabilityServiceSettings reachabilityServiceSettings =
ReachabilityServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ReachabilityServiceClient reachabilityServiceClient =
ReachabilityServiceClient.create(reachabilityServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
ReachabilityServiceSettings reachabilityServiceSettings =
ReachabilityServiceSettings.newHttpJsonBuilder().build();
ReachabilityServiceClient reachabilityServiceClient =
ReachabilityServiceClient.create(reachabilityServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ReachabilityServiceClient create()
Constructs an instance of ReachabilityServiceClient with default settings.
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ReachabilityServiceSettings settings)
public static final ReachabilityServiceClient create(ReachabilityServiceSettings settings)
Constructs an instance of ReachabilityServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings |
ReachabilityServiceSettings |
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ReachabilityServiceStub stub)
public static final ReachabilityServiceClient create(ReachabilityServiceStub stub)
Constructs an instance of ReachabilityServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ReachabilityServiceSettings).
Parameter | |
---|---|
Name | Description |
stub |
ReachabilityServiceStub |
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient |
Constructors
ReachabilityServiceClient(ReachabilityServiceSettings settings)
protected ReachabilityServiceClient(ReachabilityServiceSettings settings)
Constructs an instance of ReachabilityServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings |
ReachabilityServiceSettings |
ReachabilityServiceClient(ReachabilityServiceStub stub)
protected ReachabilityServiceClient(ReachabilityServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub |
ReachabilityServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createConnectivityTestAsync(CreateConnectivityTestRequest request)
public final OperationFuture<ConnectivityTest,OperationMetadata> createConnectivityTestAsync(CreateConnectivityTestRequest request)
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest
are invalid (for example, containing
non-existent resources in the network, or you don't have read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of <code>AMBIGUOUS</code>. For more information, see the
Connectivity Test documentation.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
CreateConnectivityTestRequest request =
CreateConnectivityTestRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTestId("testId-877170355")
.setResource(ConnectivityTest.newBuilder().build())
.build();
ConnectivityTest response =
reachabilityServiceClient.createConnectivityTestAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
CreateConnectivityTestRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
createConnectivityTestAsync(ProjectName parent, String testId, ConnectivityTest resource)
public final OperationFuture<ConnectivityTest,OperationMetadata> createConnectivityTestAsync(ProjectName parent, String testId, ConnectivityTest resource)
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest
are invalid (for example, containing
non-existent resources in the network, or you don't have read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of <code>AMBIGUOUS</code>. For more information, see the
Connectivity Test documentation.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String testId = "testId-877170355";
ConnectivityTest resource = ConnectivityTest.newBuilder().build();
ConnectivityTest response =
reachabilityServiceClient.createConnectivityTestAsync(parent, testId, resource).get();
}
Parameters | |
---|---|
Name | Description |
parent |
ProjectName Required. The parent resource of the Connectivity Test to create:
|
testId |
String Required. The logical name of the Connectivity Test in your project with the following restrictions:
|
resource |
ConnectivityTest Required. A |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
createConnectivityTestAsync(String parent, String testId, ConnectivityTest resource)
public final OperationFuture<ConnectivityTest,OperationMetadata> createConnectivityTestAsync(String parent, String testId, ConnectivityTest resource)
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest
are invalid (for example, containing
non-existent resources in the network, or you don't have read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of <code>AMBIGUOUS</code>. For more information, see the
Connectivity Test documentation.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
String testId = "testId-877170355";
ConnectivityTest resource = ConnectivityTest.newBuilder().build();
ConnectivityTest response =
reachabilityServiceClient.createConnectivityTestAsync(parent, testId, resource).get();
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent resource of the Connectivity Test to create:
|
testId |
String Required. The logical name of the Connectivity Test in your project with the following restrictions:
|
resource |
ConnectivityTest Required. A |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
createConnectivityTestCallable()
public final UnaryCallable<CreateConnectivityTestRequest,Operation> createConnectivityTestCallable()
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest
are invalid (for example, containing
non-existent resources in the network, or you don't have read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of <code>AMBIGUOUS</code>. For more information, see the
Connectivity Test documentation.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
CreateConnectivityTestRequest request =
CreateConnectivityTestRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTestId("testId-877170355")
.setResource(ConnectivityTest.newBuilder().build())
.build();
ApiFuture<Operation> future =
reachabilityServiceClient.createConnectivityTestCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateConnectivityTestRequest,Operation> |
createConnectivityTestOperationCallable()
public final OperationCallable<CreateConnectivityTestRequest,ConnectivityTest,OperationMetadata> createConnectivityTestOperationCallable()
Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.
If the endpoint specifications in ConnectivityTest
are invalid (for example, containing
non-existent resources in the network, or you don't have read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of <code>AMBIGUOUS</code>. For more information, see the
Connectivity Test documentation.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
CreateConnectivityTestRequest request =
CreateConnectivityTestRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setTestId("testId-877170355")
.setResource(ConnectivityTest.newBuilder().build())
.build();
OperationFuture<ConnectivityTest, OperationMetadata> future =
reachabilityServiceClient.createConnectivityTestOperationCallable().futureCall(request);
// Do something.
ConnectivityTest response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateConnectivityTestRequest,ConnectivityTest,OperationMetadata> |
deleteConnectivityTestAsync(ConnectivityTestName name)
public final OperationFuture<Empty,OperationMetadata> deleteConnectivityTestAsync(ConnectivityTestName name)
Deletes a specific ConnectivityTest
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ConnectivityTestName name = ConnectivityTestName.of("[PROJECT]", "[TEST]");
reachabilityServiceClient.deleteConnectivityTestAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name |
ConnectivityTestName Required. Connectivity Test resource name using the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteConnectivityTestAsync(DeleteConnectivityTestRequest request)
public final OperationFuture<Empty,OperationMetadata> deleteConnectivityTestAsync(DeleteConnectivityTestRequest request)
Deletes a specific ConnectivityTest
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
DeleteConnectivityTestRequest request =
DeleteConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
reachabilityServiceClient.deleteConnectivityTestAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
DeleteConnectivityTestRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteConnectivityTestAsync(String name)
public final OperationFuture<Empty,OperationMetadata> deleteConnectivityTestAsync(String name)
Deletes a specific ConnectivityTest
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
String name = ConnectivityTestName.of("[PROJECT]", "[TEST]").toString();
reachabilityServiceClient.deleteConnectivityTestAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Connectivity Test resource name using the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deleteConnectivityTestCallable()
public final UnaryCallable<DeleteConnectivityTestRequest,Operation> deleteConnectivityTestCallable()
Deletes a specific ConnectivityTest
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
DeleteConnectivityTestRequest request =
DeleteConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
ApiFuture<Operation> future =
reachabilityServiceClient.deleteConnectivityTestCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteConnectivityTestRequest,Operation> |
deleteConnectivityTestOperationCallable()
public final OperationCallable<DeleteConnectivityTestRequest,Empty,OperationMetadata> deleteConnectivityTestOperationCallable()
Deletes a specific ConnectivityTest
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
DeleteConnectivityTestRequest request =
DeleteConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
OperationFuture<Empty, OperationMetadata> future =
reachabilityServiceClient.deleteConnectivityTestOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteConnectivityTestRequest,Empty,OperationMetadata> |
getConnectivityTest(ConnectivityTestName name)
public final ConnectivityTest getConnectivityTest(ConnectivityTestName name)
Gets the details of a specific Connectivity Test.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ConnectivityTestName name = ConnectivityTestName.of("[PROJECT]", "[TEST]");
ConnectivityTest response = reachabilityServiceClient.getConnectivityTest(name);
}
Parameter | |
---|---|
Name | Description |
name |
ConnectivityTestName Required. |
Returns | |
---|---|
Type | Description |
ConnectivityTest |
getConnectivityTest(GetConnectivityTestRequest request)
public final ConnectivityTest getConnectivityTest(GetConnectivityTestRequest request)
Gets the details of a specific Connectivity Test.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetConnectivityTestRequest request =
GetConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
ConnectivityTest response = reachabilityServiceClient.getConnectivityTest(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetConnectivityTestRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ConnectivityTest |
getConnectivityTest(String name)
public final ConnectivityTest getConnectivityTest(String name)
Gets the details of a specific Connectivity Test.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
String name = ConnectivityTestName.of("[PROJECT]", "[TEST]").toString();
ConnectivityTest response = reachabilityServiceClient.getConnectivityTest(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. |
Returns | |
---|---|
Type | Description |
ConnectivityTest |
getConnectivityTestCallable()
public final UnaryCallable<GetConnectivityTestRequest,ConnectivityTest> getConnectivityTestCallable()
Gets the details of a specific Connectivity Test.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetConnectivityTestRequest request =
GetConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
ApiFuture<ConnectivityTest> future =
reachabilityServiceClient.getConnectivityTestCallable().futureCall(request);
// Do something.
ConnectivityTest response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetConnectivityTestRequest,ConnectivityTest> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = reachabilityServiceClient.getIamPolicy(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
reachabilityServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
Gets information about a location.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = reachabilityServiceClient.getLocation(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
Gets information about a location.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
reachabilityServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final ReachabilityServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
ReachabilityServiceSettings |
getStub()
public ReachabilityServiceStub getStub()
Returns | |
---|---|
Type | Description |
ReachabilityServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listConnectivityTests(ListConnectivityTestsRequest request)
public final ReachabilityServiceClient.ListConnectivityTestsPagedResponse listConnectivityTests(ListConnectivityTestsRequest request)
Lists all Connectivity Tests owned by a 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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListConnectivityTestsRequest request =
ListConnectivityTestsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for (ConnectivityTest element :
reachabilityServiceClient.listConnectivityTests(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListConnectivityTestsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient.ListConnectivityTestsPagedResponse |
listConnectivityTests(ProjectName parent)
public final ReachabilityServiceClient.ListConnectivityTestsPagedResponse listConnectivityTests(ProjectName parent)
Lists all Connectivity Tests owned by a 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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (ConnectivityTest element :
reachabilityServiceClient.listConnectivityTests(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
ProjectName Required. The parent resource of the Connectivity Tests:
|
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient.ListConnectivityTestsPagedResponse |
listConnectivityTests(String parent)
public final ReachabilityServiceClient.ListConnectivityTestsPagedResponse listConnectivityTests(String parent)
Lists all Connectivity Tests owned by a 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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
for (ConnectivityTest element :
reachabilityServiceClient.listConnectivityTests(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent resource of the Connectivity Tests:
|
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient.ListConnectivityTestsPagedResponse |
listConnectivityTestsCallable()
public final UnaryCallable<ListConnectivityTestsRequest,ListConnectivityTestsResponse> listConnectivityTestsCallable()
Lists all Connectivity Tests owned by a 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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListConnectivityTestsRequest request =
ListConnectivityTestsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
ListConnectivityTestsResponse response =
reachabilityServiceClient.listConnectivityTestsCallable().call(request);
for (ConnectivityTest element : response.getResourcesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListConnectivityTestsRequest,ListConnectivityTestsResponse> |
listConnectivityTestsPagedCallable()
public final UnaryCallable<ListConnectivityTestsRequest,ReachabilityServiceClient.ListConnectivityTestsPagedResponse> listConnectivityTestsPagedCallable()
Lists all Connectivity Tests owned by a 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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListConnectivityTestsRequest request =
ListConnectivityTestsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<ConnectivityTest> future =
reachabilityServiceClient.listConnectivityTestsPagedCallable().futureCall(request);
// Do something.
for (ConnectivityTest element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListConnectivityTestsRequest,ListConnectivityTestsPagedResponse> |
listLocations(ListLocationsRequest request)
public final ReachabilityServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)
Lists information about the supported locations for this service.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : reachabilityServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ReachabilityServiceClient.ListLocationsPagedResponse |
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
Lists information about the supported locations for this service.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
reachabilityServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,ReachabilityServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Lists information about the supported locations for this service.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
reachabilityServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
rerunConnectivityTestAsync(RerunConnectivityTestRequest request)
public final OperationFuture<ConnectivityTest,OperationMetadata> rerunConnectivityTestAsync(RerunConnectivityTestRequest request)
Rerun an existing ConnectivityTest
. After the user triggers the rerun, the reachability
analysis is performed as part of the long running operation, which completes when the analysis
completes.
Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes.
If the endpoint specifications in ConnectivityTest
become invalid (for example, specified
resources are deleted in the network, or you lost read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
RerunConnectivityTestRequest request =
RerunConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
ConnectivityTest response =
reachabilityServiceClient.rerunConnectivityTestAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
RerunConnectivityTestRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
rerunConnectivityTestCallable()
public final UnaryCallable<RerunConnectivityTestRequest,Operation> rerunConnectivityTestCallable()
Rerun an existing ConnectivityTest
. After the user triggers the rerun, the reachability
analysis is performed as part of the long running operation, which completes when the analysis
completes.
Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes.
If the endpoint specifications in ConnectivityTest
become invalid (for example, specified
resources are deleted in the network, or you lost read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
RerunConnectivityTestRequest request =
RerunConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
ApiFuture<Operation> future =
reachabilityServiceClient.rerunConnectivityTestCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<RerunConnectivityTestRequest,Operation> |
rerunConnectivityTestOperationCallable()
public final OperationCallable<RerunConnectivityTestRequest,ConnectivityTest,OperationMetadata> rerunConnectivityTestOperationCallable()
Rerun an existing ConnectivityTest
. After the user triggers the rerun, the reachability
analysis is performed as part of the long running operation, which completes when the analysis
completes.
Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes.
If the endpoint specifications in ConnectivityTest
become invalid (for example, specified
resources are deleted in the network, or you lost read permissions to the network
configurations of listed projects), then the reachability result returns a value of UNKNOWN
.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
RerunConnectivityTestRequest request =
RerunConnectivityTestRequest.newBuilder()
.setName(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.build();
OperationFuture<ConnectivityTest, OperationMetadata> future =
reachabilityServiceClient.rerunConnectivityTestOperationCallable().futureCall(request);
// Do something.
ConnectivityTest response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<RerunConnectivityTestRequest,ConnectivityTest,OperationMetadata> |
setIamPolicy(SetIamPolicyRequest request)
public final Policy setIamPolicy(SetIamPolicyRequest request)
Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = reachabilityServiceClient.setIamPolicy(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.iam.v1.SetIamPolicyRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
setIamPolicyCallable()
public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()
Sets the access control policy on the specified resource. Replacesany existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
reachabilityServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
testIamPermissions(TestIamPermissionsRequest request)
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = reachabilityServiceClient.testIamPermissions(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.iam.v1.TestIamPermissionsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissionsCallable()
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource. If theresource does not exist,
this will return an empty set ofpermissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(ConnectivityTestName.of("[PROJECT]", "[TEST]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
reachabilityServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
updateConnectivityTestAsync(UpdateConnectivityTestRequest request)
public final OperationFuture<ConnectivityTest,OperationMetadata> updateConnectivityTestAsync(UpdateConnectivityTestRequest request)
Updates the configuration of an existing ConnectivityTest
. After you update a test, the
reachability analysis is performed as part of the long running operation, which completes when
the analysis completes. The Reachability state in the test resource is updated with the new
result.
If the endpoint specifications in ConnectivityTest
are invalid (for example, they contain
non-existent resources in the network, or the user does not have read permissions to the
network configurations of listed projects), then the reachability result returns a value of
<code>UNKNOWN</code>.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of AMBIGUOUS
. See the documentation in ConnectivityTest
for more details.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
UpdateConnectivityTestRequest request =
UpdateConnectivityTestRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(ConnectivityTest.newBuilder().build())
.build();
ConnectivityTest response =
reachabilityServiceClient.updateConnectivityTestAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
UpdateConnectivityTestRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
updateConnectivityTestAsync(FieldMask updateMask, ConnectivityTest resource)
public final OperationFuture<ConnectivityTest,OperationMetadata> updateConnectivityTestAsync(FieldMask updateMask, ConnectivityTest resource)
Updates the configuration of an existing ConnectivityTest
. After you update a test, the
reachability analysis is performed as part of the long running operation, which completes when
the analysis completes. The Reachability state in the test resource is updated with the new
result.
If the endpoint specifications in ConnectivityTest
are invalid (for example, they contain
non-existent resources in the network, or the user does not have read permissions to the
network configurations of listed projects), then the reachability result returns a value of
<code>UNKNOWN</code>.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of AMBIGUOUS
. See the documentation in ConnectivityTest
for more details.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
FieldMask updateMask = FieldMask.newBuilder().build();
ConnectivityTest resource = ConnectivityTest.newBuilder().build();
ConnectivityTest response =
reachabilityServiceClient.updateConnectivityTestAsync(updateMask, resource).get();
}
Parameters | |
---|---|
Name | Description |
updateMask |
FieldMask Required. Mask of fields to update. At least one path must be supplied in this field. |
resource |
ConnectivityTest Required. Only fields specified in update_mask are updated. |
Returns | |
---|---|
Type | Description |
OperationFuture<ConnectivityTest,OperationMetadata> |
updateConnectivityTestCallable()
public final UnaryCallable<UpdateConnectivityTestRequest,Operation> updateConnectivityTestCallable()
Updates the configuration of an existing ConnectivityTest
. After you update a test, the
reachability analysis is performed as part of the long running operation, which completes when
the analysis completes. The Reachability state in the test resource is updated with the new
result.
If the endpoint specifications in ConnectivityTest
are invalid (for example, they contain
non-existent resources in the network, or the user does not have read permissions to the
network configurations of listed projects), then the reachability result returns a value of
<code>UNKNOWN</code>.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of AMBIGUOUS
. See the documentation in ConnectivityTest
for more details.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
UpdateConnectivityTestRequest request =
UpdateConnectivityTestRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(ConnectivityTest.newBuilder().build())
.build();
ApiFuture<Operation> future =
reachabilityServiceClient.updateConnectivityTestCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateConnectivityTestRequest,Operation> |
updateConnectivityTestOperationCallable()
public final OperationCallable<UpdateConnectivityTestRequest,ConnectivityTest,OperationMetadata> updateConnectivityTestOperationCallable()
Updates the configuration of an existing ConnectivityTest
. After you update a test, the
reachability analysis is performed as part of the long running operation, which completes when
the analysis completes. The Reachability state in the test resource is updated with the new
result.
If the endpoint specifications in ConnectivityTest
are invalid (for example, they contain
non-existent resources in the network, or the user does not have read permissions to the
network configurations of listed projects), then the reachability result returns a value of
<code>UNKNOWN</code>.
If the endpoint specifications in ConnectivityTest
are incomplete, the reachability result
returns a value of AMBIGUOUS
. See the documentation in ConnectivityTest
for more details.
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 (ReachabilityServiceClient reachabilityServiceClient = ReachabilityServiceClient.create()) {
UpdateConnectivityTestRequest request =
UpdateConnectivityTestRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(ConnectivityTest.newBuilder().build())
.build();
OperationFuture<ConnectivityTest, OperationMetadata> future =
reachabilityServiceClient.updateConnectivityTestOperationCallable().futureCall(request);
// Do something.
ConnectivityTest response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateConnectivityTestRequest,ConnectivityTest,OperationMetadata> |