- 2.56.0 (latest)
- 2.55.0
- 2.54.0
- 2.53.0
- 2.52.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.6
- 2.2.9
public class ProfileServiceClient implements BackgroundResource
Service Description: A service that handles profile management, including profile CRUD, enumeration and search.
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:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.createProfile(parent, profile);
}
Note: close() needs to be called on the ProfileServiceClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 ProfileServiceSettings to create(). For example:
To customize credentials:
ProfileServiceSettings profileServiceSettings =
ProfileServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ProfileServiceClient profileServiceClient = ProfileServiceClient.create(profileServiceSettings);
To customize the endpoint:
ProfileServiceSettings profileServiceSettings =
ProfileServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ProfileServiceClient profileServiceClient = ProfileServiceClient.create(profileServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final ProfileServiceClient create()
Constructs an instance of ProfileServiceClient with default settings.
Type | Description |
ProfileServiceClient |
Type | Description |
IOException |
create(ProfileServiceSettings settings)
public static final ProfileServiceClient create(ProfileServiceSettings settings)
Constructs an instance of ProfileServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | ProfileServiceSettings |
Type | Description |
ProfileServiceClient |
Type | Description |
IOException |
create(ProfileServiceStub stub)
public static final ProfileServiceClient create(ProfileServiceStub stub)
Constructs an instance of ProfileServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ProfileServiceSettings).
Name | Description |
stub | ProfileServiceStub |
Type | Description |
ProfileServiceClient |
Constructors
ProfileServiceClient(ProfileServiceSettings settings)
protected ProfileServiceClient(ProfileServiceSettings settings)
Constructs an instance of ProfileServiceClient, 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.
Name | Description |
settings | ProfileServiceSettings |
ProfileServiceClient(ProfileServiceStub stub)
protected ProfileServiceClient(ProfileServiceStub stub)
Name | Description |
stub | ProfileServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createProfile(CreateProfileRequest request)
public final Profile createProfile(CreateProfileRequest request)
Creates and returns a new profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
CreateProfileRequest request =
CreateProfileRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setProfile(Profile.newBuilder().build())
.build();
Profile response = profileServiceClient.createProfile(request);
}
Name | Description |
request | CreateProfileRequest The request object containing all of the parameters for the API call. |
Type | Description |
Profile |
createProfile(TenantName parent, Profile profile)
public final Profile createProfile(TenantName parent, Profile profile)
Creates and returns a new profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.createProfile(parent, profile);
}
Name | Description |
parent | TenantName Required. The name of the tenant this profile belongs to. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
profile | Profile Required. The profile to be created. |
Type | Description |
Profile |
createProfile(String parent, Profile profile)
public final Profile createProfile(String parent, Profile profile)
Creates and returns a new profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.createProfile(parent, profile);
}
Name | Description |
parent | String Required. The name of the tenant this profile belongs to. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
profile | Profile Required. The profile to be created. |
Type | Description |
Profile |
createProfileCallable()
public final UnaryCallable<CreateProfileRequest,Profile> createProfileCallable()
Creates and returns a new profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
CreateProfileRequest request =
CreateProfileRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setProfile(Profile.newBuilder().build())
.build();
ApiFuture<Profile> future = profileServiceClient.createProfileCallable().futureCall(request);
// Do something.
Profile response = future.get();
}
Type | Description |
UnaryCallable<CreateProfileRequest,Profile> |
deleteProfile(DeleteProfileRequest request)
public final void deleteProfile(DeleteProfileRequest request)
Deletes the specified profile. Prerequisite: The profile has no associated applications or assignments associated.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
DeleteProfileRequest request =
DeleteProfileRequest.newBuilder()
.setName(ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString())
.build();
profileServiceClient.deleteProfile(request);
}
Name | Description |
request | DeleteProfileRequest The request object containing all of the parameters for the API call. |
deleteProfile(ProfileName name)
public final void deleteProfile(ProfileName name)
Deletes the specified profile. Prerequisite: The profile has no associated applications or assignments associated.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
profileServiceClient.deleteProfile(name);
}
Name | Description |
name | ProfileName Required. Resource name of the profile to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". |
deleteProfile(String name)
public final void deleteProfile(String name)
Deletes the specified profile. Prerequisite: The profile has no associated applications or assignments associated.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
String name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString();
profileServiceClient.deleteProfile(name);
}
Name | Description |
name | String Required. Resource name of the profile to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". |
deleteProfileCallable()
public final UnaryCallable<DeleteProfileRequest,Empty> deleteProfileCallable()
Deletes the specified profile. Prerequisite: The profile has no associated applications or assignments associated.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
DeleteProfileRequest request =
DeleteProfileRequest.newBuilder()
.setName(ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString())
.build();
ApiFuture<Empty> future = profileServiceClient.deleteProfileCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteProfileRequest,Empty> |
getProfile(GetProfileRequest request)
public final Profile getProfile(GetProfileRequest request)
Gets the specified profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
GetProfileRequest request =
GetProfileRequest.newBuilder()
.setName(ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString())
.build();
Profile response = profileServiceClient.getProfile(request);
}
Name | Description |
request | GetProfileRequest The request object containing all of the parameters for the API call. |
Type | Description |
Profile |
getProfile(ProfileName name)
public final Profile getProfile(ProfileName name)
Gets the specified profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Profile response = profileServiceClient.getProfile(name);
}
Name | Description |
name | ProfileName Required. Resource name of the profile to get. The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". |
Type | Description |
Profile |
getProfile(String name)
public final Profile getProfile(String name)
Gets the specified profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
String name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString();
Profile response = profileServiceClient.getProfile(name);
}
Name | Description |
name | String Required. Resource name of the profile to get. The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". |
Type | Description |
Profile |
getProfileCallable()
public final UnaryCallable<GetProfileRequest,Profile> getProfileCallable()
Gets the specified profile.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
GetProfileRequest request =
GetProfileRequest.newBuilder()
.setName(ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]").toString())
.build();
ApiFuture<Profile> future = profileServiceClient.getProfileCallable().futureCall(request);
// Do something.
Profile response = future.get();
}
Type | Description |
UnaryCallable<GetProfileRequest,Profile> |
getSettings()
public final ProfileServiceSettings getSettings()
Type | Description |
ProfileServiceSettings |
getStub()
public ProfileServiceStub getStub()
Type | Description |
ProfileServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listProfiles(ListProfilesRequest request)
public final ProfileServiceClient.ListProfilesPagedResponse listProfiles(ListProfilesRequest request)
Lists profiles by filter. The order is unspecified.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ListProfilesRequest request =
ListProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setReadMask(FieldMask.newBuilder().build())
.build();
for (Profile element : profileServiceClient.listProfiles(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListProfilesRequest The request object containing all of the parameters for the API call. |
Type | Description |
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(TenantName parent)
public final ProfileServiceClient.ListProfilesPagedResponse listProfiles(TenantName parent)
Lists profiles by filter. The order is unspecified.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
for (Profile element : profileServiceClient.listProfiles(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the profile is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
Type | Description |
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(String parent)
public final ProfileServiceClient.ListProfilesPagedResponse listProfiles(String parent)
Lists profiles by filter. The order is unspecified.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
for (Profile element : profileServiceClient.listProfiles(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The resource name of the tenant under which the profile is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
Type | Description |
ProfileServiceClient.ListProfilesPagedResponse |
listProfilesCallable()
public final UnaryCallable<ListProfilesRequest,ListProfilesResponse> listProfilesCallable()
Lists profiles by filter. The order is unspecified.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ListProfilesRequest request =
ListProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setReadMask(FieldMask.newBuilder().build())
.build();
while (true) {
ListProfilesResponse response = profileServiceClient.listProfilesCallable().call(request);
for (Profile element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListProfilesRequest,ListProfilesResponse> |
listProfilesPagedCallable()
public final UnaryCallable<ListProfilesRequest,ProfileServiceClient.ListProfilesPagedResponse> listProfilesPagedCallable()
Lists profiles by filter. The order is unspecified.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ListProfilesRequest request =
ListProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setReadMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Profile> future =
profileServiceClient.listProfilesPagedCallable().futureCall(request);
// Do something.
for (Profile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListProfilesRequest,ListProfilesPagedResponse> |
searchProfiles(SearchProfilesRequest request)
public final ProfileServiceClient.SearchProfilesPagedResponse searchProfiles(SearchProfilesRequest request)
Searches for profiles within a tenant.
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See SearchProfilesRequest for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
SearchProfilesRequest request =
SearchProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setProfileQuery(ProfileQuery.newBuilder().build())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOffset(-1019779949)
.setDisableSpellCheck(true)
.setOrderBy("orderBy-1207110587")
.setCaseSensitiveSort(true)
.addAllHistogramQueries(new ArrayList
Name | Description |
request | SearchProfilesRequest The request object containing all of the parameters for the API call. |
Type | Description |
ProfileServiceClient.SearchProfilesPagedResponse |
searchProfilesCallable()
public final UnaryCallable<SearchProfilesRequest,SearchProfilesResponse> searchProfilesCallable()
Searches for profiles within a tenant.
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See SearchProfilesRequest for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
SearchProfilesRequest request =
SearchProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setProfileQuery(ProfileQuery.newBuilder().build())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOffset(-1019779949)
.setDisableSpellCheck(true)
.setOrderBy("orderBy-1207110587")
.setCaseSensitiveSort(true)
.addAllHistogramQueries(new ArrayList
Type | Description |
UnaryCallable<SearchProfilesRequest,SearchProfilesResponse> |
searchProfilesPagedCallable()
public final UnaryCallable<SearchProfilesRequest,ProfileServiceClient.SearchProfilesPagedResponse> searchProfilesPagedCallable()
Searches for profiles within a tenant.
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See SearchProfilesRequest for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
SearchProfilesRequest request =
SearchProfilesRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setProfileQuery(ProfileQuery.newBuilder().build())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setOffset(-1019779949)
.setDisableSpellCheck(true)
.setOrderBy("orderBy-1207110587")
.setCaseSensitiveSort(true)
.addAllHistogramQueries(new ArrayList
Type | Description |
UnaryCallable<SearchProfilesRequest,SearchProfilesPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateProfile(Profile profile)
public final Profile updateProfile(Profile profile)
Updates the specified profile and returns the updated result.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.updateProfile(profile);
}
Name | Description |
profile | Profile Required. Profile to be updated. |
Type | Description |
Profile |
updateProfile(UpdateProfileRequest request)
public final Profile updateProfile(UpdateProfileRequest request)
Updates the specified profile and returns the updated result.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
UpdateProfileRequest request =
UpdateProfileRequest.newBuilder()
.setProfile(Profile.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Profile response = profileServiceClient.updateProfile(request);
}
Name | Description |
request | UpdateProfileRequest The request object containing all of the parameters for the API call. |
Type | Description |
Profile |
updateProfileCallable()
public final UnaryCallable<UpdateProfileRequest,Profile> updateProfileCallable()
Updates the specified profile and returns the updated result.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
UpdateProfileRequest request =
UpdateProfileRequest.newBuilder()
.setProfile(Profile.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Profile> future = profileServiceClient.updateProfileCallable().futureCall(request);
// Do something.
Profile response = future.get();
}
Type | Description |
UnaryCallable<UpdateProfileRequest,Profile> |