@Generated(value="by gapic-generator") @BetaApi public class ApplicationServiceClient 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 (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.
|
Application |
createApplication(CreateApplicationRequest request)
Creates a new application entity.
|
Application |
createApplication(ProfileName parent,
Application application)
Creates a new application entity.
|
Application |
createApplication(String parent,
Application application)
Creates a new application entity.
|
com.google.api.gax.rpc.UnaryCallable<CreateApplicationRequest,Application> |
createApplicationCallable()
Creates a new application entity.
|
void |
deleteApplication(ApplicationName name)
Deletes specified application.
|
void |
deleteApplication(DeleteApplicationRequest request)
Deletes specified application.
|
void |
deleteApplication(String name)
Deletes specified application.
|
com.google.api.gax.rpc.UnaryCallable<DeleteApplicationRequest,Empty> |
deleteApplicationCallable()
Deletes specified application.
|
Application |
getApplication(ApplicationName name)
Retrieves specified application.
|
Application |
getApplication(GetApplicationRequest request)
Retrieves specified application.
|
Application |
getApplication(String name)
Retrieves specified application.
|
com.google.api.gax.rpc.UnaryCallable<GetApplicationRequest,Application> |
getApplicationCallable()
Retrieves specified application.
|
ApplicationServiceSettings |
getSettings() |
ApplicationServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(ListApplicationsRequest request)
Lists all applications associated with the profile.
|
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(ProfileName parent)
Lists all applications associated with the profile.
|
ApplicationServiceClient.ListApplicationsPagedResponse |
listApplications(String parent)
Lists all applications associated with the profile.
|
com.google.api.gax.rpc.UnaryCallable<ListApplicationsRequest,ListApplicationsResponse> |
listApplicationsCallable()
Lists all applications associated with the profile.
|
com.google.api.gax.rpc.UnaryCallable<ListApplicationsRequest,ApplicationServiceClient.ListApplicationsPagedResponse> |
listApplicationsPagedCallable()
Lists all applications associated with the profile.
|
void |
shutdown() |
void |
shutdownNow() |
Application |
updateApplication(Application application)
Updates specified application.
|
Application |
updateApplication(UpdateApplicationRequest request)
Updates specified application.
|
com.google.api.gax.rpc.UnaryCallable<UpdateApplicationRequest,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 Application createApplication(ProfileName parent, 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/foo/tenants/bar/profiles/baz".
application
- Required. The application to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Application createApplication(String parent, 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/foo/tenants/bar/profiles/baz".
application
- Required. The application to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Application createApplication(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateApplicationRequest,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 Application getApplication(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/foo/tenants/bar/profiles/baz/applications/qux".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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/foo/tenants/bar/profiles/baz/applications/qux".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Application getApplication(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetApplicationRequest,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 Application updateApplication(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Application updateApplication(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateApplicationRequest,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(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/foo/tenants/bar/profiles/baz/applications/qux".
com.google.api.gax.rpc.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/foo/tenants/bar/profiles/baz/applications/qux".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteApplication(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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(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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.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/foo/tenants/bar/profiles/baz".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ApplicationServiceClient.ListApplicationsPagedResponse listApplications(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.rpc.UnaryCallable<ListApplicationsRequest,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 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.