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

com.pulumi.gcp.compute.kotlin.BackendBucket.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.BackendBucketCdnPolicy
import com.pulumi.gcp.compute.kotlin.outputs.BackendBucketCdnPolicy.Companion.toKotlin
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

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

    public var args: BackendBucketArgs = BackendBucketArgs()

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

/**
 * Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S)
 * load balancing.
 * An HTTP(S) load balancer can direct traffic to specified URLs to a
 * backend bucket rather than a backend service. It can send requests for
 * static content to a Cloud Storage bucket and requests for dynamic content
 * to a virtual machine instance.
 * To get more information about BackendBucket, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/backendBuckets)
 * * How-to Guides
 *     * [Using a Cloud Storage bucket as a load balancer backend](https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)
 * ## Example Usage
 * ### Backend Bucket Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const imageBucket = new gcp.storage.Bucket("image_bucket", {
 *     name: "image-store-bucket",
 *     location: "EU",
 * });
 * const imageBackend = new gcp.compute.BackendBucket("image_backend", {
 *     name: "image-backend-bucket",
 *     description: "Contains beautiful images",
 *     bucketName: imageBucket.name,
 *     enableCdn: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * image_bucket = gcp.storage.Bucket("image_bucket",
 *     name="image-store-bucket",
 *     location="EU")
 * image_backend = gcp.compute.BackendBucket("image_backend",
 *     name="image-backend-bucket",
 *     description="Contains beautiful images",
 *     bucket_name=image_bucket.name,
 *     enable_cdn=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var imageBucket = new Gcp.Storage.Bucket("image_bucket", new()
 *     {
 *         Name = "image-store-bucket",
 *         Location = "EU",
 *     });
 *     var imageBackend = new Gcp.Compute.BackendBucket("image_backend", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Description = "Contains beautiful images",
 *         BucketName = imageBucket.Name,
 *         EnableCdn = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		imageBucket, err := storage.NewBucket(ctx, "image_bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("image-store-bucket"),
 * 			Location: pulumi.String("EU"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendBucket(ctx, "image_backend", &compute.BackendBucketArgs{
 * 			Name:        pulumi.String("image-backend-bucket"),
 * 			Description: pulumi.String("Contains beautiful images"),
 * 			BucketName:  imageBucket.Name,
 * 			EnableCdn:   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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.compute.BackendBucket;
 * import com.pulumi.gcp.compute.BackendBucketArgs;
 * 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) {
 *         var imageBucket = new Bucket("imageBucket", BucketArgs.builder()
 *             .name("image-store-bucket")
 *             .location("EU")
 *             .build());
 *         var imageBackend = new BackendBucket("imageBackend", BackendBucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .description("Contains beautiful images")
 *             .bucketName(imageBucket.name())
 *             .enableCdn(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   imageBackend:
 *     type: gcp:compute:BackendBucket
 *     name: image_backend
 *     properties:
 *       name: image-backend-bucket
 *       description: Contains beautiful images
 *       bucketName: ${imageBucket.name}
 *       enableCdn: true
 *   imageBucket:
 *     type: gcp:storage:Bucket
 *     name: image_bucket
 *     properties:
 *       name: image-store-bucket
 *       location: EU
 * ```
 * 
 * ### Backend Bucket Security Policy
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const imageBackendBucket = new gcp.storage.Bucket("image_backend", {
 *     name: "image-store-bucket",
 *     location: "EU",
 * });
 * const policy = new gcp.compute.SecurityPolicy("policy", {
 *     name: "image-store-bucket",
 *     description: "basic security policy",
 *     type: "CLOUD_ARMOR_EDGE",
 * });
 * const imageBackend = new gcp.compute.BackendBucket("image_backend", {
 *     name: "image-backend-bucket",
 *     description: "Contains beautiful images",
 *     bucketName: imageBackendBucket.name,
 *     enableCdn: true,
 *     edgeSecurityPolicy: policy.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * image_backend_bucket = gcp.storage.Bucket("image_backend",
 *     name="image-store-bucket",
 *     location="EU")
 * policy = gcp.compute.SecurityPolicy("policy",
 *     name="image-store-bucket",
 *     description="basic security policy",
 *     type="CLOUD_ARMOR_EDGE")
 * image_backend = gcp.compute.BackendBucket("image_backend",
 *     name="image-backend-bucket",
 *     description="Contains beautiful images",
 *     bucket_name=image_backend_bucket.name,
 *     enable_cdn=True,
 *     edge_security_policy=policy.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var imageBackendBucket = new Gcp.Storage.Bucket("image_backend", new()
 *     {
 *         Name = "image-store-bucket",
 *         Location = "EU",
 *     });
 *     var policy = new Gcp.Compute.SecurityPolicy("policy", new()
 *     {
 *         Name = "image-store-bucket",
 *         Description = "basic security policy",
 *         Type = "CLOUD_ARMOR_EDGE",
 *     });
 *     var imageBackend = new Gcp.Compute.BackendBucket("image_backend", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Description = "Contains beautiful images",
 *         BucketName = imageBackendBucket.Name,
 *         EnableCdn = true,
 *         EdgeSecurityPolicy = policy.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		imageBackendBucket, err := storage.NewBucket(ctx, "image_backend", &storage.BucketArgs{
 * 			Name:     pulumi.String("image-store-bucket"),
 * 			Location: pulumi.String("EU"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		policy, err := compute.NewSecurityPolicy(ctx, "policy", &compute.SecurityPolicyArgs{
 * 			Name:        pulumi.String("image-store-bucket"),
 * 			Description: pulumi.String("basic security policy"),
 * 			Type:        pulumi.String("CLOUD_ARMOR_EDGE"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendBucket(ctx, "image_backend", &compute.BackendBucketArgs{
 * 			Name:               pulumi.String("image-backend-bucket"),
 * 			Description:        pulumi.String("Contains beautiful images"),
 * 			BucketName:         imageBackendBucket.Name,
 * 			EnableCdn:          pulumi.Bool(true),
 * 			EdgeSecurityPolicy: policy.ID(),
 * 		})
 * 		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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.compute.SecurityPolicy;
 * import com.pulumi.gcp.compute.SecurityPolicyArgs;
 * import com.pulumi.gcp.compute.BackendBucket;
 * import com.pulumi.gcp.compute.BackendBucketArgs;
 * 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) {
 *         var imageBackendBucket = new Bucket("imageBackendBucket", BucketArgs.builder()
 *             .name("image-store-bucket")
 *             .location("EU")
 *             .build());
 *         var policy = new SecurityPolicy("policy", SecurityPolicyArgs.builder()
 *             .name("image-store-bucket")
 *             .description("basic security policy")
 *             .type("CLOUD_ARMOR_EDGE")
 *             .build());
 *         var imageBackend = new BackendBucket("imageBackend", BackendBucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .description("Contains beautiful images")
 *             .bucketName(imageBackendBucket.name())
 *             .enableCdn(true)
 *             .edgeSecurityPolicy(policy.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   imageBackend:
 *     type: gcp:compute:BackendBucket
 *     name: image_backend
 *     properties:
 *       name: image-backend-bucket
 *       description: Contains beautiful images
 *       bucketName: ${imageBackendBucket.name}
 *       enableCdn: true
 *       edgeSecurityPolicy: ${policy.id}
 *   imageBackendBucket:
 *     type: gcp:storage:Bucket
 *     name: image_backend
 *     properties:
 *       name: image-store-bucket
 *       location: EU
 *   policy:
 *     type: gcp:compute:SecurityPolicy
 *     properties:
 *       name: image-store-bucket
 *       description: basic security policy
 *       type: CLOUD_ARMOR_EDGE
 * ```
 * 
 * ### Backend Bucket Query String Whitelist
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const imageBucket = new gcp.storage.Bucket("image_bucket", {
 *     name: "image-backend-bucket",
 *     location: "EU",
 * });
 * const imageBackend = new gcp.compute.BackendBucket("image_backend", {
 *     name: "image-backend-bucket",
 *     description: "Contains beautiful images",
 *     bucketName: imageBucket.name,
 *     enableCdn: true,
 *     cdnPolicy: {
 *         cacheKeyPolicy: {
 *             queryStringWhitelists: ["image-version"],
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * image_bucket = gcp.storage.Bucket("image_bucket",
 *     name="image-backend-bucket",
 *     location="EU")
 * image_backend = gcp.compute.BackendBucket("image_backend",
 *     name="image-backend-bucket",
 *     description="Contains beautiful images",
 *     bucket_name=image_bucket.name,
 *     enable_cdn=True,
 *     cdn_policy=gcp.compute.BackendBucketCdnPolicyArgs(
 *         cache_key_policy=gcp.compute.BackendBucketCdnPolicyCacheKeyPolicyArgs(
 *             query_string_whitelists=["image-version"],
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var imageBucket = new Gcp.Storage.Bucket("image_bucket", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Location = "EU",
 *     });
 *     var imageBackend = new Gcp.Compute.BackendBucket("image_backend", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Description = "Contains beautiful images",
 *         BucketName = imageBucket.Name,
 *         EnableCdn = true,
 *         CdnPolicy = new Gcp.Compute.Inputs.BackendBucketCdnPolicyArgs
 *         {
 *             CacheKeyPolicy = new Gcp.Compute.Inputs.BackendBucketCdnPolicyCacheKeyPolicyArgs
 *             {
 *                 QueryStringWhitelists = new[]
 *                 {
 *                     "image-version",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		imageBucket, err := storage.NewBucket(ctx, "image_bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("image-backend-bucket"),
 * 			Location: pulumi.String("EU"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendBucket(ctx, "image_backend", &compute.BackendBucketArgs{
 * 			Name:        pulumi.String("image-backend-bucket"),
 * 			Description: pulumi.String("Contains beautiful images"),
 * 			BucketName:  imageBucket.Name,
 * 			EnableCdn:   pulumi.Bool(true),
 * 			CdnPolicy: &compute.BackendBucketCdnPolicyArgs{
 * 				CacheKeyPolicy: &compute.BackendBucketCdnPolicyCacheKeyPolicyArgs{
 * 					QueryStringWhitelists: pulumi.StringArray{
 * 						pulumi.String("image-version"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.compute.BackendBucket;
 * import com.pulumi.gcp.compute.BackendBucketArgs;
 * import com.pulumi.gcp.compute.inputs.BackendBucketCdnPolicyArgs;
 * import com.pulumi.gcp.compute.inputs.BackendBucketCdnPolicyCacheKeyPolicyArgs;
 * 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) {
 *         var imageBucket = new Bucket("imageBucket", BucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .location("EU")
 *             .build());
 *         var imageBackend = new BackendBucket("imageBackend", BackendBucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .description("Contains beautiful images")
 *             .bucketName(imageBucket.name())
 *             .enableCdn(true)
 *             .cdnPolicy(BackendBucketCdnPolicyArgs.builder()
 *                 .cacheKeyPolicy(BackendBucketCdnPolicyCacheKeyPolicyArgs.builder()
 *                     .queryStringWhitelists("image-version")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   imageBackend:
 *     type: gcp:compute:BackendBucket
 *     name: image_backend
 *     properties:
 *       name: image-backend-bucket
 *       description: Contains beautiful images
 *       bucketName: ${imageBucket.name}
 *       enableCdn: true
 *       cdnPolicy:
 *         cacheKeyPolicy:
 *           queryStringWhitelists:
 *             - image-version
 *   imageBucket:
 *     type: gcp:storage:Bucket
 *     name: image_bucket
 *     properties:
 *       name: image-backend-bucket
 *       location: EU
 * ```
 * 
 * ### Backend Bucket Include Http Headers
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const imageBucket = new gcp.storage.Bucket("image_bucket", {
 *     name: "image-backend-bucket",
 *     location: "EU",
 * });
 * const imageBackend = new gcp.compute.BackendBucket("image_backend", {
 *     name: "image-backend-bucket",
 *     description: "Contains beautiful images",
 *     bucketName: imageBucket.name,
 *     enableCdn: true,
 *     cdnPolicy: {
 *         cacheKeyPolicy: {
 *             includeHttpHeaders: ["X-My-Header-Field"],
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * image_bucket = gcp.storage.Bucket("image_bucket",
 *     name="image-backend-bucket",
 *     location="EU")
 * image_backend = gcp.compute.BackendBucket("image_backend",
 *     name="image-backend-bucket",
 *     description="Contains beautiful images",
 *     bucket_name=image_bucket.name,
 *     enable_cdn=True,
 *     cdn_policy=gcp.compute.BackendBucketCdnPolicyArgs(
 *         cache_key_policy=gcp.compute.BackendBucketCdnPolicyCacheKeyPolicyArgs(
 *             include_http_headers=["X-My-Header-Field"],
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var imageBucket = new Gcp.Storage.Bucket("image_bucket", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Location = "EU",
 *     });
 *     var imageBackend = new Gcp.Compute.BackendBucket("image_backend", new()
 *     {
 *         Name = "image-backend-bucket",
 *         Description = "Contains beautiful images",
 *         BucketName = imageBucket.Name,
 *         EnableCdn = true,
 *         CdnPolicy = new Gcp.Compute.Inputs.BackendBucketCdnPolicyArgs
 *         {
 *             CacheKeyPolicy = new Gcp.Compute.Inputs.BackendBucketCdnPolicyCacheKeyPolicyArgs
 *             {
 *                 IncludeHttpHeaders = new[]
 *                 {
 *                     "X-My-Header-Field",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		imageBucket, err := storage.NewBucket(ctx, "image_bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("image-backend-bucket"),
 * 			Location: pulumi.String("EU"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendBucket(ctx, "image_backend", &compute.BackendBucketArgs{
 * 			Name:        pulumi.String("image-backend-bucket"),
 * 			Description: pulumi.String("Contains beautiful images"),
 * 			BucketName:  imageBucket.Name,
 * 			EnableCdn:   pulumi.Bool(true),
 * 			CdnPolicy: &compute.BackendBucketCdnPolicyArgs{
 * 				CacheKeyPolicy: &compute.BackendBucketCdnPolicyCacheKeyPolicyArgs{
 * 					IncludeHttpHeaders: pulumi.StringArray{
 * 						pulumi.String("X-My-Header-Field"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.gcp.storage.Bucket;
 * import com.pulumi.gcp.storage.BucketArgs;
 * import com.pulumi.gcp.compute.BackendBucket;
 * import com.pulumi.gcp.compute.BackendBucketArgs;
 * import com.pulumi.gcp.compute.inputs.BackendBucketCdnPolicyArgs;
 * import com.pulumi.gcp.compute.inputs.BackendBucketCdnPolicyCacheKeyPolicyArgs;
 * 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) {
 *         var imageBucket = new Bucket("imageBucket", BucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .location("EU")
 *             .build());
 *         var imageBackend = new BackendBucket("imageBackend", BackendBucketArgs.builder()
 *             .name("image-backend-bucket")
 *             .description("Contains beautiful images")
 *             .bucketName(imageBucket.name())
 *             .enableCdn(true)
 *             .cdnPolicy(BackendBucketCdnPolicyArgs.builder()
 *                 .cacheKeyPolicy(BackendBucketCdnPolicyCacheKeyPolicyArgs.builder()
 *                     .includeHttpHeaders("X-My-Header-Field")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   imageBackend:
 *     type: gcp:compute:BackendBucket
 *     name: image_backend
 *     properties:
 *       name: image-backend-bucket
 *       description: Contains beautiful images
 *       bucketName: ${imageBucket.name}
 *       enableCdn: true
 *       cdnPolicy:
 *         cacheKeyPolicy:
 *           includeHttpHeaders:
 *             - X-My-Header-Field
 *   imageBucket:
 *     type: gcp:storage:Bucket
 *     name: image_bucket
 *     properties:
 *       name: image-backend-bucket
 *       location: EU
 * ```
 * 
 * ## Import
 * BackendBucket can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/backendBuckets/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, BackendBucket can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/backendBucket:BackendBucket default projects/{{project}}/global/backendBuckets/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/backendBucket:BackendBucket default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/backendBucket:BackendBucket default {{name}}
 * ```
 */
