| GitHub Repository | Product Reference | RPC Documentation |
Service Description: Data Subscription Service that allows clients (e.g., Fitbit 3P applications, internal Fitbit Services) to manage their subscriber endpoints. This service provides CRUD APIs for subscribers, and also offers functionalities for subscriber verification and statistics.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
SubscriberName parent = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]");
CreateSubscriptionPayload subscription = CreateSubscriptionPayload.newBuilder().build();
String subscriptionId = "subscriptionId1478790936";
Subscription response =
dataSubscriptionServiceClient.createSubscription(parent, subscription, subscriptionId);
}
Note: close() needs to be called on the DataSubscriptionServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateSubscriber |
Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent. **Endpoint Verification:** For a subscriber to be successfully created, the provided 1. **Verification with Authorization:** * **Headers:** Includes 2. **Verification without Authorization:** * **Headers:** Includes Both tests must pass for the subscriber creation to succeed. If verification fails, the operation will not be completed and an error will be returned. This process ensures the endpoint is reachable and correctly validates the |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListSubscribers |
Lists all subscribers registered within the owned Google Cloud Project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateSubscriber |
Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in. **Endpoint Verification:** If the 1. **Verification with Authorization:** POST to the new or existing Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSubscriber |
Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateSubscription |
Creates a subscription for a specific user to a specific subscriber. This method requires the subscriber to have a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListSubscriptions |
Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateSubscription |
Updates the data types for an existing user subscription. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSubscription |
Deletes a specific user subscription, stopping notifications for this user to this subscriber. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 DataSubscriptionServiceSettings 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
DataSubscriptionServiceSettings dataSubscriptionServiceSettings =
DataSubscriptionServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create(dataSubscriptionServiceSettings);
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
DataSubscriptionServiceSettings dataSubscriptionServiceSettings =
DataSubscriptionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create(dataSubscriptionServiceSettings);
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
DataSubscriptionServiceSettings dataSubscriptionServiceSettings =
DataSubscriptionServiceSettings.newHttpJsonBuilder().build();
DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create(dataSubscriptionServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final DataSubscriptionServiceClient create()Constructs an instance of DataSubscriptionServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DataSubscriptionServiceSettings settings)
public static final DataSubscriptionServiceClient create(DataSubscriptionServiceSettings settings)Constructs an instance of DataSubscriptionServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
DataSubscriptionServiceSettings |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DataSubscriptionServiceStub stub)
public static final DataSubscriptionServiceClient create(DataSubscriptionServiceStub stub)Constructs an instance of DataSubscriptionServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataSubscriptionServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
DataSubscriptionServiceStub |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient |
|
Constructors
DataSubscriptionServiceClient(DataSubscriptionServiceSettings settings)
protected DataSubscriptionServiceClient(DataSubscriptionServiceSettings settings)Constructs an instance of DataSubscriptionServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
DataSubscriptionServiceSettings |
DataSubscriptionServiceClient(DataSubscriptionServiceStub stub)
protected DataSubscriptionServiceClient(DataSubscriptionServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
DataSubscriptionServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()createSubscriberAsync(CreateSubscriberRequest request)
public final OperationFuture<Subscriber,CreateSubscriberMetadata> createSubscriberAsync(CreateSubscriberRequest request)Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent.
**Endpoint Verification:** For a subscriber to be successfully created, the
provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
1. **Verification with Authorization:** * **Headers:**
Includes Content-Type: application/json and Authorization (with the exact value from
CreateSubscriberPayload.endpoint_authorization.secret). * **Body:**
{"type": "verification"} * **Expected Response:** HTTP 201 Created.
2. **Verification without Authorization:** *
**Headers:** Includes Content-Type: application/json. The Authorization
header is OMITTED. * **Body:** {"type": "verification"} *
**Expected Response:** HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass for the subscriber creation to succeed. If verification fails, the
operation will not be completed and an error will be returned. This process ensures the
endpoint is reachable and correctly validates the Authorization header.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
CreateSubscriberRequest request =
CreateSubscriberRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setSubscriber(CreateSubscriberPayload.newBuilder().build())
.setSubscriberId("subscriberId327834531")
.build();
Subscriber response = dataSubscriptionServiceClient.createSubscriberAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateSubscriberRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Subscriber,CreateSubscriberMetadata> |
|
createSubscriberAsync(ProjectName parent, CreateSubscriberPayload subscriber, String subscriberId)
public final OperationFuture<Subscriber,CreateSubscriberMetadata> createSubscriberAsync(ProjectName parent, CreateSubscriberPayload subscriber, String subscriberId)Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent.
**Endpoint Verification:** For a subscriber to be successfully created, the
provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
1. **Verification with Authorization:** * **Headers:**
Includes Content-Type: application/json and Authorization (with the exact value from
CreateSubscriberPayload.endpoint_authorization.secret). * **Body:**
{"type": "verification"} * **Expected Response:** HTTP 201 Created.
2. **Verification without Authorization:** *
**Headers:** Includes Content-Type: application/json. The Authorization
header is OMITTED. * **Body:** {"type": "verification"} *
**Expected Response:** HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass for the subscriber creation to succeed. If verification fails, the
operation will not be completed and an error will be returned. This process ensures the
endpoint is reachable and correctly validates the Authorization header.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
CreateSubscriberPayload subscriber = CreateSubscriberPayload.newBuilder().build();
String subscriberId = "subscriberId327834531";
Subscriber response =
dataSubscriptionServiceClient
.createSubscriberAsync(parent, subscriber, subscriberId)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
ProjectNameRequired. The parent resource where this subscriber will be created. Format: projects/{project} Example: projects/my-project-123 |
subscriber |
CreateSubscriberPayloadRequired. The subscriber to create. |
subscriberId |
StringOptional. The ID to use for the subscriber, which will become the final component of the subscriber's resource name. This value should be 4-36 characters, and valid characters are /a-z/. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Subscriber,CreateSubscriberMetadata> |
|
createSubscriberAsync(String parent, CreateSubscriberPayload subscriber, String subscriberId)
public final OperationFuture<Subscriber,CreateSubscriberMetadata> createSubscriberAsync(String parent, CreateSubscriberPayload subscriber, String subscriberId)Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent.
**Endpoint Verification:** For a subscriber to be successfully created, the
provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
1. **Verification with Authorization:** * **Headers:**
Includes Content-Type: application/json and Authorization (with the exact value from
CreateSubscriberPayload.endpoint_authorization.secret). * **Body:**
{"type": "verification"} * **Expected Response:** HTTP 201 Created.
2. **Verification without Authorization:** *
**Headers:** Includes Content-Type: application/json. The Authorization
header is OMITTED. * **Body:** {"type": "verification"} *
**Expected Response:** HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass for the subscriber creation to succeed. If verification fails, the
operation will not be completed and an error will be returned. This process ensures the
endpoint is reachable and correctly validates the Authorization header.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
CreateSubscriberPayload subscriber = CreateSubscriberPayload.newBuilder().build();
String subscriberId = "subscriberId327834531";
Subscriber response =
dataSubscriptionServiceClient
.createSubscriberAsync(parent, subscriber, subscriberId)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this subscriber will be created. Format: projects/{project} Example: projects/my-project-123 |
subscriber |
CreateSubscriberPayloadRequired. The subscriber to create. |
subscriberId |
StringOptional. The ID to use for the subscriber, which will become the final component of the subscriber's resource name. This value should be 4-36 characters, and valid characters are /a-z/. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Subscriber,CreateSubscriberMetadata> |
|
createSubscriberCallable()
public final UnaryCallable<CreateSubscriberRequest,Operation> createSubscriberCallable()Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent.
**Endpoint Verification:** For a subscriber to be successfully created, the
provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
1. **Verification with Authorization:** * **Headers:**
Includes Content-Type: application/json and Authorization (with the exact value from
CreateSubscriberPayload.endpoint_authorization.secret). * **Body:**
{"type": "verification"} * **Expected Response:** HTTP 201 Created.
2. **Verification without Authorization:** *
**Headers:** Includes Content-Type: application/json. The Authorization
header is OMITTED. * **Body:** {"type": "verification"} *
**Expected Response:** HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass for the subscriber creation to succeed. If verification fails, the
operation will not be completed and an error will be returned. This process ensures the
endpoint is reachable and correctly validates the Authorization header.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
CreateSubscriberRequest request =
CreateSubscriberRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setSubscriber(CreateSubscriberPayload.newBuilder().build())
.setSubscriberId("subscriberId327834531")
.build();
ApiFuture<Operation> future =
dataSubscriptionServiceClient.createSubscriberCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateSubscriberRequest,Operation> |
|
createSubscriberOperationCallable()
public final OperationCallable<CreateSubscriberRequest,Subscriber,CreateSubscriberMetadata> createSubscriberOperationCallable()Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent.
**Endpoint Verification:** For a subscriber to be successfully created, the
provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
1. **Verification with Authorization:** * **Headers:**
Includes Content-Type: application/json and Authorization (with the exact value from
CreateSubscriberPayload.endpoint_authorization.secret). * **Body:**
{"type": "verification"} * **Expected Response:** HTTP 201 Created.
2. **Verification without Authorization:** *
**Headers:** Includes Content-Type: application/json. The Authorization
header is OMITTED. * **Body:** {"type": "verification"} *
**Expected Response:** HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass for the subscriber creation to succeed. If verification fails, the
operation will not be completed and an error will be returned. This process ensures the
endpoint is reachable and correctly validates the Authorization header.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
CreateSubscriberRequest request =
CreateSubscriberRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setSubscriber(CreateSubscriberPayload.newBuilder().build())
.setSubscriberId("subscriberId327834531")
.build();
OperationFuture<Subscriber, CreateSubscriberMetadata> future =
dataSubscriptionServiceClient.createSubscriberOperationCallable().futureCall(request);
// Do something.
Subscriber response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateSubscriberRequest,Subscriber,CreateSubscriberMetadata> |
|
createSubscription(CreateSubscriptionRequest request)
public final Subscription createSubscription(CreateSubscriptionRequest request)Creates a subscription for a specific user to a specific subscriber. This method requires the
subscriber to have a SubscriptionCreatePolicy set to MANUAL for the given data types.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
CreateSubscriptionRequest request =
CreateSubscriptionRequest.newBuilder()
.setParent(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setSubscriptionId("subscriptionId1478790936")
.setSubscription(CreateSubscriptionPayload.newBuilder().build())
.build();
Subscription response = dataSubscriptionServiceClient.createSubscription(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateSubscriptionRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Subscription |
|
createSubscription(SubscriberName parent, CreateSubscriptionPayload subscription, String subscriptionId)
public final Subscription createSubscription(SubscriberName parent, CreateSubscriptionPayload subscription, String subscriptionId)Creates a subscription for a specific user to a specific subscriber. This method requires the
subscriber to have a SubscriptionCreatePolicy set to MANUAL for the given data types.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
SubscriberName parent = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]");
CreateSubscriptionPayload subscription = CreateSubscriptionPayload.newBuilder().build();
String subscriptionId = "subscriptionId1478790936";
Subscription response =
dataSubscriptionServiceClient.createSubscription(parent, subscription, subscriptionId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
SubscriberNameRequired. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. |
subscription |
CreateSubscriptionPayloadRequired. The subscription to create. |
subscriptionId |
StringOptional. The {subscription_id} is user-settable (4-36 chars, matching /a-z/) or system-generated otherwise. If provided, the ID must be unique within the parent subscriber. |
| Returns | |
|---|---|
| Type | Description |
Subscription |
|
createSubscription(String parent, CreateSubscriptionPayload subscription, String subscriptionId)
public final Subscription createSubscription(String parent, CreateSubscriptionPayload subscription, String subscriptionId)Creates a subscription for a specific user to a specific subscriber. This method requires the
subscriber to have a SubscriptionCreatePolicy set to MANUAL for the given data types.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String parent = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString();
CreateSubscriptionPayload subscription = CreateSubscriptionPayload.newBuilder().build();
String subscriptionId = "subscriptionId1478790936";
Subscription response =
dataSubscriptionServiceClient.createSubscription(parent, subscription, subscriptionId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. |
subscription |
CreateSubscriptionPayloadRequired. The subscription to create. |
subscriptionId |
StringOptional. The {subscription_id} is user-settable (4-36 chars, matching /a-z/) or system-generated otherwise. If provided, the ID must be unique within the parent subscriber. |
| Returns | |
|---|---|
| Type | Description |
Subscription |
|
createSubscriptionCallable()
public final UnaryCallable<CreateSubscriptionRequest,Subscription> createSubscriptionCallable()Creates a subscription for a specific user to a specific subscriber. This method requires the
subscriber to have a SubscriptionCreatePolicy set to MANUAL for the given data types.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
CreateSubscriptionRequest request =
CreateSubscriptionRequest.newBuilder()
.setParent(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setSubscriptionId("subscriptionId1478790936")
.setSubscription(CreateSubscriptionPayload.newBuilder().build())
.build();
ApiFuture<Subscription> future =
dataSubscriptionServiceClient.createSubscriptionCallable().futureCall(request);
// Do something.
Subscription response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateSubscriptionRequest,Subscription> |
|
deleteSubscriberAsync(DeleteSubscriberRequest request)
public final OperationFuture<Empty,DeleteSubscriberMetadata> deleteSubscriberAsync(DeleteSubscriberRequest request)Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
DeleteSubscriberRequest request =
DeleteSubscriberRequest.newBuilder()
.setName(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setForce(true)
.build();
dataSubscriptionServiceClient.deleteSubscriberAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteSubscriberRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteSubscriberMetadata> |
|
deleteSubscriberAsync(SubscriberName name)
public final OperationFuture<Empty,DeleteSubscriberMetadata> deleteSubscriberAsync(SubscriberName name)Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
SubscriberName name = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]");
dataSubscriptionServiceClient.deleteSubscriberAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
SubscriberNameRequired. The name of the subscriber to delete. Format: projects/{project}/subscribers/{subscriber} Example: projects/my-project/subscribers/my-subscriber-123 The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteSubscriberMetadata> |
|
deleteSubscriberAsync(String name)
public final OperationFuture<Empty,DeleteSubscriberMetadata> deleteSubscriberAsync(String name)Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String name = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString();
dataSubscriptionServiceClient.deleteSubscriberAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the subscriber to delete. Format: projects/{project}/subscribers/{subscriber} Example: projects/my-project/subscribers/my-subscriber-123 The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,DeleteSubscriberMetadata> |
|
deleteSubscriberCallable()
public final UnaryCallable<DeleteSubscriberRequest,Operation> deleteSubscriberCallable()Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
DeleteSubscriberRequest request =
DeleteSubscriberRequest.newBuilder()
.setName(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setForce(true)
.build();
ApiFuture<Operation> future =
dataSubscriptionServiceClient.deleteSubscriberCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteSubscriberRequest,Operation> |
|
deleteSubscriberOperationCallable()
public final OperationCallable<DeleteSubscriberRequest,Empty,DeleteSubscriberMetadata> deleteSubscriberOperationCallable()Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
DeleteSubscriberRequest request =
DeleteSubscriberRequest.newBuilder()
.setName(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setForce(true)
.build();
OperationFuture<Empty, DeleteSubscriberMetadata> future =
dataSubscriptionServiceClient.deleteSubscriberOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteSubscriberRequest,Empty,DeleteSubscriberMetadata> |
|
deleteSubscription(DeleteSubscriptionRequest request)
public final void deleteSubscription(DeleteSubscriptionRequest request)Deletes a specific user subscription, stopping notifications for this user to this subscriber.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
DeleteSubscriptionRequest request =
DeleteSubscriptionRequest.newBuilder()
.setName(
SubscriptionName.of("[PROJECT]", "[SUBSCRIBER]", "[SUBSCRIPTION]").toString())
.build();
dataSubscriptionServiceClient.deleteSubscription(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteSubscriptionRequestThe request object containing all of the parameters for the API call. |
deleteSubscription(SubscriptionName name)
public final void deleteSubscription(SubscriptionName name)Deletes a specific user subscription, stopping notifications for this user to this subscriber.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIBER]", "[SUBSCRIPTION]");
dataSubscriptionServiceClient.deleteSubscription(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
SubscriptionNameRequired. The resource name of the subscription to delete. Format:
|
deleteSubscription(String name)
public final void deleteSubscription(String name)Deletes a specific user subscription, stopping notifications for this user to this subscriber.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIBER]", "[SUBSCRIPTION]").toString();
dataSubscriptionServiceClient.deleteSubscription(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the subscription to delete. Format:
|
deleteSubscriptionCallable()
public final UnaryCallable<DeleteSubscriptionRequest,Empty> deleteSubscriptionCallable()Deletes a specific user subscription, stopping notifications for this user to this subscriber.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
DeleteSubscriptionRequest request =
DeleteSubscriptionRequest.newBuilder()
.setName(
SubscriptionName.of("[PROJECT]", "[SUBSCRIBER]", "[SUBSCRIPTION]").toString())
.build();
ApiFuture<Empty> future =
dataSubscriptionServiceClient.deleteSubscriptionCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteSubscriptionRequest,Empty> |
|
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getOperationsClient()
public final OperationsClient getOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
public final DataSubscriptionServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceSettings |
|
getStub()
public DataSubscriptionServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listSubscribers(ListSubscribersRequest request)
public final DataSubscriptionServiceClient.ListSubscribersPagedResponse listSubscribers(ListSubscribersRequest request)Lists all subscribers registered within the owned Google Cloud Project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscribersRequest request =
ListSubscribersRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Subscriber element :
dataSubscriptionServiceClient.listSubscribers(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListSubscribersRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscribersPagedResponse |
|
listSubscribers(ProjectName parent)
public final DataSubscriptionServiceClient.ListSubscribersPagedResponse listSubscribers(ProjectName parent)Lists all subscribers registered within the owned Google Cloud Project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (Subscriber element :
dataSubscriptionServiceClient.listSubscribers(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
ProjectNameRequired. The parent, which owns this collection of subscribers. Format: projects/{project} |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscribersPagedResponse |
|
listSubscribers(String parent)
public final DataSubscriptionServiceClient.ListSubscribersPagedResponse listSubscribers(String parent)Lists all subscribers registered within the owned Google Cloud Project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
for (Subscriber element :
dataSubscriptionServiceClient.listSubscribers(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of subscribers. Format: projects/{project} |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscribersPagedResponse |
|
listSubscribersCallable()
public final UnaryCallable<ListSubscribersRequest,ListSubscribersResponse> listSubscribersCallable()Lists all subscribers registered within the owned Google Cloud Project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscribersRequest request =
ListSubscribersRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSubscribersResponse response =
dataSubscriptionServiceClient.listSubscribersCallable().call(request);
for (Subscriber element : response.getSubscribersList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListSubscribersRequest,ListSubscribersResponse> |
|
listSubscribersPagedCallable()
public final UnaryCallable<ListSubscribersRequest,DataSubscriptionServiceClient.ListSubscribersPagedResponse> listSubscribersPagedCallable()Lists all subscribers registered within the owned Google Cloud Project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscribersRequest request =
ListSubscribersRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Subscriber> future =
dataSubscriptionServiceClient.listSubscribersPagedCallable().futureCall(request);
// Do something.
for (Subscriber element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListSubscribersRequest,ListSubscribersPagedResponse> |
|
listSubscriptions(ListSubscriptionsRequest request)
public final DataSubscriptionServiceClient.ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request)Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscriptionsRequest request =
ListSubscriptionsRequest.newBuilder()
.setParent(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Subscription element :
dataSubscriptionServiceClient.listSubscriptions(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListSubscriptionsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscriptionsPagedResponse |
|
listSubscriptions(SubscriberName parent)
public final DataSubscriptionServiceClient.ListSubscriptionsPagedResponse listSubscriptions(SubscriberName parent)Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
SubscriberName parent = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]");
for (Subscription element :
dataSubscriptionServiceClient.listSubscriptions(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
SubscriberNameRequired. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscriptionsPagedResponse |
|
listSubscriptions(String parent)
public final DataSubscriptionServiceClient.ListSubscriptionsPagedResponse listSubscriptions(String parent)Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
String parent = SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString();
for (Subscription element :
dataSubscriptionServiceClient.listSubscriptions(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. |
| Returns | |
|---|---|
| Type | Description |
DataSubscriptionServiceClient.ListSubscriptionsPagedResponse |
|
listSubscriptionsCallable()
public final UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> listSubscriptionsCallable()Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscriptionsRequest request =
ListSubscriptionsRequest.newBuilder()
.setParent(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListSubscriptionsResponse response =
dataSubscriptionServiceClient.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;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> |
|
listSubscriptionsPagedCallable()
public final UnaryCallable<ListSubscriptionsRequest,DataSubscriptionServiceClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
ListSubscriptionsRequest request =
ListSubscriptionsRequest.newBuilder()
.setParent(SubscriberName.of("[PROJECT]", "[SUBSCRIBER]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Subscription> future =
dataSubscriptionServiceClient.listSubscriptionsPagedCallable().futureCall(request);
// Do something.
for (Subscription element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateSubscriberAsync(Subscriber subscriber, FieldMask updateMask)
public final OperationFuture<Subscriber,UpdateSubscriberMetadata> updateSubscriberAsync(Subscriber subscriber, FieldMask updateMask)Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in.
**Endpoint Verification:** If the endpoint_uri or endpoint_authorization
field is included in the update_mask, the backend will re-verify the endpoint. The
verification process is the same as described in CreateSubscriber:
1. **Verification with Authorization:** POST to the new or existing
endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2.
**Verification without Authorization:** POST to the endpoint_uri without the
Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
Subscriber subscriber = Subscriber.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Subscriber response =
dataSubscriptionServiceClient.updateSubscriberAsync(subscriber, updateMask).get();
}
| Parameters | |
|---|---|
| Name | Description |
subscriber |
SubscriberRequired. The subscriber resource to update. Its 'name' field is mapped to the URI, and the value of the 'name' field should be of the form: "projects/{project}/subscribers/{subscriber_id}". The remaining fields of the Subscriber object represent the new values for the corresponding fields in the existing subscriber resource. |
updateMask |
FieldMaskOptional. A field mask that specifies which fields of the Subscriber message are to be updated. This allows for partial updates. Supported fields: - endpoint_uri - subscriber_configs - endpoint_authorization |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Subscriber,UpdateSubscriberMetadata> |
|
updateSubscriberAsync(UpdateSubscriberRequest request)
public final OperationFuture<Subscriber,UpdateSubscriberMetadata> updateSubscriberAsync(UpdateSubscriberRequest request)Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in.
**Endpoint Verification:** If the endpoint_uri or endpoint_authorization
field is included in the update_mask, the backend will re-verify the endpoint. The
verification process is the same as described in CreateSubscriber:
1. **Verification with Authorization:** POST to the new or existing
endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2.
**Verification without Authorization:** POST to the endpoint_uri without the
Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
UpdateSubscriberRequest request =
UpdateSubscriberRequest.newBuilder()
.setSubscriber(Subscriber.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Subscriber response = dataSubscriptionServiceClient.updateSubscriberAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateSubscriberRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Subscriber,UpdateSubscriberMetadata> |
|
updateSubscriberCallable()
public final UnaryCallable<UpdateSubscriberRequest,Operation> updateSubscriberCallable()Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in.
**Endpoint Verification:** If the endpoint_uri or endpoint_authorization
field is included in the update_mask, the backend will re-verify the endpoint. The
verification process is the same as described in CreateSubscriber:
1. **Verification with Authorization:** POST to the new or existing
endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2.
**Verification without Authorization:** POST to the endpoint_uri without the
Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
UpdateSubscriberRequest request =
UpdateSubscriberRequest.newBuilder()
.setSubscriber(Subscriber.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
dataSubscriptionServiceClient.updateSubscriberCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateSubscriberRequest,Operation> |
|
updateSubscriberOperationCallable()
public final OperationCallable<UpdateSubscriberRequest,Subscriber,UpdateSubscriberMetadata> updateSubscriberOperationCallable()Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in.
**Endpoint Verification:** If the endpoint_uri or endpoint_authorization
field is included in the update_mask, the backend will re-verify the endpoint. The
verification process is the same as described in CreateSubscriber:
1. **Verification with Authorization:** POST to the new or existing
endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2.
**Verification without Authorization:** POST to the endpoint_uri without the
Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden.
Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
UpdateSubscriberRequest request =
UpdateSubscriberRequest.newBuilder()
.setSubscriber(Subscriber.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Subscriber, UpdateSubscriberMetadata> future =
dataSubscriptionServiceClient.updateSubscriberOperationCallable().futureCall(request);
// Do something.
Subscriber response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateSubscriberRequest,Subscriber,UpdateSubscriberMetadata> |
|
updateSubscription(Subscription subscription, FieldMask updateMask)
public final Subscription updateSubscription(Subscription subscription, FieldMask updateMask)Updates the data types for an existing user 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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
Subscription subscription = Subscription.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Subscription response =
dataSubscriptionServiceClient.updateSubscription(subscription, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
subscription |
SubscriptionRequired. The subscription to update. The subscription's |
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
Subscription |
|
updateSubscription(UpdateSubscriptionRequest request)
public final Subscription updateSubscription(UpdateSubscriptionRequest request)Updates the data types for an existing user 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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
UpdateSubscriptionRequest request =
UpdateSubscriptionRequest.newBuilder()
.setSubscription(Subscription.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Subscription response = dataSubscriptionServiceClient.updateSubscription(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateSubscriptionRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Subscription |
|
updateSubscriptionCallable()
public final UnaryCallable<UpdateSubscriptionRequest,Subscription> updateSubscriptionCallable()Updates the data types for an existing user 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 (DataSubscriptionServiceClient dataSubscriptionServiceClient =
DataSubscriptionServiceClient.create()) {
UpdateSubscriptionRequest request =
UpdateSubscriptionRequest.newBuilder()
.setSubscription(Subscription.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Subscription> future =
dataSubscriptionServiceClient.updateSubscriptionCallable().futureCall(request);
// Do something.
Subscription response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateSubscriptionRequest,Subscription> |
|