Class SubscriptionAdminClient

java.lang.Object
com.google.cloud.pubsub.v1.SubscriptionAdminClient
All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class SubscriptionAdminClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: The service that an application uses to manipulate subscriptions and to consume messages from a subscription via the `Pull` method or by establishing a bi-directional stream using the `StreamingPull` method.

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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
   PushConfig pushConfig = PushConfig.newBuilder().build();
   int ackDeadlineSeconds = 2135351438;
   Subscription response =
       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
 }
 

Note: close() needs to be called on the SubscriptionAdminClient 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 subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSubscription(Subscription request)

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

  • createSubscription(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)

  • createSubscription(SubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds)

  • createSubscription(String name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)

  • createSubscription(String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds)

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

  • createSubscriptionCallable()

GetSubscription

Gets the configuration details of a 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 subscription)

  • getSubscription(String subscription)

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

  • getSubscriptionCallable()

UpdateSubscription

Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSubscription(UpdateSubscriptionRequest request)

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

  • updateSubscription(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.

  • updateSubscriptionCallable()

ListSubscriptions

Lists matching 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(ProjectName project)

  • listSubscriptions(String project)

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

DeleteSubscription

Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteSubscription(DeleteSubscriptionRequest request)

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

  • deleteSubscription(SubscriptionName subscription)

  • deleteSubscription(String subscription)

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

  • deleteSubscriptionCallable()

ModifyAckDeadline

Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • modifyAckDeadline(ModifyAckDeadlineRequest request)

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

  • modifyAckDeadline(SubscriptionName subscription, List<String> ackIds, int ackDeadlineSeconds)

  • modifyAckDeadline(String subscription, List<String> ackIds, int ackDeadlineSeconds)

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

  • modifyAckDeadlineCallable()

Acknowledge

Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • acknowledge(AcknowledgeRequest request)

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

  • acknowledge(SubscriptionName subscription, List<String> ackIds)

  • acknowledge(String subscription, List<String> ackIds)

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

  • acknowledgeCallable()

Pull

Pulls messages from the server.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • pull(PullRequest request)

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

  • pull(SubscriptionName subscription, int maxMessages)

  • pull(String subscription, int maxMessages)

  • pull(SubscriptionName subscription, boolean returnImmediately, int maxMessages)

  • pull(String subscription, boolean returnImmediately, int maxMessages)

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

  • pullCallable()

StreamingPull

Establishes a stream with the server, which sends messages down to the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status `UNAVAILABLE` to reassign server-side resources, in which case, the client should re-establish the stream. Flow control can be achieved by configuring the underlying RPC channel.

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

  • streamingPullCallable()

ModifyPushConfig

Modifies the `PushConfig` for a specified subscription.

This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • modifyPushConfig(ModifyPushConfigRequest request)

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

  • modifyPushConfig(SubscriptionName subscription, PushConfig pushConfig)

  • modifyPushConfig(String subscription, PushConfig pushConfig)

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

  • modifyPushConfigCallable()

GetSnapshot

Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getSnapshot(GetSnapshotRequest request)

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

  • getSnapshot(SnapshotName snapshot)

  • getSnapshot(String snapshot)

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

  • getSnapshotCallable()

ListSnapshots

Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listSnapshots(ListSnapshotsRequest request)

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

  • listSnapshots(ProjectName project)

  • listSnapshots(String project)

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

  • listSnapshotsPagedCallable()

  • listSnapshotsCallable()

CreateSnapshot

Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSnapshot(CreateSnapshotRequest request)

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

  • createSnapshot(SnapshotName name, SubscriptionName subscription)

  • createSnapshot(SnapshotName name, String subscription)

  • createSnapshot(String name, SubscriptionName subscription)

  • createSnapshot(String name, String subscription)

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

  • createSnapshotCallable()

UpdateSnapshot

Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSnapshot(UpdateSnapshotRequest request)

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

  • updateSnapshot(Snapshot snapshot, 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.

  • updateSnapshotCallable()

DeleteSnapshot

Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteSnapshot(DeleteSnapshotRequest request)

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

  • deleteSnapshot(SnapshotName snapshot)

  • deleteSnapshot(String snapshot)

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

  • deleteSnapshotCallable()

Seek

Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • seek(SeekRequest request)

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

  • seekCallable()

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setIamPolicy(SetIamPolicyRequest request)

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

  • setIamPolicyCallable()

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIamPolicy(GetIamPolicyRequest request)

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

  • getIamPolicyCallable()

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • testIamPermissions(TestIamPermissionsRequest request)

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

  • testIamPermissionsCallable()

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 SubscriptionAdminSettings 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
 SubscriptionAdminSettings subscriptionAdminSettings =
     SubscriptionAdminSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SubscriptionAdminClient subscriptionAdminClient =
     SubscriptionAdminClient.create(subscriptionAdminSettings);
 

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
 SubscriptionAdminSettings subscriptionAdminSettings =
     SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
 SubscriptionAdminClient subscriptionAdminClient =
     SubscriptionAdminClient.create(subscriptionAdminSettings);
 

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
 SubscriptionAdminSettings subscriptionAdminSettings =
     SubscriptionAdminSettings.newHttpJsonBuilder().build();
 SubscriptionAdminClient subscriptionAdminClient =
     SubscriptionAdminClient.create(subscriptionAdminSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • SubscriptionAdminClient

      protected SubscriptionAdminClient(SubscriptionAdminSettings settings) throws IOException
      Constructs an instance of SubscriptionAdminClient, 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
    • SubscriptionAdminClient

      protected SubscriptionAdminClient(SubscriberStub stub)
  • Method Details

    • create

      public static final SubscriptionAdminClient create() throws IOException
      Constructs an instance of SubscriptionAdminClient with default settings.
      Throws:
      IOException
    • create

      public static final SubscriptionAdminClient create(SubscriptionAdminSettings settings) throws IOException
      Constructs an instance of SubscriptionAdminClient, 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 SubscriptionAdminClient create(SubscriberStub stub)
      Constructs an instance of SubscriptionAdminClient, using the given stub for making calls. This is for advanced usage - prefer using create(SubscriptionAdminSettings).
    • getSettings

      public final SubscriptionAdminSettings getSettings()
    • getStub

      public SubscriberStub getStub()
    • createSubscription

      public final Subscription createSubscription(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - Optional. If push delivery is used with this subscription, this field is used to configure it.
      ackDeadlineSeconds - Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be _outstanding_. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      public final Subscription createSubscription(SubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - Optional. If push delivery is used with this subscription, this field is used to configure it.
      ackDeadlineSeconds - Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be _outstanding_. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      public final Subscription createSubscription(String name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - Optional. If push delivery is used with this subscription, this field is used to configure it.
      ackDeadlineSeconds - Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be _outstanding_. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      public final Subscription createSubscription(String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - Optional. If push delivery is used with this subscription, this field is used to configure it.
      ackDeadlineSeconds - Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be _outstanding_. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      public final Subscription createSubscription(Subscription request)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         Subscription request =
             Subscription.newBuilder()
                 .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
                 .setPushConfig(PushConfig.newBuilder().build())
                 .setBigqueryConfig(BigQueryConfig.newBuilder().build())
                 .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
                 .setAckDeadlineSeconds(2135351438)
                 .setRetainAckedMessages(true)
                 .setMessageRetentionDuration(Duration.newBuilder().build())
                 .putAllLabels(new HashMap<String, String>())
                 .setEnableMessageOrdering(true)
                 .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
                 .setFilter("filter-1274492040")
                 .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
                 .setRetryPolicy(RetryPolicy.newBuilder().build())
                 .setDetached(true)
                 .setEnableExactlyOnceDelivery(true)
                 .setTopicMessageRetentionDuration(Duration.newBuilder().build())
                 .build();
         Subscription response = subscriptionAdminClient.createSubscription(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      @Deprecated public final Subscription createSubscription(ProjectSubscriptionName name, ProjectTopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the <a href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name rules</a>. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 0;
         Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods.
      ackDeadlineSeconds - The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be <i>outstanding</i>. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscription

      @Deprecated public final Subscription createSubscription(ProjectSubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods.
      ackDeadlineSeconds - The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be <i>outstanding</i>. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

    • createSubscription

      @Deprecated public final Subscription createSubscription(ProjectSubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds)
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         int ackDeadlineSeconds = 2135351438;
         Subscription response =
             subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
       }
       
      Parameters:
      name - Required. The name of the subscription. It must have the format `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
      topic - Required. The name of the topic from which this subscription is receiving messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be `_deleted-topic_` if the topic has been deleted.
      pushConfig - If push delivery is used with this subscription, this field is used to configure it. An empty `pushConfig` signifies that the subscriber will pull and ack messages using API methods.
      ackDeadlineSeconds - The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be <i>outstanding</i>. During that time period, the message will not be redelivered (on a best-effort basis).

      For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using non-streaming pull or send the `ack_id` in a `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

      For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

      If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSubscriptionCallable

      public final com.google.api.gax.rpc.UnaryCallable<Subscription,Subscription> createSubscriptionCallable()
      Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`.

      If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         Subscription request =
             Subscription.newBuilder()
                 .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
                 .setPushConfig(PushConfig.newBuilder().build())
                 .setBigqueryConfig(BigQueryConfig.newBuilder().build())
                 .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
                 .setAckDeadlineSeconds(2135351438)
                 .setRetainAckedMessages(true)
                 .setMessageRetentionDuration(Duration.newBuilder().build())
                 .putAllLabels(new HashMap<String, String>())
                 .setEnableMessageOrdering(true)
                 .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
                 .setFilter("filter-1274492040")
                 .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
                 .setRetryPolicy(RetryPolicy.newBuilder().build())
                 .setDetached(true)
                 .setEnableExactlyOnceDelivery(true)
                 .setTopicMessageRetentionDuration(Duration.newBuilder().build())
                 .build();
         ApiFuture<Subscription> future =
             subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
         // Do something.
         Subscription response = future.get();
       }
       
    • getSubscription

      public final Subscription getSubscription(SubscriptionName subscription)
      Gets the configuration details of a 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Subscription response = subscriptionAdminClient.getSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The name of the subscription to get. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSubscription

      public final Subscription getSubscription(String subscription)
      Gets the configuration details of a 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         Subscription response = subscriptionAdminClient.getSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The name of the subscription to get. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSubscription

      public final Subscription getSubscription(GetSubscriptionRequest request)
      Gets the configuration details of a 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetSubscriptionRequest request =
             GetSubscriptionRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         Subscription response = subscriptionAdminClient.getSubscription(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSubscription

      @Deprecated public final Subscription getSubscription(ProjectSubscriptionName subscription)
      Deprecated.
      Gets the configuration details of a subscription.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Subscription response = subscriptionAdminClient.getSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The name of the subscription to get. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSubscriptionCallable

      public final com.google.api.gax.rpc.UnaryCallable<GetSubscriptionRequest,Subscription> getSubscriptionCallable()
      Gets the configuration details of a 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetSubscriptionRequest request =
             GetSubscriptionRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         ApiFuture<Subscription> future =
             subscriptionAdminClient.getSubscriptionCallable().futureCall(request);
         // Do something.
         Subscription response = future.get();
       }
       
    • updateSubscription

      public final Subscription updateSubscription(Subscription subscription, com.google.protobuf.FieldMask updateMask)
      Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         Subscription subscription = Subscription.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Subscription response = subscriptionAdminClient.updateSubscription(subscription, updateMask);
       }
       
      Parameters:
      subscription - Required. The updated subscription object.
      updateMask - Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateSubscription

      public final Subscription updateSubscription(UpdateSubscriptionRequest request)
      Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         UpdateSubscriptionRequest request =
             UpdateSubscriptionRequest.newBuilder()
                 .setSubscription(Subscription.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Subscription response = subscriptionAdminClient.updateSubscription(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateSubscriptionCallable

      public final com.google.api.gax.rpc.UnaryCallable<UpdateSubscriptionRequest,Subscription> updateSubscriptionCallable()
      Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         UpdateSubscriptionRequest request =
             UpdateSubscriptionRequest.newBuilder()
                 .setSubscription(Subscription.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Subscription> future =
             subscriptionAdminClient.updateSubscriptionCallable().futureCall(request);
         // Do something.
         Subscription response = future.get();
       }
       
    • listSubscriptions

      public final SubscriptionAdminClient.ListSubscriptionsPagedResponse listSubscriptions(ProjectName project)
      Lists matching 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectName project = ProjectName.of("[PROJECT]");
         for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project in which to list subscriptions. Format is `projects/{project-id}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSubscriptions

      public final SubscriptionAdminClient.ListSubscriptionsPagedResponse listSubscriptions(String project)
      Lists matching 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String project = ProjectName.of("[PROJECT]").toString();
         for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project in which to list subscriptions. Format is `projects/{project-id}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSubscriptions

      Lists matching 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSubscriptionsRequest request =
             ListSubscriptionsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Subscription element : subscriptionAdminClient.listSubscriptions(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSubscriptionsPagedCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,SubscriptionAdminClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()
      Lists matching 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSubscriptionsRequest request =
             ListSubscriptionsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Subscription> future =
             subscriptionAdminClient.listSubscriptionsPagedCallable().futureCall(request);
         // Do something.
         for (Subscription element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listSubscriptionsCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> listSubscriptionsCallable()
      Lists matching 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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSubscriptionsRequest request =
             ListSubscriptionsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListSubscriptionsResponse response =
               subscriptionAdminClient.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;
           }
         }
       }
       
    • deleteSubscription

      public final void deleteSubscription(SubscriptionName subscription)
      Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         subscriptionAdminClient.deleteSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The subscription to delete. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSubscription

      public final void deleteSubscription(String subscription)
      Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         subscriptionAdminClient.deleteSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The subscription to delete. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSubscription

      public final void deleteSubscription(DeleteSubscriptionRequest request)
      Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         DeleteSubscriptionRequest request =
             DeleteSubscriptionRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         subscriptionAdminClient.deleteSubscription(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSubscription

      @Deprecated public final void deleteSubscription(ProjectSubscriptionName subscription)
      Deprecated.
      Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         subscriptionAdminClient.deleteSubscription(subscription);
       }
       
      Parameters:
      subscription - Required. The subscription to delete. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSubscriptionCallable

      public final com.google.api.gax.rpc.UnaryCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty> deleteSubscriptionCallable()
      Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         DeleteSubscriptionRequest request =
             DeleteSubscriptionRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         ApiFuture<Empty> future =
             subscriptionAdminClient.deleteSubscriptionCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • modifyAckDeadline

      public final void modifyAckDeadline(SubscriptionName subscription, List<String> ackIds, int ackDeadlineSeconds)
      Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         List<String> ackIds = new ArrayList<>();
         int ackDeadlineSeconds = 2135351438;
         subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
       }
       
      Parameters:
      subscription - Required. The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
      ackIds - Required. List of acknowledgment IDs.
      ackDeadlineSeconds - Required. The new ack deadline with respect to the time this request was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might immediately make the message available for delivery to another subscriber client. This typically results in an increase in the rate of message redeliveries (that is, duplicates). The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify in a single request is 600 seconds (10 minutes).
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyAckDeadline

      public final void modifyAckDeadline(String subscription, List<String> ackIds, int ackDeadlineSeconds)
      Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         List<String> ackIds = new ArrayList<>();
         int ackDeadlineSeconds = 2135351438;
         subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
       }
       
      Parameters:
      subscription - Required. The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
      ackIds - Required. List of acknowledgment IDs.
      ackDeadlineSeconds - Required. The new ack deadline with respect to the time this request was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might immediately make the message available for delivery to another subscriber client. This typically results in an increase in the rate of message redeliveries (that is, duplicates). The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify in a single request is 600 seconds (10 minutes).
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyAckDeadline

      public final void modifyAckDeadline(ModifyAckDeadlineRequest request)
      Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ModifyAckDeadlineRequest request =
             ModifyAckDeadlineRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .addAllAckIds(new ArrayList<String>())
                 .setAckDeadlineSeconds(2135351438)
                 .build();
         subscriptionAdminClient.modifyAckDeadline(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyAckDeadlineCallable

      public final com.google.api.gax.rpc.UnaryCallable<ModifyAckDeadlineRequest,com.google.protobuf.Empty> modifyAckDeadlineCallable()
      Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ModifyAckDeadlineRequest request =
             ModifyAckDeadlineRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .addAllAckIds(new ArrayList<String>())
                 .setAckDeadlineSeconds(2135351438)
                 .build();
         ApiFuture<Empty> future =
             subscriptionAdminClient.modifyAckDeadlineCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • acknowledge

      public final void acknowledge(SubscriptionName subscription, List<String> ackIds)
      Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

      Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         List<String> ackIds = new ArrayList<>();
         subscriptionAdminClient.acknowledge(subscription, ackIds);
       }
       
      Parameters:
      subscription - Required. The subscription whose message is being acknowledged. Format is `projects/{project}/subscriptions/{sub}`.
      ackIds - Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • acknowledge

      public final void acknowledge(String subscription, List<String> ackIds)
      Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

      Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         List<String> ackIds = new ArrayList<>();
         subscriptionAdminClient.acknowledge(subscription, ackIds);
       }
       
      Parameters:
      subscription - Required. The subscription whose message is being acknowledged. Format is `projects/{project}/subscriptions/{sub}`.
      ackIds - Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • acknowledge

      public final void acknowledge(AcknowledgeRequest request)
      Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

      Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         AcknowledgeRequest request =
             AcknowledgeRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .addAllAckIds(new ArrayList<String>())
                 .build();
         subscriptionAdminClient.acknowledge(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • acknowledge

      @Deprecated public final void acknowledge(ProjectSubscriptionName subscription, List<String> ackIds)
      Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

      Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         List<String> ackIds = new ArrayList<>();
         subscriptionAdminClient.acknowledge(subscription, ackIds);
       }
       
      Parameters:
      subscription - Required. The subscription whose message is being acknowledged. Format is `projects/{project}/subscriptions/{sub}`.
      ackIds - Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • acknowledgeCallable

      public final com.google.api.gax.rpc.UnaryCallable<AcknowledgeRequest,com.google.protobuf.Empty> acknowledgeCallable()
      Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.

      Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         AcknowledgeRequest request =
             AcknowledgeRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .addAllAckIds(new ArrayList<String>())
                 .build();
         ApiFuture<Empty> future = subscriptionAdminClient.acknowledgeCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • pull

      public final PullResponse pull(SubscriptionName subscription, int maxMessages)
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         int maxMessages = 496131527;
         PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
       }
       
      Parameters:
      subscription - Required. The subscription from which messages should be pulled. Format is `projects/{project}/subscriptions/{sub}`.
      maxMessages - Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pull

      public final PullResponse pull(String subscription, int maxMessages)
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         int maxMessages = 496131527;
         PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
       }
       
      Parameters:
      subscription - Required. The subscription from which messages should be pulled. Format is `projects/{project}/subscriptions/{sub}`.
      maxMessages - Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pull

      public final PullResponse pull(SubscriptionName subscription, boolean returnImmediately, int maxMessages)
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         boolean returnImmediately = true;
         int maxMessages = 496131527;
         PullResponse response =
             subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
       }
       
      Parameters:
      subscription - Required. The subscription from which messages should be pulled. Format is `projects/{project}/subscriptions/{sub}`.
      returnImmediately - Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the `Pull` response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to `true` is discouraged because it adversely impacts the performance of `Pull` operations. We recommend that users do not set this field.
      maxMessages - Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pull

      public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages)
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         boolean returnImmediately = true;
         int maxMessages = 496131527;
         PullResponse response =
             subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
       }
       
      Parameters:
      subscription - Required. The subscription from which messages should be pulled. Format is `projects/{project}/subscriptions/{sub}`.
      returnImmediately - Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the `Pull` response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to `true` is discouraged because it adversely impacts the performance of `Pull` operations. We recommend that users do not set this field.
      maxMessages - Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pull

      public final PullResponse pull(PullRequest request)
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         PullRequest request =
             PullRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setReturnImmediately(true)
                 .setMaxMessages(496131527)
                 .build();
         PullResponse response = subscriptionAdminClient.pull(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pull

      @Deprecated public final PullResponse pull(ProjectSubscriptionName subscription, int maxMessages)
      Deprecated.
      Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         int maxMessages = 496131527;
         PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
       }
       
      Parameters:
      subscription - Required. The subscription from which messages should be pulled. Format is `projects/{project}/subscriptions/{sub}`.
      maxMessages - Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • pullCallable

      public final com.google.api.gax.rpc.UnaryCallable<PullRequest,PullResponse> pullCallable()
      Pulls messages from the server.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         PullRequest request =
             PullRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setReturnImmediately(true)
                 .setMaxMessages(496131527)
                 .build();
         ApiFuture<PullResponse> future = subscriptionAdminClient.pullCallable().futureCall(request);
         // Do something.
         PullResponse response = future.get();
       }
       
    • streamingPullCallable

      public final com.google.api.gax.rpc.BidiStreamingCallable<StreamingPullRequest,StreamingPullResponse> streamingPullCallable()
      Establishes a stream with the server, which sends messages down to the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status `UNAVAILABLE` to reassign server-side resources, in which case, the client should re-establish the stream. Flow control can be achieved by configuring the underlying RPC channel.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         BidiStream<StreamingPullRequest, StreamingPullResponse> bidiStream =
             subscriptionAdminClient.streamingPullCallable().call();
         StreamingPullRequest request =
             StreamingPullRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .addAllAckIds(new ArrayList<String>())
                 .addAllModifyDeadlineSeconds(new ArrayList<Integer>())
                 .addAllModifyDeadlineAckIds(new ArrayList<String>())
                 .setStreamAckDeadlineSeconds(1875467245)
                 .setClientId("clientId908408390")
                 .setMaxOutstandingMessages(-1315266996)
                 .setMaxOutstandingBytes(-2103098517)
                 .build();
         bidiStream.send(request);
         for (StreamingPullResponse response : bidiStream) {
           // Do something when a response is received.
         }
       }
       
    • modifyPushConfig

      public final void modifyPushConfig(SubscriptionName subscription, PushConfig pushConfig)
      Modifies the `PushConfig` for a specified subscription.

      This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
       }
       
      Parameters:
      subscription - Required. The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
      pushConfig - Required. The push configuration for future deliveries.

      An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` or `StreamingPull` is not called.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyPushConfig

      public final void modifyPushConfig(String subscription, PushConfig pushConfig)
      Modifies the `PushConfig` for a specified subscription.

      This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         PushConfig pushConfig = PushConfig.newBuilder().build();
         subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
       }
       
      Parameters:
      subscription - Required. The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
      pushConfig - Required. The push configuration for future deliveries.

      An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` or `StreamingPull` is not called.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyPushConfig

      public final void modifyPushConfig(ModifyPushConfigRequest request)
      Modifies the `PushConfig` for a specified subscription.

      This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ModifyPushConfigRequest request =
             ModifyPushConfigRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setPushConfig(PushConfig.newBuilder().build())
                 .build();
         subscriptionAdminClient.modifyPushConfig(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyPushConfig

      @Deprecated public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig)
      Modifies the `PushConfig` for a specified subscription.

      This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         PushConfig pushConfig = PushConfig.newBuilder().build();
         subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
       }
       
      Parameters:
      subscription - Required. The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
      pushConfig - Required. The push configuration for future deliveries.

      An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` or `StreamingPull` is not called.

      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • modifyPushConfigCallable

      public final com.google.api.gax.rpc.UnaryCallable<ModifyPushConfigRequest,com.google.protobuf.Empty> modifyPushConfigCallable()
      Modifies the `PushConfig` for a specified subscription.

      This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ModifyPushConfigRequest request =
             ModifyPushConfigRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .setPushConfig(PushConfig.newBuilder().build())
                 .build();
         ApiFuture<Empty> future =
             subscriptionAdminClient.modifyPushConfigCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • getSnapshot

      public final Snapshot getSnapshot(SnapshotName snapshot)
      Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to get. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSnapshot

      public final Snapshot getSnapshot(String snapshot)
      Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
         Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to get. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSnapshot

      public final Snapshot getSnapshot(GetSnapshotRequest request)
      Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetSnapshotRequest request =
             GetSnapshotRequest.newBuilder()
                 .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .build();
         Snapshot response = subscriptionAdminClient.getSnapshot(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSnapshot

      @Deprecated public final Snapshot getSnapshot(ProjectSnapshotName snapshot)
      Deprecated.
      Use Use getSnapshot(SnapshotName) instead.
      Gets the configuration details of a snapshot. Snapshots are used in <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to get. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getSnapshotCallable

      public final com.google.api.gax.rpc.UnaryCallable<GetSnapshotRequest,Snapshot> getSnapshotCallable()
      Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetSnapshotRequest request =
             GetSnapshotRequest.newBuilder()
                 .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .build();
         ApiFuture<Snapshot> future =
             subscriptionAdminClient.getSnapshotCallable().futureCall(request);
         // Do something.
         Snapshot response = future.get();
       }
       
    • listSnapshots

      Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectName project = ProjectName.of("[PROJECT]");
         for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project in which to list snapshots. Format is `projects/{project-id}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSnapshots

      public final SubscriptionAdminClient.ListSnapshotsPagedResponse listSnapshots(String project)
      Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String project = ProjectName.of("[PROJECT]").toString();
         for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project in which to list snapshots. Format is `projects/{project-id}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSnapshots

      Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSnapshotsRequest request =
             ListSnapshotsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Snapshot element : subscriptionAdminClient.listSnapshots(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listSnapshotsPagedCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListSnapshotsRequest,SubscriptionAdminClient.ListSnapshotsPagedResponse> listSnapshotsPagedCallable()
      Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSnapshotsRequest request =
             ListSnapshotsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Snapshot> future =
             subscriptionAdminClient.listSnapshotsPagedCallable().futureCall(request);
         // Do something.
         for (Snapshot element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listSnapshotsCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListSnapshotsRequest,ListSnapshotsResponse> listSnapshotsCallable()
      Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ListSnapshotsRequest request =
             ListSnapshotsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListSnapshotsResponse response =
               subscriptionAdminClient.listSnapshotsCallable().call(request);
           for (Snapshot element : response.getSnapshotsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • createSnapshot

      public final Snapshot createSnapshot(SnapshotName name, SubscriptionName subscription)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      public final Snapshot createSnapshot(SnapshotName name, String subscription)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      public final Snapshot createSnapshot(String name, SubscriptionName subscription)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
         SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      public final Snapshot createSnapshot(String name, String subscription)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
         String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      public final Snapshot createSnapshot(CreateSnapshotRequest request)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         CreateSnapshotRequest request =
             CreateSnapshotRequest.newBuilder()
                 .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .putAllLabels(new HashMap<String, String>())
                 .build();
         Snapshot response = subscriptionAdminClient.createSnapshot(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      @Deprecated public final Snapshot createSnapshot(ProjectSnapshotName name, ProjectSubscriptionName subscription)
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the <a href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      @Deprecated public final Snapshot createSnapshot(String name, ProjectSubscriptionName subscription)
      Deprecated.
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
         ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the <a href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshot

      @Deprecated public final Snapshot createSnapshot(ProjectSnapshotName name, String subscription)
      Deprecated.
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         String subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
         Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
       }
       
      Parameters:
      name - Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the <a href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
      subscription - Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • createSnapshotCallable

      public final com.google.api.gax.rpc.UnaryCallable<CreateSnapshotRequest,Snapshot> createSnapshotCallable()
      Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         CreateSnapshotRequest request =
             CreateSnapshotRequest.newBuilder()
                 .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .putAllLabels(new HashMap<String, String>())
                 .build();
         ApiFuture<Snapshot> future =
             subscriptionAdminClient.createSnapshotCallable().futureCall(request);
         // Do something.
         Snapshot response = future.get();
       }
       
    • updateSnapshot

      public final Snapshot updateSnapshot(Snapshot snapshot, com.google.protobuf.FieldMask updateMask)
      Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         Snapshot snapshot = Snapshot.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Snapshot response = subscriptionAdminClient.updateSnapshot(snapshot, updateMask);
       }
       
      Parameters:
      snapshot - Required. The updated snapshot object.
      updateMask - Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateSnapshot

      public final Snapshot updateSnapshot(UpdateSnapshotRequest request)
      Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         UpdateSnapshotRequest request =
             UpdateSnapshotRequest.newBuilder()
                 .setSnapshot(Snapshot.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Snapshot response = subscriptionAdminClient.updateSnapshot(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • updateSnapshotCallable

      public final com.google.api.gax.rpc.UnaryCallable<UpdateSnapshotRequest,Snapshot> updateSnapshotCallable()
      Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         UpdateSnapshotRequest request =
             UpdateSnapshotRequest.newBuilder()
                 .setSnapshot(Snapshot.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Snapshot> future =
             subscriptionAdminClient.updateSnapshotCallable().futureCall(request);
         // Do something.
         Snapshot response = future.get();
       }
       
    • deleteSnapshot

      public final void deleteSnapshot(SnapshotName snapshot)
      Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         subscriptionAdminClient.deleteSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to delete. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSnapshot

      public final void deleteSnapshot(String snapshot)
      Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
         subscriptionAdminClient.deleteSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to delete. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSnapshot

      public final void deleteSnapshot(DeleteSnapshotRequest request)
      Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         DeleteSnapshotRequest request =
             DeleteSnapshotRequest.newBuilder()
                 .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .build();
         subscriptionAdminClient.deleteSnapshot(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSnapshot

      @Deprecated public final void deleteSnapshot(ProjectSnapshotName snapshot)
      Deprecated.
      Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
         subscriptionAdminClient.deleteSnapshot(snapshot);
       }
       
      Parameters:
      snapshot - Required. The name of the snapshot to delete. Format is `projects/{project}/snapshots/{snap}`.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • deleteSnapshotCallable

      public final com.google.api.gax.rpc.UnaryCallable<DeleteSnapshotRequest,com.google.protobuf.Empty> deleteSnapshotCallable()
      Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         DeleteSnapshotRequest request =
             DeleteSnapshotRequest.newBuilder()
                 .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
                 .build();
         ApiFuture<Empty> future =
             subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • seek

      public final SeekResponse seek(SeekRequest request)
      Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SeekRequest request =
             SeekRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         SeekResponse response = subscriptionAdminClient.seek(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • seekCallable

      public final com.google.api.gax.rpc.UnaryCallable<SeekRequest,SeekResponse> seekCallable()
      Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.

      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 (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SeekRequest request =
             SeekRequest.newBuilder()
                 .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
                 .build();
         ApiFuture<SeekResponse> future = subscriptionAdminClient.seekCallable().futureCall(request);
         // Do something.
         SeekResponse response = future.get();
       }
       
    • setIamPolicy

      public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
      Sets the access control policy on the specified resource. Replacesany existing policy.

      Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Policy response = subscriptionAdminClient.setIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • setIamPolicy

      @Deprecated public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
      Deprecated.
      Sets the access control policy on the specified resource. Replaces any existing policy.

      Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
         Policy policy = Policy.newBuilder().build();
         Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
      policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • setIamPolicyCallable

      public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
      Sets the access control policy on the specified resource. Replacesany existing policy.

      Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Policy> future = subscriptionAdminClient.setIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • getIamPolicy

      public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
      Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         Policy response = subscriptionAdminClient.getIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getIamPolicy

      @Deprecated public final com.google.iam.v1.Policy getIamPolicy(String resource)
      Deprecated.
      Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
         Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • getIamPolicyCallable

      public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
      Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         ApiFuture<Policy> future = subscriptionAdminClient.getIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • testIamPermissions

      public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
      Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.

      Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • testIamPermissions

      @Deprecated public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
      Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

      Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

      Sample code:

      
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
         List<String> permissions = new ArrayList<>();
         TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
      permissions - The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • testIamPermissionsCallable

      public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
      Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.

      Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

      Sample code:

      
       // This snippet has been automatically generated and should be regarded as a code template only.
       // It will require modifications to work:
       // - It may require correct/in-range values for request initialization.
       // - It may require specifying regional endpoints when creating the service client as shown in
       // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
       try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         ApiFuture<TestIamPermissionsResponse> future =
             subscriptionAdminClient.testIamPermissionsCallable().futureCall(request);
         // Do something.
         TestIamPermissionsResponse response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface com.google.api.gax.core.BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface com.google.api.gax.core.BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface com.google.api.gax.core.BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface com.google.api.gax.core.BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface com.google.api.gax.core.BackgroundResource
      Throws:
      InterruptedException