Search in sources :

Example 1 with ImportErrorsConfig

use of com.google.cloud.retail.v2.ImportErrorsConfig 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 ImportErrorsConfig

use of com.google.cloud.retail.v2.ImportErrorsConfig 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

GcsSource (com.google.cloud.retail.v2.GcsSource)2 ImportErrorsConfig (com.google.cloud.retail.v2.ImportErrorsConfig)2 ImportProductsRequest (com.google.cloud.retail.v2.ImportProductsRequest)2 ProductInputConfig (com.google.cloud.retail.v2.ProductInputConfig)2