Skip to content

Commit

Permalink
added automatic reflection hint config
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdjulian committed May 31, 2024
1 parent 0dd5c8d commit 2e25b21
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
build
/.idea/
/aot-smoke-test/native-image/
/.kotlin/
6 changes: 4 additions & 2 deletions kirc-core/src/main/kotlin/de/cmdjulian/kirc/spec/Platform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ enum class OS(@get:JsonValue val string: String) {
WINDOWS("windows"),

@JsonEnumDefaultValue
UNKNOWN("unknown");
UNKNOWN("unknown"),
;

override fun toString() = string
}
Expand All @@ -47,7 +48,8 @@ enum class Architecture(@get:JsonValue val string: String) {
ARM_V5("arm/v5"),

@JsonEnumDefaultValue
UNKNOWN("unknown");
UNKNOWN("unknown"),
;

override fun toString() = string
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint:standard:property-naming")

package de.cmdjulian.kirc.spec.blob

const val DockerBlobMediaType = "application/vnd.docker.image.rootfs.diff.tar.gzip"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint:standard:property-naming")

package de.cmdjulian.kirc.spec.blob

const val OciBlobMediaTypeTar = "application/vnd.oci.image.layer.v1.tar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ data class DockerImageConfigV1(
override val history: List<History>,
) : ImageConfig {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.docker.container.image.v1+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data class OciImageConfigV1(
override val history: List<History>,
) : ImageConfig {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.oci.image.config.v1+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ data class DockerManifestListV1(
override val manifests: List<ManifestListEntry>,
) : ManifestList {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.docker.distribution.manifest.list.v2+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class DockerManifestV2(
override val layers: List<LayerReference>,
) : ManifestSingle {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.docker.distribution.manifest.v2+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class OciManifestListV1(
val annotations: Map<String, String>,
) : ManifestList {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.oci.image.index.v1+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data class OciManifestV1(
val annotations: Map<String, String>,
) : ManifestSingle {
@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val MediaType = "application/vnd.oci.image.manifest.v1+json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Tag(@JsonValue private val value: String) : Reference, Comparable<Tag> {
override fun toString(): String = value

@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
val LATEST = Tag("latest")
const val separator: Char = ':'
Expand All @@ -54,6 +55,7 @@ class Digest(@JsonValue private val value: String) : Reference, Comparable<Diges
override fun toString(): String = value

@ReflectionHint
@Suppress("ktlint:standard:property-naming")
companion object {
const val separator: Char = '@'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ internal class SuspendingContainerImageRegistryClientImpl(private val api: Conta
}
}

override suspend fun repositories(limit: Int?, last: Int?): List<Repository> =
api.repositories(limit, last)
.map(Catalog::repositories)
.getOrElse { throw it.toRegistryClientError() }
override suspend fun repositories(limit: Int?, last: Int?): List<Repository> = api.repositories(limit, last)
.map(Catalog::repositories)
.getOrElse { throw it.toRegistryClientError() }

override suspend fun tags(repository: Repository, limit: Int?, last: Int?): List<Tag> =
api.tags(repository, limit, last)
Expand All @@ -68,9 +67,8 @@ internal class SuspendingContainerImageRegistryClientImpl(private val api: Conta
api.digest(repository, reference)
.getOrElse { throw it.toRegistryClientError(repository, reference) }

override suspend fun blob(repository: Repository, digest: Digest): ByteArray =
api.blob(repository, digest)
.getOrElse { throw it.toRegistryClientError(repository) }
override suspend fun blob(repository: Repository, digest: Digest): ByteArray = api.blob(repository, digest)
.getOrElse { throw it.toRegistryClientError(repository) }

override suspend fun config(repository: Repository, reference: Reference): ImageConfig =
api.manifest(repository, reference)
Expand Down

0 comments on commit 2e25b21

Please sign in to comment.