Class TrafficForecastSegmentServiceClient (0.62.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   TrafficForecastSegmentName name =
       TrafficForecastSegmentName.of("[NETWORK_CODE]", "[TRAFFIC_FORECAST_SEGMENT]");
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.getTrafficForecastSegment(name);
 }
 

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

GetTrafficForecastSegment

Retrieves a TrafficForecastSegment object.

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

  • getTrafficForecastSegment(GetTrafficForecastSegmentRequest request)

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

  • getTrafficForecastSegment(TrafficForecastSegmentName name)

  • getTrafficForecastSegment(String name)

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

  • getTrafficForecastSegmentCallable()

ListTrafficForecastSegments

Lists TrafficForecastSegment objects.

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

  • listTrafficForecastSegments(ListTrafficForecastSegmentsRequest request)

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

  • listTrafficForecastSegments(NetworkName parent)

  • listTrafficForecastSegments(String parent)

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

  • listTrafficForecastSegmentsPagedCallable()

  • listTrafficForecastSegmentsCallable()

CreateTrafficForecastSegment

Creates a TrafficForecastSegment object.

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

  • createTrafficForecastSegment(CreateTrafficForecastSegmentRequest request)

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

  • createTrafficForecastSegment(NetworkName parent, TrafficForecastSegment trafficForecastSegment)

  • createTrafficForecastSegment(String parent, TrafficForecastSegment trafficForecastSegment)

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

  • createTrafficForecastSegmentCallable()

BatchCreateTrafficForecastSegments

Creates TrafficForecastSegment objects.

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

  • batchCreateTrafficForecastSegments(NetworkName parent, List<CreateTrafficForecastSegmentRequest> requests)

  • batchCreateTrafficForecastSegments(String parent, List<CreateTrafficForecastSegmentRequest> requests)

  • batchCreateTrafficForecastSegments(BatchCreateTrafficForecastSegmentsRequest request)

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

  • batchCreateTrafficForecastSegmentsCallable()

UpdateTrafficForecastSegment

Updates a TrafficForecastSegment object.

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

  • updateTrafficForecastSegment(UpdateTrafficForecastSegmentRequest request)

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

  • updateTrafficForecastSegment(TrafficForecastSegment trafficForecastSegment, FieldMask updateMask)

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

  • updateTrafficForecastSegmentCallable()

BatchUpdateTrafficForecastSegments

Batch updates TrafficForecastSegment objects.

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

  • batchUpdateTrafficForecastSegments(NetworkName parent, List<UpdateTrafficForecastSegmentRequest> requests)

  • batchUpdateTrafficForecastSegments(String parent, List<UpdateTrafficForecastSegmentRequest> requests)

  • batchUpdateTrafficForecastSegments(BatchUpdateTrafficForecastSegmentsRequest request)

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

  • batchUpdateTrafficForecastSegmentsCallable()

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 TrafficForecastSegmentServiceSettings 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
 TrafficForecastSegmentServiceSettings trafficForecastSegmentServiceSettings =
     TrafficForecastSegmentServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create(trafficForecastSegmentServiceSettings);
 

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
 TrafficForecastSegmentServiceSettings trafficForecastSegmentServiceSettings =
     TrafficForecastSegmentServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create(trafficForecastSegmentServiceSettings);
 

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

Inheritance

java.lang.Object > TrafficForecastSegmentServiceClient

Static Methods

create()

public static final TrafficForecastSegmentServiceClient create()

Constructs an instance of TrafficForecastSegmentServiceClient with default settings.

Returns
Type Description
TrafficForecastSegmentServiceClient
Exceptions
Type Description
IOException

create(TrafficForecastSegmentServiceSettings settings)

public static final TrafficForecastSegmentServiceClient create(TrafficForecastSegmentServiceSettings settings)

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

create(TrafficForecastSegmentServiceStub stub)

public static final TrafficForecastSegmentServiceClient create(TrafficForecastSegmentServiceStub stub)

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

Parameter
Name Description
stub TrafficForecastSegmentServiceStub
Returns
Type Description
TrafficForecastSegmentServiceClient

Constructors

TrafficForecastSegmentServiceClient(TrafficForecastSegmentServiceSettings settings)

protected TrafficForecastSegmentServiceClient(TrafficForecastSegmentServiceSettings settings)

Constructs an instance of TrafficForecastSegmentServiceClient, 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 TrafficForecastSegmentServiceSettings

TrafficForecastSegmentServiceClient(TrafficForecastSegmentServiceStub stub)

protected TrafficForecastSegmentServiceClient(TrafficForecastSegmentServiceStub stub)
Parameter
Name Description
stub TrafficForecastSegmentServiceStub

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

batchCreateTrafficForecastSegments(@Nullable NetworkName parent, List<CreateTrafficForecastSegmentRequest> requests)

public final BatchCreateTrafficForecastSegmentsResponse batchCreateTrafficForecastSegments(@Nullable NetworkName parent, List<CreateTrafficForecastSegmentRequest> requests)

Creates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateTrafficForecastSegmentRequest> requests = new ArrayList<>();
   BatchCreateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchCreateTrafficForecastSegments(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where TrafficForecastSegments will be created. Format: networks/{network_code} The parent field in the CreateTrafficForecastSegmentRequest must match this field.

requests List<CreateTrafficForecastSegmentRequest>

Required. The TrafficForecastSegment objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateTrafficForecastSegmentsResponse

batchCreateTrafficForecastSegments(BatchCreateTrafficForecastSegmentsRequest request)

public final BatchCreateTrafficForecastSegmentsResponse batchCreateTrafficForecastSegments(BatchCreateTrafficForecastSegmentsRequest request)

Creates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   BatchCreateTrafficForecastSegmentsRequest request =
       BatchCreateTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateTrafficForecastSegmentRequest>())
           .build();
   BatchCreateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchCreateTrafficForecastSegments(request);
 }
 
Parameter
Name Description
request BatchCreateTrafficForecastSegmentsRequest

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

Returns
Type Description
BatchCreateTrafficForecastSegmentsResponse

batchCreateTrafficForecastSegments(String parent, List<CreateTrafficForecastSegmentRequest> requests)

public final BatchCreateTrafficForecastSegmentsResponse batchCreateTrafficForecastSegments(String parent, List<CreateTrafficForecastSegmentRequest> requests)

Creates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateTrafficForecastSegmentRequest> requests = new ArrayList<>();
   BatchCreateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchCreateTrafficForecastSegments(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where TrafficForecastSegments will be created. Format: networks/{network_code} The parent field in the CreateTrafficForecastSegmentRequest must match this field.

requests List<CreateTrafficForecastSegmentRequest>

Required. The TrafficForecastSegment objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateTrafficForecastSegmentsResponse

batchCreateTrafficForecastSegmentsCallable()

public final UnaryCallable<BatchCreateTrafficForecastSegmentsRequest,BatchCreateTrafficForecastSegmentsResponse> batchCreateTrafficForecastSegmentsCallable()

Creates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   BatchCreateTrafficForecastSegmentsRequest request =
       BatchCreateTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateTrafficForecastSegmentRequest>())
           .build();
   ApiFuture<BatchCreateTrafficForecastSegmentsResponse> future =
       trafficForecastSegmentServiceClient
           .batchCreateTrafficForecastSegmentsCallable()
           .futureCall(request);
   // Do something.
   BatchCreateTrafficForecastSegmentsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateTrafficForecastSegmentsRequest,BatchCreateTrafficForecastSegmentsResponse>

batchUpdateTrafficForecastSegments(@Nullable NetworkName parent, List<UpdateTrafficForecastSegmentRequest> requests)

public final BatchUpdateTrafficForecastSegmentsResponse batchUpdateTrafficForecastSegments(@Nullable NetworkName parent, List<UpdateTrafficForecastSegmentRequest> requests)

Batch updates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateTrafficForecastSegmentRequest> requests = new ArrayList<>();
   BatchUpdateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchUpdateTrafficForecastSegments(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where TrafficForecastSegments will be updated. Format: networks/{network_code} The parent field in the UpdateTrafficForecastSegmentRequest must match this field.

requests List<UpdateTrafficForecastSegmentRequest>

Required. The TrafficForecastSegment objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateTrafficForecastSegmentsResponse

batchUpdateTrafficForecastSegments(BatchUpdateTrafficForecastSegmentsRequest request)

public final BatchUpdateTrafficForecastSegmentsResponse batchUpdateTrafficForecastSegments(BatchUpdateTrafficForecastSegmentsRequest request)

Batch updates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   BatchUpdateTrafficForecastSegmentsRequest request =
       BatchUpdateTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateTrafficForecastSegmentRequest>())
           .build();
   BatchUpdateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchUpdateTrafficForecastSegments(request);
 }
 
Parameter
Name Description
request BatchUpdateTrafficForecastSegmentsRequest

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

Returns
Type Description
BatchUpdateTrafficForecastSegmentsResponse

batchUpdateTrafficForecastSegments(String parent, List<UpdateTrafficForecastSegmentRequest> requests)

public final BatchUpdateTrafficForecastSegmentsResponse batchUpdateTrafficForecastSegments(String parent, List<UpdateTrafficForecastSegmentRequest> requests)

Batch updates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateTrafficForecastSegmentRequest> requests = new ArrayList<>();
   BatchUpdateTrafficForecastSegmentsResponse response =
       trafficForecastSegmentServiceClient.batchUpdateTrafficForecastSegments(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where TrafficForecastSegments will be updated. Format: networks/{network_code} The parent field in the UpdateTrafficForecastSegmentRequest must match this field.

requests List<UpdateTrafficForecastSegmentRequest>

Required. The TrafficForecastSegment objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateTrafficForecastSegmentsResponse

batchUpdateTrafficForecastSegmentsCallable()

public final UnaryCallable<BatchUpdateTrafficForecastSegmentsRequest,BatchUpdateTrafficForecastSegmentsResponse> batchUpdateTrafficForecastSegmentsCallable()

Batch updates TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   BatchUpdateTrafficForecastSegmentsRequest request =
       BatchUpdateTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateTrafficForecastSegmentRequest>())
           .build();
   ApiFuture<BatchUpdateTrafficForecastSegmentsResponse> future =
       trafficForecastSegmentServiceClient
           .batchUpdateTrafficForecastSegmentsCallable()
           .futureCall(request);
   // Do something.
   BatchUpdateTrafficForecastSegmentsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateTrafficForecastSegmentsRequest,BatchUpdateTrafficForecastSegmentsResponse>

close()

public final void close()

createTrafficForecastSegment(@Nullable NetworkName parent, TrafficForecastSegment trafficForecastSegment)

public final TrafficForecastSegment createTrafficForecastSegment(@Nullable NetworkName parent, TrafficForecastSegment trafficForecastSegment)

Creates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   TrafficForecastSegment trafficForecastSegment = TrafficForecastSegment.newBuilder().build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.createTrafficForecastSegment(
           parent, trafficForecastSegment);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where this TrafficForecastSegment will be created. Format: networks/{network_code}

trafficForecastSegment TrafficForecastSegment

Required. The TrafficForecastSegment to create.

Returns
Type Description
TrafficForecastSegment

createTrafficForecastSegment(CreateTrafficForecastSegmentRequest request)

public final TrafficForecastSegment createTrafficForecastSegment(CreateTrafficForecastSegmentRequest request)

Creates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   CreateTrafficForecastSegmentRequest request =
       CreateTrafficForecastSegmentRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setTrafficForecastSegment(TrafficForecastSegment.newBuilder().build())
           .build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.createTrafficForecastSegment(request);
 }
 
Parameter
Name Description
request CreateTrafficForecastSegmentRequest

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

Returns
Type Description
TrafficForecastSegment

createTrafficForecastSegment(String parent, TrafficForecastSegment trafficForecastSegment)

public final TrafficForecastSegment createTrafficForecastSegment(String parent, TrafficForecastSegment trafficForecastSegment)

Creates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   TrafficForecastSegment trafficForecastSegment = TrafficForecastSegment.newBuilder().build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.createTrafficForecastSegment(
           parent, trafficForecastSegment);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where this TrafficForecastSegment will be created. Format: networks/{network_code}

trafficForecastSegment TrafficForecastSegment

Required. The TrafficForecastSegment to create.

Returns
Type Description
TrafficForecastSegment

createTrafficForecastSegmentCallable()

public final UnaryCallable<CreateTrafficForecastSegmentRequest,TrafficForecastSegment> createTrafficForecastSegmentCallable()

Creates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   CreateTrafficForecastSegmentRequest request =
       CreateTrafficForecastSegmentRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setTrafficForecastSegment(TrafficForecastSegment.newBuilder().build())
           .build();
   ApiFuture<TrafficForecastSegment> future =
       trafficForecastSegmentServiceClient
           .createTrafficForecastSegmentCallable()
           .futureCall(request);
   // Do something.
   TrafficForecastSegment response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateTrafficForecastSegmentRequest,TrafficForecastSegment>

getSettings()

public final @Nullable TrafficForecastSegmentServiceSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.TrafficForecastSegmentServiceSettings

getStub()

public TrafficForecastSegmentServiceStub getStub()
Returns
Type Description
TrafficForecastSegmentServiceStub

getTrafficForecastSegment(@Nullable TrafficForecastSegmentName name)

public final TrafficForecastSegment getTrafficForecastSegment(@Nullable TrafficForecastSegmentName name)

Retrieves a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   TrafficForecastSegmentName name =
       TrafficForecastSegmentName.of("[NETWORK_CODE]", "[TRAFFIC_FORECAST_SEGMENT]");
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.getTrafficForecastSegment(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.TrafficForecastSegmentName

Required. The resource name of the TrafficForecastSegment. Format: networks/{network_code}/trafficForecastSegments/{trafficForecastSegmentId}

Returns
Type Description
TrafficForecastSegment

getTrafficForecastSegment(GetTrafficForecastSegmentRequest request)

public final TrafficForecastSegment getTrafficForecastSegment(GetTrafficForecastSegmentRequest request)

Retrieves a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   GetTrafficForecastSegmentRequest request =
       GetTrafficForecastSegmentRequest.newBuilder()
           .setName(
               TrafficForecastSegmentName.of("[NETWORK_CODE]", "[TRAFFIC_FORECAST_SEGMENT]")
                   .toString())
           .build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.getTrafficForecastSegment(request);
 }
 
Parameter
Name Description
request GetTrafficForecastSegmentRequest

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

Returns
Type Description
TrafficForecastSegment

getTrafficForecastSegment(String name)

public final TrafficForecastSegment getTrafficForecastSegment(String name)

Retrieves a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   String name =
       TrafficForecastSegmentName.of("[NETWORK_CODE]", "[TRAFFIC_FORECAST_SEGMENT]").toString();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.getTrafficForecastSegment(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the TrafficForecastSegment. Format: networks/{network_code}/trafficForecastSegments/{trafficForecastSegmentId}

Returns
Type Description
TrafficForecastSegment

getTrafficForecastSegmentCallable()

public final UnaryCallable<GetTrafficForecastSegmentRequest,TrafficForecastSegment> getTrafficForecastSegmentCallable()

Retrieves a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   GetTrafficForecastSegmentRequest request =
       GetTrafficForecastSegmentRequest.newBuilder()
           .setName(
               TrafficForecastSegmentName.of("[NETWORK_CODE]", "[TRAFFIC_FORECAST_SEGMENT]")
                   .toString())
           .build();
   ApiFuture<TrafficForecastSegment> future =
       trafficForecastSegmentServiceClient
           .getTrafficForecastSegmentCallable()
           .futureCall(request);
   // Do something.
   TrafficForecastSegment response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetTrafficForecastSegmentRequest,TrafficForecastSegment>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listTrafficForecastSegments(@Nullable NetworkName parent)

public final TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse listTrafficForecastSegments(@Nullable NetworkName parent)

Lists TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (TrafficForecastSegment element :
       trafficForecastSegmentServiceClient.listTrafficForecastSegments(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent, which owns this collection of TrafficForecastSegments. Format: networks/{network_code}

Returns
Type Description
TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse

listTrafficForecastSegments(ListTrafficForecastSegmentsRequest request)

public final TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse listTrafficForecastSegments(ListTrafficForecastSegmentsRequest request)

Lists TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   ListTrafficForecastSegmentsRequest request =
       ListTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (TrafficForecastSegment element :
       trafficForecastSegmentServiceClient.listTrafficForecastSegments(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListTrafficForecastSegmentsRequest

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

Returns
Type Description
TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse

listTrafficForecastSegments(String parent)

public final TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse listTrafficForecastSegments(String parent)

Lists TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (TrafficForecastSegment element :
       trafficForecastSegmentServiceClient.listTrafficForecastSegments(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent, which owns this collection of TrafficForecastSegments. Format: networks/{network_code}

Returns
Type Description
TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse

listTrafficForecastSegmentsCallable()

public final UnaryCallable<ListTrafficForecastSegmentsRequest,ListTrafficForecastSegmentsResponse> listTrafficForecastSegmentsCallable()

Lists TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   ListTrafficForecastSegmentsRequest request =
       ListTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListTrafficForecastSegmentsResponse response =
         trafficForecastSegmentServiceClient.listTrafficForecastSegmentsCallable().call(request);
     for (TrafficForecastSegment element : response.getTrafficForecastSegmentsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListTrafficForecastSegmentsRequest,ListTrafficForecastSegmentsResponse>

listTrafficForecastSegmentsPagedCallable()

public final UnaryCallable<ListTrafficForecastSegmentsRequest,TrafficForecastSegmentServiceClient.ListTrafficForecastSegmentsPagedResponse> listTrafficForecastSegmentsPagedCallable()

Lists TrafficForecastSegment objects.

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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   ListTrafficForecastSegmentsRequest request =
       ListTrafficForecastSegmentsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<TrafficForecastSegment> future =
       trafficForecastSegmentServiceClient
           .listTrafficForecastSegmentsPagedCallable()
           .futureCall(request);
   // Do something.
   for (TrafficForecastSegment element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListTrafficForecastSegmentsRequest,ListTrafficForecastSegmentsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateTrafficForecastSegment(TrafficForecastSegment trafficForecastSegment, FieldMask updateMask)

public final TrafficForecastSegment updateTrafficForecastSegment(TrafficForecastSegment trafficForecastSegment, FieldMask updateMask)

Updates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   TrafficForecastSegment trafficForecastSegment = TrafficForecastSegment.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.updateTrafficForecastSegment(
           trafficForecastSegment, updateMask);
 }
 
Parameters
Name Description
trafficForecastSegment TrafficForecastSegment

Required. The TrafficForecastSegment to update.

The TrafficForecastSegment's name is used to identify the TrafficForecastSegment to update.

updateMask FieldMask

Optional. The list of fields to update.

Returns
Type Description
TrafficForecastSegment

updateTrafficForecastSegment(UpdateTrafficForecastSegmentRequest request)

public final TrafficForecastSegment updateTrafficForecastSegment(UpdateTrafficForecastSegmentRequest request)

Updates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   UpdateTrafficForecastSegmentRequest request =
       UpdateTrafficForecastSegmentRequest.newBuilder()
           .setTrafficForecastSegment(TrafficForecastSegment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   TrafficForecastSegment response =
       trafficForecastSegmentServiceClient.updateTrafficForecastSegment(request);
 }
 
Parameter
Name Description
request UpdateTrafficForecastSegmentRequest

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

Returns
Type Description
TrafficForecastSegment

updateTrafficForecastSegmentCallable()

public final UnaryCallable<UpdateTrafficForecastSegmentRequest,TrafficForecastSegment> updateTrafficForecastSegmentCallable()

Updates a TrafficForecastSegment 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 (TrafficForecastSegmentServiceClient trafficForecastSegmentServiceClient =
     TrafficForecastSegmentServiceClient.create()) {
   UpdateTrafficForecastSegmentRequest request =
       UpdateTrafficForecastSegmentRequest.newBuilder()
           .setTrafficForecastSegment(TrafficForecastSegment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<TrafficForecastSegment> future =
       trafficForecastSegmentServiceClient
           .updateTrafficForecastSegmentCallable()
           .futureCall(request);
   // Do something.
   TrafficForecastSegment response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateTrafficForecastSegmentRequest,TrafficForecastSegment>