commonMain.aws.sdk.kotlin.services.grafana.serde.CreateWorkspaceOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafana-jvm Show documentation
Show all versions of grafana-jvm Show documentation
The AWS SDK for Kotlin client for grafana
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.grafana.serde
import aws.sdk.kotlin.services.grafana.model.AccountAccessType
import aws.sdk.kotlin.services.grafana.model.AuthenticationProviderTypes
import aws.sdk.kotlin.services.grafana.model.CreateWorkspaceRequest
import aws.sdk.kotlin.services.grafana.model.DataSourceType
import aws.sdk.kotlin.services.grafana.model.NetworkAccessConfiguration
import aws.sdk.kotlin.services.grafana.model.NotificationDestinationType
import aws.sdk.kotlin.services.grafana.model.PermissionType
import aws.sdk.kotlin.services.grafana.model.VpcConfiguration
import aws.smithy.kotlin.runtime.client.idempotencyTokenProvider
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 CreateWorkspaceOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateWorkspaceRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/workspaces"
}
val payload = serializeCreateWorkspaceOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeCreateWorkspaceOperationBody(context: ExecutionContext, input: CreateWorkspaceRequest): ByteArray {
val serializer = JsonSerializer()
val ACCOUNTACCESSTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountAccessType"))
val AUTHENTICATIONPROVIDERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("authenticationProviders"))
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
val CONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("configuration"))
val GRAFANAVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("grafanaVersion"))
val NETWORKACCESSCONTROL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("networkAccessControl"))
val ORGANIZATIONROLENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("organizationRoleName"))
val PERMISSIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("permissionType"))
val STACKSETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("stackSetName"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
val VPCCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vpcConfiguration"))
val WORKSPACEDATASOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("workspaceDataSources"))
val WORKSPACEDESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("workspaceDescription"))
val WORKSPACENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("workspaceName"))
val WORKSPACENOTIFICATIONDESTINATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("workspaceNotificationDestinations"))
val WORKSPACEORGANIZATIONALUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("workspaceOrganizationalUnits"))
val WORKSPACEROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("workspaceRoleArn"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTACCESSTYPE_DESCRIPTOR)
field(AUTHENTICATIONPROVIDERS_DESCRIPTOR)
field(CLIENTTOKEN_DESCRIPTOR)
field(CONFIGURATION_DESCRIPTOR)
field(GRAFANAVERSION_DESCRIPTOR)
field(NETWORKACCESSCONTROL_DESCRIPTOR)
field(ORGANIZATIONROLENAME_DESCRIPTOR)
field(PERMISSIONTYPE_DESCRIPTOR)
field(STACKSETNAME_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(VPCCONFIGURATION_DESCRIPTOR)
field(WORKSPACEDATASOURCES_DESCRIPTOR)
field(WORKSPACEDESCRIPTION_DESCRIPTOR)
field(WORKSPACENAME_DESCRIPTOR)
field(WORKSPACENOTIFICATIONDESTINATIONS_DESCRIPTOR)
field(WORKSPACEORGANIZATIONALUNITS_DESCRIPTOR)
field(WORKSPACEROLEARN_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
field(ACCOUNTACCESSTYPE_DESCRIPTOR, input.accountAccessType.value)
listField(AUTHENTICATIONPROVIDERS_DESCRIPTOR) {
for (el0 in input.authenticationProviders) {
serializeString(el0.value)
}
}
input.clientToken?.let { field(CLIENTTOKEN_DESCRIPTOR, it) } ?: field(CLIENTTOKEN_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
input.configuration?.let { field(CONFIGURATION_DESCRIPTOR, it) }
input.grafanaVersion?.let { field(GRAFANAVERSION_DESCRIPTOR, it) }
input.networkAccessControl?.let { field(NETWORKACCESSCONTROL_DESCRIPTOR, it, ::serializeNetworkAccessConfigurationDocument) }
input.organizationRoleName?.let { field(ORGANIZATIONROLENAME_DESCRIPTOR, it) }
field(PERMISSIONTYPE_DESCRIPTOR, input.permissionType.value)
input.stackSetName?.let { field(STACKSETNAME_DESCRIPTOR, it) }
if (input.tags != null) {
mapField(TAGS_DESCRIPTOR) {
input.tags.forEach { (key, value) ->
entry(key, value)
}
}
}
input.vpcConfiguration?.let { field(VPCCONFIGURATION_DESCRIPTOR, it, ::serializeVpcConfigurationDocument) }
if (input.workspaceDataSources != null) {
listField(WORKSPACEDATASOURCES_DESCRIPTOR) {
for (el0 in input.workspaceDataSources) {
serializeString(el0.value)
}
}
}
input.workspaceDescription?.let { field(WORKSPACEDESCRIPTION_DESCRIPTOR, it) }
input.workspaceName?.let { field(WORKSPACENAME_DESCRIPTOR, it) }
if (input.workspaceNotificationDestinations != null) {
listField(WORKSPACENOTIFICATIONDESTINATIONS_DESCRIPTOR) {
for (el0 in input.workspaceNotificationDestinations) {
serializeString(el0.value)
}
}
}
if (input.workspaceOrganizationalUnits != null) {
listField(WORKSPACEORGANIZATIONALUNITS_DESCRIPTOR) {
for (el0 in input.workspaceOrganizationalUnits) {
serializeString(el0)
}
}
}
input.workspaceRoleArn?.let { field(WORKSPACEROLEARN_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}