Class SubscriptionsServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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 (SubscriptionsServiceClient subscriptionsServiceClient =
SubscriptionsServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[SUBSCRIPTION]");
Subscription response = subscriptionsServiceClient.getSubscription(name);
}
Note: close() needs to be called on the SubscriptionsServiceClient 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 |
|---|---|---|
CreateSubscription |
Creates a Google Workspace subscription. To learn how to use this method, see [Create a Google Workspace subscription](https://developers.google.com/workspace/events/guides/create-subscription). |
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 `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSubscription |
Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription). |
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 `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetSubscription |
Gets details about a Google Workspace subscription. To learn how to use this method, see [Get details about a Google Workspace subscription](https://developers.google.com/workspace/events/guides/get-subscription). |
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.
|
ListSubscriptions |
Lists Google Workspace subscriptions. To learn how to use this method, see [List Google Workspace subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions). |
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.
|
UpdateSubscription |
Updates or renews a Google Workspace subscription. To learn how to use this method, see [Update or renew a Google Workspace subscription](https://developers.google.com/workspace/events/guides/update-subscription). |
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 `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ReactivateSubscription |
Reactivates a suspended Google Workspace subscription. This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription). |
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 `OperationFuture`, which is used to track polling of the service.
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 SubscriptionsServiceSettings 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
SubscriptionsServiceSettings subscriptionsServiceSettings =
SubscriptionsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SubscriptionsServiceClient subscriptionsServiceClient =
SubscriptionsServiceClient.create(subscriptionsServiceSettings);
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
SubscriptionsServiceSettings subscriptionsServiceSettings =
SubscriptionsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SubscriptionsServiceClient subscriptionsServiceClient =
SubscriptionsServiceClient.create(subscriptionsServiceSettings);
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
SubscriptionsServiceSettings subscriptionsServiceSettings =
SubscriptionsServiceSettings.newHttpJsonBuilder().build();
SubscriptionsServiceClient subscriptionsServiceClient =
SubscriptionsServiceClient.create(subscriptionsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedConstructs an instance of SubscriptionsServiceClient, using the given settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final SubscriptionsServiceClientcreate()Constructs an instance of SubscriptionsServiceClient with default settings.static final SubscriptionsServiceClientConstructs an instance of SubscriptionsServiceClient, using the given stub for making calls.static final SubscriptionsServiceClientcreate(SubscriptionsServiceSettings settings) Constructs an instance of SubscriptionsServiceClient, using the given settings.Creates a Google Workspace subscription.createSubscriptionAsync(Subscription subscription) Creates a Google Workspace subscription.Creates a Google Workspace subscription.Creates a Google Workspace subscription.final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> Deletes a Google Workspace subscription.final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> Deletes a Google Workspace subscription.final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> Deletes a Google Workspace subscription.Deletes a Google Workspace subscription.final OperationCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty, DeleteSubscriptionMetadata> Deletes a Google Workspace subscription.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()final SubscriptiongetSubscription(GetSubscriptionRequest request) Gets details about a Google Workspace subscription.final SubscriptionGets details about a Google Workspace subscription.final SubscriptiongetSubscription(String name) Gets details about a Google Workspace subscription.Gets details about a Google Workspace subscription.booleanbooleanLists Google Workspace subscriptions.listSubscriptions(String filter) Lists Google Workspace subscriptions.Lists Google Workspace subscriptions.final UnaryCallable<ListSubscriptionsRequest,SubscriptionsServiceClient.ListSubscriptionsPagedResponse> Lists Google Workspace subscriptions.Reactivates a suspended Google Workspace subscription.Reactivates a suspended Google Workspace subscription.Reactivates a suspended Google Workspace subscription.Reactivates a suspended Google Workspace subscription.Reactivates a suspended Google Workspace subscription.voidshutdown()voidupdateSubscriptionAsync(Subscription subscription, com.google.protobuf.FieldMask updateMask) Updates or renews a Google Workspace subscription.Updates or renews a Google Workspace subscription.Updates or renews a Google Workspace subscription.Updates or renews a Google Workspace subscription.
-
Constructor Details
-
SubscriptionsServiceClient
Constructs an instance of SubscriptionsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
SubscriptionsServiceClient
-
-
Method Details
-
create
Constructs an instance of SubscriptionsServiceClient with default settings.- Throws:
IOException
-
create
public static final SubscriptionsServiceClient create(SubscriptionsServiceSettings settings) throws IOException Constructs an instance of SubscriptionsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of SubscriptionsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SubscriptionsServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createSubscriptionAsync
public final OperationFuture<Subscription,CreateSubscriptionMetadata> createSubscriptionAsync(Subscription subscription) Creates a Google Workspace subscription. To learn how to use this method, see [Create a Google Workspace subscription](https://developers.google.com/workspace/events/guides/create-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { Subscription subscription = Subscription.newBuilder().build(); Subscription response = subscriptionsServiceClient.createSubscriptionAsync(subscription).get(); }- Parameters:
subscription- Required. The subscription resource to create.- Throws:
ApiException- if the remote call fails
-
createSubscriptionAsync
public final OperationFuture<Subscription,CreateSubscriptionMetadata> createSubscriptionAsync(CreateSubscriptionRequest request) Creates a Google Workspace subscription. To learn how to use this method, see [Create a Google Workspace subscription](https://developers.google.com/workspace/events/guides/create-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setValidateOnly(true) .build(); Subscription response = subscriptionsServiceClient.createSubscriptionAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createSubscriptionOperationCallable
public final OperationCallable<CreateSubscriptionRequest,Subscription, createSubscriptionOperationCallable()CreateSubscriptionMetadata> Creates a Google Workspace subscription. To learn how to use this method, see [Create a Google Workspace subscription](https://developers.google.com/workspace/events/guides/create-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setValidateOnly(true) .build(); OperationFuture<Subscription, CreateSubscriptionMetadata> future = subscriptionsServiceClient.createSubscriptionOperationCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
createSubscriptionCallable
Creates a Google Workspace subscription. To learn how to use this method, see [Create a Google Workspace subscription](https://developers.google.com/workspace/events/guides/create-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = subscriptionsServiceClient.createSubscriptionCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteSubscriptionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> deleteSubscriptionAsync(SubscriptionName name) Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { SubscriptionName name = SubscriptionName.of("[SUBSCRIPTION]"); subscriptionsServiceClient.deleteSubscriptionAsync(name).get(); }- Parameters:
name- Required. Resource name of the subscription to delete.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
deleteSubscriptionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> deleteSubscriptionAsync(String name) Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { String name = SubscriptionName.of("[SUBSCRIPTION]").toString(); subscriptionsServiceClient.deleteSubscriptionAsync(name).get(); }- Parameters:
name- Required. Resource name of the subscription to delete.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
deleteSubscriptionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteSubscriptionMetadata> deleteSubscriptionAsync(DeleteSubscriptionRequest request) Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .setValidateOnly(true) .setAllowMissing(true) .setEtag("etag3123477") .build(); subscriptionsServiceClient.deleteSubscriptionAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteSubscriptionOperationCallable
public final OperationCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty, deleteSubscriptionOperationCallable()DeleteSubscriptionMetadata> Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .setValidateOnly(true) .setAllowMissing(true) .setEtag("etag3123477") .build(); OperationFuture<Empty, DeleteSubscriptionMetadata> future = subscriptionsServiceClient.deleteSubscriptionOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteSubscriptionCallable
Deletes a Google Workspace subscription. To learn how to use this method, see [Delete a Google Workspace subscription](https://developers.google.com/workspace/events/guides/delete-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .setValidateOnly(true) .setAllowMissing(true) .setEtag("etag3123477") .build(); ApiFuture<Operation> future = subscriptionsServiceClient.deleteSubscriptionCallable().futureCall(request); // Do something. future.get(); } -
getSubscription
Gets details about a Google Workspace subscription. To learn how to use this method, see [Get details about a Google Workspace subscription](https://developers.google.com/workspace/events/guides/get-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { SubscriptionName name = SubscriptionName.of("[SUBSCRIPTION]"); Subscription response = subscriptionsServiceClient.getSubscription(name); }- Parameters:
name- Required. Resource name of the subscription.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
getSubscription
Gets details about a Google Workspace subscription. To learn how to use this method, see [Get details about a Google Workspace subscription](https://developers.google.com/workspace/events/guides/get-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { String name = SubscriptionName.of("[SUBSCRIPTION]").toString(); Subscription response = subscriptionsServiceClient.getSubscription(name); }- Parameters:
name- Required. Resource name of the subscription.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
getSubscription
Gets details about a Google Workspace subscription. To learn how to use this method, see [Get details about a Google Workspace subscription](https://developers.google.com/workspace/events/guides/get-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .build(); Subscription response = subscriptionsServiceClient.getSubscription(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getSubscriptionCallable
Gets details about a Google Workspace subscription. To learn how to use this method, see [Get details about a Google Workspace subscription](https://developers.google.com/workspace/events/guides/get-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .build(); ApiFuture<Subscription> future = subscriptionsServiceClient.getSubscriptionCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
listSubscriptions
public final SubscriptionsServiceClient.ListSubscriptionsPagedResponse listSubscriptions(String filter) Lists Google Workspace subscriptions. To learn how to use this method, see [List Google Workspace subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { String filter = "filter-1274492040"; for (Subscription element : subscriptionsServiceClient.listSubscriptions(filter).iterateAll()) { // doThingsWith(element); } }- Parameters:
filter- Required. A query filter.You can filter subscriptions by event type (`event_types`) and target resource (`target_resource`).
You must specify at least one event type in your query. To filter for multiple event types, use the `OR` operator.
To filter by both event type and target resource, use the `AND` operator and specify the full resource name, such as `//chat.googleapis.com/spaces/{space}`.
For example, the following queries are valid:
``` event_types:"google.workspace.chat.membership.v1.updated" OR event_types:"google.workspace.chat.message.v1.created"
event_types:"google.workspace.chat.message.v1.created" AND target_resource="//chat.googleapis.com/spaces/{space}"
( event_types:"google.workspace.chat.membership.v1.updated" OR event_types:"google.workspace.chat.message.v1.created" ) AND target_resource="//chat.googleapis.com/spaces/{space}" ```
The server rejects invalid queries with an `INVALID_ARGUMENT` error.
- Throws:
ApiException- if the remote call fails
-
listSubscriptions
public final SubscriptionsServiceClient.ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request) Lists Google Workspace subscriptions. To learn how to use this method, see [List Google Workspace subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (Subscription element : subscriptionsServiceClient.listSubscriptions(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listSubscriptionsPagedCallable
public final UnaryCallable<ListSubscriptionsRequest,SubscriptionsServiceClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()Lists Google Workspace subscriptions. To learn how to use this method, see [List Google Workspace subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<Subscription> future = subscriptionsServiceClient.listSubscriptionsPagedCallable().futureCall(request); // Do something. for (Subscription element : future.get().iterateAll()) { // doThingsWith(element); } } -
listSubscriptionsCallable
public final UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> listSubscriptionsCallable()Lists Google Workspace subscriptions. To learn how to use this method, see [List Google Workspace subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListSubscriptionsResponse response = subscriptionsServiceClient.listSubscriptionsCallable().call(request); for (Subscription element : response.getSubscriptionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateSubscriptionAsync
public final OperationFuture<Subscription,UpdateSubscriptionMetadata> updateSubscriptionAsync(Subscription subscription, com.google.protobuf.FieldMask updateMask) Updates or renews a Google Workspace subscription. To learn how to use this method, see [Update or renew a Google Workspace subscription](https://developers.google.com/workspace/events/guides/update-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { Subscription subscription = Subscription.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Subscription response = subscriptionsServiceClient.updateSubscriptionAsync(subscription, updateMask).get(); }- Parameters:
subscription- Required. The subscription to update.The subscription's `name` field is used to identify the subscription to update.
updateMask- Optional. Required. The field to update.You can update one of the following fields in a subscription:
- [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the subscription expires.
- [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The time-to-live (TTL) or duration of the subscription.
- Throws:
ApiException- if the remote call fails
-
updateSubscriptionAsync
public final OperationFuture<Subscription,UpdateSubscriptionMetadata> updateSubscriptionAsync(UpdateSubscriptionRequest request) Updates or renews a Google Workspace subscription. To learn how to use this method, see [Update or renew a Google Workspace subscription](https://developers.google.com/workspace/events/guides/update-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); Subscription response = subscriptionsServiceClient.updateSubscriptionAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateSubscriptionOperationCallable
public final OperationCallable<UpdateSubscriptionRequest,Subscription, updateSubscriptionOperationCallable()UpdateSubscriptionMetadata> Updates or renews a Google Workspace subscription. To learn how to use this method, see [Update or renew a Google Workspace subscription](https://developers.google.com/workspace/events/guides/update-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); OperationFuture<Subscription, UpdateSubscriptionMetadata> future = subscriptionsServiceClient.updateSubscriptionOperationCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
updateSubscriptionCallable
Updates or renews a Google Workspace subscription. To learn how to use this method, see [Update or renew a Google Workspace subscription](https://developers.google.com/workspace/events/guides/update-subscription).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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); ApiFuture<Operation> future = subscriptionsServiceClient.updateSubscriptionCallable().futureCall(request); // Do something. Operation response = future.get(); } -
reactivateSubscriptionAsync
public final OperationFuture<Subscription,ReactivateSubscriptionMetadata> reactivateSubscriptionAsync(SubscriptionName name) Reactivates a suspended Google Workspace subscription.This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { SubscriptionName name = SubscriptionName.of("[SUBSCRIPTION]"); Subscription response = subscriptionsServiceClient.reactivateSubscriptionAsync(name).get(); }- Parameters:
name- Required. Resource name of the subscription.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
reactivateSubscriptionAsync
public final OperationFuture<Subscription,ReactivateSubscriptionMetadata> reactivateSubscriptionAsync(String name) Reactivates a suspended Google Workspace subscription.This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { String name = SubscriptionName.of("[SUBSCRIPTION]").toString(); Subscription response = subscriptionsServiceClient.reactivateSubscriptionAsync(name).get(); }- Parameters:
name- Required. Resource name of the subscription.Format: `subscriptions/{subscription}`
- Throws:
ApiException- if the remote call fails
-
reactivateSubscriptionAsync
public final OperationFuture<Subscription,ReactivateSubscriptionMetadata> reactivateSubscriptionAsync(ReactivateSubscriptionRequest request) Reactivates a suspended Google Workspace subscription.This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ReactivateSubscriptionRequest request = ReactivateSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .build(); Subscription response = subscriptionsServiceClient.reactivateSubscriptionAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
reactivateSubscriptionOperationCallable
public final OperationCallable<ReactivateSubscriptionRequest,Subscription, reactivateSubscriptionOperationCallable()ReactivateSubscriptionMetadata> Reactivates a suspended Google Workspace subscription.This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ReactivateSubscriptionRequest request = ReactivateSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .build(); OperationFuture<Subscription, ReactivateSubscriptionMetadata> future = subscriptionsServiceClient.reactivateSubscriptionOperationCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
reactivateSubscriptionCallable
public final UnaryCallable<ReactivateSubscriptionRequest,Operation> reactivateSubscriptionCallable()Reactivates a suspended Google Workspace subscription.This method resets your subscription's `State` field to `ACTIVE`. Before you use this method, you must fix the error that suspended the subscription. To learn how to use this method, see [Reactivate a Google Workspace subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
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 (SubscriptionsServiceClient subscriptionsServiceClient = SubscriptionsServiceClient.create()) { ReactivateSubscriptionRequest request = ReactivateSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[SUBSCRIPTION]").toString()) .build(); ApiFuture<Operation> future = subscriptionsServiceClient.reactivateSubscriptionCallable().futureCall(request); // Do something. Operation response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-