com.pulumi.gcp.container.kotlin.Registry.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.container.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 [Registry].
*/
@PulumiTagMarker
public class RegistryResourceBuilder internal constructor() {
public var name: String? = null
public var args: RegistryArgs = RegistryArgs()
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 RegistryArgsBuilder.() -> Unit) {
val builder = RegistryArgsBuilder()
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(): Registry {
val builtJavaResource = com.pulumi.gcp.container.Registry(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Registry(builtJavaResource)
}
}
/**
* Ensures that the Google Cloud Storage bucket that backs Google Container Registry exists. Creating this resource will create the backing bucket if it does not exist, or do nothing if the bucket already exists. Destroying this resource does *NOT* destroy the backing bucket. For more information see [the official documentation](https://cloud.google.com/container-registry/docs/overview)
* This resource can be used to ensure that the GCS bucket exists prior to assigning permissions. For more information see the [access control page](https://cloud.google.com/container-registry/docs/access-control) for GCR.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const registry = new gcp.container.Registry("registry", {
* project: "my-project",
* location: "EU",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* registry = gcp.container.Registry("registry",
* project="my-project",
* location="EU")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var registry = new Gcp.Container.Registry("registry", new()
* {
* Project = "my-project",
* Location = "EU",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := container.NewRegistry(ctx, "registry", &container.RegistryArgs{
* Project: pulumi.String("my-project"),
* Location: pulumi.String("EU"),
* })
* 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.container.Registry;
* import com.pulumi.gcp.container.RegistryArgs;
* 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 registry = new Registry("registry", RegistryArgs.builder()
* .project("my-project")
* .location("EU")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* registry:
* type: gcp:container:Registry
* properties:
* project: my-project
* location: EU
* ```
*
* The `id` field of the `gcp.container.Registry` is the identifier of the storage bucket that backs GCR and can be used to assign permissions to the bucket.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const registry = new gcp.container.Registry("registry", {
* project: "my-project",
* location: "EU",
* });
* const viewer = new gcp.storage.BucketIAMMember("viewer", {
* bucket: registry.id,
* role: "roles/storage.objectViewer",
* member: "user:[email protected]",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* registry = gcp.container.Registry("registry",
* project="my-project",
* location="EU")
* viewer = gcp.storage.BucketIAMMember("viewer",
* bucket=registry.id,
* role="roles/storage.objectViewer",
* member="user:[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var registry = new Gcp.Container.Registry("registry", new()
* {
* Project = "my-project",
* Location = "EU",
* });
* var viewer = new Gcp.Storage.BucketIAMMember("viewer", new()
* {
* Bucket = registry.Id,
* Role = "roles/storage.objectViewer",
* Member = "user:[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "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 {
* registry, err := container.NewRegistry(ctx, "registry", &container.RegistryArgs{
* Project: pulumi.String("my-project"),
* Location: pulumi.String("EU"),
* })
* if err != nil {
* return err
* }
* _, err = storage.NewBucketIAMMember(ctx, "viewer", &storage.BucketIAMMemberArgs{
* Bucket: registry.ID(),
* Role: pulumi.String("roles/storage.objectViewer"),
* Member: pulumi.String("user:[email protected]"),
* })
* 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.container.Registry;
* import com.pulumi.gcp.container.RegistryArgs;
* import com.pulumi.gcp.storage.BucketIAMMember;
* import com.pulumi.gcp.storage.BucketIAMMemberArgs;
* 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 registry = new Registry("registry", RegistryArgs.builder()
* .project("my-project")
* .location("EU")
* .build());
* var viewer = new BucketIAMMember("viewer", BucketIAMMemberArgs.builder()
* .bucket(registry.id())
* .role("roles/storage.objectViewer")
* .member("user:[email protected]")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* registry:
* type: gcp:container:Registry
* properties:
* project: my-project
* location: EU
* viewer:
* type: gcp:storage:BucketIAMMember
* properties:
* bucket: ${registry.id}
* role: roles/storage.objectViewer
* member: user:[email protected]
* ```
*
* ## Import
* This resource does not support import.
*/
public class Registry internal constructor(
override val javaResource: com.pulumi.gcp.container.Registry,
) : KotlinCustomResource(javaResource, RegistryMapper) {
/**
* The URI of the created resource.
*/
public val bucketSelfLink: Output
get() = javaResource.bucketSelfLink().applyValue({ args0 -> args0 })
/**
* The location of the registry. One of `ASIA`, `EU`, `US` or not specified. See [the official documentation](https://cloud.google.com/container-registry/docs/pushing-and-pulling#pushing_an_image_to_a_registry) for more information on registry locations.
*/
public val location: Output?
get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* 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 RegistryMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.container.Registry::class == javaResource::class
override fun map(javaResource: Resource): Registry = Registry(
javaResource as
com.pulumi.gcp.container.Registry,
)
}
/**
* @see [Registry].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Registry].
*/
public suspend fun registry(name: String, block: suspend RegistryResourceBuilder.() -> Unit): Registry {
val builder = RegistryResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Registry].
* @param name The _unique_ name of the resulting resource.
*/
public fun registry(name: String): Registry {
val builder = RegistryResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy