@Generated(value="by gapic-generator") @BetaApi public class ProfileServiceClient 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:
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.
|
Profile |
createProfile(CreateProfileRequest request)
Creates and returns a new profile.
|
Profile |
createProfile(String parent,
Profile profile)
Creates and returns a new profile.
|
Profile |
createProfile(TenantName parent,
Profile profile)
Creates and returns a new profile.
|
com.google.api.gax.rpc.UnaryCallable<CreateProfileRequest,Profile> |
createProfileCallable()
Creates and returns a new profile.
|
void |
deleteProfile(DeleteProfileRequest request)
Deletes the specified profile.
|
void |
deleteProfile(ProfileName name)
Deletes the specified profile.
|
void |
deleteProfile(String name)
Deletes the specified profile.
|
com.google.api.gax.rpc.UnaryCallable<DeleteProfileRequest,Empty> |
deleteProfileCallable()
Deletes the specified profile.
|
Profile |
getProfile(GetProfileRequest request)
Gets the specified profile.
|
Profile |
getProfile(ProfileName name)
Gets the specified profile.
|
Profile |
getProfile(String name)
Gets the specified profile.
|
com.google.api.gax.rpc.UnaryCallable<GetProfileRequest,Profile> |
getProfileCallable()
Gets the specified profile.
|
ProfileServiceSettings |
getSettings() |
ProfileServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(ListProfilesRequest request)
Lists profiles by filter.
|
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(String parent)
Lists profiles by filter.
|
ProfileServiceClient.ListProfilesPagedResponse |
listProfiles(TenantName parent)
Lists profiles by filter.
|
com.google.api.gax.rpc.UnaryCallable<ListProfilesRequest,ListProfilesResponse> |
listProfilesCallable()
Lists profiles by filter.
|
com.google.api.gax.rpc.UnaryCallable<ListProfilesRequest,ProfileServiceClient.ListProfilesPagedResponse> |
listProfilesPagedCallable()
Lists profiles by filter.
|
ProfileServiceClient.SearchProfilesPagedResponse |
searchProfiles(SearchProfilesRequest request)
Searches for profiles within a tenant.
|
com.google.api.gax.rpc.UnaryCallable<SearchProfilesRequest,SearchProfilesResponse> |
searchProfilesCallable()
Searches for profiles within a tenant.
|
com.google.api.gax.rpc.UnaryCallable<SearchProfilesRequest,ProfileServiceClient.SearchProfilesPagedResponse> |
searchProfilesPagedCallable()
Searches for profiles within a tenant.
|
void |
shutdown() |
void |
shutdownNow() |
Profile |
updateProfile(Profile profile)
Updates the specified profile and returns the updated result.
|
Profile |
updateProfile(UpdateProfileRequest request)
Updates the specified profile and returns the updated result.
|
com.google.api.gax.rpc.UnaryCallable<UpdateProfileRequest,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(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 profile is created.
The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
com.google.api.gax.rpc.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 profile is created.
The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ProfileServiceClient.ListProfilesPagedResponse listProfiles(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.rpc.UnaryCallable<ListProfilesRequest,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 Profile createProfile(TenantName parent, 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/foo/tenants/bar".
profile
- Required. The profile to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Profile createProfile(String parent, 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/foo/tenants/bar".
profile
- Required. The profile to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Profile createProfile(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateProfileRequest,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 Profile getProfile(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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Profile getProfile(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetProfileRequest,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 Profile updateProfile(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Profile updateProfile(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateProfileRequest,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(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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteProfile(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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(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 (SummarizedProfile element : profileServiceClient.searchProfiles(request).iterateAll()) {
// doThingsWith(element);
}
}
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<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 (SummarizedProfile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<SearchProfilesRequest,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 (SummarizedProfile element : response.getSummarizedProfilesList()) {
// 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 com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.