Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="cosmotech-api-common [clean spotlessApply build assemble publishToMavenLocal]" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="clean" />
<option value="spotlessApply" />
<option value="build" />
<option value="assemble" />
<option value="publishToMavenLocal" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
58 changes: 0 additions & 58 deletions src/main/kotlin/com/cosmotech/api/config/CsmPlatformProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ data class CsmPlatformProperties(
val dataWarehouseCluster: CsmPlatformAzureDataWarehouseCluster,
val keyVault: String,
val analytics: CsmPlatformAzureAnalytics,
/** Azure Cosmos DB */
val cosmos: CsmPlatformAzureCosmos,
val appIdUri: String,
val claimToAuthorityPrefix: Map<String, String> = mutableMapOf("roles" to "")
) {
Expand Down Expand Up @@ -318,62 +316,6 @@ data class CsmPlatformProperties(
val instrumentationKey: String,
val connectionString: String
)

data class CsmPlatformAzureCosmos(

/** DNS URI of the Azure Cosmos DB account */
val uri: String,

/** Azure Cosmos DB Database used for Phoenix */
val coreDatabase: CoreDatabase,

/** Access Key of the Azure Cosmos DB database */
val key: String,

/** Consistency level. See com.azure.cosmos.ConsistencyLevel for the possible values. */
val consistencyLevel: String?,

/** Whether to populate Diagnostics Strings and Query metrics */
val populateQueryMetrics: Boolean,

/**
* The connection mode to be used by the clients to Azure Cosmos DB. See
* com.azure.cosmos.ConnectionMode for the possible values.
*/
val connectionMode: String?
) {
data class CoreDatabase(
/** The core database name in Azure Cosmos DB. Must already exist there. */
val name: String,

/** The Connectors configuration */
val connectors: Connectors,

/** The Organizations configuration */
val organizations: Organizations,

/** The Users configuration */
val users: Users
) {
data class Connectors(

/** Container name for storing all Connectors */
val container: String
)

data class Organizations(

/** Container name for storing all Organizations */
val container: String
)

data class Users(

/** Container name for storing all Users */
val container: String
)
}
}
}

enum class Vendor {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ open class JedisConfig {
@Bean
// JedisPool must be use with .use autocloseable method
open fun csmJedisPool(csmPlatformProperties: CsmPlatformProperties): JedisPool {
val twincacheProperties = csmPlatformProperties.twincache!!
val twincacheProperties = csmPlatformProperties.twincache
val password = twincacheProperties.password
val host = twincacheProperties.host
val port = twincacheProperties.port.toInt()
Expand All @@ -40,7 +40,7 @@ open class JedisConfig {

@Bean
open fun csmRedisTimeSeries(csmPlatformProperties: CsmPlatformProperties): RedisTimeSeries {
val twincacheProperties = csmPlatformProperties.twincache!!
val twincacheProperties = csmPlatformProperties.twincache
val password = twincacheProperties.password
val host = twincacheProperties.host
val port = twincacheProperties.port.toInt()
Expand Down
15 changes: 0 additions & 15 deletions src/main/kotlin/com/cosmotech/api/utils/ObjectMappers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package com.cosmotech.api.utils

import com.fasterxml.jackson.core.JsonFactory
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
Expand All @@ -19,17 +18,3 @@ fun objectMapper(jsonFactory: JsonFactory? = null): ObjectMapper =
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)

fun yamlObjectMapper(): ObjectMapper = objectMapper(YAMLFactory())

/**
* Convert any JsonNode as an object of the domain type specified.
*
* This is a workaround due to Azure Cosmos SDK not being able to deserialize Kotlin data classes
* [1].
*
* @see [1] https://github.com/Azure/azure-sdk-for-java/issues/12269
*/
inline fun <reified T> JsonNode?.toDomain(objectMapper: ObjectMapper? = null): T? =
if (this == null) null
else {
(objectMapper ?: objectMapper()).treeToValue(this, T::class.java)
}
Binary file added src/test/resources/test.zip
Binary file not shown.