commonMain.aws.sdk.kotlin.services.databrew.serde.DescribeJobOperationDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of databrew-jvm Show documentation
Show all versions of databrew-jvm Show documentation
The AWS Kotlin client for DataBrew
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.databrew.serde
import aws.sdk.kotlin.services.databrew.model.DataBrewException
import aws.sdk.kotlin.services.databrew.model.DataCatalogOutput
import aws.sdk.kotlin.services.databrew.model.DatabaseOutput
import aws.sdk.kotlin.services.databrew.model.DescribeJobResponse
import aws.sdk.kotlin.services.databrew.model.EncryptionMode
import aws.sdk.kotlin.services.databrew.model.JobSample
import aws.sdk.kotlin.services.databrew.model.JobType
import aws.sdk.kotlin.services.databrew.model.LogSubscription
import aws.sdk.kotlin.services.databrew.model.Output
import aws.sdk.kotlin.services.databrew.model.ProfileConfiguration
import aws.sdk.kotlin.services.databrew.model.RecipeReference
import aws.sdk.kotlin.services.databrew.model.ValidationConfiguration
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.HttpDeserialize
import aws.smithy.kotlin.runtime.http.readAll
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 kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf
internal class DescribeJobOperationDeserializer: HttpDeserialize {
override suspend fun deserialize(context: ExecutionContext, call: HttpCall): DescribeJobResponse {
val response = call.response
if (!response.status.isSuccess()) {
throwDescribeJobError(context, call)
}
val builder = DescribeJobResponse.Builder()
val payload = response.body.readAll()
if (payload != null) {
deserializeDescribeJobOperationBody(builder, payload)
}
builder.correctErrors()
return builder.build()
}
}
private suspend fun throwDescribeJobError(context: ExecutionContext, call: HttpCall): kotlin.Nothing {
val payload = call.response.body.readAll()
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 DataBrewException("Failed to parse response as 'restJson1' error", ex).also {
setAseErrorMetadata(it, wrappedCall.response, null)
}
}
val ex = when(errorDetails.code) {
"ResourceNotFoundException" -> ResourceNotFoundExceptionDeserializer().deserialize(context, wrappedCall)
"ValidationException" -> ValidationExceptionDeserializer().deserialize(context, wrappedCall)
else -> DataBrewException(errorDetails.message)
}
setAseErrorMetadata(ex, wrappedResponse, errorDetails)
throw ex
}
private fun deserializeDescribeJobOperationBody(builder: DescribeJobResponse.Builder, payload: ByteArray) {
val deserializer = JsonDeserializer(payload)
val CREATEDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateDate"))
val CREATEDBY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CreatedBy"))
val DATACATALOGOUTPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DataCatalogOutputs"))
val DATABASEOUTPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DatabaseOutputs"))
val DATASETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatasetName"))
val ENCRYPTIONKEYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EncryptionKeyArn"))
val ENCRYPTIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("EncryptionMode"))
val JOBSAMPLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("JobSample"))
val LASTMODIFIEDBY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LastModifiedBy"))
val LASTMODIFIEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastModifiedDate"))
val LOGSUBSCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("LogSubscription"))
val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxCapacity"))
val MAXRETRIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxRetries"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val OUTPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Outputs"))
val PROFILECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ProfileConfiguration"))
val PROJECTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ProjectName"))
val RECIPEREFERENCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("RecipeReference"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceArn"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleArn"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
val TIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Timeout"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
val VALIDATIONCONFIGURATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ValidationConfigurations"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CREATEDATE_DESCRIPTOR)
field(CREATEDBY_DESCRIPTOR)
field(DATACATALOGOUTPUTS_DESCRIPTOR)
field(DATABASEOUTPUTS_DESCRIPTOR)
field(DATASETNAME_DESCRIPTOR)
field(ENCRYPTIONKEYARN_DESCRIPTOR)
field(ENCRYPTIONMODE_DESCRIPTOR)
field(JOBSAMPLE_DESCRIPTOR)
field(LASTMODIFIEDBY_DESCRIPTOR)
field(LASTMODIFIEDDATE_DESCRIPTOR)
field(LOGSUBSCRIPTION_DESCRIPTOR)
field(MAXCAPACITY_DESCRIPTOR)
field(MAXRETRIES_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(OUTPUTS_DESCRIPTOR)
field(PROFILECONFIGURATION_DESCRIPTOR)
field(PROJECTNAME_DESCRIPTOR)
field(RECIPEREFERENCE_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TIMEOUT_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
field(VALIDATIONCONFIGURATIONS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CREATEDATE_DESCRIPTOR.index -> builder.createDate = deserializeString().let { Instant.fromEpochSeconds(it) }
CREATEDBY_DESCRIPTOR.index -> builder.createdBy = deserializeString()
DATACATALOGOUTPUTS_DESCRIPTOR.index -> builder.dataCatalogOutputs =
deserializer.deserializeList(DATACATALOGOUTPUTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeDataCatalogOutputDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DATABASEOUTPUTS_DESCRIPTOR.index -> builder.databaseOutputs =
deserializer.deserializeList(DATABASEOUTPUTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeDatabaseOutputDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DATASETNAME_DESCRIPTOR.index -> builder.datasetName = deserializeString()
ENCRYPTIONKEYARN_DESCRIPTOR.index -> builder.encryptionKeyArn = deserializeString()
ENCRYPTIONMODE_DESCRIPTOR.index -> builder.encryptionMode = deserializeString().let { EncryptionMode.fromValue(it) }
JOBSAMPLE_DESCRIPTOR.index -> builder.jobSample = deserializeJobSampleDocument(deserializer)
LASTMODIFIEDBY_DESCRIPTOR.index -> builder.lastModifiedBy = deserializeString()
LASTMODIFIEDDATE_DESCRIPTOR.index -> builder.lastModifiedDate = deserializeString().let { Instant.fromEpochSeconds(it) }
LOGSUBSCRIPTION_DESCRIPTOR.index -> builder.logSubscription = deserializeString().let { LogSubscription.fromValue(it) }
MAXCAPACITY_DESCRIPTOR.index -> builder.maxCapacity = deserializeInt()
MAXRETRIES_DESCRIPTOR.index -> builder.maxRetries = deserializeInt()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
OUTPUTS_DESCRIPTOR.index -> builder.outputs =
deserializer.deserializeList(OUTPUTS_DESCRIPTOR) {
val col0 = mutableListOf
© 2015 - 2025 Weber Informatics LLC | Privacy Policy