com.pulumi.awsnative.ec2.kotlin.SecurityGroup.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-native-kotlin Show documentation
Show all versions of pulumi-aws-native-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.awsnative.ec2.kotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.SecurityGroupEgress
import com.pulumi.awsnative.ec2.kotlin.outputs.SecurityGroupIngress
import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.ec2.kotlin.outputs.SecurityGroupEgress.Companion.toKotlin as securityGroupEgressToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.SecurityGroupIngress.Companion.toKotlin as securityGroupIngressToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
/**
* Builder for [SecurityGroup].
*/
@PulumiTagMarker
public class SecurityGroupResourceBuilder internal constructor() {
public var name: String? = null
public var args: SecurityGroupArgs = SecurityGroupArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SecurityGroupArgsBuilder.() -> Unit) {
val builder = SecurityGroupArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): SecurityGroup {
val builtJavaResource = com.pulumi.awsnative.ec2.SecurityGroup(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SecurityGroup(builtJavaResource)
}
}
/**
* Resource Type definition for AWS::EC2::SecurityGroup
*/
public class SecurityGroup internal constructor(
override val javaResource: com.pulumi.awsnative.ec2.SecurityGroup,
) : KotlinCustomResource(javaResource, SecurityGroupMapper) {
/**
* The group name or group ID depending on whether the SG is created in default or specific VPC
*/
public val awsId: Output
get() = javaResource.awsId().applyValue({ args0 -> args0 })
/**
* A description for the security group.
*/
public val groupDescription: Output
get() = javaResource.groupDescription().applyValue({ args0 -> args0 })
/**
* The group ID of the specified security group.
*/
public val groupId: Output
get() = javaResource.groupId().applyValue({ args0 -> args0 })
/**
* The name of the security group.
*/
public val groupName: Output?
get() = javaResource.groupName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* [VPC only] The outbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.
*/
public val securityGroupEgress: Output>?
get() = javaResource.securityGroupEgress().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
securityGroupEgressToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The inbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.
*/
public val securityGroupIngress: Output>?
get() = javaResource.securityGroupIngress().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
securityGroupIngressToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Any tags assigned to the security group.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> tagToKotlin(args0) })
})
}).orElse(null)
})
/**
* The ID of the VPC for the security group.
*/
public val vpcId: Output?
get() = javaResource.vpcId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object SecurityGroupMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.awsnative.ec2.SecurityGroup::class == javaResource::class
override fun map(javaResource: Resource): SecurityGroup = SecurityGroup(
javaResource as
com.pulumi.awsnative.ec2.SecurityGroup,
)
}
/**
* @see [SecurityGroup].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SecurityGroup].
*/
public suspend fun securityGroup(
name: String,
block: suspend SecurityGroupResourceBuilder.() -> Unit,
): SecurityGroup {
val builder = SecurityGroupResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SecurityGroup].
* @param name The _unique_ name of the resulting resource.
*/
public fun securityGroup(name: String): SecurityGroup {
val builder = SecurityGroupResourceBuilder()
builder.name(name)
return builder.build()
}