commonMain.aws.sdk.kotlin.services.grafana.serde.WorkspaceSummaryDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafana-jvm Show documentation
Show all versions of grafana-jvm Show documentation
The AWS SDK for Kotlin client for grafana
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.grafana.serde
import aws.sdk.kotlin.services.grafana.model.LicenseType
import aws.sdk.kotlin.services.grafana.model.NotificationDestinationType
import aws.sdk.kotlin.services.grafana.model.WorkspaceStatus
import aws.sdk.kotlin.services.grafana.model.WorkspaceSummary
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf
internal fun deserializeWorkspaceSummaryDocument(deserializer: Deserializer): WorkspaceSummary {
val builder = WorkspaceSummary.Builder()
val AUTHENTICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("authentication"))
val CREATED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("created"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val ENDPOINT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("endpoint"))
val GRAFANATOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("grafanaToken"))
val GRAFANAVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("grafanaVersion"))
val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("id"))
val LICENSETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("licenseType"))
val MODIFIED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("modified"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val NOTIFICATIONDESTINATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("notificationDestinations"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("status"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AUTHENTICATION_DESCRIPTOR)
field(CREATED_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(ENDPOINT_DESCRIPTOR)
field(GRAFANATOKEN_DESCRIPTOR)
field(GRAFANAVERSION_DESCRIPTOR)
field(ID_DESCRIPTOR)
field(LICENSETYPE_DESCRIPTOR)
field(MODIFIED_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(NOTIFICATIONDESTINATIONS_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AUTHENTICATION_DESCRIPTOR.index -> builder.authentication = deserializeAuthenticationSummaryDocument(deserializer)
CREATED_DESCRIPTOR.index -> builder.created = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
ENDPOINT_DESCRIPTOR.index -> builder.endpoint = deserializeString()
GRAFANATOKEN_DESCRIPTOR.index -> builder.grafanaToken = deserializeString()
GRAFANAVERSION_DESCRIPTOR.index -> builder.grafanaVersion = deserializeString()
ID_DESCRIPTOR.index -> builder.id = deserializeString()
LICENSETYPE_DESCRIPTOR.index -> builder.licenseType = deserializeString().let { LicenseType.fromValue(it) }
MODIFIED_DESCRIPTOR.index -> builder.modified = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
NOTIFICATIONDESTINATIONS_DESCRIPTOR.index -> builder.notificationDestinations =
deserializer.deserializeList(NOTIFICATIONDESTINATIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { NotificationDestinationType.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { WorkspaceStatus.fromValue(it) }
TAGS_DESCRIPTOR.index -> builder.tags =
deserializer.deserializeMap(TAGS_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}