Search in sources :

Example 1 with ProductInputConfig

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;
}
Also used : ImportProductsRequest(com.google.cloud.retail.v2.ImportProductsRequest) GcsSource(com.google.cloud.retail.v2.GcsSource) ProductInputConfig(com.google.cloud.retail.v2.ProductInputConfig) ImportErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig)

Example 2 with ProductInputConfig

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;
}
Also used : ImportProductsRequest(com.google.cloud.retail.v2.ImportProductsRequest) ProductInputConfig(com.google.cloud.retail.v2.ProductInputConfig) ProductInlineSource(com.google.cloud.retail.v2.ProductInlineSource)

Example 3 with ProductInputConfig

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;
}
Also used : ImportProductsRequest(com.google.cloud.retail.v2.ImportProductsRequest) ProductInputConfig(com.google.cloud.retail.v2.ProductInputConfig) BigQuerySource(com.google.cloud.retail.v2.BigQuerySource)

Example 4 with ProductInputConfig

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;
}
Also used : ImportProductsRequest(com.google.cloud.retail.v2.ImportProductsRequest) GcsSource(com.google.cloud.retail.v2.GcsSource) ProductInputConfig(com.google.cloud.retail.v2.ProductInputConfig) ImportErrorsConfig(com.google.cloud.retail.v2.ImportErrorsConfig)

Aggregations

ImportProductsRequest (com.google.cloud.retail.v2.ImportProductsRequest)4 ProductInputConfig (com.google.cloud.retail.v2.ProductInputConfig)4 GcsSource (com.google.cloud.retail.v2.GcsSource)2 ImportErrorsConfig (com.google.cloud.retail.v2.ImportErrorsConfig)2 BigQuerySource (com.google.cloud.retail.v2.BigQuerySource)1 ProductInlineSource (com.google.cloud.retail.v2.ProductInlineSource)1