Class CatalogServiceClient (0.61.0)

GitHub RepositoryProduct Reference

Service Description: Service for ingesting catalog information of the customer's website.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
   CatalogItem catalogItem = CatalogItem.newBuilder().build();
   CatalogItem response = catalogServiceClient.createCatalogItem(parent, catalogItem);
 }
 

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

Methods
Method Description Method Variants

CreateCatalogItem

Creates a catalog item.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createCatalogItem(CreateCatalogItemRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createCatalogItem(CatalogName parent, CatalogItem catalogItem)

  • createCatalogItem(String parent, CatalogItem catalogItem)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createCatalogItemCallable()

GetCatalogItem

Gets a specific catalog item.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getCatalogItem(GetCatalogItemRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getCatalogItem(CatalogItemPathName name)

  • getCatalogItem(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCatalogItemCallable()

ListCatalogItems

Gets a list of catalog items.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listCatalogItems(ListCatalogItemsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listCatalogItems(CatalogName parent, String filter)

  • listCatalogItems(String parent, String filter)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listCatalogItemsPagedCallable()

  • listCatalogItemsCallable()

UpdateCatalogItem

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateCatalogItem(UpdateCatalogItemRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateCatalogItem(CatalogItemPathName name, CatalogItem catalogItem, FieldMask updateMask)

  • updateCatalogItem(String name, CatalogItem catalogItem, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateCatalogItemCallable()

DeleteCatalogItem

Deletes a catalog item.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteCatalogItem(DeleteCatalogItemRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteCatalogItem(CatalogItemPathName name)

  • deleteCatalogItem(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteCatalogItemCallable()

ImportCatalogItems

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • importCatalogItemsAsync(CatalogName parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

  • importCatalogItemsAsync(String parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

  • importCatalogItemsAsync(ImportCatalogItemsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • importCatalogItemsOperationCallable()

  • importCatalogItemsCallable()

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 CatalogServiceSettings 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
 CatalogServiceSettings catalogServiceSettings =
     CatalogServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
 

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
 CatalogServiceSettings catalogServiceSettings =
     CatalogServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
 

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
 CatalogServiceSettings catalogServiceSettings =
     CatalogServiceSettings.newHttpJsonBuilder().build();
 CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
 

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

Inheritance

java.lang.Object > CatalogServiceClient

Static Methods

create()

public static final CatalogServiceClient create()

Constructs an instance of CatalogServiceClient with default settings.

Returns
Type Description
CatalogServiceClient
Exceptions
Type Description
IOException

create(CatalogServiceSettings settings)

public static final CatalogServiceClient create(CatalogServiceSettings settings)

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

create(CatalogServiceStub stub)

public static final CatalogServiceClient create(CatalogServiceStub stub)

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

Parameter
Name Description
stub CatalogServiceStub
Returns
Type Description
CatalogServiceClient

Constructors

CatalogServiceClient(CatalogServiceSettings settings)

protected CatalogServiceClient(CatalogServiceSettings settings)

Constructs an instance of CatalogServiceClient, 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 CatalogServiceSettings

CatalogServiceClient(CatalogServiceStub stub)

protected CatalogServiceClient(CatalogServiceStub stub)
Parameter
Name Description
stub CatalogServiceStub

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

createCatalogItem(CatalogName parent, CatalogItem catalogItem)

public final CatalogItem createCatalogItem(CatalogName parent, CatalogItem catalogItem)

Creates a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
   CatalogItem catalogItem = CatalogItem.newBuilder().build();
   CatalogItem response = catalogServiceClient.createCatalogItem(parent, catalogItem);
 }
 
Parameters
Name Description
parent CatalogName

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

catalogItem CatalogItem

Required. The catalog item to create.

Returns
Type Description
CatalogItem

createCatalogItem(CreateCatalogItemRequest request)

public final CatalogItem createCatalogItem(CreateCatalogItemRequest request)

Creates a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CreateCatalogItemRequest request =
       CreateCatalogItemRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setCatalogItem(CatalogItem.newBuilder().build())
           .build();
   CatalogItem response = catalogServiceClient.createCatalogItem(request);
 }
 
Parameter
Name Description
request CreateCatalogItemRequest

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

Returns
Type Description
CatalogItem

createCatalogItem(String parent, CatalogItem catalogItem)

public final CatalogItem createCatalogItem(String parent, CatalogItem catalogItem)

Creates a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
   CatalogItem catalogItem = CatalogItem.newBuilder().build();
   CatalogItem response = catalogServiceClient.createCatalogItem(parent, catalogItem);
 }
 
Parameters
Name Description
parent String

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

catalogItem CatalogItem

Required. The catalog item to create.

Returns
Type Description
CatalogItem

createCatalogItemCallable()

public final UnaryCallable<CreateCatalogItemRequest,CatalogItem> createCatalogItemCallable()

Creates a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CreateCatalogItemRequest request =
       CreateCatalogItemRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setCatalogItem(CatalogItem.newBuilder().build())
           .build();
   ApiFuture<CatalogItem> future =
       catalogServiceClient.createCatalogItemCallable().futureCall(request);
   // Do something.
   CatalogItem response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateCatalogItemRequest,CatalogItem>

deleteCatalogItem(CatalogItemPathName name)

public final void deleteCatalogItem(CatalogItemPathName name)

Deletes a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogItemPathName name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]");
   catalogServiceClient.deleteCatalogItem(name);
 }
 
Parameter
Name Description
name CatalogItemPathName

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

deleteCatalogItem(DeleteCatalogItemRequest request)

public final void deleteCatalogItem(DeleteCatalogItemRequest request)

Deletes a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   DeleteCatalogItemRequest request =
       DeleteCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .build();
   catalogServiceClient.deleteCatalogItem(request);
 }
 
Parameter
Name Description
request DeleteCatalogItemRequest

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

deleteCatalogItem(String name)

public final void deleteCatalogItem(String name)

Deletes a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
           .toString();
   catalogServiceClient.deleteCatalogItem(name);
 }
 
Parameter
Name Description
name String

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

deleteCatalogItemCallable()

public final UnaryCallable<DeleteCatalogItemRequest,Empty> deleteCatalogItemCallable()

Deletes a catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   DeleteCatalogItemRequest request =
       DeleteCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       catalogServiceClient.deleteCatalogItemCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteCatalogItemRequest,Empty>

getCatalogItem(CatalogItemPathName name)

public final CatalogItem getCatalogItem(CatalogItemPathName name)

Gets a specific catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogItemPathName name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]");
   CatalogItem response = catalogServiceClient.getCatalogItem(name);
 }
 
Parameter
Name Description
name CatalogItemPathName

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id.

Returns
Type Description
CatalogItem

getCatalogItem(GetCatalogItemRequest request)

public final CatalogItem getCatalogItem(GetCatalogItemRequest request)

Gets a specific catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   GetCatalogItemRequest request =
       GetCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .build();
   CatalogItem response = catalogServiceClient.getCatalogItem(request);
 }
 
Parameter
Name Description
request GetCatalogItemRequest

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

Returns
Type Description
CatalogItem

getCatalogItem(String name)

public final CatalogItem getCatalogItem(String name)

Gets a specific catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
           .toString();
   CatalogItem response = catalogServiceClient.getCatalogItem(name);
 }
 
Parameter
Name Description
name String

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id.

Returns
Type Description
CatalogItem

getCatalogItemCallable()

public final UnaryCallable<GetCatalogItemRequest,CatalogItem> getCatalogItemCallable()

Gets a specific catalog item.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   GetCatalogItemRequest request =
       GetCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .build();
   ApiFuture<CatalogItem> future =
       catalogServiceClient.getCatalogItemCallable().futureCall(request);
   // Do something.
   CatalogItem response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetCatalogItemRequest,CatalogItem>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final CatalogServiceSettings getSettings()
Returns
Type Description
CatalogServiceSettings

getStub()

public CatalogServiceStub getStub()
Returns
Type Description
CatalogServiceStub

importCatalogItemsAsync(CatalogName parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

public final OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(CatalogName parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
   String requestId = "requestId693933066";
   InputConfig inputConfig = InputConfig.newBuilder().build();
   ImportErrorsConfig errorsConfig = ImportErrorsConfig.newBuilder().build();
   ImportCatalogItemsResponse response =
       catalogServiceClient
           .importCatalogItemsAsync(parent, requestId, inputConfig, errorsConfig)
           .get();
 }
 
Parameters
Name Description
parent CatalogName

Required. projects/1234/locations/global/catalogs/default_catalog

requestId String

Optional. Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency and used for request deduplication. Server-generated if unspecified. Up to 128 characters long. This is returned as google.longrunning.Operation.name in the response.

inputConfig InputConfig

Required. The desired input location of the data.

errorsConfig ImportErrorsConfig

Optional. The desired location of errors incurred during the Import.

Returns
Type Description
OperationFuture<ImportCatalogItemsResponse,ImportMetadata>

importCatalogItemsAsync(ImportCatalogItemsRequest request)

public final OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(ImportCatalogItemsRequest request)

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ImportCatalogItemsRequest request =
       ImportCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setRequestId("requestId693933066")
           .setInputConfig(InputConfig.newBuilder().build())
           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
           .build();
   ImportCatalogItemsResponse response =
       catalogServiceClient.importCatalogItemsAsync(request).get();
 }
 
