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

commonMain.aws.sdk.kotlin.services.backup.model.BackupSelection.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.backup.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Used to specify a set of resources to a backup plan.
 *
 * Specifying your desired `Conditions`, `ListOfTags`, `NotResources`, and/or `Resources` is recommended. If none of these are specified, Backup will attempt to select all supported and opted-in storage resources, which could have unintended cost implications.
 */
public class BackupSelection private constructor(builder: Builder) {
    /**
     * A list of conditions that you define to assign resources to your backup plans using tags. For example, `"StringEquals": { "Key": "aws:ResourceTag/CreatedByCryo", "Value": "true" },`. Condition operators are case sensitive.
     *
     * `Conditions` differs from `ListOfTags` as follows:
     * + When you specify more than one condition, you only assign the resources that match ALL conditions (using AND logic).
     * + `Conditions` supports `StringEquals`, `StringLike`, `StringNotEquals`, and `StringNotLike`. `ListOfTags` only supports `StringEquals`.
     */
    public val conditions: aws.sdk.kotlin.services.backup.model.Conditions? = builder.conditions
    /**
     * The ARN of the IAM role that Backup uses to authenticate when backing up the target resource; for example, `arn:aws:iam::123456789012:role/S3Access`.
     */
    public val iamRoleArn: kotlin.String = requireNotNull(builder.iamRoleArn) { "A non-null value must be provided for iamRoleArn" }
    /**
     * A list of conditions that you define to assign resources to your backup plans using tags. For example, `"StringEquals": { "Key": "aws:ResourceTag/CreatedByCryo", "Value": "true" },`. Condition operators are case sensitive.
     *
     * `ListOfTags` differs from `Conditions` as follows:
     * + When you specify more than one condition, you assign all resources that match AT LEAST ONE condition (using OR logic).
     * + `ListOfTags` only supports `StringEquals`. `Conditions` supports `StringEquals`, `StringLike`, `StringNotEquals`, and `StringNotLike`.
     */
    public val listOfTags: List? = builder.listOfTags
    /**
     * A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.
     *
     * If you need to exclude many resources from a backup plan, consider a different resource selection strategy, such as assigning only one or a few resource types or refining your resource selection using tags.
     */
    public val notResources: List? = builder.notResources
    /**
     * A list of Amazon Resource Names (ARNs) to assign to a backup plan. The maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.
     *
     * If you need to assign many resources to a backup plan, consider a different resource selection strategy, such as assigning all resources of a resource type or refining your resource selection using tags.
     */
    public val resources: List? = builder.resources
    /**
     * The display name of a resource selection document. Must contain 1 to 50 alphanumeric or '-_.' characters.
     */
    public val selectionName: kotlin.String = requireNotNull(builder.selectionName) { "A non-null value must be provided for selectionName" }

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

    override fun toString(): kotlin.String = buildString {
        append("BackupSelection(")
        append("conditions=$conditions,")
        append("iamRoleArn=$iamRoleArn,")
        append("listOfTags=$listOfTags,")
        append("notResources=$notResources,")
        append("resources=$resources,")
        append("selectionName=$selectionName")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = conditions?.hashCode() ?: 0
        result = 31 * result + (iamRoleArn.hashCode())
        result = 31 * result + (listOfTags?.hashCode() ?: 0)
        result = 31 * result + (notResources?.hashCode() ?: 0)
        result = 31 * result + (resources?.hashCode() ?: 0)
        result = 31 * result + (selectionName.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 BackupSelection

        if (conditions != other.conditions) return false
        if (iamRoleArn != other.iamRoleArn) return false
        if (listOfTags != other.listOfTags) return false
        if (notResources != other.notResources) return false
        if (resources != other.resources) return false
        if (selectionName != other.selectionName) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * A list of conditions that you define to assign resources to your backup plans using tags. For example, `"StringEquals": { "Key": "aws:ResourceTag/CreatedByCryo", "Value": "true" },`. Condition operators are case sensitive.
         *
         * `Conditions` differs from `ListOfTags` as follows:
         * + When you specify more than one condition, you only assign the resources that match ALL conditions (using AND logic).
         * + `Conditions` supports `StringEquals`, `StringLike`, `StringNotEquals`, and `StringNotLike`. `ListOfTags` only supports `StringEquals`.
         */
        public var conditions: aws.sdk.kotlin.services.backup.model.Conditions? = null
        /**
         * The ARN of the IAM role that Backup uses to authenticate when backing up the target resource; for example, `arn:aws:iam::123456789012:role/S3Access`.
         */
        public var iamRoleArn: kotlin.String? = null
        /**
         * A list of conditions that you define to assign resources to your backup plans using tags. For example, `"StringEquals": { "Key": "aws:ResourceTag/CreatedByCryo", "Value": "true" },`. Condition operators are case sensitive.
         *
         * `ListOfTags` differs from `Conditions` as follows:
         * + When you specify more than one condition, you assign all resources that match AT LEAST ONE condition (using OR logic).
         * + `ListOfTags` only supports `StringEquals`. `Conditions` supports `StringEquals`, `StringLike`, `StringNotEquals`, and `StringNotLike`.
         */
        public var listOfTags: List? = null
        /**
         * A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.
         *
         * If you need to exclude many resources from a backup plan, consider a different resource selection strategy, such as assigning only one or a few resource types or refining your resource selection using tags.
         */
        public var notResources: List? = null
        /**
         * A list of Amazon Resource Names (ARNs) to assign to a backup plan. The maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.
         *
         * If you need to assign many resources to a backup plan, consider a different resource selection strategy, such as assigning all resources of a resource type or refining your resource selection using tags.
         */
        public var resources: List? = null
        /**
         * The display name of a resource selection document. Must contain 1 to 50 alphanumeric or '-_.' characters.
         */
        public var selectionName: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.backup.model.BackupSelection) : this() {
            this.conditions = x.conditions
            this.iamRoleArn = x.iamRoleArn
            this.listOfTags = x.listOfTags
            this.notResources = x.notResources
            this.resources = x.resources
            this.selectionName = x.selectionName
        }

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

        /**
         * construct an [aws.sdk.kotlin.services.backup.model.Conditions] inside the given [block]
         */
        public fun conditions(block: aws.sdk.kotlin.services.backup.model.Conditions.Builder.() -> kotlin.Unit) {
            this.conditions = aws.sdk.kotlin.services.backup.model.Conditions.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (iamRoleArn == null) iamRoleArn = ""
            if (selectionName == null) selectionName = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy