Class WebhooksClient
- java.lang.Object
-
- com.google.cloud.dialogflow.cx.v3.WebhooksClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class WebhooksClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service for managing [Webhooks][google.cloud.dialogflow.cx.v3.Webhook].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:
- 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.
- 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.
- 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.newHttpJsonBuilder().build(); WebhooksClient webhooksClient = WebhooksClient.create(webhooksSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebhooksClient.ListLocationsFixedSizeCollection
static class
WebhooksClient.ListLocationsPage
static class
WebhooksClient.ListLocationsPagedResponse
static class
WebhooksClient.ListWebhooksFixedSizeCollection
static class
WebhooksClient.ListWebhooksPage
static class
WebhooksClient.ListWebhooksPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
WebhooksClient(WebhooksStub stub)
protected
WebhooksClient(WebhooksSettings settings)
Constructs an instance of WebhooksClient, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static WebhooksClient
create()
Constructs an instance of WebhooksClient with default settings.static WebhooksClient
create(WebhooksStub stub)
Constructs an instance of WebhooksClient, using the given stub for making calls.static WebhooksClient
create(WebhooksSettings settings)
Constructs an instance of WebhooksClient, using the given settings.Webhook
createWebhook(AgentName parent, Webhook webhook)
Creates a webhook in the specified agent.Webhook
createWebhook(CreateWebhookRequest request)
Creates a webhook in the specified agent.Webhook
createWebhook(String parent, Webhook webhook)
Creates a webhook in the specified agent.com.google.api.gax.rpc.UnaryCallable<CreateWebhookRequest,Webhook>
createWebhookCallable()
Creates a webhook in the specified agent.void
deleteWebhook(DeleteWebhookRequest request)
Deletes the specified webhook.void
deleteWebhook(WebhookName name)
Deletes the specified webhook.void
deleteWebhook(String name)
Deletes the specified webhook.com.google.api.gax.rpc.UnaryCallable<DeleteWebhookRequest,com.google.protobuf.Empty>
deleteWebhookCallable()
Deletes the specified webhook.com.google.cloud.location.Location
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>
getLocationCallable()
Gets information about a location.WebhooksSettings
getSettings()
WebhooksStub
getStub()
Webhook
getWebhook(GetWebhookRequest request)
Retrieves the specified webhook.Webhook
getWebhook(WebhookName name)
Retrieves the specified webhook.Webhook
getWebhook(String name)
Retrieves the specified webhook.com.google.api.gax.rpc.UnaryCallable<GetWebhookRequest,Webhook>
getWebhookCallable()
Retrieves the specified webhook.boolean
isShutdown()
boolean
isTerminated()
WebhooksClient.ListLocationsPagedResponse
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>
listLocationsCallable()
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,WebhooksClient.ListLocationsPagedResponse>
listLocationsPagedCallable()
Lists information about the supported locations for this service.WebhooksClient.ListWebhooksPagedResponse
listWebhooks(AgentName parent)
Returns the list of all webhooks in the specified agent.WebhooksClient.ListWebhooksPagedResponse
listWebhooks(ListWebhooksRequest request)
Returns the list of all webhooks in the specified agent.WebhooksClient.ListWebhooksPagedResponse
listWebhooks(String parent)
Returns the list of all webhooks in the specified agent.com.google.api.gax.rpc.UnaryCallable<ListWebhooksRequest,ListWebhooksResponse>
listWebhooksCallable()
Returns the list of all webhooks in the specified agent.com.google.api.gax.rpc.UnaryCallable<ListWebhooksRequest,WebhooksClient.ListWebhooksPagedResponse>
listWebhooksPagedCallable()
Returns the list of all webhooks in the specified agent.void
shutdown()
void
shutdownNow()
Webhook
updateWebhook(UpdateWebhookRequest request)
Updates the specified webhook.Webhook
updateWebhook(Webhook webhook, com.google.protobuf.FieldMask updateMask)
Updates the specified webhook.com.google.api.gax.rpc.UnaryCallable<UpdateWebhookRequest,Webhook>
updateWebhookCallable()
Updates the specified webhook.
-
-
-
Constructor Detail
-
WebhooksClient
protected WebhooksClient(WebhooksSettings settings) throws IOException
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.- Throws:
IOException
-
WebhooksClient
protected WebhooksClient(WebhooksStub stub)
-
-
Method Detail
-
create
public static final WebhooksClient create() throws IOException
Constructs an instance of WebhooksClient with default settings.- Throws:
IOException
-
create
public static final WebhooksClient create(WebhooksSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final WebhooksSettings getSettings()
-
getStub
public WebhooksStub getStub()
-
listWebhooks
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); } }
- Parameters:
parent
- Required. The agent to list all webhooks for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listWebhooks
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); } }
- Parameters:
parent
- Required. The agent to list all webhooks for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listWebhooks
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listWebhooksPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listWebhooksCallable
public final com.google.api.gax.rpc.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; } } }
-
getWebhook
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); }
- Parameters:
name
- Required. The name of the webhook. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getWebhook
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); }
- Parameters:
name
- Required. The name of the webhook. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getWebhook
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getWebhookCallable
public final com.google.api.gax.rpc.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(); }
-
createWebhook
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:
parent
- Required. The agent to create a webhook for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.webhook
- Required. The webhook to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createWebhook
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:
parent
- Required. The agent to create a webhook for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.webhook
- Required. The webhook to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createWebhook
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createWebhookCallable
public final com.google.api.gax.rpc.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(); }
-
updateWebhook
public final Webhook updateWebhook(Webhook webhook, com.google.protobuf.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:
webhook
- Required. The webhook to update.updateMask
- The mask to control which fields get updated. If the mask is not present, all fields will be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateWebhook
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateWebhookCallable
public final com.google.api.gax.rpc.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(); }
-
deleteWebhook
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); }
- Parameters:
name
- Required. The name of the webhook to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteWebhook
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); }
- Parameters:
name
- Required. The name of the webhook to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteWebhook
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteWebhookCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteWebhookRequest,com.google.protobuf.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(); }
-
listLocations
public final WebhooksClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.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); } }
-
listLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-