Class FulfillmentsClient (4.7.0)

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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder().setEndpoint(myEndpoint).build();
 FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create(fulfillmentsSettings);
 

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


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 FulfillmentsSettings fulfillmentsSettings =
     FulfillmentsSettings.newBuilder()
         .setTransportChannelProvider(
             FulfillmentsSettings.defaultHttpJsonTransportProviderBuilder().build())
         .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

Static Methods

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

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

getFulfillment(FulfillmentName name)

public final Fulfillment getFulfillment(FulfillmentName name)

Retrieves the fulfillment.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   FulfillmentName name = FulfillmentName.ofProjectName("[PROJECT]");
   Fulfillment response = fulfillmentsClient.getFulfillment(name);
 }
 
Parameter
NameDescription
nameFulfillmentName

Required. The name of the fulfillment. Format: projects/<Project ID>/agent/fulfillment.

Returns
TypeDescription
Fulfillment

getFulfillment(GetFulfillmentRequest request)

public final Fulfillment getFulfillment(GetFulfillmentRequest request)

Retrieves the fulfillment.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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. Format: projects/<Project ID>/agent/fulfillment.

Returns
TypeDescription
Fulfillment

getFulfillmentCallable()

public final UnaryCallable<GetFulfillmentRequest,Fulfillment> getFulfillmentCallable()

Retrieves the fulfillment.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   GetFulfillmentRequest request =
       GetFulfillmentRequest.newBuilder()
           .setName(FulfillmentName.ofProjectName("[PROJECT]").toString())
           .build();
   ApiFuture<Fulfillment> future =
       fulfillmentsClient.getFulfillmentCallable().futureCall(request);
   // Do something.
   Fulfillment response = future.get();
 }
 
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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (FulfillmentsClient fulfillmentsClient = FulfillmentsClient.create()) {
   UpdateFulfillmentRequest request =
       UpdateFulfillmentRequest.newBuilder()
           .setFulfillment(Fulfillment.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Fulfillment> future =
       fulfillmentsClient.updateFulfillmentCallable().futureCall(request);
   // Do something.
   Fulfillment response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateFulfillmentRequest,Fulfillment>