Class WebhooksClient (0.15.0)

public class WebhooksClient implements BackgroundResource

Service Description: Service for managing Webhooks.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
   Webhook response = webhooksClient.getWebhook(name);
 }
 

Note: close() needs to be called on the WebhooksClient 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 WebhooksSettings 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
 WebhooksSettings webhooksSettings =
     WebhooksSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings);
 

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
 WebhooksSettings webhooksSettings =
     WebhooksSettings.newBuilder().setEndpoint(myEndpoint).build();
 WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings);
 

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


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 WebhooksSettings webhooksSettings =
     WebhooksSettings.newBuilder()
         .setTransportChannelProvider(
             WebhooksSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings);
 

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

Inheritance

java.lang.Object > WebhooksClient

Implements

BackgroundResource

Static Methods

create()

public static final WebhooksClient create()

Constructs an instance of WebhooksClient with default settings.

Returns
Type Description
WebhooksClient
Exceptions
Type Description
IOException

create(WebhooksSettings settings)

public static final WebhooksClient create(WebhooksSettings settings)

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

create(WebhooksStub stub)

public static final WebhooksClient create(WebhooksStub stub)

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

Parameter
Name Description
stub WebhooksStub
Returns
Type Description
WebhooksClient

Constructors

WebhooksClient(WebhooksSettings settings)

protected WebhooksClient(WebhooksSettings settings)

Constructs an instance of WebhooksClient, 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 WebhooksSettings

WebhooksClient(WebhooksStub stub)

protected WebhooksClient(WebhooksStub stub)
Parameter
Name Description
stub WebhooksStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createWebhook(AgentName parent, Webhook webhook)

public final Webhook createWebhook(AgentName parent, Webhook webhook)

Creates a webhook in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   Webhook webhook = Webhook.newBuilder().build();
   Webhook response = webhooksClient.createWebhook(parent, webhook);
 }
 
Parameters
Name Description
parent AgentName

Required. The agent to create a webhook for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

webhook Webhook

Required. The webhook to create.

Returns
Type Description
Webhook

createWebhook(CreateWebhookRequest request)

public final Webhook createWebhook(CreateWebhookRequest request)

Creates a webhook in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   CreateWebhookRequest request =
       CreateWebhookRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setWebhook(Webhook.newBuilder().build())
           .build();
   Webhook response = webhooksClient.createWebhook(request);
 }
 
Parameter
Name Description
request CreateWebhookRequest

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

Returns
Type Description
Webhook

createWebhook(String parent, Webhook webhook)

public final Webhook createWebhook(String parent, Webhook webhook)

Creates a webhook in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   Webhook webhook = Webhook.newBuilder().build();
   Webhook response = webhooksClient.createWebhook(parent, webhook);
 }
 
Parameters
Name Description
parent String

Required. The agent to create a webhook for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

webhook Webhook

Required. The webhook to create.

Returns
Type Description
Webhook

createWebhookCallable()

public final UnaryCallable<CreateWebhookRequest,Webhook> createWebhookCallable()

Creates a webhook in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   CreateWebhookRequest request =
       CreateWebhookRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setWebhook(Webhook.newBuilder().build())
           .build();
   ApiFuture<Webhook> future = webhooksClient.createWebhookCallable().futureCall(request);
   // Do something.
   Webhook response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateWebhookRequest,Webhook>

deleteWebhook(DeleteWebhookRequest request)

public final void deleteWebhook(DeleteWebhookRequest request)

Deletes the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   DeleteWebhookRequest request =
       DeleteWebhookRequest.newBuilder()
           .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString())
           .setForce(true)
           .build();
   webhooksClient.deleteWebhook(request);
 }
 
Parameter
Name Description
request DeleteWebhookRequest

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

deleteWebhook(WebhookName name)

public final void deleteWebhook(WebhookName name)

Deletes the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
   webhooksClient.deleteWebhook(name);
 }
 
Parameter
Name Description
name WebhookName

Required. The name of the webhook to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

deleteWebhook(String name)

public final void deleteWebhook(String name)

Deletes the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   String name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString();
   webhooksClient.deleteWebhook(name);
 }
 
Parameter
Name Description
name String

Required. The name of the webhook to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

deleteWebhookCallable()

public final UnaryCallable<DeleteWebhookRequest,Empty> deleteWebhookCallable()

Deletes the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   DeleteWebhookRequest request =
       DeleteWebhookRequest.newBuilder()
           .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString())
           .setForce(true)
           .build();
   ApiFuture<Empty> future = webhooksClient.deleteWebhookCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteWebhookRequest,Empty>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = webhooksClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

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

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = webhooksClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

public final WebhooksSettings getSettings()
Returns
Type Description
WebhooksSettings

getStub()

public WebhooksStub getStub()
Returns
Type Description
WebhooksStub

getWebhook(GetWebhookRequest request)

