| GitHub Repository | Product Reference |
Service Description: Service for managing User Stores.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
UserStoreName name = UserStoreName.of("[PROJECT]", "[LOCATION]", "[USER_STORE]");
UserStore response = userStoreServiceClient.getUserStore(name);
}
Note: close() needs to be called on the UserStoreServiceClient 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 |
|---|---|---|
GetUserStore |
Gets the User Store. |
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.
|
UpdateUserStore |
Updates the User Store. |
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 UserStoreServiceSettings 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
UserStoreServiceSettings userStoreServiceSettings =
UserStoreServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
UserStoreServiceClient userStoreServiceClient =
UserStoreServiceClient.create(userStoreServiceSettings);
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
UserStoreServiceSettings userStoreServiceSettings =
UserStoreServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
UserStoreServiceClient userStoreServiceClient =
UserStoreServiceClient.create(userStoreServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
UserStoreServiceSettings userStoreServiceSettings =
UserStoreServiceSettings.newHttpJsonBuilder().build();
UserStoreServiceClient userStoreServiceClient =
UserStoreServiceClient.create(userStoreServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final UserStoreServiceClient create()Constructs an instance of UserStoreServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
UserStoreServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(UserStoreServiceSettings settings)
public static final UserStoreServiceClient create(UserStoreServiceSettings settings)Constructs an instance of UserStoreServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
UserStoreServiceSettings |
| Returns | |
|---|---|
| Type | Description |
UserStoreServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(UserStoreServiceStub stub)
public static final UserStoreServiceClient create(UserStoreServiceStub stub)Constructs an instance of UserStoreServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(UserStoreServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
UserStoreServiceStub |
| Returns | |
|---|---|
| Type | Description |
UserStoreServiceClient |
|
Constructors
UserStoreServiceClient(UserStoreServiceSettings settings)
protected UserStoreServiceClient(UserStoreServiceSettings settings)Constructs an instance of UserStoreServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
UserStoreServiceSettings |
UserStoreServiceClient(UserStoreServiceStub stub)
protected UserStoreServiceClient(UserStoreServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
UserStoreServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()getSettings()
public final UserStoreServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
UserStoreServiceSettings |
|
getStub()
public UserStoreServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
UserStoreServiceStub |
|
getUserStore(GetUserStoreRequest request)
public final UserStore getUserStore(GetUserStoreRequest request)Gets the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
GetUserStoreRequest request =
GetUserStoreRequest.newBuilder()
.setName(UserStoreName.of("[PROJECT]", "[LOCATION]", "[USER_STORE]").toString())
.build();
UserStore response = userStoreServiceClient.getUserStore(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetUserStoreRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
UserStore |
|
getUserStore(UserStoreName name)
public final UserStore getUserStore(UserStoreName name)Gets the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
UserStoreName name = UserStoreName.of("[PROJECT]", "[LOCATION]", "[USER_STORE]");
UserStore response = userStoreServiceClient.getUserStore(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
UserStoreNameRequired. The name of the User Store to get. Format:
|
| Returns | |
|---|---|
| Type | Description |
UserStore |
|
getUserStore(String name)
public final UserStore getUserStore(String name)Gets the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
String name = UserStoreName.of("[PROJECT]", "[LOCATION]", "[USER_STORE]").toString();
UserStore response = userStoreServiceClient.getUserStore(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the User Store to get. Format:
|
| Returns | |
|---|---|
| Type | Description |
UserStore |
|
getUserStoreCallable()
public final UnaryCallable<GetUserStoreRequest,UserStore> getUserStoreCallable()Gets the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
GetUserStoreRequest request =
GetUserStoreRequest.newBuilder()
.setName(UserStoreName.of("[PROJECT]", "[LOCATION]", "[USER_STORE]").toString())
.build();
ApiFuture<UserStore> future =
userStoreServiceClient.getUserStoreCallable().futureCall(request);
// Do something.
UserStore response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetUserStoreRequest,UserStore> |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateUserStore(UpdateUserStoreRequest request)
public final UserStore updateUserStore(UpdateUserStoreRequest request)Updates the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
UpdateUserStoreRequest request =
UpdateUserStoreRequest.newBuilder()
.setUserStore(UserStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
UserStore response = userStoreServiceClient.updateUserStore(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateUserStoreRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
UserStore |
|
updateUserStore(UserStore userStore, FieldMask updateMask)
public final UserStore updateUserStore(UserStore userStore, FieldMask updateMask)Updates the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
UserStore userStore = UserStore.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UserStore response = userStoreServiceClient.updateUserStore(userStore, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
userStore |
UserStoreRequired. The User Store to update. Format:
|
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
UserStore |
|
updateUserStoreCallable()
public final UnaryCallable<UpdateUserStoreRequest,UserStore> updateUserStoreCallable()Updates the User Store.
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 (UserStoreServiceClient userStoreServiceClient = UserStoreServiceClient.create()) {
UpdateUserStoreRequest request =
UpdateUserStoreRequest.newBuilder()
.setUserStore(UserStore.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<UserStore> future =
userStoreServiceClient.updateUserStoreCallable().futureCall(request);
// Do something.
UserStore response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateUserStoreRequest,UserStore> |
|