commonMain.aws.sdk.kotlin.services.budgets.serde.UpdateBudgetActionOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of budgets-jvm Show documentation
Show all versions of budgets-jvm Show documentation
The AWS SDK for Kotlin client for Budgets
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.budgets.serde
import aws.sdk.kotlin.services.budgets.model.ActionThreshold
import aws.sdk.kotlin.services.budgets.model.ApprovalModel
import aws.sdk.kotlin.services.budgets.model.Definition
import aws.sdk.kotlin.services.budgets.model.NotificationType
import aws.sdk.kotlin.services.budgets.model.Subscriber
import aws.sdk.kotlin.services.budgets.model.UpdateBudgetActionRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerializer
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
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.json.JsonSerializer
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
internal class UpdateBudgetActionOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: UpdateBudgetActionRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeUpdateBudgetActionOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/x-amz-json-1.1")
}
return builder
}
}
private fun serializeUpdateBudgetActionOperationBody(context: ExecutionContext, input: UpdateBudgetActionRequest): ByteArray {
val serializer = JsonSerializer()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccountId"))
val ACTIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ActionId"))
val ACTIONTHRESHOLD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ActionThreshold"))
val APPROVALMODEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ApprovalModel"))
val BUDGETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BudgetName"))
val DEFINITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Definition"))
val EXECUTIONROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ExecutionRoleArn"))
val NOTIFICATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("NotificationType"))
val SUBSCRIBERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Subscribers"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTID_DESCRIPTOR)
field(ACTIONID_DESCRIPTOR)
field(ACTIONTHRESHOLD_DESCRIPTOR)
field(APPROVALMODEL_DESCRIPTOR)
field(BUDGETNAME_DESCRIPTOR)
field(DEFINITION_DESCRIPTOR)
field(EXECUTIONROLEARN_DESCRIPTOR)
field(NOTIFICATIONTYPE_DESCRIPTOR)
field(SUBSCRIBERS_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.accountId?.let { field(ACCOUNTID_DESCRIPTOR, it) }
input.actionId?.let { field(ACTIONID_DESCRIPTOR, it) }
input.actionThreshold?.let { field(ACTIONTHRESHOLD_DESCRIPTOR, it, ::serializeActionThresholdDocument) }
input.approvalModel?.let { field(APPROVALMODEL_DESCRIPTOR, it.value) }
input.budgetName?.let { field(BUDGETNAME_DESCRIPTOR, it) }
input.definition?.let { field(DEFINITION_DESCRIPTOR, it, ::serializeDefinitionDocument) }
input.executionRoleArn?.let { field(EXECUTIONROLEARN_DESCRIPTOR, it) }
input.notificationType?.let { field(NOTIFICATIONTYPE_DESCRIPTOR, it.value) }
if (input.subscribers != null) {
listField(SUBSCRIBERS_DESCRIPTOR) {
for (el0 in input.subscribers) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeSubscriberDocument))
}
}
}
}
return serializer.toByteArray()
}