io.cloudshiftdev.awscdk.services.iam.GroupProps.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.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
/**
* Properties for defining an IAM group.
*
* 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.iam.*;
* ManagedPolicy managedPolicy;
* GroupProps groupProps = GroupProps.builder()
* .groupName("groupName")
* .managedPolicies(List.of(managedPolicy))
* .path("path")
* .build();
* ```
*/
public interface GroupProps {
/**
* A name for the IAM group.
*
* For valid values, see the GroupName parameter
* for the CreateGroup action in the IAM API Reference. If you don't specify
* a name, AWS CloudFormation generates a unique physical ID and uses that
* ID for the group name.
*
* If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to
* acknowledge your template's capabilities. For more information, see
* Acknowledging IAM Resources in AWS CloudFormation Templates.
*
* Default: Generated by CloudFormation (recommended)
*/
public fun groupName(): String? = unwrap(this).getGroupName()
/**
* A list of managed policies associated with this role.
*
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*
* Default: - No managed policies.
*/
public fun managedPolicies(): List =
unwrap(this).getManagedPolicies()?.map(IManagedPolicy::wrap) ?: emptyList()
/**
* The path to the group.
*
* For more information about paths, see IAM
* Identifiers
* in the IAM User Guide.
*
* Default: /
*/
public fun path(): String? = unwrap(this).getPath()
/**
* A builder for [GroupProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @param groupName A name for the IAM group.
* For valid values, see the GroupName parameter
* for the CreateGroup action in the IAM API Reference. If you don't specify
* a name, AWS CloudFormation generates a unique physical ID and uses that
* ID for the group name.
*
* If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to
* acknowledge your template's capabilities. For more information, see
* Acknowledging IAM Resources in AWS CloudFormation Templates.
*/
public fun groupName(groupName: String)
/**
* @param managedPolicies A list of managed policies associated with this role.
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*/
public fun managedPolicies(managedPolicies: List)
/**
* @param managedPolicies A list of managed policies associated with this role.
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*/
public fun managedPolicies(vararg managedPolicies: IManagedPolicy)
/**
* @param path The path to the group.
* For more information about paths, see IAM
* Identifiers
* in the IAM User Guide.
*/
public fun path(path: String)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.iam.GroupProps.Builder =
software.amazon.awscdk.services.iam.GroupProps.builder()
/**
* @param groupName A name for the IAM group.
* For valid values, see the GroupName parameter
* for the CreateGroup action in the IAM API Reference. If you don't specify
* a name, AWS CloudFormation generates a unique physical ID and uses that
* ID for the group name.
*
* If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to
* acknowledge your template's capabilities. For more information, see
* Acknowledging IAM Resources in AWS CloudFormation Templates.
*/
override fun groupName(groupName: String) {
cdkBuilder.groupName(groupName)
}
/**
* @param managedPolicies A list of managed policies associated with this role.
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*/
override fun managedPolicies(managedPolicies: List) {
cdkBuilder.managedPolicies(managedPolicies.map(IManagedPolicy.Companion::unwrap))
}
/**
* @param managedPolicies A list of managed policies associated with this role.
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*/
override fun managedPolicies(vararg managedPolicies: IManagedPolicy): Unit =
managedPolicies(managedPolicies.toList())
/**
* @param path The path to the group.
* For more information about paths, see IAM
* Identifiers
* in the IAM User Guide.
*/
override fun path(path: String) {
cdkBuilder.path(path)
}
public fun build(): software.amazon.awscdk.services.iam.GroupProps = cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.iam.GroupProps,
) : CdkObject(cdkObject),
GroupProps {
/**
* A name for the IAM group.
*
* For valid values, see the GroupName parameter
* for the CreateGroup action in the IAM API Reference. If you don't specify
* a name, AWS CloudFormation generates a unique physical ID and uses that
* ID for the group name.
*
* If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to
* acknowledge your template's capabilities. For more information, see
* Acknowledging IAM Resources in AWS CloudFormation Templates.
*
* Default: Generated by CloudFormation (recommended)
*/
override fun groupName(): String? = unwrap(this).getGroupName()
/**
* A list of managed policies associated with this role.
*
* You can add managed policies later using
* `addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))`.
*
* Default: - No managed policies.
*/
override fun managedPolicies(): List =
unwrap(this).getManagedPolicies()?.map(IManagedPolicy::wrap) ?: emptyList()
/**
* The path to the group.
*
* For more information about paths, see IAM
* Identifiers
* in the IAM User Guide.
*
* Default: /
*/
override fun path(): String? = unwrap(this).getPath()
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): GroupProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.iam.GroupProps): GroupProps =
CdkObjectWrappers.wrap(cdkObject) as? GroupProps ?: Wrapper(cdkObject)
internal fun unwrap(wrapped: GroupProps): software.amazon.awscdk.services.iam.GroupProps =
(wrapped as CdkObject).cdkObject as software.amazon.awscdk.services.iam.GroupProps
}
}