@BetaApi @Generated(value="by gapic-generator-java") public class CatalogServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetCatalogItem | Gets a specific catalog item. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeleteCatalogItem | Deletes a catalog item. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| 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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
CatalogServiceClient.ListCatalogItemsFixedSizeCollection |
static class |
CatalogServiceClient.ListCatalogItemsPage |
static class |
CatalogServiceClient.ListCatalogItemsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
CatalogServiceClient(CatalogServiceSettings settings)
Constructs an instance of CatalogServiceClient, using the given settings.
|
protected |
CatalogServiceClient(CatalogServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static CatalogServiceClient |
create()
Constructs an instance of CatalogServiceClient with default settings.
|
static CatalogServiceClient |
create(CatalogServiceSettings settings)
Constructs an instance of CatalogServiceClient, using the given settings.
|
static CatalogServiceClient |
create(CatalogServiceStub stub)
Constructs an instance of CatalogServiceClient, using the given stub for making calls.
|
CatalogItem |
createCatalogItem(CatalogName parent,
CatalogItem catalogItem)
Creates a catalog item.
|
CatalogItem |
createCatalogItem(CreateCatalogItemRequest request)
Creates a catalog item.
|
CatalogItem |
createCatalogItem(String parent,
CatalogItem catalogItem)
Creates a catalog item.
|
com.google.api.gax.rpc.UnaryCallable<CreateCatalogItemRequest,CatalogItem> |
createCatalogItemCallable()
Creates a catalog item.
|
void |
deleteCatalogItem(CatalogItemPathName name)
Deletes a catalog item.
|
void |
deleteCatalogItem(DeleteCatalogItemRequest request)
Deletes a catalog item.
|
void |
deleteCatalogItem(String name)
Deletes a catalog item.
|
com.google.api.gax.rpc.UnaryCallable<DeleteCatalogItemRequest,com.google.protobuf.Empty> |
deleteCatalogItemCallable()
Deletes a catalog item.
|
CatalogItem |
getCatalogItem(CatalogItemPathName name)
Gets a specific catalog item.
|
CatalogItem |
getCatalogItem(GetCatalogItemRequest request)
Gets a specific catalog item.
|
CatalogItem |
getCatalogItem(String name)
Gets a specific catalog item.
|
com.google.api.gax.rpc.UnaryCallable<GetCatalogItemRequest,CatalogItem> |
getCatalogItemCallable()
Gets a specific catalog item.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
CatalogServiceSettings |
getSettings() |
CatalogServiceStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> |
importCatalogItemsAsync(CatalogName parent,
String requestId,
InputConfig inputConfig,
ImportErrorsConfig errorsConfig)
Bulk import of multiple catalog items.
|
com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> |
importCatalogItemsAsync(ImportCatalogItemsRequest request)
Bulk import of multiple catalog items.
|
com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> |
importCatalogItemsAsync(String parent,
String requestId,
InputConfig inputConfig,
ImportErrorsConfig errorsConfig)
Bulk import of multiple catalog items.
|
com.google.api.gax.rpc.UnaryCallable<ImportCatalogItemsRequest,com.google.longrunning.Operation> |
importCatalogItemsCallable()
Bulk import of multiple catalog items.
|
com.google.api.gax.rpc.OperationCallable<ImportCatalogItemsRequest,ImportCatalogItemsResponse,ImportMetadata> |
importCatalogItemsOperationCallable()
Bulk import of multiple catalog items.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
CatalogServiceClient.ListCatalogItemsPagedResponse |
listCatalogItems(CatalogName parent,
String filter)
Gets a list of catalog items.
|
CatalogServiceClient.ListCatalogItemsPagedResponse |
listCatalogItems(ListCatalogItemsRequest request)
Gets a list of catalog items.
|
CatalogServiceClient.ListCatalogItemsPagedResponse |
listCatalogItems(String parent,
String filter)
Gets a list of catalog items.
|
com.google.api.gax.rpc.UnaryCallable<ListCatalogItemsRequest,ListCatalogItemsResponse> |
listCatalogItemsCallable()
Gets a list of catalog items.
|
com.google.api.gax.rpc.UnaryCallable<ListCatalogItemsRequest,CatalogServiceClient.ListCatalogItemsPagedResponse> |
listCatalogItemsPagedCallable()
Gets a list of catalog items.
|
void |
shutdown() |
void |
shutdownNow() |
CatalogItem |
updateCatalogItem(CatalogItemPathName name,
CatalogItem catalogItem,
com.google.protobuf.FieldMask updateMask)
Updates a catalog item.
|
CatalogItem |
updateCatalogItem(String name,
CatalogItem catalogItem,
com.google.protobuf.FieldMask updateMask)
Updates a catalog item.
|
CatalogItem |
updateCatalogItem(UpdateCatalogItemRequest request)
Updates a catalog item.
|
com.google.api.gax.rpc.UnaryCallable<UpdateCatalogItemRequest,CatalogItem> |
updateCatalogItemCallable()
Updates a catalog item.
|
protected CatalogServiceClient(CatalogServiceSettings settings) throws IOException
IOExceptionprotected CatalogServiceClient(CatalogServiceStub stub)
public static final CatalogServiceClient create() throws IOException
IOExceptionpublic static final CatalogServiceClient create(CatalogServiceSettings settings) throws IOException
IOExceptionpublic static final CatalogServiceClient create(CatalogServiceStub stub)
public final CatalogServiceSettings getSettings()
public CatalogServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final CatalogItem createCatalogItem(CatalogName parent, CatalogItem catalogItem)
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);
}
parent - Required. The parent catalog resource name, such as
`projects/*/locations/global/catalogs/default_catalog`.catalogItem - Required. The catalog item to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem createCatalogItem(String parent, CatalogItem catalogItem)
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);
}
parent - Required. The parent catalog resource name, such as
`projects/*/locations/global/catalogs/default_catalog`.catalogItem - Required. The catalog item to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem createCatalogItem(CreateCatalogItemRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateCatalogItemRequest,CatalogItem> createCatalogItemCallable()
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();
}
public final CatalogItem getCatalogItem(CatalogItemPathName name)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem getCatalogItem(String name)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem getCatalogItem(GetCatalogItemRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetCatalogItemRequest,CatalogItem> getCatalogItemCallable()
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();
}
public final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(CatalogName parent, String filter)
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);
}
}
parent - Required. The parent catalog resource name, such as
`projects/*/locations/global/catalogs/default_catalog`.filter - Optional. A filter to apply on the list results.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(String parent, String filter)
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);
}
}
parent - Required. The parent catalog resource name, such as
`projects/*/locations/global/catalogs/default_catalog`.filter - Optional. A filter to apply on the list results.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogServiceClient.ListCatalogItemsPagedResponse listCatalogItems(ListCatalogItemsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListCatalogItemsRequest,CatalogServiceClient.ListCatalogItemsPagedResponse> listCatalogItemsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListCatalogItemsRequest,ListCatalogItemsResponse> listCatalogItemsCallable()
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;
}
}
}
public final CatalogItem updateCatalogItem(CatalogItemPathName name, CatalogItem catalogItem, com.google.protobuf.FieldMask updateMask)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.catalogItem - Required. The catalog item to update/create. The 'catalog_item_id' field has
to match that in the 'name'.updateMask - Optional. Indicates which fields in the provided 'item' to update. If not
set, will by default update all fields.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem updateCatalogItem(String name, CatalogItem catalogItem, com.google.protobuf.FieldMask updateMask)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.catalogItem - Required. The catalog item to update/create. The 'catalog_item_id' field has
to match that in the 'name'.updateMask - Optional. Indicates which fields in the provided 'item' to update. If not
set, will by default update all fields.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CatalogItem updateCatalogItem(UpdateCatalogItemRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateCatalogItemRequest,CatalogItem> updateCatalogItemCallable()
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();
}
public final void deleteCatalogItem(CatalogItemPathName name)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteCatalogItem(String name)
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);
}
name - Required. Full resource name of catalog item, such as
`projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteCatalogItem(DeleteCatalogItemRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteCatalogItemRequest,com.google.protobuf.Empty> deleteCatalogItemCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(CatalogName parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)
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();
}
parent - Required. `projects/1234/locations/global/catalogs/default_catalog`requestId - 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 - Required. The desired input location of the data.errorsConfig - Optional. The desired location of errors incurred during the Import.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(String parent, String requestId, InputConfig inputConfig, ImportErrorsConfig errorsConfig)
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();
}
parent - Required. `projects/1234/locations/global/catalogs/default_catalog`requestId - 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 - Required. The desired input location of the data.errorsConfig - Optional. The desired location of errors incurred during the Import.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsAsync(ImportCatalogItemsRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportCatalogItemsRequest,ImportCatalogItemsResponse,ImportMetadata> importCatalogItemsOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportCatalogItemsRequest,com.google.longrunning.Operation> importCatalogItemsCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.