io.cloudshiftdev.awscdk.services.iam.SamlProvider.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.iam
import io.cloudshiftdev.awscdk.Resource
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import kotlin.String
import kotlin.Unit
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct
/**
* A SAML provider.
*
* Example:
*
* ```
* SamlProvider provider = SamlProvider.Builder.create(this, "Provider")
* .metadataDocument(SamlMetadataDocument.fromFile("/path/to/saml-metadata-document.xml"))
* .build();
* Role.Builder.create(this, "Role")
* .assumedBy(new SamlConsolePrincipal(provider))
* .build();
* ```
*/
public open class SamlProvider(
cdkObject: software.amazon.awscdk.services.iam.SamlProvider,
) : Resource(cdkObject),
ISamlProvider {
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: SamlProviderProps,
) :
this(software.amazon.awscdk.services.iam.SamlProvider(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, props.let(SamlProviderProps.Companion::unwrap))
)
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: SamlProviderProps.Builder.() -> Unit,
) : this(scope, id, SamlProviderProps(props)
)
/**
* The Amazon Resource Name (ARN) of the provider.
*/
public override fun samlProviderArn(): String = unwrap(this).getSamlProviderArn()
/**
* A fluent builder for [io.cloudshiftdev.awscdk.services.iam.SamlProvider].
*/
@CdkDslMarker
public interface Builder {
/**
* An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document
* includes the issuer's name, expiration information, and keys that can be used to validate the
* SAML authentication response (assertions) that are received from the IdP. You must generate the
* metadata document using the identity management software that is used as your organization's
* IdP.
*
* @param metadataDocument An XML document generated by an identity provider (IdP) that supports
* SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be
* used to validate the SAML authentication response (assertions) that are received from the IdP.
* You must generate the metadata document using the identity management software that is used as
* your organization's IdP.
*/
public fun metadataDocument(metadataDocument: SamlMetadataDocument)
/**
* The name of the provider to create.
*
* This parameter allows a string of characters consisting of upper and
* lowercase alphanumeric characters with no spaces. You can also include
* any of the following characters: _+=,.@-
*
* Length must be between 1 and 128 characters.
*
* Default: - a CloudFormation generated name
*
* @param name The name of the provider to create.
*/
public fun name(name: String)
}
private class BuilderImpl(
scope: SoftwareConstructsConstruct,
id: String,
) : Builder {
private val cdkBuilder: software.amazon.awscdk.services.iam.SamlProvider.Builder =
software.amazon.awscdk.services.iam.SamlProvider.Builder.create(scope, id)
/**
* An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document
* includes the issuer's name, expiration information, and keys that can be used to validate the
* SAML authentication response (assertions) that are received from the IdP. You must generate the
* metadata document using the identity management software that is used as your organization's
* IdP.
*
* @param metadataDocument An XML document generated by an identity provider (IdP) that supports
* SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be
* used to validate the SAML authentication response (assertions) that are received from the IdP.
* You must generate the metadata document using the identity management software that is used as
* your organization's IdP.
*/
override fun metadataDocument(metadataDocument: SamlMetadataDocument) {
cdkBuilder.metadataDocument(metadataDocument.let(SamlMetadataDocument.Companion::unwrap))
}
/**
* The name of the provider to create.
*
* This parameter allows a string of characters consisting of upper and
* lowercase alphanumeric characters with no spaces. You can also include
* any of the following characters: _+=,.@-
*
* Length must be between 1 and 128 characters.
*
* Default: - a CloudFormation generated name
*
* @param name The name of the provider to create.
*/
override fun name(name: String) {
cdkBuilder.name(name)
}
public fun build(): software.amazon.awscdk.services.iam.SamlProvider = cdkBuilder.build()
}
public companion object {
public fun fromSamlProviderArn(
scope: CloudshiftdevConstructsConstruct,
id: String,
samlProviderArn: String,
): ISamlProvider =
software.amazon.awscdk.services.iam.SamlProvider.fromSamlProviderArn(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, samlProviderArn).let(ISamlProvider::wrap)
public operator fun invoke(
scope: CloudshiftdevConstructsConstruct,
id: String,
block: Builder.() -> Unit = {},
): SamlProvider {
val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
return SamlProvider(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.iam.SamlProvider): SamlProvider =
SamlProvider(cdkObject)
internal fun unwrap(wrapped: SamlProvider): software.amazon.awscdk.services.iam.SamlProvider =
wrapped.cdkObject as software.amazon.awscdk.services.iam.SamlProvider
}
}