Class IngestionServiceClient (0.1.0)

GitHub RepositoryProduct ReferenceRPC Documentation

Service Description: Service for sending audience data to supported destinations.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   IngestAudienceMembersRequest request =
       IngestAudienceMembersRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllAudienceMembers(new ArrayList<AudienceMember>())
           .setConsent(Consent.newBuilder().build())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .setTermsOfService(TermsOfService.newBuilder().build())
           .build();
   IngestAudienceMembersResponse response =
       ingestionServiceClient.ingestAudienceMembers(request);
 }
 

Note: close() needs to be called on the IngestionServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

IngestAudienceMembers

Uploads a list of AudienceMember resources to the provided Destination.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • ingestAudienceMembers(IngestAudienceMembersRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • ingestAudienceMembersCallable()

RemoveAudienceMembers

Removes a list of AudienceMember resources from the provided Destination.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removeAudienceMembers(RemoveAudienceMembersRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removeAudienceMembersCallable()

IngestEvents

Uploads a list of Event resources from the provided Destination.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • ingestEvents(IngestEventsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • ingestEventsCallable()

RetrieveRequestStatus

Gets the status of a request given request id.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • retrieveRequestStatus(RetrieveRequestStatusRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • retrieveRequestStatusCallable()

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 IngestionServiceSettings 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
 IngestionServiceSettings ingestionServiceSettings =
     IngestionServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 IngestionServiceClient ingestionServiceClient =
     IngestionServiceClient.create(ingestionServiceSettings);
 

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
 IngestionServiceSettings ingestionServiceSettings =
     IngestionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 IngestionServiceClient ingestionServiceClient =
     IngestionServiceClient.create(ingestionServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 IngestionServiceSettings ingestionServiceSettings =
     IngestionServiceSettings.newHttpJsonBuilder().build();
 IngestionServiceClient ingestionServiceClient =
     IngestionServiceClient.create(ingestionServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > IngestionServiceClient

Static Methods

create()

public static final IngestionServiceClient create()

Constructs an instance of IngestionServiceClient with default settings.

Returns
Type Description
IngestionServiceClient
Exceptions
Type Description
IOException

create(IngestionServiceSettings settings)

public static final IngestionServiceClient create(IngestionServiceSettings settings)

Constructs an instance of IngestionServiceClient, 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 IngestionServiceSettings
Returns
Type Description
IngestionServiceClient
Exceptions
Type Description
IOException

create(IngestionServiceStub stub)

public static final IngestionServiceClient create(IngestionServiceStub stub)

Constructs an instance of IngestionServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(IngestionServiceSettings).

Parameter
Name Description
stub IngestionServiceStub
Returns
Type Description
IngestionServiceClient

Constructors

IngestionServiceClient(IngestionServiceSettings settings)

protected IngestionServiceClient(IngestionServiceSettings settings)

Constructs an instance of IngestionServiceClient, 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 IngestionServiceSettings

IngestionServiceClient(IngestionServiceStub stub)

protected IngestionServiceClient(IngestionServiceStub stub)
Parameter
Name Description
stub IngestionServiceStub

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()

getSettings()

public final IngestionServiceSettings getSettings()
Returns
Type Description
IngestionServiceSettings

getStub()

public IngestionServiceStub getStub()
Returns
Type Description
IngestionServiceStub

ingestAudienceMembers(IngestAudienceMembersRequest request)

public final IngestAudienceMembersResponse ingestAudienceMembers(IngestAudienceMembersRequest request)

Uploads a list of AudienceMember resources to the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   IngestAudienceMembersRequest request =
       IngestAudienceMembersRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllAudienceMembers(new ArrayList<AudienceMember>())
           .setConsent(Consent.newBuilder().build())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .setTermsOfService(TermsOfService.newBuilder().build())
           .build();
   IngestAudienceMembersResponse response =
       ingestionServiceClient.ingestAudienceMembers(request);
 }
 
Parameter
Name Description
request IngestAudienceMembersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
IngestAudienceMembersResponse

ingestAudienceMembersCallable()

public final UnaryCallable<IngestAudienceMembersRequest,IngestAudienceMembersResponse> ingestAudienceMembersCallable()

Uploads a list of AudienceMember resources to the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   IngestAudienceMembersRequest request =
       IngestAudienceMembersRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllAudienceMembers(new ArrayList<AudienceMember>())
           .setConsent(Consent.newBuilder().build())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .setTermsOfService(TermsOfService.newBuilder().build())
           .build();
   ApiFuture<IngestAudienceMembersResponse> future =
       ingestionServiceClient.ingestAudienceMembersCallable().futureCall(request);
   // Do something.
   IngestAudienceMembersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<IngestAudienceMembersRequest,IngestAudienceMembersResponse>

ingestEvents(IngestEventsRequest request)

public final IngestEventsResponse ingestEvents(IngestEventsRequest request)

Uploads a list of Event resources from the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   IngestEventsRequest request =
       IngestEventsRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllEvents(new ArrayList<Event>())
           .setConsent(Consent.newBuilder().build())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .build();
   IngestEventsResponse response = ingestionServiceClient.ingestEvents(request);
 }
 
Parameter
Name Description
request IngestEventsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
IngestEventsResponse

ingestEventsCallable()

public final UnaryCallable<IngestEventsRequest,IngestEventsResponse> ingestEventsCallable()

Uploads a list of Event resources from the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   IngestEventsRequest request =
       IngestEventsRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllEvents(new ArrayList<Event>())
           .setConsent(Consent.newBuilder().build())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .build();
   ApiFuture<IngestEventsResponse> future =
       ingestionServiceClient.ingestEventsCallable().futureCall(request);
   // Do something.
   IngestEventsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<IngestEventsRequest,IngestEventsResponse>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

removeAudienceMembers(RemoveAudienceMembersRequest request)

public final RemoveAudienceMembersResponse removeAudienceMembers(RemoveAudienceMembersRequest request)

Removes a list of AudienceMember resources from the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   RemoveAudienceMembersRequest request =
       RemoveAudienceMembersRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllAudienceMembers(new ArrayList<AudienceMember>())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .build();
   RemoveAudienceMembersResponse response =
       ingestionServiceClient.removeAudienceMembers(request);
 }
 
Parameter
Name Description
request RemoveAudienceMembersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RemoveAudienceMembersResponse

removeAudienceMembersCallable()

public final UnaryCallable<RemoveAudienceMembersRequest,RemoveAudienceMembersResponse> removeAudienceMembersCallable()

Removes a list of AudienceMember resources from the provided Destination.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   RemoveAudienceMembersRequest request =
       RemoveAudienceMembersRequest.newBuilder()
           .addAllDestinations(new ArrayList<Destination>())
           .addAllAudienceMembers(new ArrayList<AudienceMember>())
           .setValidateOnly(true)
           .setEncoding(Encoding.forNumber(0))
           .setEncryptionInfo(EncryptionInfo.newBuilder().build())
           .build();
   ApiFuture<RemoveAudienceMembersResponse> future =
       ingestionServiceClient.removeAudienceMembersCallable().futureCall(request);
   // Do something.
   RemoveAudienceMembersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RemoveAudienceMembersRequest,RemoveAudienceMembersResponse>

retrieveRequestStatus(RetrieveRequestStatusRequest request)

public final RetrieveRequestStatusResponse retrieveRequestStatus(RetrieveRequestStatusRequest request)

Gets the status of a request given request id.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   RetrieveRequestStatusRequest request =
       RetrieveRequestStatusRequest.newBuilder().setRequestId("requestId693933066").build();
   RetrieveRequestStatusResponse response =
       ingestionServiceClient.retrieveRequestStatus(request);
 }
 
Parameter
Name Description
request RetrieveRequestStatusRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RetrieveRequestStatusResponse

retrieveRequestStatusCallable()

public final UnaryCallable<RetrieveRequestStatusRequest,RetrieveRequestStatusResponse> retrieveRequestStatusCallable()

Gets the status of a request given request id.

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 (IngestionServiceClient ingestionServiceClient = IngestionServiceClient.create()) {
   RetrieveRequestStatusRequest request =
       RetrieveRequestStatusRequest.newBuilder().setRequestId("requestId693933066").build();
   ApiFuture<RetrieveRequestStatusResponse> future =
       ingestionServiceClient.retrieveRequestStatusCallable().futureCall(request);
   // Do something.
   RetrieveRequestStatusResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RetrieveRequestStatusRequest,RetrieveRequestStatusResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()