Class ServingConfigServiceClient
- java.lang.Object
-
- com.google.cloud.retail.v2alpha.ServingConfigServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class ServingConfigServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Service for modifying ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); ServingConfig servingConfig = ServingConfig.newBuilder().build(); String servingConfigId = "servingConfigId-831052759"; ServingConfig response = servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); }
Note: close() needs to be called on the ServingConfigServiceClient 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 ServingConfigServiceSettings 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 ServingConfigServiceSettings servingConfigServiceSettings = ServingConfigServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create(servingConfigServiceSettings);
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 ServingConfigServiceSettings servingConfigServiceSettings = ServingConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create(servingConfigServiceSettings);
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 ServingConfigServiceSettings servingConfigServiceSettings = ServingConfigServiceSettings.newHttpJsonBuilder().build(); ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create(servingConfigServiceSettings);
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
ServingConfigServiceClient.ListServingConfigsFixedSizeCollection
static class
ServingConfigServiceClient.ListServingConfigsPage
static class
ServingConfigServiceClient.ListServingConfigsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
ServingConfigServiceClient(ServingConfigServiceSettings settings)
Constructs an instance of ServingConfigServiceClient, using the given settings.protected
ServingConfigServiceClient(ServingConfigServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServingConfig
addControl(AddControlRequest request)
Enables a Control on the specified ServingConfig.ServingConfig
addControl(ServingConfigName servingConfig)
Enables a Control on the specified ServingConfig.ServingConfig
addControl(String servingConfig)
Enables a Control on the specified ServingConfig.com.google.api.gax.rpc.UnaryCallable<AddControlRequest,ServingConfig>
addControlCallable()
Enables a Control on the specified ServingConfig.boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static ServingConfigServiceClient
create()
Constructs an instance of ServingConfigServiceClient with default settings.static ServingConfigServiceClient
create(ServingConfigServiceSettings settings)
Constructs an instance of ServingConfigServiceClient, using the given settings.static ServingConfigServiceClient
create(ServingConfigServiceStub stub)
Constructs an instance of ServingConfigServiceClient, using the given stub for making calls.ServingConfig
createServingConfig(CatalogName parent, ServingConfig servingConfig, String servingConfigId)
Creates a ServingConfig.ServingConfig
createServingConfig(CreateServingConfigRequest request)
Creates a ServingConfig.ServingConfig
createServingConfig(String parent, ServingConfig servingConfig, String servingConfigId)
Creates a ServingConfig.com.google.api.gax.rpc.UnaryCallable<CreateServingConfigRequest,ServingConfig>
createServingConfigCallable()
Creates a ServingConfig.void
deleteServingConfig(DeleteServingConfigRequest request)
Deletes a ServingConfig.void
deleteServingConfig(ServingConfigName name)
Deletes a ServingConfig.void
deleteServingConfig(String name)
Deletes a ServingConfig.com.google.api.gax.rpc.UnaryCallable<DeleteServingConfigRequest,com.google.protobuf.Empty>
deleteServingConfigCallable()
Deletes a ServingConfig.ServingConfig
getServingConfig(GetServingConfigRequest request)
Gets a ServingConfig.ServingConfig
getServingConfig(ServingConfigName name)
Gets a ServingConfig.ServingConfig
getServingConfig(String name)
Gets a ServingConfig.com.google.api.gax.rpc.UnaryCallable<GetServingConfigRequest,ServingConfig>
getServingConfigCallable()
Gets a ServingConfig.ServingConfigServiceSettings
getSettings()
ServingConfigServiceStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
ServingConfigServiceClient.ListServingConfigsPagedResponse
listServingConfigs(CatalogName parent)
Lists all ServingConfigs linked to this catalog.ServingConfigServiceClient.ListServingConfigsPagedResponse
listServingConfigs(ListServingConfigsRequest request)
Lists all ServingConfigs linked to this catalog.ServingConfigServiceClient.ListServingConfigsPagedResponse
listServingConfigs(String parent)
Lists all ServingConfigs linked to this catalog.com.google.api.gax.rpc.UnaryCallable<ListServingConfigsRequest,ListServingConfigsResponse>
listServingConfigsCallable()
Lists all ServingConfigs linked to this catalog.com.google.api.gax.rpc.UnaryCallable<ListServingConfigsRequest,ServingConfigServiceClient.ListServingConfigsPagedResponse>
listServingConfigsPagedCallable()
Lists all ServingConfigs linked to this catalog.ServingConfig
removeControl(RemoveControlRequest request)
Disables a Control on the specified ServingConfig.ServingConfig
removeControl(ServingConfigName servingConfig)
Disables a Control on the specified ServingConfig.ServingConfig
removeControl(String servingConfig)
Disables a Control on the specified ServingConfig.com.google.api.gax.rpc.UnaryCallable<RemoveControlRequest,ServingConfig>
removeControlCallable()
Disables a Control on the specified ServingConfig.void
shutdown()
void
shutdownNow()
ServingConfig
updateServingConfig(ServingConfig servingConfig, com.google.protobuf.FieldMask updateMask)
Updates a ServingConfig.ServingConfig
updateServingConfig(UpdateServingConfigRequest request)
Updates a ServingConfig.com.google.api.gax.rpc.UnaryCallable<UpdateServingConfigRequest,ServingConfig>
updateServingConfigCallable()
Updates a ServingConfig.
-
-
-
Constructor Detail
-
ServingConfigServiceClient
protected ServingConfigServiceClient(ServingConfigServiceSettings settings) throws IOException
Constructs an instance of ServingConfigServiceClient, 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
-
ServingConfigServiceClient
protected ServingConfigServiceClient(ServingConfigServiceStub stub)
-
-
Method Detail
-
create
public static final ServingConfigServiceClient create() throws IOException
Constructs an instance of ServingConfigServiceClient with default settings.- Throws:
IOException
-
create
public static final ServingConfigServiceClient create(ServingConfigServiceSettings settings) throws IOException
Constructs an instance of ServingConfigServiceClient, 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 ServingConfigServiceClient create(ServingConfigServiceStub stub)
Constructs an instance of ServingConfigServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ServingConfigServiceSettings).
-
getSettings
public final ServingConfigServiceSettings getSettings()
-
getStub
public ServingConfigServiceStub getStub()
-
createServingConfig
public final ServingConfig createServingConfig(CatalogName parent, ServingConfig servingConfig, String servingConfigId)
Creates a ServingConfig.A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); ServingConfig servingConfig = ServingConfig.newBuilder().build(); String servingConfigId = "servingConfigId-831052759"; ServingConfig response = servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); }
- Parameters:
parent
- Required. Full resource name of parent. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`servingConfig
- Required. The ServingConfig to create.servingConfigId
- Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createServingConfig
public final ServingConfig createServingConfig(String parent, ServingConfig servingConfig, String servingConfigId)
Creates a ServingConfig.A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); ServingConfig servingConfig = ServingConfig.newBuilder().build(); String servingConfigId = "servingConfigId-831052759"; ServingConfig response = servingConfigServiceClient.createServingConfig(parent, servingConfig, servingConfigId); }
- Parameters:
parent
- Required. Full resource name of parent. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`servingConfig
- Required. The ServingConfig to create.servingConfigId
- Required. The ID to use for the ServingConfig, which will become the final component of the ServingConfig's resource name.This value should be 4-63 characters, and valid characters are /[a-z][0-9]-_/.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createServingConfig
public final ServingConfig createServingConfig(CreateServingConfigRequest request)
Creates a ServingConfig.A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { CreateServingConfigRequest request = CreateServingConfigRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setServingConfig(ServingConfig.newBuilder().build()) .setServingConfigId("servingConfigId-831052759") .build(); ServingConfig response = servingConfigServiceClient.createServingConfig(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
-
createServingConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateServingConfigRequest,ServingConfig> createServingConfigCallable()
Creates a ServingConfig.A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { CreateServingConfigRequest request = CreateServingConfigRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setServingConfig(ServingConfig.newBuilder().build()) .setServingConfigId("servingConfigId-831052759") .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.createServingConfigCallable().futureCall(request); // Do something. ServingConfig response = future.get(); }
-
deleteServingConfig
public final void deleteServingConfig(ServingConfigName name)
Deletes a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ServingConfigName name = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); servingConfigServiceClient.deleteServingConfig(name); }
- Parameters:
name
- Required. The resource name of the ServingConfig to delete. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteServingConfig
public final void deleteServingConfig(String name)
Deletes a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String name = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString(); servingConfigServiceClient.deleteServingConfig(name); }
- Parameters:
name
- Required. The resource name of the ServingConfig to delete. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteServingConfig
public final void deleteServingConfig(DeleteServingConfigRequest request)
Deletes a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { DeleteServingConfigRequest request = DeleteServingConfigRequest.newBuilder() .setName( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .build(); servingConfigServiceClient.deleteServingConfig(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
-
deleteServingConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteServingConfigRequest,com.google.protobuf.Empty> deleteServingConfigCallable()
Deletes a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { DeleteServingConfigRequest request = DeleteServingConfigRequest.newBuilder() .setName( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .build(); ApiFuture<Empty> future = servingConfigServiceClient.deleteServingConfigCallable().futureCall(request); // Do something. future.get(); }
-
updateServingConfig
public final ServingConfig updateServingConfig(ServingConfig servingConfig, com.google.protobuf.FieldMask updateMask)
Updates a ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ServingConfig servingConfig = ServingConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); ServingConfig response = servingConfigServiceClient.updateServingConfig(servingConfig, updateMask); }
- Parameters:
servingConfig
- Required. The ServingConfig to update.updateMask
- Indicates which fields in the provided [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to update. The following are NOT supported:- [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name]
If not set, all supported fields are updated.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateServingConfig
public final ServingConfig updateServingConfig(UpdateServingConfigRequest request)
Updates a ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { UpdateServingConfigRequest request = UpdateServingConfigRequest.newBuilder() .setServingConfig(ServingConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ServingConfig response = servingConfigServiceClient.updateServingConfig(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
-
updateServingConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateServingConfigRequest,ServingConfig> updateServingConfigCallable()
Updates a ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { UpdateServingConfigRequest request = UpdateServingConfigRequest.newBuilder() .setServingConfig(ServingConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.updateServingConfigCallable().futureCall(request); // Do something. ServingConfig response = future.get(); }
-
getServingConfig
public final ServingConfig getServingConfig(ServingConfigName name)
Gets a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ServingConfigName name = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); ServingConfig response = servingConfigServiceClient.getServingConfig(name); }
- Parameters:
name
- Required. The resource name of the ServingConfig to get. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getServingConfig
public final ServingConfig getServingConfig(String name)
Gets a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String name = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString(); ServingConfig response = servingConfigServiceClient.getServingConfig(name); }
- Parameters:
name
- Required. The resource name of the ServingConfig to get. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getServingConfig
public final ServingConfig getServingConfig(GetServingConfigRequest request)
Gets a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { GetServingConfigRequest request = GetServingConfigRequest.newBuilder() .setName( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .build(); ServingConfig response = servingConfigServiceClient.getServingConfig(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
-
getServingConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetServingConfigRequest,ServingConfig> getServingConfigCallable()
Gets a ServingConfig.Returns a NotFound error if the ServingConfig does not exist.
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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { GetServingConfigRequest request = GetServingConfigRequest.newBuilder() .setName( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.getServingConfigCallable().futureCall(request); // Do something. ServingConfig response = future.get(); }
-
listServingConfigs
public final ServingConfigServiceClient.ListServingConfigsPagedResponse listServingConfigs(CatalogName parent)
Lists all ServingConfigs linked to this catalog.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]"); for (ServingConfig element : servingConfigServiceClient.listServingConfigs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The catalog resource name. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listServingConfigs
public final ServingConfigServiceClient.ListServingConfigsPagedResponse listServingConfigs(String parent)
Lists all ServingConfigs linked to this catalog.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString(); for (ServingConfig element : servingConfigServiceClient.listServingConfigs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The catalog resource name. Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listServingConfigs
public final ServingConfigServiceClient.ListServingConfigsPagedResponse listServingConfigs(ListServingConfigsRequest request)
Lists all ServingConfigs linked to this catalog.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ListServingConfigsRequest request = ListServingConfigsRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (ServingConfig element : servingConfigServiceClient.listServingConfigs(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
-
listServingConfigsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListServingConfigsRequest,ServingConfigServiceClient.ListServingConfigsPagedResponse> listServingConfigsPagedCallable()
Lists all ServingConfigs linked to this catalog.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ListServingConfigsRequest request = ListServingConfigsRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.listServingConfigsPagedCallable().futureCall(request); // Do something. for (ServingConfig element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listServingConfigsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListServingConfigsRequest,ListServingConfigsResponse> listServingConfigsCallable()
Lists all ServingConfigs linked to this catalog.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ListServingConfigsRequest request = ListServingConfigsRequest.newBuilder() .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListServingConfigsResponse response = servingConfigServiceClient.listServingConfigsCallable().call(request); for (ServingConfig element : response.getServingConfigsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
addControl
public final ServingConfig addControl(ServingConfigName servingConfig)
Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ServingConfigName servingConfig = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); ServingConfig response = servingConfigServiceClient.addControl(servingConfig); }
- Parameters:
servingConfig
- Required. The source ServingConfig resource name . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addControl
public final ServingConfig addControl(String servingConfig)
Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String servingConfig = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString(); ServingConfig response = servingConfigServiceClient.addControl(servingConfig); }
- Parameters:
servingConfig
- Required. The source ServingConfig resource name . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
addControl
public final ServingConfig addControl(AddControlRequest request)
Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { AddControlRequest request = AddControlRequest.newBuilder() .setServingConfig( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .setControlId("controlId-395080872") .build(); ServingConfig response = servingConfigServiceClient.addControl(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
-
addControlCallable
public final com.google.api.gax.rpc.UnaryCallable<AddControlRequest,ServingConfig> addControlCallable()
Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { AddControlRequest request = AddControlRequest.newBuilder() .setServingConfig( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .setControlId("controlId-395080872") .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.addControlCallable().futureCall(request); // Do something. ServingConfig response = future.get(); }
-
removeControl
public final ServingConfig removeControl(ServingConfigName servingConfig)
Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { ServingConfigName servingConfig = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]"); ServingConfig response = servingConfigServiceClient.removeControl(servingConfig); }
- Parameters:
servingConfig
- Required. The source ServingConfig resource name . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeControl
public final ServingConfig removeControl(String servingConfig)
Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { String servingConfig = ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString(); ServingConfig response = servingConfigServiceClient.removeControl(servingConfig); }
- Parameters:
servingConfig
- Required. The source ServingConfig resource name . Format: `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
removeControl
public final ServingConfig removeControl(RemoveControlRequest request)
Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { RemoveControlRequest request = RemoveControlRequest.newBuilder() .setServingConfig( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .setControlId("controlId-395080872") .build(); ServingConfig response = servingConfigServiceClient.removeControl(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
-
removeControlCallable
public final com.google.api.gax.rpc.UnaryCallable<RemoveControlRequest,ServingConfig> removeControlCallable()
Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.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 (ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.create()) { RemoveControlRequest request = RemoveControlRequest.newBuilder() .setServingConfig( ServingConfigName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[SERVING_CONFIG]") .toString()) .setControlId("controlId-395080872") .build(); ApiFuture<ServingConfig> future = servingConfigServiceClient.removeControlCallable().futureCall(request); // Do something. ServingConfig 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
-
-