| GitHub Repository | Product Reference |
Service Description: Provides methods for handling DaiSession objects.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DaiSessionServiceClient daiSessionServiceClient = DaiSessionServiceClient.create()) {
DaiSessionName name = DaiSessionName.of("[NETWORK_CODE]", "[DAI_SESSION]");
DaiSession response = daiSessionServiceClient.getDaiSession(name);
}
Note: close() needs to be called on the DaiSessionServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetDaiSession |
Retrieves a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return 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 DaiSessionServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DaiSessionServiceSettings daiSessionServiceSettings =
DaiSessionServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DaiSessionServiceClient daiSessionServiceClient =
DaiSessionServiceClient.create(daiSessionServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DaiSessionServiceSettings daiSessionServiceSettings =
DaiSessionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DaiSessionServiceClient daiSessionServiceClient =
DaiSessionServiceClient.create(daiSessionServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final DaiSessionServiceClient create()Constructs an instance of DaiSessionServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
DaiSessionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DaiSessionServiceSettings settings)
public static final DaiSessionServiceClient create(DaiSessionServiceSettings settings)Constructs an instance of DaiSessionServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
DaiSessionServiceSettings |
| Returns | |
|---|---|
| Type | Description |
DaiSessionServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(DaiSessionServiceStub stub)
public static final DaiSessionServiceClient create(DaiSessionServiceStub stub)Constructs an instance of DaiSessionServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DaiSessionServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
DaiSessionServiceStub |
| Returns | |
|---|---|
| Type | Description |
DaiSessionServiceClient |
|
Constructors
DaiSessionServiceClient(DaiSessionServiceSettings settings)
protected DaiSessionServiceClient(DaiSessionServiceSettings settings)Constructs an instance of DaiSessionServiceClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
DaiSessionServiceSettings |
DaiSessionServiceClient(DaiSessionServiceStub stub)
protected DaiSessionServiceClient(DaiSessionServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
DaiSessionServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()getDaiSession(@Nullable DaiSessionName name)
public final DaiSession getDaiSession(@Nullable DaiSessionName name)Retrieves a DaiSession object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DaiSessionServiceClient daiSessionServiceClient = DaiSessionServiceClient.create()) {
DaiSessionName name = DaiSessionName.of("[NETWORK_CODE]", "[DAI_SESSION]");
DaiSession response = daiSessionServiceClient.getDaiSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.DaiSessionNameRequired. The resource name of the DaiSession. The dai_session can be either the session ID or debug key, that DAI returns on stream create. For details, see Locate a DAI session ID or debug key. Format: |
| Returns | |
|---|---|
| Type | Description |
DaiSession |
|
getDaiSession(GetDaiSessionRequest request)
public final DaiSession getDaiSession(GetDaiSessionRequest request)Retrieves a DaiSession object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DaiSessionServiceClient daiSessionServiceClient = DaiSessionServiceClient.create()) {
GetDaiSessionRequest request =
GetDaiSessionRequest.newBuilder()
.setName(DaiSessionName.of("[NETWORK_CODE]", "[DAI_SESSION]").toString())
.build();
DaiSession response = daiSessionServiceClient.getDaiSession(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetDaiSessionRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
DaiSession |
|
getDaiSession(String name)
public final DaiSession getDaiSession(String name)Retrieves a DaiSession object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DaiSessionServiceClient daiSessionServiceClient = DaiSessionServiceClient.create()) {
String name = DaiSessionName.of("[NETWORK_CODE]", "[DAI_SESSION]").toString();
DaiSession response = daiSessionServiceClient.getDaiSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the DaiSession. The dai_session can be either the session ID or debug key, that DAI returns on stream create. For details, see Locate a DAI session ID or debug key. Format: |
| Returns | |
|---|---|
| Type | Description |
DaiSession |
|
getDaiSessionCallable()
public final UnaryCallable<GetDaiSessionRequest,DaiSession> getDaiSessionCallable()Retrieves a DaiSession object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DaiSessionServiceClient daiSessionServiceClient = DaiSessionServiceClient.create()) {
GetDaiSessionRequest request =
GetDaiSessionRequest.newBuilder()
.setName(DaiSessionName.of("[NETWORK_CODE]", "[DAI_SESSION]").toString())
.build();
ApiFuture<DaiSession> future =
daiSessionServiceClient.getDaiSessionCallable().futureCall(request);
// Do something.
DaiSession response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetDaiSessionRequest,DaiSession> |
|
getSettings()
public final @Nullable DaiSessionServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.DaiSessionServiceSettings |
|
getStub()
public DaiSessionServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
DaiSessionServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()