commonMain.aws.sdk.kotlin.services.datasync.serde.CreateLocationObjectStorageOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datasync-jvm Show documentation
Show all versions of datasync-jvm Show documentation
The AWS SDK for Kotlin client for DataSync
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.datasync.serde
import aws.sdk.kotlin.services.datasync.model.CreateLocationObjectStorageRequest
import aws.sdk.kotlin.services.datasync.model.ObjectStorageServerProtocol
import aws.sdk.kotlin.services.datasync.model.TagListEntry
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
import aws.smithy.kotlin.runtime.text.encoding.encodeBase64String
internal class CreateLocationObjectStorageOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateLocationObjectStorageRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateLocationObjectStorageOperationBody(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 serializeCreateLocationObjectStorageOperationBody(context: ExecutionContext, input: CreateLocationObjectStorageRequest): ByteArray {
val serializer = JsonSerializer()
val ACCESSKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccessKey"))
val AGENTARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AgentArns"))
val BUCKETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BucketName"))
val SECRETKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecretKey"))
val SERVERCERTIFICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Blob, JsonSerialName("ServerCertificate"))
val SERVERHOSTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ServerHostname"))
val SERVERPORT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("ServerPort"))
val SERVERPROTOCOL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ServerProtocol"))
val SUBDIRECTORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Subdirectory"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCESSKEY_DESCRIPTOR)
field(AGENTARNS_DESCRIPTOR)
field(BUCKETNAME_DESCRIPTOR)
field(SECRETKEY_DESCRIPTOR)
field(SERVERCERTIFICATE_DESCRIPTOR)
field(SERVERHOSTNAME_DESCRIPTOR)
field(SERVERPORT_DESCRIPTOR)
field(SERVERPROTOCOL_DESCRIPTOR)
field(SUBDIRECTORY_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.accessKey?.let { field(ACCESSKEY_DESCRIPTOR, it) }
if (input.agentArns != null) {
listField(AGENTARNS_DESCRIPTOR) {
for (el0 in input.agentArns) {
serializeString(el0)
}
}
}
input.bucketName?.let { field(BUCKETNAME_DESCRIPTOR, it) }
input.secretKey?.let { field(SECRETKEY_DESCRIPTOR, it) }
input.serverCertificate?.let { field(SERVERCERTIFICATE_DESCRIPTOR, it.encodeBase64String()) }
input.serverHostname?.let { field(SERVERHOSTNAME_DESCRIPTOR, it) }
input.serverPort?.let { field(SERVERPORT_DESCRIPTOR, it) }
input.serverProtocol?.let { field(SERVERPROTOCOL_DESCRIPTOR, it.value) }
input.subdirectory?.let { field(SUBDIRECTORY_DESCRIPTOR, it) }
if (input.tags != null) {
listField(TAGS_DESCRIPTOR) {
for (el0 in input.tags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagListEntryDocument))
}
}
}
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy