Class CampaignDraftServiceClient

java.lang.Object
com.google.ads.googleads.v18.services.CampaignDraftServiceClient
All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class CampaignDraftServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service to manage campaign drafts.

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 (CampaignDraftServiceClient campaignDraftServiceClient =
     CampaignDraftServiceClient.create()) {
   String customerId = "customerId-1581184615";
   List<CampaignDraftOperation> operations = new ArrayList<>();
   MutateCampaignDraftsResponse response =
       campaignDraftServiceClient.mutateCampaignDrafts(customerId, operations);
 }
 

Note: close() needs to be called on the CampaignDraftServiceClient 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

MutateCampaignDrafts

Creates, updates, or removes campaign drafts. Operation statuses are returned.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [DatabaseError]() [FieldError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()

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

  • mutateCampaignDrafts(MutateCampaignDraftsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • mutateCampaignDrafts(String customerId, List<CampaignDraftOperation> operations)

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

  • mutateCampaignDraftsCallable()

PromoteCampaignDraft

Promotes the changes in a draft back to the base campaign.

This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

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

  • promoteCampaignDraftAsync(PromoteCampaignDraftRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • promoteCampaignDraftAsync(CampaignDraftName campaignDraft)

  • promoteCampaignDraftAsync(String campaignDraft)

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

  • promoteCampaignDraftOperationCallable()

  • promoteCampaignDraftCallable()

ListCampaignDraftAsyncErrors

Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

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

  • listCampaignDraftAsyncErrors(ListCampaignDraftAsyncErrorsRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • listCampaignDraftAsyncErrors(CampaignDraftName resourceName)

  • listCampaignDraftAsyncErrors(String resourceName)

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

  • listCampaignDraftAsyncErrorsPagedCallable()

  • listCampaignDraftAsyncErrorsCallable()

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 CampaignDraftServiceSettings 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
 CampaignDraftServiceSettings campaignDraftServiceSettings =
     CampaignDraftServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CampaignDraftServiceClient campaignDraftServiceClient =
     CampaignDraftServiceClient.create(campaignDraftServiceSettings);
 

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
 CampaignDraftServiceSettings campaignDraftServiceSettings =
     CampaignDraftServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 CampaignDraftServiceClient campaignDraftServiceClient =
     CampaignDraftServiceClient.create(campaignDraftServiceSettings);
 

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

  • Constructor Details

    • CampaignDraftServiceClient

      protected CampaignDraftServiceClient(CampaignDraftServiceSettings settings) throws IOException
      Constructs an instance of CampaignDraftServiceClient, 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.
      Throws:
      IOException
    • CampaignDraftServiceClient

      protected CampaignDraftServiceClient(CampaignDraftServiceStub stub)
  • Method Details

    • create

      public static final CampaignDraftServiceClient create() throws IOException
      Constructs an instance of CampaignDraftServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final CampaignDraftServiceClient create(CampaignDraftServiceSettings settings) throws IOException
      Constructs an instance of CampaignDraftServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final CampaignDraftServiceClient create(CampaignDraftServiceStub stub)
      Constructs an instance of CampaignDraftServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(CampaignDraftServiceSettings).
    • getSettings

      public final CampaignDraftServiceSettings getSettings()
    • getStub

      public CampaignDraftServiceStub getStub()
    • getOperationsClient

      public final com.google.longrunning.OperationsClient getOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • mutateCampaignDrafts

      public final MutateCampaignDraftsResponse mutateCampaignDrafts(String customerId, List<CampaignDraftOperation> operations)
      Creates, updates, or removes campaign drafts. Operation statuses are returned.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [DatabaseError]() [FieldError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         String customerId = "customerId-1581184615";
         List<CampaignDraftOperation> operations = new ArrayList<>();
         MutateCampaignDraftsResponse response =
             campaignDraftServiceClient.mutateCampaignDrafts(customerId, operations);
       }
       
      Parameters:
      customerId - Required. The ID of the customer whose campaign drafts are being modified.
      operations - Required. The list of operations to perform on individual campaign drafts.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • mutateCampaignDrafts

      public final MutateCampaignDraftsResponse mutateCampaignDrafts(MutateCampaignDraftsRequest request)
      Creates, updates, or removes campaign drafts. Operation statuses are returned.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [DatabaseError]() [FieldError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         MutateCampaignDraftsRequest request =
             MutateCampaignDraftsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllOperations(new ArrayList<CampaignDraftOperation>())
                 .setPartialFailure(true)
                 .setValidateOnly(true)
                 .build();
         MutateCampaignDraftsResponse response =
             campaignDraftServiceClient.mutateCampaignDrafts(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • mutateCampaignDraftsCallable

      public final com.google.api.gax.rpc.UnaryCallable<MutateCampaignDraftsRequest,MutateCampaignDraftsResponse> mutateCampaignDraftsCallable()
      Creates, updates, or removes campaign drafts. Operation statuses are returned.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [DatabaseError]() [FieldError]() [HeaderError]() [InternalError]() [MutateError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         MutateCampaignDraftsRequest request =
             MutateCampaignDraftsRequest.newBuilder()
                 .setCustomerId("customerId-1581184615")
                 .addAllOperations(new ArrayList<CampaignDraftOperation>())
                 .setPartialFailure(true)
                 .setValidateOnly(true)
                 .build();
         ApiFuture<MutateCampaignDraftsResponse> future =
             campaignDraftServiceClient.mutateCampaignDraftsCallable().futureCall(request);
         // Do something.
         MutateCampaignDraftsResponse response = future.get();
       }
       
    • promoteCampaignDraftAsync

      public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignDraftAsync(CampaignDraftName campaignDraft)
      Promotes the changes in a draft back to the base campaign.

      This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         CampaignDraftName campaignDraft =
             CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]");
         campaignDraftServiceClient.promoteCampaignDraftAsync(campaignDraft).get();
       }
       
      Parameters:
      campaignDraft - Required. The resource name of the campaign draft to promote.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • promoteCampaignDraftAsync

      public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignDraftAsync(String campaignDraft)
      Promotes the changes in a draft back to the base campaign.

      This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         String campaignDraft =
             CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]").toString();
         campaignDraftServiceClient.promoteCampaignDraftAsync(campaignDraft).get();
       }
       
      Parameters:
      campaignDraft - Required. The resource name of the campaign draft to promote.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • promoteCampaignDraftAsync

      public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignDraftAsync(PromoteCampaignDraftRequest request)
      Promotes the changes in a draft back to the base campaign.

      This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         PromoteCampaignDraftRequest request =
             PromoteCampaignDraftRequest.newBuilder()
                 .setCampaignDraft(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setValidateOnly(true)
                 .build();
         campaignDraftServiceClient.promoteCampaignDraftAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • promoteCampaignDraftOperationCallable

      public final com.google.api.gax.rpc.OperationCallable<PromoteCampaignDraftRequest,com.google.protobuf.Empty,com.google.protobuf.Empty> promoteCampaignDraftOperationCallable()
      Promotes the changes in a draft back to the base campaign.

      This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         PromoteCampaignDraftRequest request =
             PromoteCampaignDraftRequest.newBuilder()
                 .setCampaignDraft(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setValidateOnly(true)
                 .build();
         OperationFuture<Empty, Empty> future =
             campaignDraftServiceClient.promoteCampaignDraftOperationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • promoteCampaignDraftCallable

      public final com.google.api.gax.rpc.UnaryCallable<PromoteCampaignDraftRequest,com.google.longrunning.Operation> promoteCampaignDraftCallable()
      Promotes the changes in a draft back to the base campaign.

      This method returns a Long Running Operation (LRO) indicating if the Promote is done. Use [Operations.GetOperation] to poll the LRO until it is done. Only a done status is returned in the response. See the status in the Campaign Draft resource to determine if the promotion was successful. If the LRO failed, use [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v18.services.CampaignDraftService.ListCampaignDraftAsyncErrors] to view the list of error reasons.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [CampaignDraftError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         PromoteCampaignDraftRequest request =
             PromoteCampaignDraftRequest.newBuilder()
                 .setCampaignDraft(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setValidateOnly(true)
                 .build();
         ApiFuture<Operation> future =
             campaignDraftServiceClient.promoteCampaignDraftCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • listCampaignDraftAsyncErrors

      public final CampaignDraftServiceClient.ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(CampaignDraftName resourceName)
      Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         CampaignDraftName resourceName =
             CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]");
         for (Status element :
             campaignDraftServiceClient.listCampaignDraftAsyncErrors(resourceName).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      resourceName - Required. The name of the campaign draft from which to retrieve the async errors.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listCampaignDraftAsyncErrors

      public final CampaignDraftServiceClient.ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(String resourceName)
      Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         String resourceName =
             CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]").toString();
         for (Status element :
             campaignDraftServiceClient.listCampaignDraftAsyncErrors(resourceName).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      resourceName - Required. The name of the campaign draft from which to retrieve the async errors.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listCampaignDraftAsyncErrors

      Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         ListCampaignDraftAsyncErrorsRequest request =
             ListCampaignDraftAsyncErrorsRequest.newBuilder()
                 .setResourceName(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setPageToken("pageToken873572522")
                 .setPageSize(883849137)
                 .build();
         for (Status element :
             campaignDraftServiceClient.listCampaignDraftAsyncErrors(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      com.google.api.gax.rpc.ApiException - if the remote call fails
    • listCampaignDraftAsyncErrorsPagedCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListCampaignDraftAsyncErrorsRequest,CampaignDraftServiceClient.ListCampaignDraftAsyncErrorsPagedResponse> listCampaignDraftAsyncErrorsPagedCallable()
      Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         ListCampaignDraftAsyncErrorsRequest request =
             ListCampaignDraftAsyncErrorsRequest.newBuilder()
                 .setResourceName(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setPageToken("pageToken873572522")
                 .setPageSize(883849137)
                 .build();
         ApiFuture<Status> future =
             campaignDraftServiceClient
                 .listCampaignDraftAsyncErrorsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (Status element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listCampaignDraftAsyncErrorsCallable

      public final com.google.api.gax.rpc.UnaryCallable<ListCampaignDraftAsyncErrorsRequest,ListCampaignDraftAsyncErrorsResponse> listCampaignDraftAsyncErrorsCallable()
      Returns all errors that occurred during CampaignDraft promote. Throws an error if called before campaign draft is promoted. Supports standard list paging.

      List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

      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 (CampaignDraftServiceClient campaignDraftServiceClient =
           CampaignDraftServiceClient.create()) {
         ListCampaignDraftAsyncErrorsRequest request =
             ListCampaignDraftAsyncErrorsRequest.newBuilder()
                 .setResourceName(
                     CampaignDraftName.of("[CUSTOMER_ID]", "[BASE_CAMPAIGN_ID]", "[DRAFT_ID]")
                         .toString())
                 .setPageToken("pageToken873572522")
                 .setPageSize(883849137)
                 .build();
         while (true) {
           ListCampaignDraftAsyncErrorsResponse response =
               campaignDraftServiceClient.listCampaignDraftAsyncErrorsCallable().call(request);
           for (Status element : response.getErrorsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface com.google.api.gax.core.BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface com.google.api.gax.core.BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface com.google.api.gax.core.BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface com.google.api.gax.core.BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface com.google.api.gax.core.BackgroundResource
      Throws:
      InterruptedException