io.cloudshiftdev.awscdk.services.iot.CfnPolicy.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.iot
import io.cloudshiftdev.awscdk.CfnResource
import io.cloudshiftdev.awscdk.CfnTag
import io.cloudshiftdev.awscdk.IInspectable
import io.cloudshiftdev.awscdk.ITaggableV2
import io.cloudshiftdev.awscdk.TagManager
import io.cloudshiftdev.awscdk.TreeInspector
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import kotlin.Any
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct
/**
* Use the `AWS::IoT::Policy` resource to declare an AWS IoT policy.
*
* For more information about working with AWS IoT policies, see
* [Authorization](https://docs.aws.amazon.com/iot/latest/developerguide/authorization.html) in the
* *AWS IoT Developer Guide* .
*
* Example:
*
* ```
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import io.cloudshiftdev.awscdk.services.iot.*;
* Object policyDocument;
* CfnPolicy cfnPolicy = CfnPolicy.Builder.create(this, "MyCfnPolicy")
* .policyDocument(policyDocument)
* // the properties below are optional
* .policyName("policyName")
* .tags(List.of(CfnTag.builder()
* .key("key")
* .value("value")
* .build()))
* .build();
* ```
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html)
*/
public open class CfnPolicy(
cdkObject: software.amazon.awscdk.services.iot.CfnPolicy,
) : CfnResource(cdkObject),
IInspectable,
ITaggableV2 {
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: CfnPolicyProps,
) :
this(software.amazon.awscdk.services.iot.CfnPolicy(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, props.let(CfnPolicyProps.Companion::unwrap))
)
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: CfnPolicyProps.Builder.() -> Unit,
) : this(scope, id, CfnPolicyProps(props)
)
/**
* The Amazon Resource Name (ARN) of the AWS IoT policy, such as
* `arn:aws:iot:us-east-2:123456789012:policy/MyPolicy` .
*/
public open fun attrArn(): String = unwrap(this).getAttrArn()
/**
* The name of this policy.
*/
public open fun attrId(): String = unwrap(this).getAttrId()
/**
* Tag Manager which manages the tags for this resource.
*/
public override fun cdkTagManager(): TagManager =
unwrap(this).getCdkTagManager().let(TagManager::wrap)
/**
* Examines the CloudFormation resource and discloses attributes.
*
* @param inspector tree inspector to collect and process attributes.
*/
public override fun inspect(inspector: TreeInspector) {
unwrap(this).inspect(inspector.let(TreeInspector.Companion::unwrap))
}
/**
* The JSON document that describes the policy.
*/
public open fun policyDocument(): Any = unwrap(this).getPolicyDocument()
/**
* The JSON document that describes the policy.
*/
public open fun policyDocument(`value`: Any) {
unwrap(this).setPolicyDocument(`value`)
}
/**
* The policy name.
*/
public open fun policyName(): String? = unwrap(this).getPolicyName()
/**
* The policy name.
*/
public open fun policyName(`value`: String) {
unwrap(this).setPolicyName(`value`)
}
/**
*
*/
public open fun tags(): List = unwrap(this).getTags()?.map(CfnTag::wrap) ?: emptyList()
/**
*
*/
public open fun tags(`value`: List) {
unwrap(this).setTags(`value`.map(CfnTag.Companion::unwrap))
}
/**
*
*/
public open fun tags(vararg `value`: CfnTag): Unit = tags(`value`.toList())
/**
* A fluent builder for [io.cloudshiftdev.awscdk.services.iot.CfnPolicy].
*/
@CdkDslMarker
public interface Builder {
/**
* The JSON document that describes the policy.
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policydocument)
* @param policyDocument The JSON document that describes the policy.
*/
public fun policyDocument(policyDocument: Any)
/**
* The policy name.
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policyname)
* @param policyName The policy name.
*/
public fun policyName(policyName: String)
/**
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-tags)
* @param tags
*/
public fun tags(tags: List)
/**
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-tags)
* @param tags
*/
public fun tags(vararg tags: CfnTag)
}
private class BuilderImpl(
scope: SoftwareConstructsConstruct,
id: String,
) : Builder {
private val cdkBuilder: software.amazon.awscdk.services.iot.CfnPolicy.Builder =
software.amazon.awscdk.services.iot.CfnPolicy.Builder.create(scope, id)
/**
* The JSON document that describes the policy.
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policydocument)
* @param policyDocument The JSON document that describes the policy.
*/
override fun policyDocument(policyDocument: Any) {
cdkBuilder.policyDocument(policyDocument)
}
/**
* The policy name.
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policyname)
* @param policyName The policy name.
*/
override fun policyName(policyName: String) {
cdkBuilder.policyName(policyName)
}
/**
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-tags)
* @param tags
*/
override fun tags(tags: List) {
cdkBuilder.tags(tags.map(CfnTag.Companion::unwrap))
}
/**
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-tags)
* @param tags
*/
override fun tags(vararg tags: CfnTag): Unit = tags(tags.toList())
public fun build(): software.amazon.awscdk.services.iot.CfnPolicy = cdkBuilder.build()
}
public companion object {
public val CFN_RESOURCE_TYPE_NAME: String =
software.amazon.awscdk.services.iot.CfnPolicy.CFN_RESOURCE_TYPE_NAME
public operator fun invoke(
scope: CloudshiftdevConstructsConstruct,
id: String,
block: Builder.() -> Unit = {},
): CfnPolicy {
val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
return CfnPolicy(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.iot.CfnPolicy): CfnPolicy =
CfnPolicy(cdkObject)
internal fun unwrap(wrapped: CfnPolicy): software.amazon.awscdk.services.iot.CfnPolicy =
wrapped.cdkObject as software.amazon.awscdk.services.iot.CfnPolicy
}
}