public final Webhook getWebhook(GetWebhookRequest request)

Retrieves the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   GetWebhookRequest request =
       GetWebhookRequest.newBuilder()
           .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString())
           .build();
   Webhook response = webhooksClient.getWebhook(request);
 }
 
Parameter
Name Description
request GetWebhookRequest

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

Returns
Type Description
Webhook

getWebhook(WebhookName name)

public final Webhook getWebhook(WebhookName name)

Retrieves the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   WebhookName name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]");
   Webhook response = webhooksClient.getWebhook(name);
 }
 
Parameter
Name Description
name WebhookName

Required. The name of the webhook. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

Returns
Type Description
Webhook

getWebhook(String name)

public final Webhook getWebhook(String name)

Retrieves the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   String name = WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString();
   Webhook response = webhooksClient.getWebhook(name);
 }
 
Parameter
Name Description
name String

Required. The name of the webhook. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

Returns
Type Description
Webhook

getWebhookCallable()

public final UnaryCallable<GetWebhookRequest,Webhook> getWebhookCallable()

Retrieves the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   GetWebhookRequest request =
       GetWebhookRequest.newBuilder()
           .setName(WebhookName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]").toString())
           .build();
   ApiFuture<Webhook> future = webhooksClient.getWebhookCallable().futureCall(request);
   // Do something.
   Webhook response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetWebhookRequest,Webhook>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLocations(ListLocationsRequest request)

public final WebhooksClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : webhooksClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

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

Returns
Type Description
WebhooksClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = webhooksClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,WebhooksClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future = webhooksClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listWebhooks(AgentName parent)

public final WebhooksClient.ListWebhooksPagedResponse listWebhooks(AgentName parent)

Returns the list of all webhooks in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   for (Webhook element : webhooksClient.listWebhooks(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AgentName

Required. The agent to list all webhooks for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
Type Description
WebhooksClient.ListWebhooksPagedResponse

listWebhooks(ListWebhooksRequest request)

public final WebhooksClient.ListWebhooksPagedResponse listWebhooks(ListWebhooksRequest request)

Returns the list of all webhooks in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListWebhooksRequest request =
       ListWebhooksRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Webhook element : webhooksClient.listWebhooks(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListWebhooksRequest

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

Returns
Type Description
WebhooksClient.ListWebhooksPagedResponse

listWebhooks(String parent)

public final WebhooksClient.ListWebhooksPagedResponse listWebhooks(String parent)

Returns the list of all webhooks in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   for (Webhook element : webhooksClient.listWebhooks(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The agent to list all webhooks for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
Type Description
WebhooksClient.ListWebhooksPagedResponse

listWebhooksCallable()

public final UnaryCallable<ListWebhooksRequest,ListWebhooksResponse> listWebhooksCallable()

Returns the list of all webhooks in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListWebhooksRequest request =
       ListWebhooksRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListWebhooksResponse response = webhooksClient.listWebhooksCallable().call(request);
     for (Webhook element : response.getWebhooksList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListWebhooksRequest,ListWebhooksResponse>

listWebhooksPagedCallable()

public final UnaryCallable<ListWebhooksRequest,WebhooksClient.ListWebhooksPagedResponse> listWebhooksPagedCallable()

Returns the list of all webhooks in the specified agent.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   ListWebhooksRequest request =
       ListWebhooksRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Webhook> future = webhooksClient.listWebhooksPagedCallable().futureCall(request);
   // Do something.
   for (Webhook element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListWebhooksRequest,ListWebhooksPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateWebhook(UpdateWebhookRequest request)

public final Webhook updateWebhook(UpdateWebhookRequest request)

Updates the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   UpdateWebhookRequest request =
       UpdateWebhookRequest.newBuilder()
           .setWebhook(Webhook.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Webhook response = webhooksClient.updateWebhook(request);
 }
 
Parameter
Name Description
request UpdateWebhookRequest

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

Returns
Type Description
Webhook

updateWebhook(Webhook webhook, FieldMask updateMask)

public final Webhook updateWebhook(Webhook webhook, FieldMask updateMask)

Updates the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   Webhook webhook = Webhook.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Webhook response = webhooksClient.updateWebhook(webhook, updateMask);
 }
 
Parameters
Name Description
webhook Webhook

Required. The webhook to update.

updateMask FieldMask

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

Returns
Type Description
Webhook

updateWebhookCallable()

public final UnaryCallable<UpdateWebhookRequest,Webhook> updateWebhookCallable()

Updates the specified webhook.

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 (WebhooksClient webhooksClient = WebhooksClient.create()) {
   UpdateWebhookRequest request =
       UpdateWebhookRequest.newBuilder()
           .setWebhook(Webhook.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Webhook> future = webhooksClient.updateWebhookCallable().futureCall(request);
   // Do something.
   Webhook response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateWebhookRequest,Webhook>