commonMain.aws.sdk.kotlin.services.backup.model.KeyValue.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.backup.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* Pair of two related strings. Allowed characters are letters, white space, and numbers that can be represented in UTF-8 and the following characters: ` + - = . _ : /`
*/
public class KeyValue private constructor(builder: Builder) {
/**
* The tag key (String). The key can't start with `aws:`.
*
* Length Constraints: Minimum length of 1. Maximum length of 128.
*
* Pattern: `^(?![aA]{1}[wW]{1}[sS]{1}:)([\p{L}\p{Z}\p{N}_.:/=+\-@]+)$`
*/
public val key: kotlin.String = requireNotNull(builder.key) { "A non-null value must be provided for key" }
/**
* The value of the key.
*
* Length Constraints: Maximum length of 256.
*
* Pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$`
*/
public val value: kotlin.String = requireNotNull(builder.value) { "A non-null value must be provided for value" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.backup.model.KeyValue = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("KeyValue(")
append("key=$key,")
append("value=$value")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = key.hashCode()
result = 31 * result + (value.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 KeyValue
if (key != other.key) return false
if (value != other.value) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.backup.model.KeyValue = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The tag key (String). The key can't start with `aws:`.
*
* Length Constraints: Minimum length of 1. Maximum length of 128.
*
* Pattern: `^(?![aA]{1}[wW]{1}[sS]{1}:)([\p{L}\p{Z}\p{N}_.:/=+\-@]+)$`
*/
public var key: kotlin.String? = null
/**
* The value of the key.
*
* Length Constraints: Maximum length of 256.
*
* Pattern: `^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$`
*/
public var value: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.backup.model.KeyValue) : this() {
this.key = x.key
this.value = x.value
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.backup.model.KeyValue = KeyValue(this)
internal fun correctErrors(): Builder {
if (key == null) key = ""
if (value == null) value = ""
return this
}
}
}