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

commonMain.aws.sdk.kotlin.services.eventbridge.model.AwsVpcConfiguration.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.eventbridge.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * This structure specifies the VPC subnets and security groups for the task, and whether a public IP address is to be used. This structure is relevant only for ECS tasks that use the `awsvpc` network mode.
 */
public class AwsVpcConfiguration private constructor(builder: Builder) {
    /**
     * Specifies whether the task's elastic network interface receives a public IP address. You can specify `ENABLED` only when `LaunchType` in `EcsParameters` is set to `FARGATE`.
     */
    public val assignPublicIp: aws.sdk.kotlin.services.eventbridge.model.AssignPublicIp? = builder.assignPublicIp
    /**
     * Specifies the security groups associated with the task. These security groups must all be in the same VPC. You can specify as many as five security groups. If you do not specify a security group, the default security group for the VPC is used.
     */
    public val securityGroups: List? = builder.securityGroups
    /**
     * Specifies the subnets associated with the task. These subnets must all be in the same VPC. You can specify as many as 16 subnets.
     */
    public val subnets: List = requireNotNull(builder.subnets) { "A non-null value must be provided for subnets" }

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.eventbridge.model.AwsVpcConfiguration = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("AwsVpcConfiguration(")
        append("assignPublicIp=$assignPublicIp,")
        append("securityGroups=$securityGroups,")
        append("subnets=$subnets")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = assignPublicIp?.hashCode() ?: 0
        result = 31 * result + (securityGroups?.hashCode() ?: 0)
        result = 31 * result + (subnets.hashCode())
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as AwsVpcConfiguration

        if (assignPublicIp != other.assignPublicIp) return false
        if (securityGroups != other.securityGroups) return false
        if (subnets != other.subnets) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.eventbridge.model.AwsVpcConfiguration = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * Specifies whether the task's elastic network interface receives a public IP address. You can specify `ENABLED` only when `LaunchType` in `EcsParameters` is set to `FARGATE`.
         */
        public var assignPublicIp: aws.sdk.kotlin.services.eventbridge.model.AssignPublicIp? = null
        /**
         * Specifies the security groups associated with the task. These security groups must all be in the same VPC. You can specify as many as five security groups. If you do not specify a security group, the default security group for the VPC is used.
         */
        public var securityGroups: List? = null
        /**
         * Specifies the subnets associated with the task. These subnets must all be in the same VPC. You can specify as many as 16 subnets.
         */
        public var subnets: List? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.eventbridge.model.AwsVpcConfiguration) : this() {
            this.assignPublicIp = x.assignPublicIp
            this.securityGroups = x.securityGroups
            this.subnets = x.subnets
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.eventbridge.model.AwsVpcConfiguration = AwsVpcConfiguration(this)

        internal fun correctErrors(): Builder {
            if (subnets == null) subnets = emptyList()
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy