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

com.pulumi.cloudflare.kotlin.PagesProject.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.PagesProjectBuildConfig
import com.pulumi.cloudflare.kotlin.outputs.PagesProjectDeploymentConfigs
import com.pulumi.cloudflare.kotlin.outputs.PagesProjectSource
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.cloudflare.kotlin.outputs.PagesProjectBuildConfig.Companion.toKotlin as pagesProjectBuildConfigToKotlin
import com.pulumi.cloudflare.kotlin.outputs.PagesProjectDeploymentConfigs.Companion.toKotlin as pagesProjectDeploymentConfigsToKotlin
import com.pulumi.cloudflare.kotlin.outputs.PagesProjectSource.Companion.toKotlin as pagesProjectSourceToKotlin

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

    public var args: PagesProjectArgs = PagesProjectArgs()

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

/**
 * Provides a resource which manages Cloudflare Pages projects.
 * > If you are using a `source` block configuration, you must first have a
 *    connected GitHub or GitLab account connected to Cloudflare. See the
 *    [Getting Started with Pages] documentation on how to link your accounts.
 * ## Import
 * !> It is not possible to import a pages project with secret environment variables. If you have a secret environment variable, you must remove it from your project before importing it.
 * ```sh
 * $ pulumi import cloudflare:index/pagesProject:PagesProject example /
 * ```
 */
public class PagesProject internal constructor(
    override val javaResource: com.pulumi.cloudflare.PagesProject,
) : KotlinCustomResource(javaResource, PagesProjectMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * Configuration for the project build process. Read more about the build configuration in the [developer documentation](https://developers.cloudflare.com/pages/platform/build-configuration).
     */
    public val buildConfig: Output?
        get() = javaResource.buildConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    pagesProjectBuildConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * When the project was created.
     */
    public val createdOn: Output
        get() = javaResource.createdOn().applyValue({ args0 -> args0 })

    /**
     * Configuration for deployments in a project.
     */
    public val deploymentConfigs: Output
        get() = javaResource.deploymentConfigs().applyValue({ args0 ->
            args0.let({ args0 ->
                pagesProjectDeploymentConfigsToKotlin(args0)
            })
        })

    /**
     * A list of associated custom domains for the project.
     */
    public val domains: Output>
        get() = javaResource.domains().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Name of the project.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the branch that is used for the production environment.
     */
    public val productionBranch: Output
        get() = javaResource.productionBranch().applyValue({ args0 -> args0 })

    /**
     * Configuration for the project source. Read more about the source configuration in the [developer documentation](https://developers.cloudflare.com/pages/platform/branch-build-controls/).
     */
    public val source: Output?
        get() = javaResource.source().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    pagesProjectSourceToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Cloudflare subdomain associated with the project.
     */
    public val subdomain: Output
        get() = javaResource.subdomain().applyValue({ args0 -> args0 })
}

public object PagesProjectMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.PagesProject::class == javaResource::class

    override fun map(javaResource: Resource): PagesProject = PagesProject(
        javaResource as
            com.pulumi.cloudflare.PagesProject,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy