commonMain.aws.sdk.kotlin.services.backup.model.BackupPlan.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
/**
* Contains an optional backup plan display name and an array of `BackupRule` objects, each of which specifies a backup rule. Each rule in a backup plan is a separate scheduled task and can back up a different selection of Amazon Web Services resources.
*/
public class BackupPlan private constructor(builder: Builder) {
/**
* Contains a list of `BackupOptions` for each resource type.
*/
public val advancedBackupSettings: List? = builder.advancedBackupSettings
/**
* The display name of a backup plan. Must contain 1 to 50 alphanumeric or '-_.' characters.
*/
public val backupPlanName: kotlin.String = requireNotNull(builder.backupPlanName) { "A non-null value must be provided for backupPlanName" }
/**
* An array of `BackupRule` objects, each of which specifies a scheduled task that is used to back up a selection of resources.
*/
public val rules: List = requireNotNull(builder.rules) { "A non-null value must be provided for rules" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.backup.model.BackupPlan = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("BackupPlan(")
append("advancedBackupSettings=$advancedBackupSettings,")
append("backupPlanName=$backupPlanName,")
append("rules=$rules")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = advancedBackupSettings?.hashCode() ?: 0
result = 31 * result + (backupPlanName.hashCode())
result = 31 * result + (rules.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 BackupPlan
if (advancedBackupSettings != other.advancedBackupSettings) return false
if (backupPlanName != other.backupPlanName) return false
if (rules != other.rules) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.backup.model.BackupPlan = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* Contains a list of `BackupOptions` for each resource type.
*/
public var advancedBackupSettings: List? = null
/**
* The display name of a backup plan. Must contain 1 to 50 alphanumeric or '-_.' characters.
*/
public var backupPlanName: kotlin.String? = null
/**
* An array of `BackupRule` objects, each of which specifies a scheduled task that is used to back up a selection of resources.
*/
public var rules: List? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.backup.model.BackupPlan) : this() {
this.advancedBackupSettings = x.advancedBackupSettings
this.backupPlanName = x.backupPlanName
this.rules = x.rules
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.backup.model.BackupPlan = BackupPlan(this)
internal fun correctErrors(): Builder {
if (backupPlanName == null) backupPlanName = ""
if (rules == null) rules = emptyList()
return this
}
}
}