public class BackendBucket internal constructor(
    override val javaResource: com.pulumi.gcp.compute.BackendBucket,
) : KotlinCustomResource(javaResource, BackendBucketMapper) {
    /**
     * Cloud Storage bucket name.
     */
    public val bucketName: Output
        get() = javaResource.bucketName().applyValue({ args0 -> args0 })

    /**
     * Cloud CDN configuration for this Backend Bucket.
     * Structure is documented below.
     */
    public val cdnPolicy: Output
        get() = javaResource.cdnPolicy().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header.
     * Possible values are: `AUTOMATIC`, `DISABLED`.
     */
    public val compressionMode: Output?
        get() = javaResource.compressionMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * Headers that the HTTP/S load balancer should add to proxied responses.
     */
    public val customResponseHeaders: Output>?
        get() = javaResource.customResponseHeaders().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * An optional textual description of the resource; provided by the
     * client when the resource is created.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The security policy associated with this backend bucket.
     */
    public val edgeSecurityPolicy: Output?
        get() = javaResource.edgeSecurityPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If true, enable Cloud CDN for this BackendBucket.
     */
    public val enableCdn: Output?
        get() = javaResource.enableCdn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the resource. Provided by the client when the resource is
     * created. The name must be 1-63 characters long, and comply with
     * RFC1035.  Specifically, the name must be 1-63 characters long and
     * match the regular expression `a-z?` which means
     * the first character must be a lowercase letter, and all following
     * characters must be a dash, lowercase letter, or digit, except the
     * last character, which cannot be a dash.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })
}

public object BackendBucketMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.BackendBucket::class == javaResource::class

    override fun map(javaResource: Resource): BackendBucket = BackendBucket(
        javaResource as
            com.pulumi.gcp.compute.BackendBucket,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy