public abstract class RecommendationAIImportCatalogItems extends PTransform<PCollection<KV<java.lang.String,com.google.api.client.json.GenericJson>>,PCollectionTuple>
PTransform
connecting to the Recommendations AI API
(https://cloud.google.com/recommendations) and creating CatalogItem
s. *
Batch size defines how many items are created at once per batch (max: 5000).
The transform consumes KV
of String
and GenericJson
s (assumed to be
the catalog item id as key and contents as value) and outputs a PCollectionTuple which will
contain the successfully created and failed catalog items.
It is possible to provide a catalog name to which you want to add the catalog item (defaults to "default_catalog").
Modifier and Type | Field and Description |
---|---|
static TupleTag<com.google.cloud.recommendationengine.v1beta1.CatalogItem> |
FAILURE_TAG |
static TupleTag<com.google.cloud.recommendationengine.v1beta1.CatalogItem> |
SUCCESS_TAG |
annotations, displayData, name, resourceHints
Constructor and Description |
---|
RecommendationAIImportCatalogItems() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Integer |
batchSize() |
abstract @Nullable java.lang.String |
catalogName() |
PCollectionTuple |
expand(PCollection<KV<java.lang.String,com.google.api.client.json.GenericJson>> input)
The transform converts the contents of input PCollection into
CatalogItem s and then
calls the Recommendation AI service to create the catalog item. |
abstract Duration |
maxBufferingDuration() |
abstract @Nullable java.lang.String |
projectId() |
RecommendationAIImportCatalogItems |
withBatchSize(java.lang.Integer batchSize) |
RecommendationAIImportCatalogItems |
withCatalogName(java.lang.String catalogName) |
RecommendationAIImportCatalogItems |
withProjectId(java.lang.String projectId) |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public static final TupleTag<com.google.cloud.recommendationengine.v1beta1.CatalogItem> SUCCESS_TAG
public static final TupleTag<com.google.cloud.recommendationengine.v1beta1.CatalogItem> FAILURE_TAG
public abstract @Nullable java.lang.String projectId()
public abstract @Nullable java.lang.String catalogName()
public abstract java.lang.Integer batchSize()
public abstract Duration maxBufferingDuration()
public RecommendationAIImportCatalogItems withProjectId(java.lang.String projectId)
public RecommendationAIImportCatalogItems withCatalogName(java.lang.String catalogName)
public RecommendationAIImportCatalogItems withBatchSize(java.lang.Integer batchSize)
public PCollectionTuple expand(PCollection<KV<java.lang.String,com.google.api.client.json.GenericJson>> input)
CatalogItem
s and then
calls the Recommendation AI service to create the catalog item.expand
in class PTransform<PCollection<KV<java.lang.String,com.google.api.client.json.GenericJson>>,PCollectionTuple>
input
- input PCollection