Parameter
Name Description
request ImportCatalogItemsRequest

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

Returns
Type Description
OperationFuture<ImportCatalogItemsResponse,ImportMetadata>

importCatalogItemsAsync(String parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

public final OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(String parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
   String requestId = "requestId693933066";
   InputConfig inputConfig = InputConfig.newBuilder().build();
   ImportErrorsConfig errorsConfig = ImportErrorsConfig.newBuilder().build();
   ImportCatalogItemsResponse response =
       catalogServiceClient
           .importCatalogItemsAsync(parent, requestId, inputConfig, errorsConfig)
           .get();
 }
 
Parameters
Name Description
parent String

Required. projects/1234/locations/global/catalogs/default_catalog

requestId String

Optional. Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency and used for request deduplication. Server-generated if unspecified. Up to 128 characters long. This is returned as google.longrunning.Operation.name in the response.

inputConfig InputConfig

Required. The desired input location of the data.

errorsConfig ImportErrorsConfig

Optional. The desired location of errors incurred during the Import.

Returns
Type Description
OperationFuture<ImportCatalogItemsResponse,ImportMetadata>

importCatalogItemsCallable()

public final UnaryCallable<ImportCatalogItemsRequest,Operation> importCatalogItemsCallable()

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ImportCatalogItemsRequest request =
       ImportCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setRequestId("requestId693933066")
           .setInputConfig(InputConfig.newBuilder().build())
           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       catalogServiceClient.importCatalogItemsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ImportCatalogItemsRequest,Operation>

importCatalogItemsOperationCallable()

public final OperationCallable<ImportCatalogItemsRequest,ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsOperationCallable()

Bulk import of multiple catalog items. Request processing may be synchronous. No partial updating supported. Non-existing items will be created.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully updated.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ImportCatalogItemsRequest request =
       ImportCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setRequestId("requestId693933066")
           .setInputConfig(InputConfig.newBuilder().build())
           .setErrorsConfig(ImportErrorsConfig.newBuilder().build())
           .build();
   OperationFuture<ImportCatalogItemsResponse, ImportMetadata> future =
       catalogServiceClient.importCatalogItemsOperationCallable().futureCall(request);
   // Do something.
   ImportCatalogItemsResponse response = future.get();
 }
 
Returns
Type Description
OperationCallable<ImportCatalogItemsRequest,ImportCatalogItemsResponse,ImportMetadata>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listCatalogItems(CatalogName parent, String filter)

public final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(CatalogName parent, String filter)

