@Generated(value="by gapic-generator") @BetaApi public class ProfileServiceClient extends Object implements 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:
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:
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);
Modifier and Type | Class and Description |
---|---|
static class |
ProfileServiceClient.ListProfilesFixedSizeCollection |
static class |
ProfileServiceClient.ListProfilesPage |
static class |
ProfileServiceClient.ListProfilesPagedResponse |
static class |
ProfileServiceClient.SearchProfilesFixedSizeCollection |
static class |
ProfileServiceClient.SearchProfilesPage |
static class |
ProfileServiceClient.SearchProfilesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ProfileServiceClient(ProfileServiceSettings settings)
Constructs an instance of ProfileServiceClient, using the given settings.
|
protected |
ProfileServiceClient(ProfileServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ProfileServiceClient |
create()
Constructs an instance of ProfileServiceClient with default settings.
|
static ProfileServiceClient |
create(ProfileServiceSettings settings)
Constructs an instance of ProfileServiceClient, using the given settings.
|
static ProfileServiceClient |
create(ProfileServiceStub stub)
Constructs an instance of ProfileServiceClient, using the given stub for making calls.
|
com.google.cloud.talent.v4beta1.Profile |
createProfile(com.google.cloud.talent.v4beta1.CreateProfileRequest request)
Creates and returns a new profile.
|
com.google.cloud.talent.v4beta1.Profile |
createProfile(String parent,
com.google.cloud.talent.v4beta1.Profile profile)
Creates and returns a new profile.
|
com.google.cloud.talent.v4beta1.Profile |
createProfile(com.google.cloud.talent.v4beta1.TenantName parent,
com.google.cloud.talent.v4beta1.Profile profile)
Creates and returns a new profile.
|
UnaryCallable<com.google.cloud.talent.v4beta1.CreateProfileRequest,com.google.cloud.talent.v4beta1.Profile> |
createProfileCallable()
Creates and returns a new profile.
|
void |
deleteProfile(com.google.cloud.talent.v4beta1.DeleteProfileRequest request)
Deletes the specified profile.
|
void |
deleteProfile(com.google.cloud.talent.v4beta1.ProfileName name)
Deletes the specified profile.
|
void |
deleteProfile(String name)
Deletes the specified profile.
|
UnaryCallable<com.google.cloud.talent.v4beta1.DeleteProfileRequest,Empty> |
deleteProfileCallable()
Deletes the specified profile.
|
com.google.cloud.talent.v4beta1.Profile |
getProfile(com.google.cloud.talent.v4beta1.GetProfileRequest request)
Gets the specified profile.
|
com.google.cloud.talent.v4beta1.Profile |
getProfile(com.google.cloud.talent.v4beta1.ProfileName name)
Gets the specified profile.
|
com.google.cloud.talent.v4beta1.Profile |
getProfile(String name)
Gets the specified profile.
|
UnaryCallable<com.google.cloud.talent.v4beta1.GetProfileRequest,com.google.cloud.talent.v4beta1.Profile> |
getProfileCallable()
Gets the specified profile.
|
ProfileServiceSettings |
getSettings() |
ProfileServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(com.google.cloud.talent.v4beta1.ListProfilesRequest request)
Lists profiles by filter.
|
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(String parent)
Lists profiles by filter.
|
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(com.google.cloud.talent.v4beta1.TenantName parent)
Lists profiles by filter.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListProfilesRequest,com.google.cloud.talent.v4beta1.ListProfilesResponse> |
listProfilesCallable()
Lists profiles by filter.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListProfilesRequest,ProfileServiceClient.ListProfilesPagedResponse> |
listProfilesPagedCallable()
Lists profiles by filter.
|
ProfileServiceClient.SearchProfilesPagedResponse |
searchProfiles(com.google.cloud.talent.v4beta1.SearchProfilesRequest request)
Searches for profiles within a tenant.
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchProfilesRequest,com.google.cloud.talent.v4beta1.SearchProfilesResponse> |
searchProfilesCallable()
Searches for profiles within a tenant.
|
UnaryCallable<com.google.cloud.talent.v4beta1.SearchProfilesRequest,ProfileServiceClient.SearchProfilesPagedResponse> |
searchProfilesPagedCallable()
Searches for profiles within a tenant.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.talent.v4beta1.Profile |
updateProfile(com.google.cloud.talent.v4beta1.Profile profile)
Updates the specified profile and returns the updated result.
|
com.google.cloud.talent.v4beta1.Profile |
updateProfile(com.google.cloud.talent.v4beta1.UpdateProfileRequest request)
Updates the specified profile and returns the updated result.
|
UnaryCallable<com.google.cloud.talent.v4beta1.UpdateProfileRequest,com.google.cloud.talent.v4beta1.Profile> |
updateProfileCallable()
Updates the specified profile and returns the updated result.
|
protected ProfileServiceClient(ProfileServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ProfileServiceClient(ProfileServiceStub stub)
public static final ProfileServiceClient create() throws IOException
IOException
public static final ProfileServiceClient create(ProfileServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ProfileServiceClient create(ProfileServiceStub stub)
public final ProfileServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ProfileServiceStub getStub()
public final ProfileServiceClient.ListProfilesPagedResponse listProfiles(com.google.cloud.talent.v4beta1.TenantName parent)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
for (Profile element : profileServiceClient.listProfiles(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenants/foo".
ApiException
- if the remote call failspublic final ProfileServiceClient.ListProfilesPagedResponse listProfiles(String parent)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
for (Profile element : profileServiceClient.listProfiles(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
The resource name of the tenant under which the job is created.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenants/foo".
ApiException
- if the remote call failspublic final ProfileServiceClient.ListProfilesPagedResponse listProfiles(com.google.cloud.talent.v4beta1.ListProfilesRequest request)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListProfilesRequest request = ListProfilesRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Profile element : profileServiceClient.listProfiles(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.ListProfilesRequest,ProfileServiceClient.ListProfilesPagedResponse> listProfilesPagedCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListProfilesRequest request = ListProfilesRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListProfilesPagedResponse> future = profileServiceClient.listProfilesPagedCallable().futureCall(request);
// Do something
for (Profile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.ListProfilesRequest,com.google.cloud.talent.v4beta1.ListProfilesResponse> listProfilesCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListProfilesRequest request = ListProfilesRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListProfilesResponse response = profileServiceClient.listProfilesCallable().call(request);
for (Profile element : response.getProfilesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.talent.v4beta1.Profile createProfile(com.google.cloud.talent.v4beta1.TenantName parent, com.google.cloud.talent.v4beta1.Profile 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);
}
parent
- Required.
The name of the tenant this profile belongs to.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenants/foo".
profile
- Required.
The profile to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Profile createProfile(String parent, com.google.cloud.talent.v4beta1.Profile profile)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.createProfile(parent.toString(), profile);
}
parent
- Required.
The name of the tenant this profile belongs to.
The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenants/foo".
profile
- Required.
The profile to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Profile createProfile(com.google.cloud.talent.v4beta1.CreateProfileRequest request)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Profile profile = Profile.newBuilder().build();
CreateProfileRequest request = CreateProfileRequest.newBuilder()
.setParent(parent.toString())
.setProfile(profile)
.build();
Profile response = profileServiceClient.createProfile(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.CreateProfileRequest,com.google.cloud.talent.v4beta1.Profile> createProfileCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Profile profile = Profile.newBuilder().build();
CreateProfileRequest request = CreateProfileRequest.newBuilder()
.setParent(parent.toString())
.setProfile(profile)
.build();
ApiFuture<Profile> future = profileServiceClient.createProfileCallable().futureCall(request);
// Do something
Profile response = future.get();
}
public final com.google.cloud.talent.v4beta1.Profile getProfile(com.google.cloud.talent.v4beta1.ProfileName name)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Profile response = profileServiceClient.getProfile(name);
}
name
- Required.
Resource name of the profile to get.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/api-test-project/tenants/foo/profiles/bar".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Profile getProfile(String name)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Profile response = profileServiceClient.getProfile(name.toString());
}
name
- Required.
Resource name of the profile to get.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/api-test-project/tenants/foo/profiles/bar".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Profile getProfile(com.google.cloud.talent.v4beta1.GetProfileRequest request)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
GetProfileRequest request = GetProfileRequest.newBuilder()
.setName(name.toString())
.build();
Profile response = profileServiceClient.getProfile(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.GetProfileRequest,com.google.cloud.talent.v4beta1.Profile> getProfileCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
GetProfileRequest request = GetProfileRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Profile> future = profileServiceClient.getProfileCallable().futureCall(request);
// Do something
Profile response = future.get();
}
public final com.google.cloud.talent.v4beta1.Profile updateProfile(com.google.cloud.talent.v4beta1.Profile profile)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
Profile profile = Profile.newBuilder().build();
Profile response = profileServiceClient.updateProfile(profile);
}
profile
- Required.
Profile to be updated.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Profile updateProfile(com.google.cloud.talent.v4beta1.UpdateProfileRequest request)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
Profile profile = Profile.newBuilder().build();
UpdateProfileRequest request = UpdateProfileRequest.newBuilder()
.setProfile(profile)
.build();
Profile response = profileServiceClient.updateProfile(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.UpdateProfileRequest,com.google.cloud.talent.v4beta1.Profile> updateProfileCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
Profile profile = Profile.newBuilder().build();
UpdateProfileRequest request = UpdateProfileRequest.newBuilder()
.setProfile(profile)
.build();
ApiFuture<Profile> future = profileServiceClient.updateProfileCallable().futureCall(request);
// Do something
Profile response = future.get();
}
public final void deleteProfile(com.google.cloud.talent.v4beta1.ProfileName name)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
profileServiceClient.deleteProfile(name);
}
name
- Required.
Resource name of the profile to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/api-test-project/tenants/foo/profiles/bar".
ApiException
- if the remote call failspublic final void deleteProfile(String name)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
profileServiceClient.deleteProfile(name.toString());
}
name
- Required.
Resource name of the profile to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/api-test-project/tenants/foo/profiles/bar".
ApiException
- if the remote call failspublic final void deleteProfile(com.google.cloud.talent.v4beta1.DeleteProfileRequest request)
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
DeleteProfileRequest request = DeleteProfileRequest.newBuilder()
.setName(name.toString())
.build();
profileServiceClient.deleteProfile(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.DeleteProfileRequest,Empty> deleteProfileCallable()
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
ProfileName name = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
DeleteProfileRequest request = DeleteProfileRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = profileServiceClient.deleteProfileCallable().futureCall(request);
// Do something
future.get();
}
public final ProfileServiceClient.SearchProfilesPagedResponse searchProfiles(com.google.cloud.talent.v4beta1.SearchProfilesRequest request)
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchProfilesRequest request = SearchProfilesRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
for (HistogramQueryResult element : profileServiceClient.searchProfiles(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.talent.v4beta1.SearchProfilesRequest,ProfileServiceClient.SearchProfilesPagedResponse> searchProfilesPagedCallable()
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchProfilesRequest request = SearchProfilesRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
ApiFuture<SearchProfilesPagedResponse> future = profileServiceClient.searchProfilesPagedCallable().futureCall(request);
// Do something
for (HistogramQueryResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.SearchProfilesRequest,com.google.cloud.talent.v4beta1.SearchProfilesResponse> searchProfilesCallable()
For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.).
See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information.
Sample code:
try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchProfilesRequest request = SearchProfilesRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
while (true) {
SearchProfilesResponse response = profileServiceClient.searchProfilesCallable().call(request);
for (HistogramQueryResult element : response.getHistogramQueryResultsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.