commonMain.aws.sdk.kotlin.services.glue.serde.ModifyIntegrationOperationDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glue-jvm Show documentation
Show all versions of glue-jvm Show documentation
The AWS SDK for Kotlin client for Glue
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.GlueException
import aws.sdk.kotlin.services.glue.model.IntegrationError
import aws.sdk.kotlin.services.glue.model.IntegrationStatus
import aws.sdk.kotlin.services.glue.model.ModifyIntegrationResponse
import aws.sdk.kotlin.services.glue.model.Tag
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
import kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf
internal class ModifyIntegrationOperationDeserializer: HttpDeserializer.NonStreaming {
override fun deserialize(context: ExecutionContext, call: HttpCall, payload: ByteArray?): ModifyIntegrationResponse {
val response = call.response
if (!response.status.isSuccess()) {
throwModifyIntegrationError(context, call, payload)
}
val builder = ModifyIntegrationResponse.Builder()
if (payload != null) {
deserializeModifyIntegrationOperationBody(builder, payload)
}
builder.correctErrors()
return builder.build()
}
}
private fun throwModifyIntegrationError(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 GlueException("Failed to parse response as 'awsJson1_1' error", ex).also {
setAseErrorMetadata(it, wrappedCall.response, null)
}
}
val ex = when(errorDetails.code) {
"IntegrationNotFoundFault" -> IntegrationNotFoundFaultDeserializer().deserialize(context, wrappedCall, payload)
"InvalidStateException" -> InvalidStateExceptionDeserializer().deserialize(context, wrappedCall, payload)
"InternalServiceException" -> InternalServiceExceptionDeserializer().deserialize(context, wrappedCall, payload)
"InvalidIntegrationStateFault" -> InvalidIntegrationStateFaultDeserializer().deserialize(context, wrappedCall, payload)
"ValidationException" -> ValidationExceptionDeserializer().deserialize(context, wrappedCall, payload)
"ConflictException" -> ConflictExceptionDeserializer().deserialize(context, wrappedCall, payload)
"EntityNotFoundException" -> EntityNotFoundExceptionDeserializer().deserialize(context, wrappedCall, payload)
"IntegrationConflictOperationFault" -> IntegrationConflictOperationFaultDeserializer().deserialize(context, wrappedCall, payload)
"InternalServerException" -> InternalServerExceptionDeserializer().deserialize(context, wrappedCall, payload)
"InvalidInputException" -> InvalidInputExceptionDeserializer().deserialize(context, wrappedCall, payload)
"AccessDeniedException" -> AccessDeniedExceptionDeserializer().deserialize(context, wrappedCall, payload)
else -> GlueException(errorDetails.message)
}
setAseErrorMetadata(ex, wrappedResponse, errorDetails)
throw ex
}
private fun deserializeModifyIntegrationOperationBody(builder: ModifyIntegrationResponse.Builder, payload: ByteArray) {
val deserializer = JsonDeserializer(payload)
val ADDITIONALENCRYPTIONCONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("AdditionalEncryptionContext"))
val CREATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateTime"))
val DATAFILTER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DataFilter"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val ERRORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Errors"))
val INTEGRATIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IntegrationArn"))
val INTEGRATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IntegrationName"))
val KMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("KmsKeyId"))
val SOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SourceArn"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
val TARGETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TargetArn"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ADDITIONALENCRYPTIONCONTEXT_DESCRIPTOR)
field(CREATETIME_DESCRIPTOR)
field(DATAFILTER_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(ERRORS_DESCRIPTOR)
field(INTEGRATIONARN_DESCRIPTOR)
field(INTEGRATIONNAME_DESCRIPTOR)
field(KMSKEYID_DESCRIPTOR)
field(SOURCEARN_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TARGETARN_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ADDITIONALENCRYPTIONCONTEXT_DESCRIPTOR.index -> builder.additionalEncryptionContext =
deserializer.deserializeMap(ADDITIONALENCRYPTIONCONTEXT_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
CREATETIME_DESCRIPTOR.index -> builder.createTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DATAFILTER_DESCRIPTOR.index -> builder.dataFilter = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
ERRORS_DESCRIPTOR.index -> builder.errors =
deserializer.deserializeList(ERRORS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeIntegrationErrorDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
INTEGRATIONARN_DESCRIPTOR.index -> builder.integrationArn = deserializeString()
INTEGRATIONNAME_DESCRIPTOR.index -> builder.integrationName = deserializeString()
KMSKEYID_DESCRIPTOR.index -> builder.kmsKeyId = deserializeString()
SOURCEARN_DESCRIPTOR.index -> builder.sourceArn = deserializeString()
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { IntegrationStatus.fromValue(it) }
TAGS_DESCRIPTOR.index -> builder.tags =
deserializer.deserializeList(TAGS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeTagDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TARGETARN_DESCRIPTOR.index -> builder.targetArn = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy