commonMain.aws.sdk.kotlin.services.devicefarm.serde.JobDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devicefarm-jvm Show documentation
Show all versions of devicefarm-jvm Show documentation
The AWS SDK for Kotlin client for Device Farm
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.devicefarm.serde
import aws.sdk.kotlin.services.devicefarm.model.ExecutionResult
import aws.sdk.kotlin.services.devicefarm.model.ExecutionStatus
import aws.sdk.kotlin.services.devicefarm.model.Job
import aws.sdk.kotlin.services.devicefarm.model.TestType
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
internal fun deserializeJobDocument(deserializer: Deserializer): Job {
val builder = Job.Builder()
val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
val COUNTERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("counters"))
val CREATED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("created"))
val DEVICE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("device"))
val DEVICEMINUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("deviceMinutes"))
val INSTANCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("instanceArn"))
val MESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("message"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val RESULT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("result"))
val STARTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("started"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
val STOPPED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("stopped"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
val VIDEOCAPTURE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("videoCapture"))
val VIDEOENDPOINT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("videoEndpoint"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ARN_DESCRIPTOR)
field(COUNTERS_DESCRIPTOR)
field(CREATED_DESCRIPTOR)
field(DEVICE_DESCRIPTOR)
field(DEVICEMINUTES_DESCRIPTOR)
field(INSTANCEARN_DESCRIPTOR)
field(MESSAGE_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(RESULT_DESCRIPTOR)
field(STARTED_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(STOPPED_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
field(VIDEOCAPTURE_DESCRIPTOR)
field(VIDEOENDPOINT_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
COUNTERS_DESCRIPTOR.index -> builder.counters = deserializeCountersDocument(deserializer)
CREATED_DESCRIPTOR.index -> builder.created = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DEVICE_DESCRIPTOR.index -> builder.device = deserializeDeviceDocument(deserializer)
DEVICEMINUTES_DESCRIPTOR.index -> builder.deviceMinutes = deserializeDeviceMinutesDocument(deserializer)
INSTANCEARN_DESCRIPTOR.index -> builder.instanceArn = deserializeString()
MESSAGE_DESCRIPTOR.index -> builder.message = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
RESULT_DESCRIPTOR.index -> builder.result = deserializeString().let { ExecutionResult.fromValue(it) }
STARTED_DESCRIPTOR.index -> builder.started = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { ExecutionStatus.fromValue(it) }
STOPPED_DESCRIPTOR.index -> builder.stopped = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { TestType.fromValue(it) }
VIDEOCAPTURE_DESCRIPTOR.index -> builder.videoCapture = deserializeBoolean()
VIDEOENDPOINT_DESCRIPTOR.index -> builder.videoEndpoint = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}