All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
commonMain.aws.sdk.kotlin.services.lookoutequipment.serde.DescribeDatasetOperationDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.lookoutequipment.serde
import aws.sdk.kotlin.services.lookoutequipment.model.DataQualitySummary
import aws.sdk.kotlin.services.lookoutequipment.model.DatasetStatus
import aws.sdk.kotlin.services.lookoutequipment.model.DescribeDatasetResponse
import aws.sdk.kotlin.services.lookoutequipment.model.IngestedFilesSummary
import aws.sdk.kotlin.services.lookoutequipment.model.IngestionInputConfiguration
import aws.sdk.kotlin.services.lookoutequipment.model.LookoutEquipmentException
import aws.smithy.kotlin.runtime.awsprotocol.json.RestJsonErrorDeserializer
import aws.smithy.kotlin.runtime.awsprotocol.setAseErrorMetadata
import aws.smithy.kotlin.runtime.awsprotocol.withPayload
import aws.smithy.kotlin.runtime.http.HttpCall
import aws.smithy.kotlin.runtime.http.isSuccess
import aws.smithy.kotlin.runtime.http.operation.HttpDeserializer
import aws.smithy.kotlin.runtime.operation.ExecutionContext
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 class DescribeDatasetOperationDeserializer: HttpDeserializer.NonStreaming {
override fun deserialize(context: ExecutionContext, call: HttpCall, payload: ByteArray?): DescribeDatasetResponse {
val response = call.response
if (!response.status.isSuccess()) {
throwDescribeDatasetError(context, call, payload)
}
val builder = DescribeDatasetResponse.Builder()
if (payload != null) {
deserializeDescribeDatasetOperationBody(builder, payload)
}
builder.correctErrors()
return builder.build()
}
}
private fun throwDescribeDatasetError(context: ExecutionContext, call: HttpCall, payload: ByteArray?): kotlin.Nothing {
val wrappedResponse = call.response.withPayload(payload)
val wrappedCall = call.copy(response = wrappedResponse)
val errorDetails = try {
RestJsonErrorDeserializer.deserialize(call.response.headers, payload)
} catch (ex: Exception) {
throw LookoutEquipmentException("Failed to parse response as 'awsJson1_0' error", ex).also {
setAseErrorMetadata(it, wrappedCall.response, null)
}
}
val ex = when(errorDetails.code) {
"InternalServerException" -> InternalServerExceptionDeserializer().deserialize(context, wrappedCall, payload)
"ResourceNotFoundException" -> ResourceNotFoundExceptionDeserializer().deserialize(context, wrappedCall, payload)
"ValidationException" -> ValidationExceptionDeserializer().deserialize(context, wrappedCall, payload)
"ThrottlingException" -> ThrottlingExceptionDeserializer().deserialize(context, wrappedCall, payload)
"AccessDeniedException" -> AccessDeniedExceptionDeserializer().deserialize(context, wrappedCall, payload)
else -> LookoutEquipmentException(errorDetails.message)
}
setAseErrorMetadata(ex, wrappedResponse, errorDetails)
throw ex
}
private fun deserializeDescribeDatasetOperationBody(builder: DescribeDatasetResponse.Builder, payload: ByteArray) {
val deserializer = JsonDeserializer(payload)
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedAt"))
val DATAENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("DataEndTime"))
val DATAQUALITYSUMMARY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("DataQualitySummary"))
val DATASTARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("DataStartTime"))
val DATASETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatasetArn"))
val DATASETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatasetName"))
val INGESTEDFILESSUMMARY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("IngestedFilesSummary"))
val INGESTIONINPUTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("IngestionInputConfiguration"))
val LASTUPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastUpdatedAt"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleArn"))
val SCHEMA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Schema"))
val SERVERSIDEKMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ServerSideKmsKeyId"))
val SOURCEDATASETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SourceDatasetArn"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CREATEDAT_DESCRIPTOR)
field(DATAENDTIME_DESCRIPTOR)
field(DATAQUALITYSUMMARY_DESCRIPTOR)
field(DATASTARTTIME_DESCRIPTOR)
field(DATASETARN_DESCRIPTOR)
field(DATASETNAME_DESCRIPTOR)
field(INGESTEDFILESSUMMARY_DESCRIPTOR)
field(INGESTIONINPUTCONFIGURATION_DESCRIPTOR)
field(LASTUPDATEDAT_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(SCHEMA_DESCRIPTOR)
field(SERVERSIDEKMSKEYID_DESCRIPTOR)
field(SOURCEDATASETARN_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DATAENDTIME_DESCRIPTOR.index -> builder.dataEndTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DATAQUALITYSUMMARY_DESCRIPTOR.index -> builder.dataQualitySummary = deserializeDataQualitySummaryDocument(deserializer)
DATASTARTTIME_DESCRIPTOR.index -> builder.dataStartTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DATASETARN_DESCRIPTOR.index -> builder.datasetArn = deserializeString()
DATASETNAME_DESCRIPTOR.index -> builder.datasetName = deserializeString()
INGESTEDFILESSUMMARY_DESCRIPTOR.index -> builder.ingestedFilesSummary = deserializeIngestedFilesSummaryDocument(deserializer)
INGESTIONINPUTCONFIGURATION_DESCRIPTOR.index -> builder.ingestionInputConfiguration = deserializeIngestionInputConfigurationDocument(deserializer)
LASTUPDATEDAT_DESCRIPTOR.index -> builder.lastUpdatedAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
ROLEARN_DESCRIPTOR.index -> builder.roleArn = deserializeString()
SCHEMA_DESCRIPTOR.index -> builder.schema = deserializeString()
SERVERSIDEKMSKEYID_DESCRIPTOR.index -> builder.serverSideKmsKeyId = deserializeString()
SOURCEDATASETARN_DESCRIPTOR.index -> builder.sourceDatasetArn = deserializeString()
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { DatasetStatus.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
}