@Generated(value="by gapic-generator") @BetaApi public class ApplicationServiceClient 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 (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.createApplication(parent, application);
}
Note: close() needs to be called on the applicationServiceClient 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 ApplicationServiceSettings to create(). For example:
To customize credentials:
ApplicationServiceSettings applicationServiceSettings =
ApplicationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ApplicationServiceClient applicationServiceClient =
ApplicationServiceClient.create(applicationServiceSettings);
To customize the endpoint:
ApplicationServiceSettings applicationServiceSettings =
ApplicationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ApplicationServiceClient applicationServiceClient =
ApplicationServiceClient.create(applicationServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ApplicationServiceClient.ListApplicationsFixedSizeCollection |
static class |
ApplicationServiceClient.ListApplicationsPage |
static class |
ApplicationServiceClient.ListApplicationsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ApplicationServiceClient(ApplicationServiceSettings settings)
Constructs an instance of ApplicationServiceClient, using the given settings.
|
protected |
ApplicationServiceClient(ApplicationServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ApplicationServiceClient |
create()
Constructs an instance of ApplicationServiceClient with default settings.
|
static ApplicationServiceClient |
create(ApplicationServiceSettings settings)
Constructs an instance of ApplicationServiceClient, using the given settings.
|
static ApplicationServiceClient |
create(ApplicationServiceStub stub)
Constructs an instance of ApplicationServiceClient, using the given stub for making calls.
|
com.google.cloud.talent.v4beta1.Application |
createApplication(com.google.cloud.talent.v4beta1.CreateApplicationRequest request)
Creates a new application entity.
|
com.google.cloud.talent.v4beta1.Application |
createApplication(com.google.cloud.talent.v4beta1.ProfileName parent,
com.google.cloud.talent.v4beta1.Application application)
Creates a new application entity.
|
com.google.cloud.talent.v4beta1.Application |
createApplication(String parent,
com.google.cloud.talent.v4beta1.Application application)
Creates a new application entity.
|
UnaryCallable<com.google.cloud.talent.v4beta1.CreateApplicationRequest,com.google.cloud.talent.v4beta1.Application> |
createApplicationCallable()
Creates a new application entity.
|
void |
deleteApplication(com.google.cloud.talent.v4beta1.ApplicationName name)
Deletes specified application.
|
void |
deleteApplication(com.google.cloud.talent.v4beta1.DeleteApplicationRequest request)
Deletes specified application.
|
void |
deleteApplication(String name)
Deletes specified application.
|
UnaryCallable<com.google.cloud.talent.v4beta1.DeleteApplicationRequest,Empty> |
deleteApplicationCallable()
Deletes specified application.
|
com.google.cloud.talent.v4beta1.Application |
getApplication(com.google.cloud.talent.v4beta1.ApplicationName name)
Retrieves specified application.
|
com.google.cloud.talent.v4beta1.Application |
getApplication(com.google.cloud.talent.v4beta1.GetApplicationRequest request)
Retrieves specified application.
|
com.google.cloud.talent.v4beta1.Application |
getApplication(String name)
Retrieves specified application.
|
UnaryCallable<com.google.cloud.talent.v4beta1.GetApplicationRequest,com.google.cloud.talent.v4beta1.Application> |
getApplicationCallable()
Retrieves specified application.
|
ApplicationServiceSettings |
getSettings() |
ApplicationServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(com.google.cloud.talent.v4beta1.ListApplicationsRequest request)
Lists all applications associated with the profile.
|
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(com.google.cloud.talent.v4beta1.ProfileName parent)
Lists all applications associated with the profile.
|
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(String parent)
Lists all applications associated with the profile.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListApplicationsRequest,com.google.cloud.talent.v4beta1.ListApplicationsResponse> |
listApplicationsCallable()
Lists all applications associated with the profile.
|
UnaryCallable<com.google.cloud.talent.v4beta1.ListApplicationsRequest,ApplicationServiceClient.ListApplicationsPagedResponse> |
listApplicationsPagedCallable()
Lists all applications associated with the profile.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.talent.v4beta1.Application |
updateApplication(com.google.cloud.talent.v4beta1.Application application)
Updates specified application.
|
com.google.cloud.talent.v4beta1.Application |
updateApplication(com.google.cloud.talent.v4beta1.UpdateApplicationRequest request)
Updates specified application.
|
UnaryCallable<com.google.cloud.talent.v4beta1.UpdateApplicationRequest,com.google.cloud.talent.v4beta1.Application> |
updateApplicationCallable()
Updates specified application.
|
protected ApplicationServiceClient(ApplicationServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ApplicationServiceClient(ApplicationServiceStub stub)
public static final ApplicationServiceClient create() throws IOException
IOException
public static final ApplicationServiceClient create(ApplicationServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ApplicationServiceClient create(ApplicationServiceStub stub)
public final ApplicationServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ApplicationServiceStub getStub()
public final com.google.cloud.talent.v4beta1.Application createApplication(com.google.cloud.talent.v4beta1.ProfileName parent, com.google.cloud.talent.v4beta1.Application application)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.createApplication(parent, application);
}
parent
- Required.
Resource name of the profile under which the application is created.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
application
- Required.
The application to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Application createApplication(String parent, com.google.cloud.talent.v4beta1.Application application)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.createApplication(parent.toString(), application);
}
parent
- Required.
Resource name of the profile under which the application is created.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
application
- Required.
The application to be created.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Application createApplication(com.google.cloud.talent.v4beta1.CreateApplicationRequest request)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
CreateApplicationRequest request = CreateApplicationRequest.newBuilder()
.setParent(parent.toString())
.setApplication(application)
.build();
Application response = applicationServiceClient.createApplication(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.CreateApplicationRequest,com.google.cloud.talent.v4beta1.Application> createApplicationCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
CreateApplicationRequest request = CreateApplicationRequest.newBuilder()
.setParent(parent.toString())
.setApplication(application)
.build();
ApiFuture<Application> future = applicationServiceClient.createApplicationCallable().futureCall(request);
// Do something
Application response = future.get();
}
public final com.google.cloud.talent.v4beta1.Application getApplication(com.google.cloud.talent.v4beta1.ApplicationName name)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
Application response = applicationServiceClient.getApplication(name);
}
name
- Required.
The resource name of the application to be retrieved.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile/applications/test-application".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Application getApplication(String name)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
Application response = applicationServiceClient.getApplication(name.toString());
}
name
- Required.
The resource name of the application to be retrieved.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile/applications/test-application".
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Application getApplication(com.google.cloud.talent.v4beta1.GetApplicationRequest request)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
GetApplicationRequest request = GetApplicationRequest.newBuilder()
.setName(name.toString())
.build();
Application response = applicationServiceClient.getApplication(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.GetApplicationRequest,com.google.cloud.talent.v4beta1.Application> getApplicationCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
GetApplicationRequest request = GetApplicationRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Application> future = applicationServiceClient.getApplicationCallable().futureCall(request);
// Do something
Application response = future.get();
}
public final com.google.cloud.talent.v4beta1.Application updateApplication(com.google.cloud.talent.v4beta1.Application application)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.updateApplication(application);
}
application
- Required.
The application resource to replace the current resource in the system.
ApiException
- if the remote call failspublic final com.google.cloud.talent.v4beta1.Application updateApplication(com.google.cloud.talent.v4beta1.UpdateApplicationRequest request)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
Application application = Application.newBuilder().build();
UpdateApplicationRequest request = UpdateApplicationRequest.newBuilder()
.setApplication(application)
.build();
Application response = applicationServiceClient.updateApplication(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.UpdateApplicationRequest,com.google.cloud.talent.v4beta1.Application> updateApplicationCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
Application application = Application.newBuilder().build();
UpdateApplicationRequest request = UpdateApplicationRequest.newBuilder()
.setApplication(application)
.build();
ApiFuture<Application> future = applicationServiceClient.updateApplicationCallable().futureCall(request);
// Do something
Application response = future.get();
}
public final void deleteApplication(com.google.cloud.talent.v4beta1.ApplicationName name)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
applicationServiceClient.deleteApplication(name);
}
name
- Required.
The resource name of the application to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile/applications/test-application".
ApiException
- if the remote call failspublic final void deleteApplication(String name)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
applicationServiceClient.deleteApplication(name.toString());
}
name
- Required.
The resource name of the application to be deleted.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile/applications/test-application".
ApiException
- if the remote call failspublic final void deleteApplication(com.google.cloud.talent.v4beta1.DeleteApplicationRequest request)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
DeleteApplicationRequest request = DeleteApplicationRequest.newBuilder()
.setName(name.toString())
.build();
applicationServiceClient.deleteApplication(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.DeleteApplicationRequest,Empty> deleteApplicationCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ApplicationName name = ApplicationName.of("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]");
DeleteApplicationRequest request = DeleteApplicationRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = applicationServiceClient.deleteApplicationCallable().futureCall(request);
// Do something
future.get();
}
public final ApplicationServiceClient.ListApplicationsPagedResponse listApplications(com.google.cloud.talent.v4beta1.ProfileName parent)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
for (Application element : applicationServiceClient.listApplications(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
Resource name of the profile under which the application is created.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
ApiException
- if the remote call failspublic final ApplicationServiceClient.ListApplicationsPagedResponse listApplications(String parent)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
for (Application element : applicationServiceClient.listApplications(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required.
Resource name of the profile under which the application is created.
The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
ApiException
- if the remote call failspublic final ApplicationServiceClient.ListApplicationsPagedResponse listApplications(com.google.cloud.talent.v4beta1.ListApplicationsRequest request)
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
ListApplicationsRequest request = ListApplicationsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Application element : applicationServiceClient.listApplications(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.ListApplicationsRequest,ApplicationServiceClient.ListApplicationsPagedResponse> listApplicationsPagedCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
ListApplicationsRequest request = ListApplicationsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListApplicationsPagedResponse> future = applicationServiceClient.listApplicationsPagedCallable().futureCall(request);
// Do something
for (Application element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.talent.v4beta1.ListApplicationsRequest,com.google.cloud.talent.v4beta1.ListApplicationsResponse> listApplicationsCallable()
Sample code:
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
ListApplicationsRequest request = ListApplicationsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListApplicationsResponse response = applicationServiceClient.listApplicationsCallable().call(request);
for (Application element : response.getApplicationsList()) {
// 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.