val catalogId = "creating-catalog-test-" + someIdentifierSuffix
val catalogConfig =
WritableCatalogConfiguration(
id = catalogId,
name = catalogId,
summary = "This is a catalog summary.",
description = "This is what the catalog is for.",
tags = Set("tag1", "tag2", "tag3"),
automaticVersionDeletion =
Some(AutomaticVersionDeletion.builder.withNumberOfVersionsToKeep(10L).build),
areaScheme = Some(HRN.fromString("hrn:here:areascheme::olp-here:default-countries")),
subsetRestrictions = Some(true),
layers = Seq(
WritableLayer(
id = "layer-0",
name = "INFO",
summary = "This is a layer summary.",
description = "This is a layer description.",
layerType = VersionedLayerType(),
partitioning = GenericPartitioning,
volume = Volumes.Durable,
contentType = "application/x-protobuf",
digest = Some(DigestAlgorithm.MD5),
crc = Some(CrcAlgorithm.CRC32C)
),
WritableLayer(
id = "layer-1",
name = "SCHEMAS",
summary = "This is a layer summary.",
description = "This is a layer description.",
layerType = VersionedLayerType(),
partitioning = GenericPartitioning,
volume = Volumes.Durable,
contentType = "application/x-protobuf"
),
WritableLayer(
id = "layer-2",
name = "VOLATILEDATA",
summary = "This is a layer summary.",
description = "This is a layer description.",
layerType =
VolatileLayerType(secureHandles = Some(true), subsetRestrictions = Some(true)),
partitioning = HereTilePartitioning(tileLevels = 1 :: Nil),
volume = Volumes.Durable,
contentType = "application/octet-stream",
contentEncoding = Some(ContentEncoding.gzip),
coverage = Some(Coverage(Set[String]("DE", "CN", "US")))
),
WritableLayer(
id = "layer-3",
name = "INDEX",
summary = "This is a layer summary.",
description = "This is a layer description.",
layerType = IndexLayerType(
indexDefinitions = Seq(
IndexDefinition("someIntKey", IndexType.Int),
IndexDefinition("someStringKey", IndexType.String),
IndexDefinition("someTimeWindowKey",
IndexType.TimeWindow,
duration = Some(3600000)),
IndexDefinition("someHereTileKey", IndexType.HereTile, zoomLevel = Some(8))
),
ttl = Ttl.OneMonth
),
partitioning = NoPartitioning,
volume = Volumes.Durable,
contentType = "application/octet-stream",
digest = Some(DigestAlgorithm.SHA256),
crc = Some(CrcAlgorithm.CRC32C)
),
WritableLayer(
id = "layer-4",
name = "OBJECTSTORE",
summary = "This is layer summary",
description = "This is layer description",
layerType = ObjectStoreLayerType(),
partitioning = NoPartitioning,
volume = Volumes.Durable
),
WritableLayer(
id = "layer-5",
name = "INTERACTIVEMAP",
summary = "This is layer summary",
description = "This is layer description",
layerType = InteractiveMapLayerType(
interactiveMapProperties =
Some(InteractiveMapProperties(searchableProperties = Seq("abc")))
),
partitioning = NoPartitioning,
volume = Volumes.Durable
)
)
)
val adminApi = DataClient().adminApi()
adminApi.createCatalog(catalogConfig).flatMap { hrn =>
log.info(s"Created new catalog `$hrn`")
processCreatedCatalog(hrn)
}
String catalogId = "creating-catalog-test-" + someIdentifierSuffix;
WritableCatalogConfiguration catalogConfig =
new WritableCatalogConfiguration.Builder()
.withId(catalogId)
.withName(catalogId)
.withSummary("This is a catalog summary.")
.withDescription("This is what the catalog is for.")
.withTags(new HashSet<>(Arrays.asList("tag1", "tag2", "tag3")))
.withAutomaticVersionDeletion(
AutomaticVersionDeletion.builder().withNumberOfVersionsToKeep(10L).build())
.withLayers(
Arrays.asList(
new WritableLayer.Builder()
.withId("layer-0")
.withName("INFO")
.withSummary("This is a layer summary.")
.withDescription("This is a layer description.")
.withLayerType(VersionedLayerType.defaultInstance())
.withPartitioning(Partitioning.Generic())
.withVolume(Volumes.Durable())
.withContentType("application/x-protobuf")
.withDigest(DigestAlgorithm.SHA256())
.withCrc(CrcAlgorithm.CRC32C()),
new WritableLayer.Builder()
.withId("layer-1")
.withName("SCHEMAS")
.withSummary("This is a layer summary.")
.withDescription("This is a layer description.")
.withLayerType(VersionedLayerType.defaultInstance())
.withPartitioning(Partitioning.Generic())
.withVolume(Volumes.Durable())
.withContentType("application/x-protobuf"),
new WritableLayer.Builder()
.withId("layer-2")
.withName("INDEX")
.withSummary("This is a layer summary.")
.withDescription("This is a layer description.")
.withLayerType(
new IndexLayerType.Builder()
.addIndexDefinition(
new IndexDefinition.Builder()
.withName("someIntKey")
.withIndexType(IndexType.Int)
.build())
.addIndexDefinition(
new IndexDefinition.Builder()
.withName("someStringKey")
.withIndexType(IndexType.String)
.build())
.addIndexDefinition(
new IndexDefinition.Builder()
.withName("someTimeWindowKey")
.withIndexType(IndexType.TimeWindow)
.withDuration(3600000L)
.build())
.addIndexDefinition(
new IndexDefinition.Builder()
.withName("someHereTileKey")
.withIndexType(IndexType.HereTile)
.withZoomLevel(8)
.build())
.withTtl(Ttl.OneMonth)
.build())
.withPartitioning(Partitioning.NoPartition())
.withVolume(Volumes.Durable())
.withContentType("application/x-protobuf"),
new WritableLayer.Builder()
.withId("layer-3")
.withName("OBJECTSTORE")
.withSummary("This is layer summary")
.withDescription("This is layer description")
.withLayerType(ObjectStoreLayerType.defaultInstance())
.withPartitioning(Partitioning.NoPartition())
.withVolume(Volumes.Durable()),
new WritableLayer.Builder()
.withId("layer-4")
.withName("INTERACTIVEMAP")
.withSummary("This is layer summary")
.withDescription("This is layer description")
.withLayerType(
new InteractiveMapLayerType.Builder()
.withInteractiveMapProperties(
new InteractiveMapProperties.Builder()
.withSearchableProperties(
Arrays.asList("some-property1", "some-property-2"))
.build())
.build())
.withPartitioning(Partitioning.NoPartition())
.withVolume(Volumes.Durable())
.withContentType("application/geo+json")))
.build();
AdminApi adminApi = DataClient.get(myActorSystem).adminApi();
adminApi
.createCatalog(catalogConfig)
.thenApply(
hrn -> {
log.info("Created new catalog `" + hrn + "`");
return processCreatedCatalog(hrn);
});