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

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

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

    public var args: AuthenticatedOriginPullsArgs = AuthenticatedOriginPullsArgs()

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

/**
 * Provides a Cloudflare Authenticated Origin Pulls resource. A `cloudflare.AuthenticatedOriginPulls`
 * resource is required to use Per-Zone or Per-Hostname Authenticated
 * Origin Pulls.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // Authenticated Origin Pulls
 * const myAop = new cloudflare.AuthenticatedOriginPulls("my_aop", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     enabled: true,
 * });
 * // Per-Zone Authenticated Origin Pulls
 * const myPerZoneAopCert = new cloudflare.AuthenticatedOriginPullsCertificate("my_per_zone_aop_cert", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     certificate: "-----INSERT CERTIFICATE-----",
 *     privateKey: "-----INSERT PRIVATE KEY-----",
 *     type: "per-zone",
 * });
 * const myPerZoneAop = new cloudflare.AuthenticatedOriginPulls("my_per_zone_aop", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     authenticatedOriginPullsCertificate: myPerZoneAopCert.id,
 *     enabled: true,
 * });
 * // Per-Hostname Authenticated Origin Pulls
 * const myPerHostnameAopCert = new cloudflare.AuthenticatedOriginPullsCertificate("my_per_hostname_aop_cert", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     certificate: "-----INSERT CERTIFICATE-----",
 *     privateKey: "-----INSERT PRIVATE KEY-----",
 *     type: "per-hostname",
 * });
 * const myPerHostnameAop = new cloudflare.AuthenticatedOriginPulls("my_per_hostname_aop", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     authenticatedOriginPullsCertificate: myPerHostnameAopCert.id,
 *     hostname: "aop.example.com",
 *     enabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # Authenticated Origin Pulls
 * my_aop = cloudflare.AuthenticatedOriginPulls("my_aop",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     enabled=True)
 * # Per-Zone Authenticated Origin Pulls
 * my_per_zone_aop_cert = cloudflare.AuthenticatedOriginPullsCertificate("my_per_zone_aop_cert",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     certificate="-----INSERT CERTIFICATE-----",
 *     private_key="-----INSERT PRIVATE KEY-----",
 *     type="per-zone")
 * my_per_zone_aop = cloudflare.AuthenticatedOriginPulls("my_per_zone_aop",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     authenticated_origin_pulls_certificate=my_per_zone_aop_cert.id,
 *     enabled=True)
 * # Per-Hostname Authenticated Origin Pulls
 * my_per_hostname_aop_cert = cloudflare.AuthenticatedOriginPullsCertificate("my_per_hostname_aop_cert",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     certificate="-----INSERT CERTIFICATE-----",
 *     private_key="-----INSERT PRIVATE KEY-----",
 *     type="per-hostname")
 * my_per_hostname_aop = cloudflare.AuthenticatedOriginPulls("my_per_hostname_aop",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     authenticated_origin_pulls_certificate=my_per_hostname_aop_cert.id,
 *     hostname="aop.example.com",
 *     enabled=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // Authenticated Origin Pulls
 *     var myAop = new Cloudflare.AuthenticatedOriginPulls("my_aop", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Enabled = true,
 *     });
 *     // Per-Zone Authenticated Origin Pulls
 *     var myPerZoneAopCert = new Cloudflare.AuthenticatedOriginPullsCertificate("my_per_zone_aop_cert", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Certificate = "-----INSERT CERTIFICATE-----",
 *         PrivateKey = "-----INSERT PRIVATE KEY-----",
 *         Type = "per-zone",
 *     });
 *     var myPerZoneAop = new Cloudflare.AuthenticatedOriginPulls("my_per_zone_aop", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         AuthenticatedOriginPullsCertificate = myPerZoneAopCert.Id,
 *         Enabled = true,
 *     });
 *     // Per-Hostname Authenticated Origin Pulls
 *     var myPerHostnameAopCert = new Cloudflare.AuthenticatedOriginPullsCertificate("my_per_hostname_aop_cert", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Certificate = "-----INSERT CERTIFICATE-----",
 *         PrivateKey = "-----INSERT PRIVATE KEY-----",
 *         Type = "per-hostname",
 *     });
 *     var myPerHostnameAop = new Cloudflare.AuthenticatedOriginPulls("my_per_hostname_aop", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         AuthenticatedOriginPullsCertificate = myPerHostnameAopCert.Id,
 *         Hostname = "aop.example.com",
 *         Enabled = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		// Authenticated Origin Pulls
 * 		_, err := cloudflare.NewAuthenticatedOriginPulls(ctx, "my_aop", &cloudflare.AuthenticatedOriginPullsArgs{
 * 			ZoneId:  pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Enabled: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Per-Zone Authenticated Origin Pulls
 * 		myPerZoneAopCert, err := cloudflare.NewAuthenticatedOriginPullsCertificate(ctx, "my_per_zone_aop_cert", &cloudflare.AuthenticatedOriginPullsCertificateArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Certificate: pulumi.String("-----INSERT CERTIFICATE-----"),
 * 			PrivateKey:  pulumi.String("-----INSERT PRIVATE KEY-----"),
 * 			Type:        pulumi.String("per-zone"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudflare.NewAuthenticatedOriginPulls(ctx, "my_per_zone_aop", &cloudflare.AuthenticatedOriginPullsArgs{
 * 			ZoneId:                              pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			AuthenticatedOriginPullsCertificate: myPerZoneAopCert.ID(),
 * 			Enabled:                             pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Per-Hostname Authenticated Origin Pulls
 * 		myPerHostnameAopCert, err := cloudflare.NewAuthenticatedOriginPullsCertificate(ctx, "my_per_hostname_aop_cert", &cloudflare.AuthenticatedOriginPullsCertificateArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Certificate: pulumi.String("-----INSERT CERTIFICATE-----"),
 * 			PrivateKey:  pulumi.String("-----INSERT PRIVATE KEY-----"),
 * 			Type:        pulumi.String("per-hostname"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudflare.NewAuthenticatedOriginPulls(ctx, "my_per_hostname_aop", &cloudflare.AuthenticatedOriginPullsArgs{
 * 			ZoneId:                              pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			AuthenticatedOriginPullsCertificate: myPerHostnameAopCert.ID(),
 * 			Hostname:                            pulumi.String("aop.example.com"),
 * 			Enabled:                             pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.cloudflare.AuthenticatedOriginPulls;
 * import com.pulumi.cloudflare.AuthenticatedOriginPullsArgs;
 * import com.pulumi.cloudflare.AuthenticatedOriginPullsCertificate;
 * import com.pulumi.cloudflare.AuthenticatedOriginPullsCertificateArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         // Authenticated Origin Pulls
 *         var myAop = new AuthenticatedOriginPulls("myAop", AuthenticatedOriginPullsArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .enabled(true)
 *             .build());
 *         // Per-Zone Authenticated Origin Pulls
 *         var myPerZoneAopCert = new AuthenticatedOriginPullsCertificate("myPerZoneAopCert", AuthenticatedOriginPullsCertificateArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .certificate("-----INSERT CERTIFICATE-----")
 *             .privateKey("-----INSERT PRIVATE KEY-----")
 *             .type("per-zone")
 *             .build());
 *         var myPerZoneAop = new AuthenticatedOriginPulls("myPerZoneAop", AuthenticatedOriginPullsArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .authenticatedOriginPullsCertificate(myPerZoneAopCert.id())
 *             .enabled(true)
 *             .build());
 *         // Per-Hostname Authenticated Origin Pulls
 *         var myPerHostnameAopCert = new AuthenticatedOriginPullsCertificate("myPerHostnameAopCert", AuthenticatedOriginPullsCertificateArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .certificate("-----INSERT CERTIFICATE-----")
 *             .privateKey("-----INSERT PRIVATE KEY-----")
 *             .type("per-hostname")
 *             .build());
 *         var myPerHostnameAop = new AuthenticatedOriginPulls("myPerHostnameAop", AuthenticatedOriginPullsArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .authenticatedOriginPullsCertificate(myPerHostnameAopCert.id())
 *             .hostname("aop.example.com")
 *             .enabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Authenticated Origin Pulls
 *   myAop:
 *     type: cloudflare:AuthenticatedOriginPulls
 *     name: my_aop
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       enabled: true
 *   # Per-Zone Authenticated Origin Pulls
 *   myPerZoneAopCert:
 *     type: cloudflare:AuthenticatedOriginPullsCertificate
 *     name: my_per_zone_aop_cert
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       certificate: '-----INSERT CERTIFICATE-----'
 *       privateKey: '-----INSERT PRIVATE KEY-----'
 *       type: per-zone
 *   myPerZoneAop:
 *     type: cloudflare:AuthenticatedOriginPulls
 *     name: my_per_zone_aop
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       authenticatedOriginPullsCertificate: ${myPerZoneAopCert.id}
 *       enabled: true
 *   # Per-Hostname Authenticated Origin Pulls
 *   myPerHostnameAopCert:
 *     type: cloudflare:AuthenticatedOriginPullsCertificate
 *     name: my_per_hostname_aop_cert
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       certificate: '-----INSERT CERTIFICATE-----'
 *       privateKey: '-----INSERT PRIVATE KEY-----'
 *       type: per-hostname
 *   myPerHostnameAop:
 *     type: cloudflare:AuthenticatedOriginPulls
 *     name: my_per_hostname_aop
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       authenticatedOriginPullsCertificate: ${myPerHostnameAopCert.id}
 *       hostname: aop.example.com
 *       enabled: true
 * ```
 * 
 * ## Import
 * global
 * ```sh
 * $ pulumi import cloudflare:index/authenticatedOriginPulls:AuthenticatedOriginPulls example 
 * ```
 * per zone
 * ```sh
 * $ pulumi import cloudflare:index/authenticatedOriginPulls:AuthenticatedOriginPulls example /
 * ```
 * per hostname
 * ```sh
 * $ pulumi import cloudflare:index/authenticatedOriginPulls:AuthenticatedOriginPulls example //
 * ```
 */
public class AuthenticatedOriginPulls internal constructor(
    override val javaResource: com.pulumi.cloudflare.AuthenticatedOriginPulls,
) : KotlinCustomResource(javaResource, AuthenticatedOriginPullsMapper) {
    /**
     * The ID of an uploaded Authenticated Origin Pulls certificate. If no hostname is provided, this certificate will be used zone wide as Per-Zone Authenticated Origin Pulls.
     */
    public val authenticatedOriginPullsCertificate: Output?
        get() = javaResource.authenticatedOriginPullsCertificate().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Whether to enable Authenticated Origin Pulls on the given zone or hostname.
     */
    public val enabled: Output
        get() = javaResource.enabled().applyValue({ args0 -> args0 })

    /**
     * Specify a hostname to enable Per-Hostname Authenticated Origin Pulls on, using the provided certificate.
     */
    public val hostname: Output?
        get() = javaResource.hostname().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    public val zoneId: Output
        get() = javaResource.zoneId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy