commonMain.aws.sdk.kotlin.services.finspace.serde.GetKxEnvironmentOperationDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finspace-jvm Show documentation
Show all versions of finspace-jvm Show documentation
The AWS SDK for Kotlin client for finspace
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.finspace.serde
import aws.sdk.kotlin.services.finspace.model.CustomDnsServer
import aws.sdk.kotlin.services.finspace.model.DnsStatus
import aws.sdk.kotlin.services.finspace.model.EnvironmentStatus
import aws.sdk.kotlin.services.finspace.model.FinspaceException
import aws.sdk.kotlin.services.finspace.model.GetKxEnvironmentResponse
import aws.sdk.kotlin.services.finspace.model.TgwStatus
import aws.sdk.kotlin.services.finspace.model.TransitGatewayConfiguration
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 kotlin.collections.mutableListOf
internal class GetKxEnvironmentOperationDeserializer: HttpDeserializer.NonStreaming {
override fun deserialize(context: ExecutionContext, call: HttpCall, payload: ByteArray?): GetKxEnvironmentResponse {
val response = call.response
if (!response.status.isSuccess()) {
throwGetKxEnvironmentError(context, call, payload)
}
val builder = GetKxEnvironmentResponse.Builder()
if (payload != null) {
deserializeGetKxEnvironmentOperationBody(builder, payload)
}
builder.correctErrors()
return builder.build()
}
}
private fun throwGetKxEnvironmentError(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 FinspaceException("Failed to parse response as 'restJson1' 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)
"ConflictException" -> ConflictExceptionDeserializer().deserialize(context, wrappedCall, payload)
"AccessDeniedException" -> AccessDeniedExceptionDeserializer().deserialize(context, wrappedCall, payload)
"ValidationException" -> ValidationExceptionDeserializer().deserialize(context, wrappedCall, payload)
else -> FinspaceException(errorDetails.message)
}
setAseErrorMetadata(ex, wrappedResponse, errorDetails)
throw ex
}
private fun deserializeGetKxEnvironmentOperationBody(builder: GetKxEnvironmentResponse.Builder, payload: ByteArray) {
val deserializer = JsonDeserializer(payload)
val AVAILABILITYZONEIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("availabilityZoneIds"))
val AWSACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("awsAccountId"))
val CERTIFICATEAUTHORITYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("certificateAuthorityArn"))
val CREATIONTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("creationTimestamp"))
val CUSTOMDNSCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("customDNSConfiguration"))
val DEDICATEDSERVICEACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("dedicatedServiceAccountId"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val DNSSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("dnsStatus"))
val ENVIRONMENTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("environmentArn"))
val ENVIRONMENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("environmentId"))
val ERRORMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("errorMessage"))
val KMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("kmsKeyId"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
val TGWSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("tgwStatus"))
val TRANSITGATEWAYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("transitGatewayConfiguration"))
val UPDATETIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("updateTimestamp"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AVAILABILITYZONEIDS_DESCRIPTOR)
field(AWSACCOUNTID_DESCRIPTOR)
field(CERTIFICATEAUTHORITYARN_DESCRIPTOR)
field(CREATIONTIMESTAMP_DESCRIPTOR)
field(CUSTOMDNSCONFIGURATION_DESCRIPTOR)
field(DEDICATEDSERVICEACCOUNTID_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(DNSSTATUS_DESCRIPTOR)
field(ENVIRONMENTARN_DESCRIPTOR)
field(ENVIRONMENTID_DESCRIPTOR)
field(ERRORMESSAGE_DESCRIPTOR)
field(KMSKEYID_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(TGWSTATUS_DESCRIPTOR)
field(TRANSITGATEWAYCONFIGURATION_DESCRIPTOR)
field(UPDATETIMESTAMP_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AVAILABILITYZONEIDS_DESCRIPTOR.index -> builder.availabilityZoneIds =
deserializer.deserializeList(AVAILABILITYZONEIDS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
AWSACCOUNTID_DESCRIPTOR.index -> builder.awsAccountId = deserializeString()
CERTIFICATEAUTHORITYARN_DESCRIPTOR.index -> builder.certificateAuthorityArn = deserializeString()
CREATIONTIMESTAMP_DESCRIPTOR.index -> builder.creationTimestamp = deserializeString().let { Instant.fromEpochSeconds(it) }
CUSTOMDNSCONFIGURATION_DESCRIPTOR.index -> builder.customDnsConfiguration =
deserializer.deserializeList(CUSTOMDNSCONFIGURATION_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeCustomDnsServerDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DEDICATEDSERVICEACCOUNTID_DESCRIPTOR.index -> builder.dedicatedServiceAccountId = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
DNSSTATUS_DESCRIPTOR.index -> builder.dnsStatus = deserializeString().let { DnsStatus.fromValue(it) }
ENVIRONMENTARN_DESCRIPTOR.index -> builder.environmentArn = deserializeString()
ENVIRONMENTID_DESCRIPTOR.index -> builder.environmentId = deserializeString()
ERRORMESSAGE_DESCRIPTOR.index -> builder.errorMessage = deserializeString()
KMSKEYID_DESCRIPTOR.index -> builder.kmsKeyId = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { EnvironmentStatus.fromValue(it) }
TGWSTATUS_DESCRIPTOR.index -> builder.tgwStatus = deserializeString().let { TgwStatus.fromValue(it) }
TRANSITGATEWAYCONFIGURATION_DESCRIPTOR.index -> builder.transitGatewayConfiguration = deserializeTransitGatewayConfigurationDocument(deserializer)
UPDATETIMESTAMP_DESCRIPTOR.index -> builder.updateTimestamp = deserializeString().let { Instant.fromEpochSeconds(it) }
null -> break@loop
else -> skipValue()
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy