@BetaApi @Generated(value="by gapic-generator") public class AdminServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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:
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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:
AdminServiceSettings adminServiceSettings =
AdminServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings);
To customize the endpoint:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
AdminServiceClient.ListSubscriptionsFixedSizeCollection |
static class |
AdminServiceClient.ListSubscriptionsPage |
static class |
AdminServiceClient.ListSubscriptionsPagedResponse |
static class |
AdminServiceClient.ListTopicsFixedSizeCollection |
static class |
AdminServiceClient.ListTopicsPage |
static class |
AdminServiceClient.ListTopicsPagedResponse |
static class |
AdminServiceClient.ListTopicSubscriptionsFixedSizeCollection |
static class |
AdminServiceClient.ListTopicSubscriptionsPage |
static class |
AdminServiceClient.ListTopicSubscriptionsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
AdminServiceClient(AdminServiceSettings settings)
Constructs an instance of AdminServiceClient, using the given settings.
|
protected |
AdminServiceClient(AdminServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static AdminServiceClient |
create()
Constructs an instance of AdminServiceClient with default settings.
|
static AdminServiceClient |
create(AdminServiceSettings settings)
Constructs an instance of AdminServiceClient, using the given settings.
|
static AdminServiceClient |
create(AdminServiceStub stub)
Constructs an instance of AdminServiceClient, using the given stub for making calls.
|
Subscription |
createSubscription(CreateSubscriptionRequest request)
Creates a new subscription.
|
Subscription |
createSubscription(LocationName parent,
Subscription subscription,
String subscriptionId)
Creates a new subscription.
|
Subscription |
createSubscription(String parent,
Subscription subscription,
String subscriptionId)
Creates a new subscription.
|
com.google.api.gax.rpc.UnaryCallable<CreateSubscriptionRequest,Subscription> |
createSubscriptionCallable()
Creates a new subscription.
|
Topic |
createTopic(CreateTopicRequest request)
Creates a new topic.
|
Topic |
createTopic(LocationName parent,
Topic topic,
String topicId)
Creates a new topic.
|
Topic |
createTopic(String parent,
Topic topic,
String topicId)
Creates a new topic.
|
com.google.api.gax.rpc.UnaryCallable<CreateTopicRequest,Topic> |
createTopicCallable()
Creates a new topic.
|
void |
deleteSubscription(DeleteSubscriptionRequest request)
Deletes the specified subscription.
|
void |
deleteSubscription(String name)
Deletes the specified subscription.
|
void |
deleteSubscription(SubscriptionName name)
Deletes the specified subscription.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty> |
deleteSubscriptionCallable()
Deletes the specified subscription.
|
void |
deleteTopic(DeleteTopicRequest request)
Deletes the specified topic.
|
void |
deleteTopic(String name)
Deletes the specified topic.
|
void |
deleteTopic(TopicName name)
Deletes the specified topic.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTopicRequest,com.google.protobuf.Empty> |
deleteTopicCallable()
Deletes the specified topic.
|
AdminServiceSettings |
getSettings() |
AdminServiceStub |
getStub() |
Subscription |
getSubscription(GetSubscriptionRequest request)
Returns the subscription configuration.
|
Subscription |
getSubscription(String name)
Returns the subscription configuration.
|
Subscription |
getSubscription(SubscriptionName name)
Returns the subscription configuration.
|
com.google.api.gax.rpc.UnaryCallable<GetSubscriptionRequest,Subscription> |
getSubscriptionCallable()
Returns the subscription configuration.
|
Topic |
getTopic(GetTopicRequest request)
Returns the topic configuration.
|
Topic |
getTopic(String name)
Returns the topic configuration.
|
Topic |
getTopic(TopicName name)
Returns the topic configuration.
|
com.google.api.gax.rpc.UnaryCallable<GetTopicRequest,Topic> |
getTopicCallable()
Returns the topic configuration.
|
TopicPartitions |
getTopicPartitions(GetTopicPartitionsRequest request)
Returns the partition information for the requested topic.
|
TopicPartitions |
getTopicPartitions(String name)
Returns the partition information for the requested topic.
|
TopicPartitions |
getTopicPartitions(TopicName name)
Returns the partition information for the requested topic.
|
com.google.api.gax.rpc.UnaryCallable<GetTopicPartitionsRequest,TopicPartitions> |
getTopicPartitionsCallable()
Returns the partition information for the requested topic.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
AdminServiceClient.ListSubscriptionsPagedResponse |
listSubscriptions(ListSubscriptionsRequest request)
Returns the list of subscriptions for the given project.
|
AdminServiceClient.ListSubscriptionsPagedResponse |
listSubscriptions(LocationName parent)
Returns the list of subscriptions for the given project.
|
AdminServiceClient.ListSubscriptionsPagedResponse |
listSubscriptions(String parent)
Returns the list of subscriptions for the given project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> |
listSubscriptionsCallable()
Returns the list of subscriptions for the given project.
|
com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,AdminServiceClient.ListSubscriptionsPagedResponse> |
listSubscriptionsPagedCallable()
Returns the list of subscriptions for the given project.
|
AdminServiceClient.ListTopicsPagedResponse |
listTopics(ListTopicsRequest request)
Returns the list of topics for the given project.
|
AdminServiceClient.ListTopicsPagedResponse |
listTopics(LocationName parent)
Returns the list of topics for the given project.
|
AdminServiceClient.ListTopicsPagedResponse |
listTopics(String parent)
Returns the list of topics for the given project.
|
com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,ListTopicsResponse> |
listTopicsCallable()
Returns the list of topics for the given project.
|
com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,AdminServiceClient.ListTopicsPagedResponse> |
listTopicsPagedCallable()
Returns the list of topics for the given project.
|
AdminServiceClient.ListTopicSubscriptionsPagedResponse |
listTopicSubscriptions(ListTopicSubscriptionsRequest request)
Lists the subscriptions attached to the specified topic.
|
AdminServiceClient.ListTopicSubscriptionsPagedResponse |
listTopicSubscriptions(String name)
Lists the subscriptions attached to the specified topic.
|
AdminServiceClient.ListTopicSubscriptionsPagedResponse |
listTopicSubscriptions(TopicName name)
Lists the subscriptions attached to the specified topic.
|
com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,ListTopicSubscriptionsResponse> |
listTopicSubscriptionsCallable()
Lists the subscriptions attached to the specified topic.
|
com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,AdminServiceClient.ListTopicSubscriptionsPagedResponse> |
listTopicSubscriptionsPagedCallable()
Lists the subscriptions attached to the specified topic.
|
void |
shutdown() |
void |
shutdownNow() |
Subscription |
updateSubscription(Subscription subscription,
com.google.protobuf.FieldMask updateMask)
Updates properties of the specified subscription.
|
Subscription |
updateSubscription(UpdateSubscriptionRequest request)
Updates properties of the specified subscription.
|
com.google.api.gax.rpc.UnaryCallable<UpdateSubscriptionRequest,Subscription> |
updateSubscriptionCallable()
Updates properties of the specified subscription.
|
Topic |
updateTopic(Topic topic,
com.google.protobuf.FieldMask updateMask)
Updates properties of the specified topic.
|
Topic |
updateTopic(UpdateTopicRequest request)
Updates properties of the specified topic.
|
com.google.api.gax.rpc.UnaryCallable<UpdateTopicRequest,Topic> |
updateTopicCallable()
Updates properties of the specified topic.
|
protected AdminServiceClient(AdminServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected AdminServiceClient(AdminServiceStub stub)
public static final AdminServiceClient create() throws IOException
IOExceptionpublic static final AdminServiceClient create(AdminServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final AdminServiceClient create(AdminServiceStub stub)
public final AdminServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public AdminServiceStub getStub()
public final Topic createTopic(LocationName parent, Topic topic, String topicId)
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`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Topic createTopic(String parent, Topic topic, String topicId)
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`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Topic createTopic(CreateTopicRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateTopicRequest,Topic> createTopicCallable()
Sample code:
public final Topic getTopic(TopicName name)
name - Required. The name of the topic whose configuration to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Topic getTopic(String name)
name - Required. The name of the topic whose configuration to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Topic getTopic(GetTopicRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetTopicRequest,Topic> getTopicCallable()
Sample code:
public final TopicPartitions getTopicPartitions(TopicName name)
name - Required. The topic whose partition information to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TopicPartitions getTopicPartitions(String name)
name - Required. The topic whose partition information to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TopicPartitions getTopicPartitions(GetTopicPartitionsRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetTopicPartitionsRequest,TopicPartitions> getTopicPartitionsCallable()
Sample code:
public final AdminServiceClient.ListTopicsPagedResponse listTopics(LocationName parent)
parent - Required. The parent whose topics are to be listed. Structured like
`projects/{project_number}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListTopicsPagedResponse listTopics(String parent)
parent - Required. The parent whose topics are to be listed. Structured like
`projects/{project_number}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListTopicsPagedResponse listTopics(ListTopicsRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,AdminServiceClient.ListTopicsPagedResponse> listTopicsPagedCallable()
Sample code:
public final com.google.api.gax.rpc.UnaryCallable<ListTopicsRequest,ListTopicsResponse> listTopicsCallable()
Sample code:
public final Topic updateTopic(Topic topic, com.google.protobuf.FieldMask updateMask)
topic - Required. The topic to update. Its `name` field must be populated.updateMask - Required. A mask specifying the topic fields to change.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Topic updateTopic(UpdateTopicRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateTopicRequest,Topic> updateTopicCallable()
Sample code:
public final void deleteTopic(TopicName name)
name - Required. The name of the topic to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTopic(String name)
name - Required. The name of the topic to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTopic(DeleteTopicRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteTopicRequest,com.google.protobuf.Empty> deleteTopicCallable()
Sample code:
public final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicName name)
name - Required. The name of the topic whose subscriptions to list.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String name)
name - Required. The name of the topic whose subscriptions to list.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ListTopicSubscriptionsRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,AdminServiceClient.ListTopicSubscriptionsPagedResponse> listTopicSubscriptionsPagedCallable()
Sample code:
public final com.google.api.gax.rpc.UnaryCallable<ListTopicSubscriptionsRequest,ListTopicSubscriptionsResponse> listTopicSubscriptionsCallable()
Sample code:
public final Subscription createSubscription(LocationName parent, Subscription subscription, String subscriptionId)
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`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subscription createSubscription(String parent, Subscription subscription, String subscriptionId)
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`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subscription createSubscription(CreateSubscriptionRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateSubscriptionRequest,Subscription> createSubscriptionCallable()
Sample code:
public final Subscription getSubscription(SubscriptionName name)
name - Required. The name of the subscription whose configuration to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subscription getSubscription(String name)
name - Required. The name of the subscription whose configuration to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subscription getSubscription(GetSubscriptionRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSubscriptionRequest,Subscription> getSubscriptionCallable()
Sample code:
public final AdminServiceClient.ListSubscriptionsPagedResponse listSubscriptions(LocationName parent)
parent - Required. The parent whose subscriptions are to be listed. Structured like
`projects/{project_number}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListSubscriptionsPagedResponse listSubscriptions(String parent)
parent - Required. The parent whose subscriptions are to be listed. Structured like
`projects/{project_number}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdminServiceClient.ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,AdminServiceClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()
Sample code:
public final com.google.api.gax.rpc.UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> listSubscriptionsCallable()
Sample code:
public final Subscription updateSubscription(Subscription subscription, com.google.protobuf.FieldMask updateMask)
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Subscription updateSubscription(UpdateSubscriptionRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateSubscriptionRequest,Subscription> updateSubscriptionCallable()
Sample code:
public final void deleteSubscription(SubscriptionName name)
name - Required. The name of the subscription to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSubscription(String name)
name - Required. The name of the subscription to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSubscription(DeleteSubscriptionRequest request)
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteSubscriptionRequest,com.google.protobuf.Empty> deleteSubscriptionCallable()
Sample code:
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2021 Google LLC. All rights reserved.