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

com.pulumi.gcp.compute.kotlin.BackendBucketSignedUrlKey.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.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 [BackendBucketSignedUrlKey].
 */
@PulumiTagMarker
public class BackendBucketSignedUrlKeyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: BackendBucketSignedUrlKeyArgs = BackendBucketSignedUrlKeyArgs()

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

/**
 * A key for signing Cloud CDN signed URLs for BackendBuckets.
 * To get more information about BackendBucketSignedUrlKey, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/backendBuckets)
 * * How-to Guides
 *     * [Using Signed URLs](https://cloud.google.com/cdn/docs/using-signed-urls/)
 * ## Example Usage
 * ### Backend Bucket Signed Url Key
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as random from "@pulumi/random";
 * const urlSignature = new random.RandomId("url_signature", {byteLength: 16});
 * const bucket = new gcp.storage.Bucket("bucket", {
 *     name: "test-storage-bucket",
 *     location: "EU",
 * });
 * const testBackend = new gcp.compute.BackendBucket("test_backend", {
 *     name: "test-signed-backend-bucket",
 *     description: "Contains beautiful images",
 *     bucketName: bucket.name,
 *     enableCdn: true,
 * });
 * const backendKey = new gcp.compute.BackendBucketSignedUrlKey("backend_key", {
 *     name: "test-key",
 *     keyValue: urlSignature.b64Url,
 *     backendBucket: testBackend.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_random as random
 * url_signature = random.RandomId("url_signature", byte_length=16)
 * bucket = gcp.storage.Bucket("bucket",
 *     name="test-storage-bucket",
 *     location="EU")
 * test_backend = gcp.compute.BackendBucket("test_backend",
 *     name="test-signed-backend-bucket",
 *     description="Contains beautiful images",
 *     bucket_name=bucket.name,
 *     enable_cdn=True)
 * backend_key = gcp.compute.BackendBucketSignedUrlKey("backend_key",
 *     name="test-key",
 *     key_value=url_signature.b64_url,
 *     backend_bucket=test_backend.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Random = Pulumi.Random;
 * return await Deployment.RunAsync(() =>
 * {
 *     var urlSignature = new Random.RandomId("url_signature", new()
 *     {
 *         ByteLength = 16,
 *     });
 *     var bucket = new Gcp.Storage.Bucket("bucket", new()
 *     {
 *         Name = "test-storage-bucket",
 *         Location = "EU",
 *     });
 *     var testBackend = new Gcp.Compute.BackendBucket("test_backend", new()
 *     {
 *         Name = "test-signed-backend-bucket",
 *         Description = "Contains beautiful images",
 *         BucketName = bucket.Name,
 *         EnableCdn = true,
 *     });
 *     var backendKey = new Gcp.Compute.BackendBucketSignedUrlKey("backend_key", new()
 *     {
 *         Name = "test-key",
 *         KeyValue = urlSignature.B64Url,
 *         BackendBucket = testBackend.Name,
 *     });
 * });
 * ```
 * ```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-random/sdk/v4/go/random"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		urlSignature, err := random.NewRandomId(ctx, "url_signature", &random.RandomIdArgs{
 * 			ByteLength: pulumi.Int(16),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
 * 			Name:     pulumi.String("test-storage-bucket"),
 * 			Location: pulumi.String("EU"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		testBackend, err := compute.NewBackendBucket(ctx, "test_backend", &compute.BackendBucketArgs{
 * 			Name:        pulumi.String("test-signed-backend-bucket"),
 * 			Description: pulumi.String("Contains beautiful images"),
 * 			BucketName:  bucket.Name,
 * 			EnableCdn:   pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendBucketSignedUrlKey(ctx, "backend_key", &compute.BackendBucketSignedUrlKeyArgs{
 * 			Name:          pulumi.String("test-key"),
 * 			KeyValue:      urlSignature.B64Url,
 * 			BackendBucket: testBackend.Name,
 * 		})
 * 		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.random.RandomId;
 * import com.pulumi.random.RandomIdArgs;
 * 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.BackendBucketSignedUrlKey;
 * import com.pulumi.gcp.compute.BackendBucketSignedUrlKeyArgs;
 * 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 urlSignature = new RandomId("urlSignature", RandomIdArgs.builder()
 *             .byteLength(16)
 *             .build());
 *         var bucket = new Bucket("bucket", BucketArgs.builder()
 *             .name("test-storage-bucket")
 *             .location("EU")
 *             .build());
 *         var testBackend = new BackendBucket("testBackend", BackendBucketArgs.builder()
 *             .name("test-signed-backend-bucket")
 *             .description("Contains beautiful images")
 *             .bucketName(bucket.name())
 *             .enableCdn(true)
 *             .build());
 *         var backendKey = new BackendBucketSignedUrlKey("backendKey", BackendBucketSignedUrlKeyArgs.builder()
 *             .name("test-key")
 *             .keyValue(urlSignature.b64Url())
 *             .backendBucket(testBackend.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   urlSignature:
 *     type: random:RandomId
 *     name: url_signature
 *     properties:
 *       byteLength: 16
 *   backendKey:
 *     type: gcp:compute:BackendBucketSignedUrlKey
 *     name: backend_key
 *     properties:
 *       name: test-key
 *       keyValue: ${urlSignature.b64Url}
 *       backendBucket: ${testBackend.name}
 *   testBackend:
 *     type: gcp:compute:BackendBucket
 *     name: test_backend
 *     properties:
 *       name: test-signed-backend-bucket
 *       description: Contains beautiful images
 *       bucketName: ${bucket.name}
 *       enableCdn: true
 *   bucket:
 *     type: gcp:storage:Bucket
 *     properties:
 *       name: test-storage-bucket
 *       location: EU
 * ```
 * 
 * ## Import
 * This resource does not support import.
 */
public class BackendBucketSignedUrlKey internal constructor(
    override val javaResource: com.pulumi.gcp.compute.BackendBucketSignedUrlKey,
) : KotlinCustomResource(javaResource, BackendBucketSignedUrlKeyMapper) {
    /**
     * The backend bucket this signed URL key belongs.
     * - - -
     */
    public val backendBucket: Output
        get() = javaResource.backendBucket().applyValue({ args0 -> args0 })

    /**
     * 128-bit key value used for signing the URL. The key value must be a
     * valid RFC 4648 Section 5 base64url encoded string.
     * **Note**: This property is sensitive and will not be displayed in the plan.
     */
    public val keyValue: Output
        get() = javaResource.keyValue().applyValue({ args0 -> args0 })

    /**
     * Name of the signed URL key.
     */
    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 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy