
commonMain.aws.sdk.kotlin.services.appmesh.model.PortMapping.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.appmesh.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* An object that represents a port mapping.
*/
public class PortMapping private constructor(builder: Builder) {
/**
* The port used for the port mapping.
*/
public val port: kotlin.Int = requireNotNull(builder.port) { "A non-null value must be provided for port" }
/**
* The protocol used for the port mapping. Specify one protocol.
*/
public val protocol: aws.sdk.kotlin.services.appmesh.model.PortProtocol = requireNotNull(builder.protocol) { "A non-null value must be provided for protocol" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.appmesh.model.PortMapping = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("PortMapping(")
append("port=$port,")
append("protocol=$protocol")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = port
result = 31 * result + (protocol.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 PortMapping
if (port != other.port) return false
if (protocol != other.protocol) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.appmesh.model.PortMapping = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The port used for the port mapping.
*/
public var port: kotlin.Int? = null
/**
* The protocol used for the port mapping. Specify one protocol.
*/
public var protocol: aws.sdk.kotlin.services.appmesh.model.PortProtocol? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.appmesh.model.PortMapping) : this() {
this.port = x.port
this.protocol = x.protocol
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.appmesh.model.PortMapping = PortMapping(this)
internal fun correctErrors(): Builder {
if (port == null) port = 0
if (protocol == null) protocol = PortProtocol.SdkUnknown("no value provided")
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy