Class AdminServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Topic topic = Topic.newBuilder().build();
String topicId = "topicId-1139259734";
Topic response = adminServiceClient.createTopic(parent, topic, topicId);
}
Note: close() needs to be called on the AdminServiceClient 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 |
|---|---|---|
CreateTopic |
Creates a new topic. |
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.
|
GetTopic |
Returns the topic configuration. |
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.
|
GetTopicPartitions |
Returns the partition information for the requested topic. |
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.
|
ListTopics |
Returns the list of topics for the given 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.
|
UpdateTopic |
Updates properties of the specified topic. |
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.
|
DeleteTopic |
Deletes the specified topic. |
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.
|
ListTopicSubscriptions |
Lists the subscriptions attached to the specified topic. |
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.
|
CreateSubscription |
Creates a new 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.
|
GetSubscription |
Returns the subscription configuration. |
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 |
Returns the list of subscriptions for the given 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.
|
UpdateSubscription |
Updates properties of the specified 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 the specified 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.
|
SeekSubscription |
Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors. If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients. If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online. If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateReservation |
Creates a new reservation. |
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.
|
GetReservation |
Returns the reservation configuration. |
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.
|
ListReservations |
Returns the list of reservations for the given 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.
|
UpdateReservation |
Updates properties of the specified reservation. |
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.
|
DeleteReservation |
Deletes the specified reservation. |
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.
|
ListReservationTopics |
Lists the topics attached to the specified reservation. |
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 AdminServiceSettings 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
AdminServiceSettings adminServiceSettings =
AdminServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings);
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
AdminServiceSettings adminServiceSettings =
AdminServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAdminServiceClient(AdminServiceSettings settings) Constructs an instance of AdminServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final AdminServiceClientcreate()Constructs an instance of AdminServiceClient with default settings.static final AdminServiceClientcreate(AdminServiceSettings settings) Constructs an instance of AdminServiceClient, using the given settings.static final AdminServiceClientcreate(AdminServiceStub stub) Constructs an instance of AdminServiceClient, using the given stub for making calls.final ReservationCreates a new reservation.final ReservationcreateReservation(LocationName parent, Reservation reservation, String reservationId) Creates a new reservation.final ReservationcreateReservation(String parent, Reservation reservation, String reservationId) Creates a new reservation.final com.google.api.gax.rpc.UnaryCallable<CreateReservationRequest,Reservation> Creates a new reservation.final SubscriptionCreates a new subscription.final SubscriptioncreateSubscription(LocationName parent, Subscription subscription, String subscriptionId) Creates a new subscription.final SubscriptioncreateSubscription(String parent, Subscription subscription, String subscriptionId) Creates a new subscription.final com.google.api.gax.rpc.UnaryCallable<CreateSubscriptionRequest,Subscription> Creates a new subscription.final TopiccreateTopic(CreateTopicRequest request) Creates a new topic.final TopiccreateTopic(LocationName parent, Topic topic, String topicId) Creates a new topic.final TopiccreateTopic(String parent, Topic topic, String topicId) Creates a new topic.final com.google.api.gax.rpc.UnaryCallable<CreateTopicRequest,Topic> Creates a new topic.final voidDeletes the specified reservation.final voidDeletes the specified reservation.final voiddeleteReservation(String name) Deletes the specified reservation.final com.google.api.gax.rpc.UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty> Deletes the specified reservation.final voidDeletes the specified subscription.final voidDeletes the specified subscription.final voiddeleteSubscription(String name) Deletes the specified subscription.final com.google.api.gax.rpc.UnaryCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty> Deletes the specified subscription.final voiddeleteTopic(DeleteTopicRequest request) Deletes the specified topic.final voiddeleteTopic(TopicName name) Deletes the specified topic.final voiddeleteTopic(String name) Deletes the specified topic.final com.google.api.gax.rpc.UnaryCallable<DeleteTopicRequest,com.google.protobuf.Empty> Deletes the specified topic.final com.google.longrunning.OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final ReservationgetReservation(GetReservationRequest request) Returns the reservation configuration.final ReservationReturns the reservation configuration.final ReservationgetReservation(String name) Returns the reservation configuration.final com.google.api.gax.rpc.UnaryCallable<GetReservationRequest,Reservation> Returns the reservation configuration.final AdminServiceSettingsgetStub()final SubscriptiongetSubscription(GetSubscriptionRequest request) Returns the subscription configuration.final SubscriptionReturns the subscription configuration.final SubscriptiongetSubscription(String name) Returns the subscription configuration.final com.google.api.gax.rpc.UnaryCallable<GetSubscriptionRequest,Subscription> Returns the subscription configuration.final TopicgetTopic(GetTopicRequest request) Returns the topic configuration.final TopicReturns the topic configuration.final TopicReturns the topic configuration.final com.google.api.gax.rpc.UnaryCallable<GetTopicRequest,Topic> Returns the topic configuration.final TopicPartitionsReturns the partition information for the requested topic.final TopicPartitionsgetTopicPartitions(TopicName name) Returns the partition information for the requested topic.final TopicPartitionsgetTopicPartitions(String name) Returns the partition information for the requested topic.final com.google.api.gax.rpc.UnaryCallable<GetTopicPartitionsRequest,TopicPartitions> Returns the partition information for the requested topic.booleanbooleanlistReservations(ListReservationsRequest request) Returns the list of reservations for the given project.listReservations(LocationName parent) Returns the list of reservations for the given project.listReservations(String parent) Returns the list of reservations for the given project.final com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,ListReservationsResponse> Returns the list of reservations for the given project.final com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,AdminServiceClient.ListReservationsPagedResponse> Returns the list of reservations for the given project.Lists the topics attached to the specified reservation.Lists the topics attached to the specified reservation.listReservationTopics(String name) Lists the topics attached to the specified reservation.final com.google.api.gax.rpc.UnaryCallable<ListReservationTopicsRequest,ListReservationTopicsResponse> Lists the topics attached to the specified reservation.final com.google.api.gax.rpc.UnaryCallable<ListReservationTopicsRequest,AdminServiceClient.ListReservationTopicsPagedResponse> Lists the topics attached to the specified reservation.Returns the list of subscriptions for the given project.listSubscriptions(LocationName parent) Returns the list of subscriptions for the given project.listSubscriptions(String parent) Returns the list of subscriptions for the given project.final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> Returns the list of subscriptions for the given project.final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,AdminServiceClient.ListSubscriptionsPagedResponse> Returns the list of subscriptions for the given project.listTopics(ListTopicsRequest request) Returns the list of topics for the given project.listTopics(LocationName parent) Returns the list of topics for the given project.listTopics(String parent) Returns the list of topics for the given project.final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,ListTopicsResponse> Returns the list of topics for the given project.final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,AdminServiceClient.ListTopicsPagedResponse> Returns the list of topics for the given project.Lists the subscriptions attached to the specified topic.Lists the subscriptions attached to the specified topic.listTopicSubscriptions(String name) Lists the subscriptions attached to the specified topic.final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,ListTopicSubscriptionsResponse> Lists the subscriptions attached to the specified topic.final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,AdminServiceClient.ListTopicSubscriptionsPagedResponse> Lists the subscriptions attached to the specified topic.final com.google.api.gax.longrunning.OperationFuture<SeekSubscriptionResponse,OperationMetadata> Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog.final com.google.api.gax.rpc.UnaryCallable<SeekSubscriptionRequest,com.google.longrunning.Operation> Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog.final com.google.api.gax.rpc.OperationCallable<SeekSubscriptionRequest,SeekSubscriptionResponse, OperationMetadata> Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog.voidshutdown()voidfinal ReservationupdateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask) Updates properties of the specified reservation.final ReservationUpdates properties of the specified reservation.final com.google.api.gax.rpc.UnaryCallable<UpdateReservationRequest,Reservation> Updates properties of the specified reservation.final SubscriptionupdateSubscription(Subscription subscription, com.google.protobuf.FieldMask updateMask) Updates properties of the specified subscription.final SubscriptionUpdates properties of the specified subscription.final com.google.api.gax.rpc.UnaryCallable<UpdateSubscriptionRequest,Subscription> Updates properties of the specified subscription.final TopicupdateTopic(Topic topic, com.google.protobuf.FieldMask updateMask) Updates properties of the specified topic.final TopicupdateTopic(UpdateTopicRequest request) Updates properties of the specified topic.final com.google.api.gax.rpc.UnaryCallable<UpdateTopicRequest,Topic> Updates properties of the specified topic.
-
Constructor Details
-
AdminServiceClient
Constructs an instance of AdminServiceClient, 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
-
AdminServiceClient
-
-
Method Details
-
create
Constructs an instance of AdminServiceClient with default settings.- Throws:
IOException
-
create
Constructs an instance of AdminServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of AdminServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AdminServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createTopic
Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Topic topic = Topic.newBuilder().build(); String topicId = "topicId-1139259734"; Topic response = adminServiceClient.createTopic(parent, topic, topicId); }- Parameters:
parent- Required. The parent location in which to create the topic. Structured like `projects/{project_number}/locations/{location}`.topic- Required. Configuration of the topic to create. Its `name` field is ignored.topicId- Required. The ID to use for the topic, which will become the final component of the topic's name.This value is structured like: `my-topic-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createTopic
Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Topic topic = Topic.newBuilder().build(); String topicId = "topicId-1139259734"; Topic response = adminServiceClient.createTopic(parent, topic, topicId); }- Parameters:
parent- Required. The parent location in which to create the topic. Structured like `projects/{project_number}/locations/{location}`.topic- Required. Configuration of the topic to create. Its `name` field is ignored.topicId- Required. The ID to use for the topic, which will become the final component of the topic's name.This value is structured like: `my-topic-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createTopic
Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateTopicRequest request = CreateTopicRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setTopic(Topic.newBuilder().build()) .setTopicId("topicId-1139259734") .build(); Topic response = adminServiceClient.createTopic(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
-
createTopicCallable
Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateTopicRequest request = CreateTopicRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setTopic(Topic.newBuilder().build()) .setTopicId("topicId-1139259734") .build(); ApiFuture<Topic> future = adminServiceClient.createTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
getTopic
Returns the topic configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); Topic response = adminServiceClient.getTopic(name); }- Parameters:
name- Required. The name of the topic whose configuration to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getTopic
Returns the topic configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); Topic response = adminServiceClient.getTopic(name); }- Parameters:
name- Required. The name of the topic whose configuration to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getTopic
Returns the topic configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetTopicRequest request = GetTopicRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); Topic response = adminServiceClient.getTopic(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
-
getTopicCallable
Returns the topic configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetTopicRequest request = GetTopicRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); ApiFuture<Topic> future = adminServiceClient.getTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
getTopicPartitions
Returns the partition information for the requested 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); TopicPartitions response = adminServiceClient.getTopicPartitions(name); }- Parameters:
name- Required. The topic whose partition information to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getTopicPartitions
Returns the partition information for the requested 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); TopicPartitions response = adminServiceClient.getTopicPartitions(name); }- Parameters:
name- Required. The topic whose partition information to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getTopicPartitions
Returns the partition information for the requested 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetTopicPartitionsRequest request = GetTopicPartitionsRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); TopicPartitions response = adminServiceClient.getTopicPartitions(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
-
getTopicPartitionsCallable
public final com.google.api.gax.rpc.UnaryCallable<GetTopicPartitionsRequest,TopicPartitions> getTopicPartitionsCallable()Returns the partition information for the requested 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetTopicPartitionsRequest request = GetTopicPartitionsRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); ApiFuture<TopicPartitions> future = adminServiceClient.getTopicPartitionsCallable().futureCall(request); // Do something. TopicPartitions response = future.get(); } -
listTopics
Returns the list of topics for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Topic element : adminServiceClient.listTopics(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose topics are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listTopics
Returns the list of topics for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Topic element : adminServiceClient.listTopics(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose topics are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listTopics
Returns the list of topics for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicsRequest request = ListTopicsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Topic element : adminServiceClient.listTopics(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
-
listTopicsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,AdminServiceClient.ListTopicsPagedResponse> listTopicsPagedCallable()Returns the list of topics for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicsRequest request = ListTopicsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Topic> future = adminServiceClient.listTopicsPagedCallable().futureCall(request); // Do something. for (Topic element : future.get().iterateAll()) { // doThingsWith(element); } } -
listTopicsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,ListTopicsResponse> listTopicsCallable()Returns the list of topics for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicsRequest request = ListTopicsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListTopicsResponse response = adminServiceClient.listTopicsCallable().call(request); for (Topic element : response.getTopicsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateTopic
Updates properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { Topic topic = Topic.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Topic response = adminServiceClient.updateTopic(topic, updateMask); }- Parameters:
topic- Required. The topic to update. Its `name` field must be populated.updateMask- Required. A mask specifying the topic fields to change.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateTopic
Updates properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateTopicRequest request = UpdateTopicRequest.newBuilder() .setTopic(Topic.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Topic response = adminServiceClient.updateTopic(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
-
updateTopicCallable
Updates properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateTopicRequest request = UpdateTopicRequest.newBuilder() .setTopic(Topic.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Topic> future = adminServiceClient.updateTopicCallable().futureCall(request); // Do something. Topic response = future.get(); } -
deleteTopic
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); adminServiceClient.deleteTopic(name); }- Parameters:
name- Required. The name of the topic to delete.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteTopic
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); adminServiceClient.deleteTopic(name); }- Parameters:
name- Required. The name of the topic to delete.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteTopic
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteTopicRequest request = DeleteTopicRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); adminServiceClient.deleteTopic(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
-
deleteTopicCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteTopicRequest,com.google.protobuf.Empty> deleteTopicCallable()Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteTopicRequest request = DeleteTopicRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .build(); ApiFuture<Empty> future = adminServiceClient.deleteTopicCallable().futureCall(request); // Do something. future.get(); } -
listTopicSubscriptions
public final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicName name) Lists the subscriptions attached to the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); for (String element : adminServiceClient.listTopicSubscriptions(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the topic whose subscriptions to list.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listTopicSubscriptions
public final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String name) Lists the subscriptions attached to the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); for (String element : adminServiceClient.listTopicSubscriptions(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the topic whose subscriptions to list.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listTopicSubscriptions
public final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ListTopicSubscriptionsRequest request) Lists the subscriptions attached to the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (String element : adminServiceClient.listTopicSubscriptions(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
-
listTopicSubscriptionsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,AdminServiceClient.ListTopicSubscriptionsPagedResponse> listTopicSubscriptionsPagedCallable()Lists the subscriptions attached to the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<String> future = adminServiceClient.listTopicSubscriptionsPagedCallable().futureCall(request); // Do something. for (String element : future.get().iterateAll()) { // doThingsWith(element); } } -
listTopicSubscriptionsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,ListTopicSubscriptionsResponse> listTopicSubscriptionsCallable()Lists the subscriptions attached to the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder() .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListTopicSubscriptionsResponse response = adminServiceClient.listTopicSubscriptionsCallable().call(request); for (String element : response.getSubscriptionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
createSubscription
public final Subscription createSubscription(LocationName parent, Subscription subscription, String subscriptionId) Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Subscription subscription = Subscription.newBuilder().build(); String subscriptionId = "subscriptionId1478790936"; Subscription response = adminServiceClient.createSubscription(parent, subscription, subscriptionId); }- Parameters:
parent- Required. The parent location in which to create the subscription. Structured like `projects/{project_number}/locations/{location}`.subscription- Required. Configuration of the subscription to create. Its `name` field is ignored.subscriptionId- Required. The ID to use for the subscription, which will become the final component of the subscription's name.This value is structured like: `my-sub-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createSubscription
public final Subscription createSubscription(String parent, Subscription subscription, String subscriptionId) Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Subscription subscription = Subscription.newBuilder().build(); String subscriptionId = "subscriptionId1478790936"; Subscription response = adminServiceClient.createSubscription(parent, subscription, subscriptionId); }- Parameters:
parent- Required. The parent location in which to create the subscription. Structured like `projects/{project_number}/locations/{location}`.subscription- Required. Configuration of the subscription to create. Its `name` field is ignored.subscriptionId- Required. The ID to use for the subscription, which will become the final component of the subscription's name.This value is structured like: `my-sub-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createSubscription
Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSubscription(Subscription.newBuilder().build()) .setSubscriptionId("subscriptionId1478790936") .setSkipBacklog(true) .build(); Subscription response = adminServiceClient.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
-
createSubscriptionCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateSubscriptionRequest,Subscription> createSubscriptionCallable()Creates a new 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSubscription(Subscription.newBuilder().build()) .setSubscriptionId("subscriptionId1478790936") .setSkipBacklog(true) .build(); ApiFuture<Subscription> future = adminServiceClient.createSubscriptionCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
getSubscription
Returns the subscription configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { SubscriptionName name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]"); Subscription response = adminServiceClient.getSubscription(name); }- Parameters:
name- Required. The name of the subscription whose configuration to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getSubscription
Returns the subscription configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString(); Subscription response = adminServiceClient.getSubscription(name); }- Parameters:
name- Required. The name of the subscription whose configuration to return.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getSubscription
Returns the subscription configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); Subscription response = adminServiceClient.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
-
getSubscriptionCallable
public final com.google.api.gax.rpc.UnaryCallable<GetSubscriptionRequest,Subscription> getSubscriptionCallable()Returns the subscription configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); ApiFuture<Subscription> future = adminServiceClient.getSubscriptionCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
listSubscriptions
public final AdminServiceClient.ListSubscriptionsPagedResponse listSubscriptions(LocationName parent) Returns the list of subscriptions for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Subscription element : adminServiceClient.listSubscriptions(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose subscriptions are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listSubscriptions
Returns the list of subscriptions for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Subscription element : adminServiceClient.listSubscriptions(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose subscriptions are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listSubscriptions
public final AdminServiceClient.ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request) Returns the list of subscriptions for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Subscription element : adminServiceClient.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,AdminServiceClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()Returns the list of subscriptions for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Subscription> future = adminServiceClient.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()Returns the list of subscriptions for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListSubscriptionsResponse response = adminServiceClient.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; } } } -
updateSubscription
public final Subscription updateSubscription(Subscription subscription, com.google.protobuf.FieldMask updateMask) Updates properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { Subscription subscription = Subscription.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Subscription response = adminServiceClient.updateSubscription(subscription, updateMask); }- Parameters:
subscription- Required. The subscription to update. Its `name` field must be populated. Topic field must not be populated.updateMask- Required. A mask specifying the subscription fields to change.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateSubscription
Updates properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Subscription response = adminServiceClient.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 properties of the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder() .setSubscription(Subscription.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Subscription> future = adminServiceClient.updateSubscriptionCallable().futureCall(request); // Do something. Subscription response = future.get(); } -
deleteSubscription
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { SubscriptionName name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]"); adminServiceClient.deleteSubscription(name); }- Parameters:
name- Required. The name of the subscription to delete.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteSubscription
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString(); adminServiceClient.deleteSubscription(name); }- Parameters:
name- Required. The name of the subscription to delete.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteSubscription
Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); adminServiceClient.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
-
deleteSubscriptionCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty> deleteSubscriptionCallable()Deletes the specified 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); ApiFuture<Empty> future = adminServiceClient.deleteSubscriptionCallable().futureCall(request); // Do something. future.get(); } -
seekSubscriptionAsync
public final com.google.api.gax.longrunning.OperationFuture<SeekSubscriptionResponse,OperationMetadata> seekSubscriptionAsync(SeekSubscriptionRequest request) Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors.If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients.
If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online.
If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it.
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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { SeekSubscriptionRequest request = SeekSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); SeekSubscriptionResponse response = adminServiceClient.seekSubscriptionAsync(request).get(); }- 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
-
seekSubscriptionOperationCallable
public final com.google.api.gax.rpc.OperationCallable<SeekSubscriptionRequest,SeekSubscriptionResponse, seekSubscriptionOperationCallable()OperationMetadata> Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors.If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients.
If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online.
If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it.
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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { SeekSubscriptionRequest request = SeekSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); OperationFuture<SeekSubscriptionResponse, OperationMetadata> future = adminServiceClient.seekSubscriptionOperationCallable().futureCall(request); // Do something. SeekSubscriptionResponse response = future.get(); } -
seekSubscriptionCallable
public final com.google.api.gax.rpc.UnaryCallable<SeekSubscriptionRequest,com.google.longrunning.Operation> seekSubscriptionCallable()Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. Seek translates these targets to cursors for each partition and orchestrates subscribers to start consuming messages from these seek cursors.If an operation is returned, the seek has been registered and subscribers will eventually receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a minimum supported client library version and not a system that tracks cursors independently of Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported clients.
If clients would like to know when subscribers react to the seek (or not), they can poll the operation. The seek operation will succeed and complete once subscribers are ready to receive messages from the seek cursors for all partitions of the topic. This means that the seek operation will not complete until all subscribers come online.
If the previous seek operation has not yet completed, it will be aborted and the new invocation of seek will supersede it.
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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { SeekSubscriptionRequest request = SeekSubscriptionRequest.newBuilder() .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .build(); ApiFuture<Operation> future = adminServiceClient.seekSubscriptionCallable().futureCall(request); // Do something. Operation response = future.get(); } -
createReservation
public final Reservation createReservation(LocationName parent, Reservation reservation, String reservationId) Creates a new reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Reservation reservation = Reservation.newBuilder().build(); String reservationId = "reservationId1116965383"; Reservation response = adminServiceClient.createReservation(parent, reservation, reservationId); }- Parameters:
parent- Required. The parent location in which to create the reservation. Structured like `projects/{project_number}/locations/{location}`.reservation- Required. Configuration of the reservation to create. Its `name` field is ignored.reservationId- Required. The ID to use for the reservation, which will become the final component of the reservation's name.This value is structured like: `my-reservation-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createReservation
public final Reservation createReservation(String parent, Reservation reservation, String reservationId) Creates a new reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Reservation reservation = Reservation.newBuilder().build(); String reservationId = "reservationId1116965383"; Reservation response = adminServiceClient.createReservation(parent, reservation, reservationId); }- Parameters:
parent- Required. The parent location in which to create the reservation. Structured like `projects/{project_number}/locations/{location}`.reservation- Required. Configuration of the reservation to create. Its `name` field is ignored.reservationId- Required. The ID to use for the reservation, which will become the final component of the reservation's name.This value is structured like: `my-reservation-name`.
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createReservation
Creates a new reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateReservationRequest request = CreateReservationRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setReservation(Reservation.newBuilder().build()) .setReservationId("reservationId1116965383") .build(); Reservation response = adminServiceClient.createReservation(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
-
createReservationCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateReservationRequest,Reservation> createReservationCallable()Creates a new reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { CreateReservationRequest request = CreateReservationRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setReservation(Reservation.newBuilder().build()) .setReservationId("reservationId1116965383") .build(); ApiFuture<Reservation> future = adminServiceClient.createReservationCallable().futureCall(request); // Do something. Reservation response = future.get(); } -
getReservation
Returns the reservation configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); Reservation response = adminServiceClient.getReservation(name); }- Parameters:
name- Required. The name of the reservation whose configuration to return. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getReservation
Returns the reservation configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); Reservation response = adminServiceClient.getReservation(name); }- Parameters:
name- Required. The name of the reservation whose configuration to return. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getReservation
Returns the reservation configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetReservationRequest request = GetReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); Reservation response = adminServiceClient.getReservation(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
-
getReservationCallable
public final com.google.api.gax.rpc.UnaryCallable<GetReservationRequest,Reservation> getReservationCallable()Returns the reservation configuration.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { GetReservationRequest request = GetReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); ApiFuture<Reservation> future = adminServiceClient.getReservationCallable().futureCall(request); // Do something. Reservation response = future.get(); } -
listReservations
Returns the list of reservations for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Reservation element : adminServiceClient.listReservations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose reservations are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listReservations
Returns the list of reservations for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Reservation element : adminServiceClient.listReservations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent whose reservations are to be listed. Structured like `projects/{project_number}/locations/{location}`.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listReservations
public final AdminServiceClient.ListReservationsPagedResponse listReservations(ListReservationsRequest request) Returns the list of reservations for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationsRequest request = ListReservationsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Reservation element : adminServiceClient.listReservations(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
-
listReservationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,AdminServiceClient.ListReservationsPagedResponse> listReservationsPagedCallable()Returns the list of reservations for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationsRequest request = ListReservationsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Reservation> future = adminServiceClient.listReservationsPagedCallable().futureCall(request); // Do something. for (Reservation element : future.get().iterateAll()) { // doThingsWith(element); } } -
listReservationsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,ListReservationsResponse> listReservationsCallable()Returns the list of reservations for the given 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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationsRequest request = ListReservationsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListReservationsResponse response = adminServiceClient.listReservationsCallable().call(request); for (Reservation element : response.getReservationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateReservation
public final Reservation updateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask) Updates properties of the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { Reservation reservation = Reservation.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Reservation response = adminServiceClient.updateReservation(reservation, updateMask); }- Parameters:
reservation- Required. The reservation to update. Its `name` field must be populated.updateMask- Required. A mask specifying the reservation fields to change.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateReservation
Updates properties of the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateReservationRequest request = UpdateReservationRequest.newBuilder() .setReservation(Reservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Reservation response = adminServiceClient.updateReservation(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
-
updateReservationCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateReservationRequest,Reservation> updateReservationCallable()Updates properties of the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { UpdateReservationRequest request = UpdateReservationRequest.newBuilder() .setReservation(Reservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Reservation> future = adminServiceClient.updateReservationCallable().futureCall(request); // Do something. Reservation response = future.get(); } -
deleteReservation
Deletes the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); adminServiceClient.deleteReservation(name); }- Parameters:
name- Required. The name of the reservation to delete. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteReservation
Deletes the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); adminServiceClient.deleteReservation(name); }- Parameters:
name- Required. The name of the reservation to delete. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteReservation
Deletes the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); adminServiceClient.deleteReservation(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
-
deleteReservationCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty> deleteReservationCallable()Deletes the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); ApiFuture<Empty> future = adminServiceClient.deleteReservationCallable().futureCall(request); // Do something. future.get(); } -
listReservationTopics
public final AdminServiceClient.ListReservationTopicsPagedResponse listReservationTopics(ReservationName name) Lists the topics attached to the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); for (String element : adminServiceClient.listReservationTopics(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the reservation whose topics to list. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listReservationTopics
public final AdminServiceClient.ListReservationTopicsPagedResponse listReservationTopics(String name) Lists the topics attached to the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); for (String element : adminServiceClient.listReservationTopics(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the reservation whose topics to list. Structured like: projects/{project_number}/locations/{location}/reservations/{reservation_id}- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listReservationTopics
public final AdminServiceClient.ListReservationTopicsPagedResponse listReservationTopics(ListReservationTopicsRequest request) Lists the topics attached to the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationTopicsRequest request = ListReservationTopicsRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (String element : adminServiceClient.listReservationTopics(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
-
listReservationTopicsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListReservationTopicsRequest,AdminServiceClient.ListReservationTopicsPagedResponse> listReservationTopicsPagedCallable()Lists the topics attached to the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationTopicsRequest request = ListReservationTopicsRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<String> future = adminServiceClient.listReservationTopicsPagedCallable().futureCall(request); // Do something. for (String element : future.get().iterateAll()) { // doThingsWith(element); } } -
listReservationTopicsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListReservationTopicsRequest,ListReservationTopicsResponse> listReservationTopicsCallable()Lists the topics attached to the specified reservation.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 (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { ListReservationTopicsRequest request = ListReservationTopicsRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListReservationTopicsResponse response = adminServiceClient.listReservationTopicsCallable().call(request); for (String element : response.getTopicsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-