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

com.pulumi.awsnative.amplify.kotlin.Branch.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.amplify.kotlin

import com.pulumi.awsnative.amplify.kotlin.enums.BranchStage
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchBackend
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchBasicAuthConfig
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchEnvironmentVariable
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.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.amplify.kotlin.enums.BranchStage.Companion.toKotlin as branchStageToKotlin
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchBackend.Companion.toKotlin as branchBackendToKotlin
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchBasicAuthConfig.Companion.toKotlin as branchBasicAuthConfigToKotlin
import com.pulumi.awsnative.amplify.kotlin.outputs.BranchEnvironmentVariable.Companion.toKotlin as branchEnvironmentVariableToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: BranchArgs = BranchArgs()

    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 BranchArgsBuilder.() -> Unit) {
        val builder = BranchArgsBuilder()
        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(): Branch {
        val builtJavaResource = com.pulumi.awsnative.amplify.Branch(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Branch(builtJavaResource)
    }
}

/**
 * The AWS::Amplify::Branch resource creates a new branch within an app.
 */
public class Branch internal constructor(
    override val javaResource: com.pulumi.awsnative.amplify.Branch,
) : KotlinCustomResource(javaResource, BranchMapper) {
    /**
     * The unique ID for an Amplify app.
     */
    public val appId: Output
        get() = javaResource.appId().applyValue({ args0 -> args0 })

    /**
     * ARN for a branch, part of an Amplify App.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The backend for a `Branch` of an Amplify app. Use for a backend created from an AWS CloudFormation stack.
     * This field is available to Amplify Gen 2 apps only. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.
     */
    public val backend: Output?
        get() = javaResource.backend().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    branchBackendToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The basic authorization credentials for a branch of an Amplify app. You must base64-encode the authorization credentials and provide them in the format `user:password` .
     */
    public val basicAuthConfig: Output?
        get() = javaResource.basicAuthConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> branchBasicAuthConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The name for the branch.
     */
    public val branchName: Output
        get() = javaResource.branchName().applyValue({ args0 -> args0 })

    /**
     * The build specification (build spec) for the branch.
     */
    public val buildSpec: Output?
        get() = javaResource.buildSpec().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The description for the branch that is part of an Amplify app.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enables auto building for the branch.
     */
    public val enableAutoBuild: Output?
        get() = javaResource.enableAutoBuild().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enables performance mode for the branch.
     * Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out.
     */
    public val enablePerformanceMode: Output?
        get() = javaResource.enablePerformanceMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether Amplify Hosting creates a preview for each pull request that is made for this branch. If this property is enabled, Amplify deploys your app to a unique preview URL after each pull request is opened. Development and QA teams can use this preview to test the pull request before it's merged into a production or integration branch.
     * To provide backend support for your preview, Amplify automatically provisions a temporary backend environment that it deletes when the pull request is closed. If you want to specify a dedicated backend environment for your previews, use the `PullRequestEnvironmentName` property.
     * For more information, see [Web Previews](https://docs.aws.amazon.com/amplify/latest/userguide/pr-previews.html) in the *AWS Amplify Hosting User Guide* .
     */
    public val enablePullRequestPreview: Output?
        get() = javaResource.enablePullRequestPreview().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The environment variables for the branch.
     */
    public val environmentVariables: Output>?
        get() = javaResource.environmentVariables().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        branchEnvironmentVariableToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The framework for the branch.
     */
    public val framework: Output?
        get() = javaResource.framework().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * If pull request previews are enabled for this branch, you can use this property to specify a dedicated backend environment for your previews. For example, you could specify an environment named `prod` , `test` , or `dev` that you initialized with the Amplify CLI and mapped to this branch.
     * To enable pull request previews, set the `EnablePullRequestPreview` property to `true` .
     * If you don't specify an environment, Amplify Hosting provides backend support for each preview by automatically provisioning a temporary backend environment. Amplify Hosting deletes this environment when the pull request is closed.
     * For more information about creating backend environments, see [Feature Branch Deployments and Team Workflows](https://docs.aws.amazon.com/amplify/latest/userguide/multi-environments.html) in the *AWS Amplify Hosting User Guide* .
     */
    public val pullRequestEnvironmentName: Output?
        get() = javaResource.pullRequestEnvironmentName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Describes the current stage for the branch.
     */
    public val stage: Output?
        get() = javaResource.stage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    branchStageToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The tag for the branch.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object BranchMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.amplify.Branch::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy