All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.sso.serde.GetRoleCredentialsOperationSerializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.sso.serde

import aws.sdk.kotlin.services.sso.model.GetRoleCredentialsRequest
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.headers
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding


internal class GetRoleCredentialsOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: GetRoleCredentialsRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.GET

        builder.url {
            path.encoded = "/federation/credentials"
            parameters.decodedParameters(PercentEncoding.SmithyLabel) {
                if (input.accountId != null) add("account_id", input.accountId)
                if (input.roleName != null) add("role_name", input.roleName)
            }
        }

        builder.headers {
            if (input.accessToken?.isNotEmpty() == true) append("x-amz-sso_bearer_token", input.accessToken)
        }

        return builder
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy