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

com.pulumi.cloudflare.kotlin.CloudflareProvider.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.Provider
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinProviderResource
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

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

    public var args: ProviderArgs = ProviderArgs()

    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 ProviderArgsBuilder.() -> Unit) {
        val builder = ProviderArgsBuilder()
        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(): CloudflareProvider {
        val builtJavaResource = Provider(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return CloudflareProvider(builtJavaResource)
    }
}

/**
 * The provider type for the cloudflare package. By default, resources use package-wide configuration
 * settings, however an explicit `Provider` instance may be created and passed during resource
 * construction to achieve fine-grained programmatic control over provider settings. See the
 * [documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.
 */
public class CloudflareProvider internal constructor(
    override val javaResource: Provider,
) : KotlinProviderResource(javaResource, CloudflareProviderMapper) {
    /**
     * Configure the base path used by the API client. Alternatively, can be configured using the `CLOUDFLARE_API_BASE_PATH`
     * environment variable.
     */
    public val apiBasePath: Output?
        get() = javaResource.apiBasePath().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Configure the hostname used by the API client. Alternatively, can be configured using the `CLOUDFLARE_API_HOSTNAME`
     * environment variable.
     */
    public val apiHostname: Output?
        get() = javaResource.apiHostname().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The API key for operations. Alternatively, can be configured using the `CLOUDFLARE_API_KEY` environment variable. API
     * keys are [now considered legacy by
   * Cloudflare](https://developers.cloudflare.com/fundamentals/api/get-started/keys/#limitations), API tokens should be used
     * instead. Must provide only one of `api_key`, `api_token`, `api_user_service_key`.
     */
    public val apiKey: Output?
        get() = javaResource.apiKey().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The API Token for operations. Alternatively, can be configured using the `CLOUDFLARE_API_TOKEN` environment variable.
     * Must provide only one of `api_key`, `api_token`, `api_user_service_key`.
     */
    public val apiToken: Output?
        get() = javaResource.apiToken().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A special Cloudflare API key good for a restricted set of endpoints. Alternatively, can be configured using the
     * `CLOUDFLARE_API_USER_SERVICE_KEY` environment variable. Must provide only one of `api_key`, `api_token`,
     * `api_user_service_key`.
     */
    public val apiUserServiceKey: Output?
        get() = javaResource.apiUserServiceKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A registered Cloudflare email address. Alternatively, can be configured using the `CLOUDFLARE_EMAIL` environment
     * variable. Required when using `api_key`. Conflicts with `api_token`.
     */
    public val email: Output?
        get() = javaResource.email().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    public val userAgentOperatorSuffix: Output?
        get() = javaResource.userAgentOperatorSuffix().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object CloudflareProviderMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        Provider::class == javaResource::class

    override fun map(javaResource: Resource): CloudflareProvider = CloudflareProvider(
        javaResource as
            Provider,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy