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

com.pulumi.awsnative.ecr.kotlin.Repository.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ecr.kotlin

import com.pulumi.awsnative.ecr.kotlin.enums.RepositoryImageTagMutability
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryEncryptionConfiguration
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryImageScanningConfiguration
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryLifecyclePolicy
import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.ecr.kotlin.enums.RepositoryImageTagMutability.Companion.toKotlin as repositoryImageTagMutabilityToKotlin
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryEncryptionConfiguration.Companion.toKotlin as repositoryEncryptionConfigurationToKotlin
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryImageScanningConfiguration.Companion.toKotlin as repositoryImageScanningConfigurationToKotlin
import com.pulumi.awsnative.ecr.kotlin.outputs.RepositoryLifecyclePolicy.Companion.toKotlin as repositoryLifecyclePolicyToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

/**
 * Builder for [Repository].
 */
@PulumiTagMarker
public class RepositoryResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: RepositoryArgs = RepositoryArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend RepositoryArgsBuilder.() -> Unit) {
        val builder = RepositoryArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Repository {
        val builtJavaResource = com.pulumi.awsnative.ecr.Repository(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Repository(builtJavaResource)
    }
}

/**
 * The ``AWS::ECR::Repository`` resource specifies an Amazon Elastic Container Registry (Amazon ECR) repository, where users can push and pull Docker images, Open Container Initiative (OCI) images, and OCI compatible artifacts. For more information, see [Amazon ECR private repositories](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html) in the *Amazon ECR User Guide*.
 * ## Example Usage
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 */
public class Repository internal constructor(
    override val javaResource: com.pulumi.awsnative.ecr.Repository,
) : KotlinCustomResource(javaResource, RepositoryMapper) {
    /**
     * Returns the Amazon Resource Name (ARN) for the specified `AWS::ECR::Repository` resource. For example, `arn:aws:ecr: *eu-west-1* : *123456789012* :repository/ *test-repository*` .
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * If true, deleting the repository force deletes the contents of the repository. If false, the repository must be empty before attempting to delete it.
     */
    public val emptyOnDelete: Output?
        get() = javaResource.emptyOnDelete().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The encryption configuration for the repository. This determines how the contents of your repository are encrypted at rest.
     */
    public val encryptionConfiguration: Output?
        get() = javaResource.encryptionConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryEncryptionConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The image scanning configuration for the repository. This determines whether images are scanned for known vulnerabilities after being pushed to the repository.
     */
    public val imageScanningConfiguration: Output?
        get() = javaResource.imageScanningConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryImageScanningConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The tag mutability setting for the repository. If this parameter is omitted, the default setting of ``MUTABLE`` will be used which will allow image tags to be overwritten. If ``IMMUTABLE`` is specified, all image tags within the repository will be immutable which will prevent them from being overwritten.
     */
    public val imageTagMutability: Output?
        get() = javaResource.imageTagMutability().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryImageTagMutabilityToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Creates or updates a lifecycle policy. For information about lifecycle policy syntax, see [Lifecycle policy template](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html).
     */
    public val lifecyclePolicy: Output?
        get() = javaResource.lifecyclePolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> repositoryLifecyclePolicyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The name to use for the repository. The repository name may be specified on its own (such as ``nginx-web-app``) or it can be prepended with a namespace to group the repository into a category (such as ``project-a/nginx-web-app``). If you don't specify a name, CFNlong generates a unique physical ID and uses that ID for the repository name. For more information, see [Name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).
     *  The repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, and forward slashes.
     *   If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
     */
    public val repositoryName: Output?
        get() = javaResource.repositoryName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The JSON repository policy text to apply to the repository. For more information, see [Amazon ECR repository policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html) in the *Amazon Elastic Container Registry User Guide*.
     * Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::ECR::Repository` for more information about the expected schema for this property.
     */
    public val repositoryPolicyText: Output?
        get() = javaResource.repositoryPolicyText().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Returns the URI for the specified `AWS::ECR::Repository` resource. For example, `*123456789012* .dkr.ecr. *us-west-2* .amazonaws.com/repository` .
     */
    public val repositoryUri: Output
        get() = javaResource.repositoryUri().applyValue({ args0 -> args0 })

    /**
     * An array of key-value pairs to apply to this resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object RepositoryMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.ecr.Repository::class == javaResource::class

    override fun map(javaResource: Resource): Repository = Repository(
        javaResource as
            com.pulumi.awsnative.ecr.Repository,
    )
}

/**
 * @see [Repository].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Repository].
 */
public suspend fun repository(name: String, block: suspend RepositoryResourceBuilder.() -> Unit): Repository {
    val builder = RepositoryResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Repository].
 * @param name The _unique_ name of the resulting resource.
 */
public fun repository(name: String): Repository {
    val builder = RepositoryResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy