- 0.53.0 (latest)
- 0.52.0
- 0.51.0
- 0.49.0
- 0.48.0
- 0.47.0
- 0.46.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.5
- 0.2.1
- 0.1.2
public class RevisionsClient implements BackgroundResource
Service Description: Cloud Run Revision Control Plane API.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
RevisionName name = RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]");
Revision response = revisionsClient.getRevision(name);
}
Note: close() needs to be called on the RevisionsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of RevisionsSettings to create(). For example:
To customize credentials:
RevisionsSettings revisionsSettings =
RevisionsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RevisionsClient revisionsClient = RevisionsClient.create(revisionsSettings);
To customize the endpoint:
RevisionsSettings revisionsSettings =
RevisionsSettings.newBuilder().setEndpoint(myEndpoint).build();
RevisionsClient revisionsClient = RevisionsClient.create(revisionsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final RevisionsClient create()
Constructs an instance of RevisionsClient with default settings.
Type | Description |
RevisionsClient |
Type | Description |
IOException |
create(RevisionsSettings settings)
public static final RevisionsClient create(RevisionsSettings settings)
Constructs an instance of RevisionsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | RevisionsSettings |
Type | Description |
RevisionsClient |
Type | Description |
IOException |
create(RevisionsStub stub)
public static final RevisionsClient create(RevisionsStub stub)
Constructs an instance of RevisionsClient, using the given stub for making calls. This is for advanced usage - prefer using create(RevisionsSettings).
Name | Description |
stub | RevisionsStub |
Type | Description |
RevisionsClient |
Constructors
RevisionsClient(RevisionsSettings settings)
protected RevisionsClient(RevisionsSettings settings)
Constructs an instance of RevisionsClient, 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.
Name | Description |
settings | RevisionsSettings |
RevisionsClient(RevisionsStub stub)
protected RevisionsClient(RevisionsStub stub)
Name | Description |
stub | RevisionsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
deleteRevisionAsync(DeleteRevisionRequest request)
public final OperationFuture<Revision,Revision> deleteRevisionAsync(DeleteRevisionRequest request)
Delete a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
DeleteRevisionRequest request =
DeleteRevisionRequest.newBuilder()
.setName(
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
Revision response = revisionsClient.deleteRevisionAsync(request).get();
}
Name | Description |
request | DeleteRevisionRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Revision,Revision> |
deleteRevisionAsync(RevisionName name)
public final OperationFuture<Revision,Revision> deleteRevisionAsync(RevisionName name)
Delete a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
RevisionName name = RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]");
Revision response = revisionsClient.deleteRevisionAsync(name).get();
}
Name | Description |
name | RevisionName Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision} |
Type | Description |
OperationFuture<Revision,Revision> |
deleteRevisionAsync(String name)
public final OperationFuture<Revision,Revision> deleteRevisionAsync(String name)
Delete a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
String name =
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString();
Revision response = revisionsClient.deleteRevisionAsync(name).get();
}
Name | Description |
name | String Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision} |
Type | Description |
OperationFuture<Revision,Revision> |
deleteRevisionCallable()
public final UnaryCallable<DeleteRevisionRequest,Operation> deleteRevisionCallable()
Delete a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
DeleteRevisionRequest request =
DeleteRevisionRequest.newBuilder()
.setName(
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = revisionsClient.deleteRevisionCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<DeleteRevisionRequest,Operation> |
deleteRevisionOperationCallable()
public final OperationCallable<DeleteRevisionRequest,Revision,Revision> deleteRevisionOperationCallable()
Delete a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
DeleteRevisionRequest request =
DeleteRevisionRequest.newBuilder()
.setName(
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
OperationFuture<Revision, Revision> future =
revisionsClient.deleteRevisionOperationCallable().futureCall(request);
// Do something.
Revision response = future.get();
}
Type | Description |
OperationCallable<DeleteRevisionRequest,Revision,Revision> |
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.
Type | Description |
OperationsClient |
getRevision(GetRevisionRequest request)
public final Revision getRevision(GetRevisionRequest request)
Gets information about a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
GetRevisionRequest request =
GetRevisionRequest.newBuilder()
.setName(
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString())
.build();
Revision response = revisionsClient.getRevision(request);
}
Name | Description |
request | GetRevisionRequest The request object containing all of the parameters for the API call. |
Type | Description |
Revision |
getRevision(RevisionName name)
public final Revision getRevision(RevisionName name)
Gets information about a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
RevisionName name = RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]");
Revision response = revisionsClient.getRevision(name);
}
Name | Description |
name | RevisionName Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision} |
Type | Description |
Revision |
getRevision(String name)
public final Revision getRevision(String name)
Gets information about a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
String name =
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString();
Revision response = revisionsClient.getRevision(name);
}
Name | Description |
name | String Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision} |
Type | Description |
Revision |
getRevisionCallable()
public final UnaryCallable<GetRevisionRequest,Revision> getRevisionCallable()
Gets information about a Revision.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
GetRevisionRequest request =
GetRevisionRequest.newBuilder()
.setName(
RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]").toString())
.build();
ApiFuture<Revision> future = revisionsClient.getRevisionCallable().futureCall(request);
// Do something.
Revision response = future.get();
}
Type | Description |
UnaryCallable<GetRevisionRequest,Revision> |
getSettings()
public final RevisionsSettings getSettings()
Type | Description |
RevisionsSettings |
getStub()
public RevisionsStub getStub()
Type | Description |
RevisionsStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listRevisions(ListRevisionsRequest request)
public final RevisionsClient.ListRevisionsPagedResponse listRevisions(ListRevisionsRequest request)
List Revisions from a given Service, or from a given location.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
ListRevisionsRequest request =
ListRevisionsRequest.newBuilder()
.setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
for (Revision element : revisionsClient.listRevisions(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListRevisionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
RevisionsClient.ListRevisionsPagedResponse |
listRevisions(ServiceName parent)
public final RevisionsClient.ListRevisionsPagedResponse listRevisions(ServiceName parent)
List Revisions from a given Service, or from a given location.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
ServiceName parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
for (Revision element : revisionsClient.listRevisions(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | ServiceName Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service} |
Type | Description |
RevisionsClient.ListRevisionsPagedResponse |
listRevisions(String parent)
public final RevisionsClient.ListRevisionsPagedResponse listRevisions(String parent)
List Revisions from a given Service, or from a given location.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
String parent = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString();
for (Revision element : revisionsClient.listRevisions(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service} |
Type | Description |
RevisionsClient.ListRevisionsPagedResponse |
listRevisionsCallable()
public final UnaryCallable<ListRevisionsRequest,ListRevisionsResponse> listRevisionsCallable()
List Revisions from a given Service, or from a given location.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
ListRevisionsRequest request =
ListRevisionsRequest.newBuilder()
.setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
while (true) {
ListRevisionsResponse response = revisionsClient.listRevisionsCallable().call(request);
for (Revision element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListRevisionsRequest,ListRevisionsResponse> |
listRevisionsPagedCallable()
public final UnaryCallable<ListRevisionsRequest,RevisionsClient.ListRevisionsPagedResponse> listRevisionsPagedCallable()
List Revisions from a given Service, or from a given location.
Sample code:
try (RevisionsClient revisionsClient = RevisionsClient.create()) {
ListRevisionsRequest request =
ListRevisionsRequest.newBuilder()
.setParent(ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
ApiFuture<Revision> future = revisionsClient.listRevisionsPagedCallable().futureCall(request);
// Do something.
for (Revision element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListRevisionsRequest,ListRevisionsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()