Class CatalogServiceClient (0.40.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().

MethodDescriptionMethod 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
TypeDescription
CatalogServiceClient
Exceptions
TypeDescription
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
NameDescription
settingsCatalogServiceSettings
Returns
TypeDescription
CatalogServiceClient
Exceptions
TypeDescription
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
NameDescription
stubCatalogServiceStub
Returns
TypeDescription
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
NameDescription
settingsCatalogServiceSettings

CatalogServiceClient(CatalogServiceStub stub)

protected CatalogServiceClient(CatalogServiceStub stub)
Parameter
NameDescription
stubCatalogServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

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
NameDescription
parentCatalogName

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

catalogItemCatalogItem

Required. The catalog item to create.

Returns
TypeDescription
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
NameDescription
requestCreateCatalogItemRequest

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

Returns
TypeDescription
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
NameDescription
parentString

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

catalogItemCatalogItem

Required. The catalog item to create.

Returns
TypeDescription
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
TypeDescription
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
NameDescription
nameCatalogItemPathName

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
NameDescription
requestDeleteCatalogItemRequest

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
NameDescription
nameString

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
TypeDescription
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
NameDescription
nameCatalogItemPathName

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

Returns
TypeDescription
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
NameDescription
requestGetCatalogItemRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
OperationsClient

getSettings()

public final CatalogServiceSettings getSettings()
Returns
TypeDescription
CatalogServiceSettings

getStub()

public CatalogServiceStub getStub()
Returns
TypeDescription
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
NameDescription
parentCatalogName

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

requestIdString

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.

inputConfigInputConfig

Required. The desired input location of the data.

errorsConfigImportErrorsConfig

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

Returns
TypeDescription
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
NameDescription
requestImportCatalogItemsRequest

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

Returns
TypeDescription
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
NameDescription
parentString

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

requestIdString

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.

inputConfigInputConfig

Required. The desired input location of the data.

errorsConfigImportErrorsConfig

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationCallable<ImportCatalogItemsRequest,ImportCatalogItemsResponse,ImportMetadata>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
parentCatalogName

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

filterString

Optional. A filter to apply on the list results.

Returns
TypeDescription
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
NameDescription
requestListCatalogItemsRequest

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

Returns
TypeDescription
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
NameDescription
parentString

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

filterString

Optional. A filter to apply on the list results.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
nameCatalogItemPathName

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

catalogItemCatalogItem

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

updateMaskFieldMask

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

Returns
TypeDescription
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
NameDescription
requestUpdateCatalogItemRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

catalogItemCatalogItem

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

updateMaskFieldMask

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<UpdateCatalogItemRequest,CatalogItem>