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

com.pulumi.awsnative.ec2.kotlin.FlowLog.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ec2.kotlin

import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogLogDestinationType
import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogResourceType
import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogTrafficType
import com.pulumi.awsnative.ec2.kotlin.outputs.DestinationOptionsProperties
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogLogDestinationType.Companion.toKotlin as flowLogLogDestinationTypeToKotlin
import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogResourceType.Companion.toKotlin as flowLogResourceTypeToKotlin
import com.pulumi.awsnative.ec2.kotlin.enums.FlowLogTrafficType.Companion.toKotlin as flowLogTrafficTypeToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.DestinationOptionsProperties.Companion.toKotlin as destinationOptionsPropertiesToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

/**
 * Builder for [FlowLog].
 */
@PulumiTagMarker
public class FlowLogResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: FlowLogArgs = FlowLogArgs()

    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 FlowLogArgsBuilder.() -> Unit) {
        val builder = FlowLogArgsBuilder()
        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(): FlowLog {
        val builtJavaResource = com.pulumi.awsnative.ec2.FlowLog(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return FlowLog(builtJavaResource)
    }
}

/**
 * Specifies a VPC flow log, which enables you to capture IP traffic for a specific network interface, subnet, or VPC.
 */
public class FlowLog internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.FlowLog,
) : KotlinCustomResource(javaResource, FlowLogMapper) {
    /**
     * The Flow Log ID
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.
     */
    public val deliverCrossAccountRole: Output?
        get() = javaResource.deliverCrossAccountRole().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ARN for the IAM role that permits Amazon EC2 to publish flow logs to a CloudWatch Logs log group in your account. If you specify LogDestinationType as s3 or kinesis-data-firehose, do not specify DeliverLogsPermissionArn or LogGroupName.
     */
    public val deliverLogsPermissionArn: Output?
        get() = javaResource.deliverLogsPermissionArn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The destination options.
     */
    public val destinationOptions: Output?
        get() = javaResource.destinationOptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> destinationOptionsPropertiesToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies the destination to which the flow log data is to be published. Flow log data can be published to a CloudWatch Logs log group, an Amazon S3 bucket, or a Kinesis Firehose stream. The value specified for this parameter depends on the value specified for LogDestinationType.
     */
    public val logDestination: Output?
        get() = javaResource.logDestination().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3.
     */
    public val logDestinationType: Output?
        get() = javaResource.logDestinationType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> flowLogLogDestinationTypeToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The fields to include in the flow log record, in the order in which they should appear.
     */
    public val logFormat: Output?
        get() = javaResource.logFormat().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs. If you specify LogDestinationType as s3 or kinesis-data-firehose, do not specify DeliverLogsPermissionArn or LogGroupName.
     */
    public val logGroupName: Output?
        get() = javaResource.logGroupName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. You can specify 60 seconds (1 minute) or 600 seconds (10 minutes).
     */
    public val maxAggregationInterval: Output?
        get() = javaResource.maxAggregationInterval().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the subnet, network interface, or VPC for which you want to create a flow log.
     */
    public val resourceId: Output
        get() = javaResource.resourceId().applyValue({ args0 -> args0 })

    /**
     * The type of resource for which to create the flow log. For example, if you specified a VPC ID for the ResourceId property, specify VPC for this property.
     */
    public val resourceType: Output
        get() = javaResource.resourceType().applyValue({ args0 ->
            args0.let({ args0 ->
                flowLogResourceTypeToKotlin(args0)
            })
        })

    /**
     * The tags to apply to the flow logs.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic.
     */
    public val trafficType: Output?
        get() = javaResource.trafficType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    flowLogTrafficTypeToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object FlowLogMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.ec2.FlowLog::class == javaResource::class

    override fun map(javaResource: Resource): FlowLog = FlowLog(
        javaResource as
            com.pulumi.awsnative.ec2.FlowLog,
    )
}

/**
 * @see [FlowLog].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [FlowLog].
 */
public suspend fun flowLog(name: String, block: suspend FlowLogResourceBuilder.() -> Unit): FlowLog {
    val builder = FlowLogResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [FlowLog].
 * @param name The _unique_ name of the resulting resource.
 */
public fun flowLog(name: String): FlowLog {
    val builder = FlowLogResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy