Class SubscriptionsServiceClient

java.lang.Object
com.google.apps.events.subscriptions.v1beta.SubscriptionsServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@BetaApi @Generated("by gapic-generator-java") public class SubscriptionsServiceClient extends Object implements BackgroundResource
Service Description: A service that manages subscriptions to Google Workspace events.

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().

Methods
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.

  • createSubscriptionAsync(CreateSubscriptionRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • createSubscriptionAsync(Subscription subscription)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createSubscriptionOperationCallable()

  • createSubscriptionCallable()

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.

  • deleteSubscriptionAsync(DeleteSubscriptionRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • deleteSubscriptionAsync(SubscriptionName name)

  • deleteSubscriptionAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteSubscriptionOperationCallable()

  • deleteSubscriptionCallable()

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.

  • getSubscription(GetSubscriptionRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getSubscription(SubscriptionName name)

  • getSubscription(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getSubscriptionCallable()

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.

  • listSubscriptions(ListSubscriptionsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listSubscriptions(String filter)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listSubscriptionsPagedCallable()

  • listSubscriptionsCallable()

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.

  • updateSubscriptionAsync(UpdateSubscriptionRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • updateSubscriptionAsync(Subscription subscription, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateSubscriptionOperationCallable()

  • updateSubscriptionCallable()

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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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.

  • reactivateSubscriptionAsync(ReactivateSubscriptionRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • reactivateSubscriptionAsync(SubscriptionName name)

  • reactivateSubscriptionAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • reactivateSubscriptionOperationCallable()

  • reactivateSubscriptionCallable()

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.

  • Constructor Details

    • SubscriptionsServiceClient

      protected SubscriptionsServiceClient(SubscriptionsServiceSettings settings) throws IOException
      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

      protected SubscriptionsServiceClient(SubscriptionsServiceStub stub)
  • Method Details

    • create

      public static final SubscriptionsServiceClient create() throws IOException
      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

      public static final SubscriptionsServiceClient create(SubscriptionsServiceStub stub)
      Constructs an instance of SubscriptionsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SubscriptionsServiceSettings).
    • getSettings

      public final SubscriptionsServiceSettings getSettings()
    • getStub

      public SubscriptionsServiceStub getStub()
    • 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.
    • getHttpJsonOperationsClient

      @BetaApi 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.
    • 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,CreateSubscriptionMetadata> createSubscriptionOperationCallable()
      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

      public final UnaryCallable<CreateSubscriptionRequest,Operation> 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,DeleteSubscriptionMetadata> deleteSubscriptionOperationCallable()
      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

      public final UnaryCallable<DeleteSubscriptionRequest,Operation> 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

      public final Subscription getSubscription(SubscriptionName name)
      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

      public final Subscription getSubscription(String name)
      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

      public final Subscription getSubscription(GetSubscriptionRequest request)
      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

      public final UnaryCallable<GetSubscriptionRequest,Subscription> 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

      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

      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. The field to update. If omitted, updates any fields included in the request.

      You can update one of the following fields in a subscription:

      • [`expire_time`][google.apps.events.subscriptions.v1beta.Subscription.expire_time]: The timestamp when the subscription expires.
      • [`ttl`][google.apps.events.subscriptions.v1beta.Subscription.ttl]: The time-to-live (TTL) or duration of the subscription.
      • [`event_types`][google.apps.events.subscriptions.v1beta.Subscription.event_types]: The list of event types to receive about the target resource.

      To fully replace the subscription (the equivalent of `PUT`), use `*`. Any omitted fields are updated with empty values.

      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,UpdateSubscriptionMetadata> updateSubscriptionOperationCallable()
      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

      public final UnaryCallable<UpdateSubscriptionRequest,Operation> 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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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

      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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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,ReactivateSubscriptionMetadata> reactivateSubscriptionOperationCallable()
      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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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. This method will ignore or reject any subscription that isn't currently in a suspended state. 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:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException