Class FulfillmentsClient (4.3.1)

public class FulfillmentsClient implements BackgroundResource

Service Description: Service for managing Fulfillments.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   FulfillmentName name = FulfillmentName.ofProjectName("[PROJECT]");
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 

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

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of FulfillmentsSettings to create(). For example:

To customize credentials:


 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

To customize the endpoint:


 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

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

Inheritance

java.lang.Object > FulfillmentsClient

Implements

BackgroundResource

Constructors

FulfillmentsClient(FulfillmentsSettings settings)

protected FulfillmentsClient(FulfillmentsSettings settings)

Constructs an instance of FulfillmentsClient, 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
NameDescription
settingsFulfillmentsSettings

FulfillmentsClient(FulfillmentsStub stub)

protected FulfillmentsClient(FulfillmentsStub stub)
Parameter
NameDescription
stubFulfillmentsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

create()

public static final FulfillmentsClient create()

Constructs an instance of FulfillmentsClient with default settings.

Returns
TypeDescription
FulfillmentsClient
Exceptions
TypeDescription
IOException

create(FulfillmentsSettings settings)

public static final FulfillmentsClient create(FulfillmentsSettings settings)

Constructs an instance of FulfillmentsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsFulfillmentsSettings
Returns
TypeDescription
FulfillmentsClient
Exceptions
TypeDescription
IOException

create(FulfillmentsStub stub)

public static final FulfillmentsClient create(FulfillmentsStub stub)

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

Parameter
NameDescription
stubFulfillmentsStub
Returns
TypeDescription
FulfillmentsClient

getFulfillment(FulfillmentName name)

public final Fulfillment getFulfillment(FulfillmentName name)

Retrieves the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   FulfillmentName name = FulfillmentName.ofProjectName("[PROJECT]");
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 
Parameter
NameDescription
nameFulfillmentName

Required. The name of the fulfillment. Supported formats: - projects/<Project ID>/agent/fulfillment - projects/<Project ID>/locations/<Location ID>/agent/fulfillment

Returns
TypeDescription
Fulfillment

getFulfillment(GetFulfillmentRequest request)

public final Fulfillment getFulfillment(GetFulfillmentRequest request)

Retrieves the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetFulfillmentRequest request =
       GetFulfillmentRequest.newBuilder()
           .setName(FulfillmentName.ofProjectName("[PROJECT]").toString())
           .build();
   Fulfillment response = fulfillmentsClient.getFulfillment(request);
 }
 
Parameter
NameDescription
requestGetFulfillmentRequest

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

Returns
TypeDescription
Fulfillment

getFulfillment(String name)

public final Fulfillment getFulfillment(String name)

Retrieves the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   String name = FulfillmentName.ofProjectName("[PROJECT]").toString();
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the fulfillment. Supported formats: - projects/<Project ID>/agent/fulfillment - projects/<Project ID>/locations/<Location ID>/agent/fulfillment

Returns
TypeDescription
Fulfillment

getFulfillmentCallable()

public final UnaryCallable<GetFulfillmentRequest,Fulfillment> getFulfillmentCallable()

Retrieves the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetFulfillmentRequest request =
       GetFulfillmentRequest.newBuilder()
           .setName(FulfillmentName.ofProjectName("[PROJECT]").toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetFulfillmentRequest,Fulfillment>

getSettings()

public final FulfillmentsSettings getSettings()
Returns
TypeDescription
FulfillmentsSettings

getStub()

public FulfillmentsStub getStub()
Returns
TypeDescription
FulfillmentsStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateFulfillment(Fulfillment fulfillment, FieldMask updateMask)

public final Fulfillment updateFulfillment(Fulfillment fulfillment, FieldMask updateMask)

Updates the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   Fulfillment fulfillment = Fulfillment.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Fulfillment response = fulfillmentsClient.updateFulfillment(fulfillment, updateMask);
 }
 
Parameters
NameDescription
fulfillmentFulfillment

Required. The fulfillment to update.

updateMaskFieldMask

Required. The mask to control which fields get updated. If the mask is not present, all fields will be updated.

Returns
TypeDescription
Fulfillment

updateFulfillment(UpdateFulfillmentRequest request)

public final Fulfillment updateFulfillment(UpdateFulfillmentRequest request)

Updates the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   UpdateFulfillmentRequest request =
       UpdateFulfillmentRequest.newBuilder()
           .setFulfillment(Fulfillment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Fulfillment response = fulfillmentsClient.updateFulfillment(request);
 }
 
Parameter
NameDescription
requestUpdateFulfillmentRequest

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

Returns
TypeDescription
Fulfillment

updateFulfillmentCallable()

public final UnaryCallable<UpdateFulfillmentRequest,Fulfillment> updateFulfillmentCallable()

Updates the fulfillment.

Sample code:


 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   UpdateFulfillmentRequest request =
       UpdateFulfillmentRequest.newBuilder()
           .setFulfillment(Fulfillment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<UpdateFulfillmentRequest,Fulfillment>