use of com.google.cloud.retail.v2.ProductInputConfig in project java-retail by googleapis.
the class CreateTestResources method getImportProductsGcsRequest.
public static ImportProductsRequest getImportProductsGcsRequest(String gcsObjectName) {
GcsSource gcsSource = GcsSource.newBuilder().addAllInputUris(Collections.singleton(String.format("gs://%s/%s", BUCKET_NAME, gcsObjectName))).build();
ProductInputConfig inputConfig = ProductInputConfig.newBuilder().setGcsSource(gcsSource).build();
System.out.println("GRS source: " + gcsSource.getInputUrisList());
ImportErrorsConfig errorsConfig = ImportErrorsConfig.newBuilder().setGcsPrefix(GCS_ERROR_BUCKET).build();
ImportProductsRequest importRequest = ImportProductsRequest.newBuilder().setParent(DEFAULT_CATALOG).setReconciliationMode(ReconciliationMode.INCREMENTAL).setInputConfig(inputConfig).setErrorsConfig(errorsConfig).build();
System.out.println("Import products from google cloud source request: " + importRequest);
return importRequest;
}
use of com.google.cloud.retail.v2.ProductInputConfig in project java-retail by googleapis.
the class ImportProductsInlineSource method getImportProductsInlineRequest.
public static ImportProductsRequest getImportProductsInlineRequest(List<Product> productsToImport) {
ProductInlineSource inlineSource = ProductInlineSource.newBuilder().addAllProducts(productsToImport).build();
ProductInputConfig inputConfig = ProductInputConfig.newBuilder().setProductInlineSource(inlineSource).build();
ImportProductsRequest importRequest = ImportProductsRequest.newBuilder().setParent(DEFAULT_CATALOG).setInputConfig(inputConfig).build();
System.out.printf("Import products from inline source request: %s%n", importRequest);
return importRequest;
}
use of com.google.cloud.retail.v2.ProductInputConfig in project java-retail by googleapis.
the class ImportProductsBigQueryTable method getImportProductsBigQueryRequest.
public static ImportProductsRequest getImportProductsBigQueryRequest(ReconciliationMode reconciliationMode) {
BigQuerySource bigQuerySource = BigQuerySource.newBuilder().setProjectId(PROJECT_ID).setDatasetId(DATASET_ID).setTableId(TABLE_ID).setDataSchema(DATA_SCHEMA).build();
ProductInputConfig inputConfig = ProductInputConfig.newBuilder().setBigQuerySource(bigQuerySource).build();
ImportProductsRequest importRequest = ImportProductsRequest.newBuilder().setParent(DEFAULT_CATALOG).setReconciliationMode(reconciliationMode).setInputConfig(inputConfig).build();
System.out.printf("Import products from big query table request: %s%n", importRequest);
return importRequest;
}
use of com.google.cloud.retail.v2.ProductInputConfig in project java-retail by googleapis.
the class ImportProductsGcs method getImportProductsGcsRequest.
public static ImportProductsRequest getImportProductsGcsRequest(String gcsObjectName) {
GcsSource gcsSource = GcsSource.newBuilder().addAllInputUris(Collections.singleton(String.format("%s/%s", GCS_BUCKET, gcsObjectName))).build();
ProductInputConfig inputConfig = ProductInputConfig.newBuilder().setGcsSource(gcsSource).build();
System.out.println("GRS source: " + gcsSource.getInputUrisList());
ImportErrorsConfig errorsConfig = ImportErrorsConfig.newBuilder().setGcsPrefix(GCS_ERROR_BUCKET).build();
ImportProductsRequest importRequest = ImportProductsRequest.newBuilder().setParent(DEFAULT_CATALOG).setReconciliationMode(ReconciliationMode.INCREMENTAL).setInputConfig(inputConfig).setErrorsConfig(errorsConfig).build();
System.out.println("Import products from google cloud source request: " + importRequest);
return importRequest;
}
Aggregations