Gets a list of catalog items.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogName parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]");
   String filter = "filter-1274492040";
   for (CatalogItem element :
       catalogServiceClient.listCatalogItems(parent, filter).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
parent CatalogName

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

filter String

Optional. A filter to apply on the list results.

Returns
Type Description
CatalogServiceClient.ListCatalogItemsPagedResponse

listCatalogItems(ListCatalogItemsRequest request)

public final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(ListCatalogItemsRequest request)

Gets a list of catalog items.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ListCatalogItemsRequest request =
       ListCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   for (CatalogItem element : catalogServiceClient.listCatalogItems(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListCatalogItemsRequest

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

Returns
Type Description
CatalogServiceClient.ListCatalogItemsPagedResponse

listCatalogItems(String parent, String filter)

public final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(String parent, String filter)

Gets a list of catalog items.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String parent = CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString();
   String filter = "filter-1274492040";
   for (CatalogItem element :
       catalogServiceClient.listCatalogItems(parent, filter).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
parent String

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

filter String

Optional. A filter to apply on the list results.

Returns
Type Description
CatalogServiceClient.ListCatalogItemsPagedResponse

listCatalogItemsCallable()

public final UnaryCallable<ListCatalogItemsRequest,ListCatalogItemsResponse> listCatalogItemsCallable()

Gets a list of catalog items.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ListCatalogItemsRequest request =
       ListCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   while (true) {
     ListCatalogItemsResponse response =
         catalogServiceClient.listCatalogItemsCallable().call(request);
     for (CatalogItem element : response.getCatalogItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListCatalogItemsRequest,ListCatalogItemsResponse>

listCatalogItemsPagedCallable()

public final UnaryCallable<ListCatalogItemsRequest,CatalogServiceClient.ListCatalogItemsPagedResponse> listCatalogItemsPagedCallable()

Gets a list of catalog items.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   ListCatalogItemsRequest request =
       ListCatalogItemsRequest.newBuilder()
           .setParent(CatalogName.of("[PROJECT]", "[LOCATION]", "[CATALOG]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<CatalogItem> future =
       catalogServiceClient.listCatalogItemsPagedCallable().futureCall(request);
   // Do something.
   for (CatalogItem element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListCatalogItemsRequest,ListCatalogItemsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateCatalogItem(CatalogItemPathName name, CatalogItem catalogItem, FieldMask updateMask)

public final CatalogItem updateCatalogItem(CatalogItemPathName name, CatalogItem catalogItem, FieldMask updateMask)

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   CatalogItemPathName name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]");
   CatalogItem catalogItem = CatalogItem.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   CatalogItem response = catalogServiceClient.updateCatalogItem(name, catalogItem, updateMask);
 }
 
Parameters
Name Description
name CatalogItemPathName

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

catalogItem CatalogItem

Required. The catalog item to update/create. The 'catalog_item_id' field has to match that in the 'name'.

updateMask FieldMask

Optional. Indicates which fields in the provided 'item' to update. If not set, will by default update all fields.

Returns
Type Description
CatalogItem

updateCatalogItem(UpdateCatalogItemRequest request)

public final CatalogItem updateCatalogItem(UpdateCatalogItemRequest request)

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   UpdateCatalogItemRequest request =
       UpdateCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .setCatalogItem(CatalogItem.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   CatalogItem response = catalogServiceClient.updateCatalogItem(request);
 }
 
Parameter
Name Description
request UpdateCatalogItemRequest

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

Returns
Type Description
CatalogItem

updateCatalogItem(String name, CatalogItem catalogItem, FieldMask updateMask)

public final CatalogItem updateCatalogItem(String name, CatalogItem catalogItem, FieldMask updateMask)

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   String name =
       CatalogItemPathName.of("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
           .toString();
   CatalogItem catalogItem = CatalogItem.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   CatalogItem response = catalogServiceClient.updateCatalogItem(name, catalogItem, updateMask);
 }
 
Parameters
Name Description
name String

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

catalogItem CatalogItem

Required. The catalog item to update/create. The 'catalog_item_id' field has to match that in the 'name'.

updateMask FieldMask

Optional. Indicates which fields in the provided 'item' to update. If not set, will by default update all fields.

Returns
Type Description
CatalogItem

updateCatalogItemCallable()

public final UnaryCallable<UpdateCatalogItemRequest,CatalogItem> updateCatalogItemCallable()

Updates a catalog item. Partial updating is supported. Non-existing items will be created.

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 (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
   UpdateCatalogItemRequest request =
       UpdateCatalogItemRequest.newBuilder()
           .setName(
               CatalogItemPathName.of(
                       "[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]")
                   .toString())
           .setCatalogItem(CatalogItem.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<CatalogItem> future =
       catalogServiceClient.updateCatalogItemCallable().futureCall(request);
   // Do something.
   CatalogItem response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateCatalogItemRequest,CatalogItem>