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

com.pulumi.azure.containerservice.kotlin.Registry.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: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.containerservice.kotlin

import com.pulumi.azure.containerservice.kotlin.outputs.RegistryEncryption
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryGeoreplication
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryIdentity
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryNetworkRuleSet
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryRetentionPolicy
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryTrustPolicy
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
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryEncryption.Companion.toKotlin as registryEncryptionToKotlin
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryGeoreplication.Companion.toKotlin as registryGeoreplicationToKotlin
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryIdentity.Companion.toKotlin as registryIdentityToKotlin
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryNetworkRuleSet.Companion.toKotlin as registryNetworkRuleSetToKotlin
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryRetentionPolicy.Companion.toKotlin as registryRetentionPolicyToKotlin
import com.pulumi.azure.containerservice.kotlin.outputs.RegistryTrustPolicy.Companion.toKotlin as registryTrustPolicyToKotlin

/**
 * 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.azure.containerservice.Registry(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Registry(builtJavaResource)
    }
}

/**
 * Manages an Azure Container Registry.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const acr = new azure.containerservice.Registry("acr", {
 *     name: "containerRegistry1",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Premium",
 *     adminEnabled: false,
 *     georeplications: [
 *         {
 *             location: "East US",
 *             zoneRedundancyEnabled: true,
 *             tags: {},
 *         },
 *         {
 *             location: "North Europe",
 *             zoneRedundancyEnabled: true,
 *             tags: {},
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * acr = azure.containerservice.Registry("acr",
 *     name="containerRegistry1",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku="Premium",
 *     admin_enabled=False,
 *     georeplications=[
 *         {
 *             "location": "East US",
 *             "zone_redundancy_enabled": True,
 *             "tags": {},
 *         },
 *         {
 *             "location": "North Europe",
 *             "zone_redundancy_enabled": True,
 *             "tags": {},
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var acr = new Azure.ContainerService.Registry("acr", new()
 *     {
 *         Name = "containerRegistry1",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = "Premium",
 *         AdminEnabled = false,
 *         Georeplications = new[]
 *         {
 *             new Azure.ContainerService.Inputs.RegistryGeoreplicationArgs
 *             {
 *                 Location = "East US",
 *                 ZoneRedundancyEnabled = true,
 *                 Tags = null,
 *             },
 *             new Azure.ContainerService.Inputs.RegistryGeoreplicationArgs
 *             {
 *                 Location = "North Europe",
 *                 ZoneRedundancyEnabled = true,
 *                 Tags = null,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/containerservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = containerservice.NewRegistry(ctx, "acr", &containerservice.RegistryArgs{
 * 			Name:              pulumi.String("containerRegistry1"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku:               pulumi.String("Premium"),
 * 			AdminEnabled:      pulumi.Bool(false),
 * 			Georeplications: containerservice.RegistryGeoreplicationArray{
 * 				&containerservice.RegistryGeoreplicationArgs{
 * 					Location:              pulumi.String("East US"),
 * 					ZoneRedundancyEnabled: pulumi.Bool(true),
 * 					Tags:                  nil,
 * 				},
 * 				&containerservice.RegistryGeoreplicationArgs{
 * 					Location:              pulumi.String("North Europe"),
 * 					ZoneRedundancyEnabled: pulumi.Bool(true),
 * 					Tags:                  nil,
 * 				},
 * 			},
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.containerservice.Registry;
 * import com.pulumi.azure.containerservice.RegistryArgs;
 * import com.pulumi.azure.containerservice.inputs.RegistryGeoreplicationArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var acr = new Registry("acr", RegistryArgs.builder()
 *             .name("containerRegistry1")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Premium")
 *             .adminEnabled(false)
 *             .georeplications(
 *                 RegistryGeoreplicationArgs.builder()
 *                     .location("East US")
 *                     .zoneRedundancyEnabled(true)
 *                     .tags()
 *                     .build(),
 *                 RegistryGeoreplicationArgs.builder()
 *                     .location("North Europe")
 *                     .zoneRedundancyEnabled(true)
 *                     .tags()
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   acr:
 *     type: azure:containerservice:Registry
 *     properties:
 *       name: containerRegistry1
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku: Premium
 *       adminEnabled: false
 *       georeplications:
 *         - location: East US
 *           zoneRedundancyEnabled: true
 *           tags: {}
 *         - location: North Europe
 *           zoneRedundancyEnabled: true
 *           tags: {}
 * ```
 * 
 * ### Encryption)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     name: "registry-uai",
 * });
 * const example = azure.keyvault.getKey({
 *     name: "super-secret",
 *     keyVaultId: existing.id,
 * });
 * const acr = new azure.containerservice.Registry("acr", {
 *     name: "containerRegistry1",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     sku: "Premium",
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 *     encryption: {
 *         enabled: true,
 *         keyVaultKeyId: example.then(example => example.id),
 *         identityClientId: exampleUserAssignedIdentity.clientId,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     name="registry-uai")
 * example = azure.keyvault.get_key(name="super-secret",
 *     key_vault_id=existing["id"])
 * acr = azure.containerservice.Registry("acr",
 *     name="containerRegistry1",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     sku="Premium",
 *     identity={
 *         "type": "UserAssigned",
 *         "identity_ids": [example_user_assigned_identity.id],
 *     },
 *     encryption={
 *         "enabled": True,
 *         "key_vault_key_id": example.id,
 *         "identity_client_id": example_user_assigned_identity.client_id,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
 *     {
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         Name = "registry-uai",
 *     });
 *     var example = Azure.KeyVault.GetKey.Invoke(new()
 *     {
 *         Name = "super-secret",
 *         KeyVaultId = existing.Id,
 *     });
 *     var acr = new Azure.ContainerService.Registry("acr", new()
 *     {
 *         Name = "containerRegistry1",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         Sku = "Premium",
 *         Identity = new Azure.ContainerService.Inputs.RegistryIdentityArgs
 *         {
 *             Type = "UserAssigned",
 *             IdentityIds = new[]
 *             {
 *                 exampleUserAssignedIdentity.Id,
 *             },
 *         },
 *         Encryption = new Azure.ContainerService.Inputs.RegistryEncryptionArgs
 *         {
 *             Enabled = true,
 *             KeyVaultKeyId = example.Apply(getKeyResult => getKeyResult.Id),
 *             IdentityClientId = exampleUserAssignedIdentity.ClientId,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/containerservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Location:          exampleResourceGroup.Location,
 * 			Name:              pulumi.String("registry-uai"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := keyvault.LookupKey(ctx, &keyvault.LookupKeyArgs{
 * 			Name:       "super-secret",
 * 			KeyVaultId: existing.Id,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = containerservice.NewRegistry(ctx, "acr", &containerservice.RegistryArgs{
 * 			Name:              pulumi.String("containerRegistry1"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Location:          exampleResourceGroup.Location,
 * 			Sku:               pulumi.String("Premium"),
 * 			Identity: &containerservice.RegistryIdentityArgs{
 * 				Type: pulumi.String("UserAssigned"),
 * 				IdentityIds: pulumi.StringArray{
 * 					exampleUserAssignedIdentity.ID(),
 * 				},
 * 			},
 * 			Encryption: &containerservice.RegistryEncryptionArgs{
 * 				Enabled:          pulumi.Bool(true),
 * 				KeyVaultKeyId:    pulumi.String(example.Id),
 * 				IdentityClientId: exampleUserAssignedIdentity.ClientId,
 * 			},
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.authorization.UserAssignedIdentity;
 * import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
 * import com.pulumi.azure.keyvault.KeyvaultFunctions;
 * import com.pulumi.azure.keyvault.inputs.GetKeyArgs;
 * import com.pulumi.azure.containerservice.Registry;
 * import com.pulumi.azure.containerservice.RegistryArgs;
 * import com.pulumi.azure.containerservice.inputs.RegistryIdentityArgs;
 * import com.pulumi.azure.containerservice.inputs.RegistryEncryptionArgs;
 * 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .name("registry-uai")
 *             .build());
 *         final var example = KeyvaultFunctions.getKey(GetKeyArgs.builder()
 *             .name("super-secret")
 *             .keyVaultId(existing.id())
 *             .build());
 *         var acr = new Registry("acr", RegistryArgs.builder()
 *             .name("containerRegistry1")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .sku("Premium")
 *             .identity(RegistryIdentityArgs.builder()
 *                 .type("UserAssigned")
 *                 .identityIds(exampleUserAssignedIdentity.id())
 *                 .build())
 *             .encryption(RegistryEncryptionArgs.builder()
 *                 .enabled(true)
 *                 .keyVaultKeyId(example.applyValue(getKeyResult -> getKeyResult.id()))
 *                 .identityClientId(exampleUserAssignedIdentity.clientId())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   acr:
 *     type: azure:containerservice:Registry
 *     properties:
 *       name: containerRegistry1
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       sku: Premium
 *       identity:
 *         type: UserAssigned
 *         identityIds:
 *           - ${exampleUserAssignedIdentity.id}
 *       encryption:
 *         enabled: true
 *         keyVaultKeyId: ${example.id}
 *         identityClientId: ${exampleUserAssignedIdentity.clientId}
 *   exampleUserAssignedIdentity:
 *     type: azure:authorization:UserAssignedIdentity
 *     name: example
 *     properties:
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       name: registry-uai
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:keyvault:getKey
 *       Arguments:
 *         name: super-secret
 *         keyVaultId: ${existing.id}
 * ```
 * 
 * ### Attaching A Container Registry To A Kubernetes Cluster)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleRegistry = new azure.containerservice.Registry("example", {
 *     name: "containerRegistry1",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Premium",
 * });
 * const exampleKubernetesCluster = new azure.containerservice.KubernetesCluster("example", {
 *     name: "example-aks1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     dnsPrefix: "exampleaks1",
 *     defaultNodePool: {
 *         name: "default",
 *         nodeCount: 1,
 *         vmSize: "Standard_D2_v2",
 *     },
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 *     tags: {
 *         Environment: "Production",
 *     },
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     principalId: exampleKubernetesCluster.kubeletIdentity.apply(kubeletIdentity => kubeletIdentity.objectId),
 *     roleDefinitionName: "AcrPull",
 *     scope: exampleRegistry.id,
 *     skipServicePrincipalAadCheck: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_registry = azure.containerservice.Registry("example",
 *     name="containerRegistry1",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku="Premium")
 * example_kubernetes_cluster = azure.containerservice.KubernetesCluster("example",
 *     name="example-aks1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     dns_prefix="exampleaks1",
 *     default_node_pool={
 *         "name": "default",
 *         "node_count": 1,
 *         "vm_size": "Standard_D2_v2",
 *     },
 *     identity={
 *         "type": "SystemAssigned",
 *     },
 *     tags={
 *         "Environment": "Production",
 *     })
 * example_assignment = azure.authorization.Assignment("example",
 *     principal_id=example_kubernetes_cluster.kubelet_identity.object_id,
 *     role_definition_name="AcrPull",
 *     scope=example_registry.id,
 *     skip_service_principal_aad_check=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleRegistry = new Azure.ContainerService.Registry("example", new()
 *     {
 *         Name = "containerRegistry1",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = "Premium",
 *     });
 *     var exampleKubernetesCluster = new Azure.ContainerService.KubernetesCluster("example", new()
 *     {
 *         Name = "example-aks1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         DnsPrefix = "exampleaks1",
 *         DefaultNodePool = new Azure.ContainerService.Inputs.KubernetesClusterDefaultNodePoolArgs
 *         {
 *             Name = "default",
 *             NodeCount = 1,
 *             VmSize = "Standard_D2_v2",
 *         },
 *         Identity = new Azure.ContainerService.Inputs.KubernetesClusterIdentityArgs
 *         {
 *             Type = "SystemAssigned",
 *         },
 *         Tags =
 *         {
 *             { "Environment", "Production" },
 *         },
 *     });
 *     var exampleAssignment = new Azure.Authorization.Assignment("example", new()
 *     {
 *         PrincipalId = exampleKubernetesCluster.KubeletIdentity.Apply(kubeletIdentity => kubeletIdentity.ObjectId),
 *         RoleDefinitionName = "AcrPull",
 *         Scope = exampleRegistry.Id,
 *         SkipServicePrincipalAadCheck = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/containerservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRegistry, err := containerservice.NewRegistry(ctx, "example", &containerservice.RegistryArgs{
 * 			Name:              pulumi.String("containerRegistry1"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku:               pulumi.String("Premium"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKubernetesCluster, err := containerservice.NewKubernetesCluster(ctx, "example", &containerservice.KubernetesClusterArgs{
 * 			Name:              pulumi.String("example-aks1"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			DnsPrefix:         pulumi.String("exampleaks1"),
 * 			DefaultNodePool: &containerservice.KubernetesClusterDefaultNodePoolArgs{
 * 				Name:      pulumi.String("default"),
 * 				NodeCount: pulumi.Int(1),
 * 				VmSize:    pulumi.String("Standard_D2_v2"),
 * 			},
 * 			Identity: &containerservice.KubernetesClusterIdentityArgs{
 * 				Type: pulumi.String("SystemAssigned"),
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"Environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			PrincipalId: pulumi.String(exampleKubernetesCluster.KubeletIdentity.ApplyT(func(kubeletIdentity containerservice.KubernetesClusterKubeletIdentity) (*string, error) {
 * 				return &kubeletIdentity.ObjectId, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			RoleDefinitionName:           pulumi.String("AcrPull"),
 * 			Scope:                        exampleRegistry.ID(),
 * 			SkipServicePrincipalAadCheck: 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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.containerservice.Registry;
 * import com.pulumi.azure.containerservice.RegistryArgs;
 * import com.pulumi.azure.containerservice.KubernetesCluster;
 * import com.pulumi.azure.containerservice.KubernetesClusterArgs;
 * import com.pulumi.azure.containerservice.inputs.KubernetesClusterDefaultNodePoolArgs;
 * import com.pulumi.azure.containerservice.inputs.KubernetesClusterIdentityArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleRegistry = new Registry("exampleRegistry", RegistryArgs.builder()
 *             .name("containerRegistry1")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Premium")
 *             .build());
 *         var exampleKubernetesCluster = new KubernetesCluster("exampleKubernetesCluster", KubernetesClusterArgs.builder()
 *             .name("example-aks1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .dnsPrefix("exampleaks1")
 *             .defaultNodePool(KubernetesClusterDefaultNodePoolArgs.builder()
 *                 .name("default")
 *                 .nodeCount(1)
 *                 .vmSize("Standard_D2_v2")
 *                 .build())
 *             .identity(KubernetesClusterIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .tags(Map.of("Environment", "Production"))
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .principalId(exampleKubernetesCluster.kubeletIdentity().applyValue(kubeletIdentity -> kubeletIdentity.objectId()))
 *             .roleDefinitionName("AcrPull")
 *             .scope(exampleRegistry.id())
 *             .skipServicePrincipalAadCheck(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleRegistry:
 *     type: azure:containerservice:Registry
 *     name: example
 *     properties:
 *       name: containerRegistry1
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku: Premium
 *   exampleKubernetesCluster:
 *     type: azure:containerservice:KubernetesCluster
 *     name: example
 *     properties:
 *       name: example-aks1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       dnsPrefix: exampleaks1
 *       defaultNodePool:
 *         name: default
 *         nodeCount: 1
 *         vmSize: Standard_D2_v2
 *       identity:
 *         type: SystemAssigned
 *       tags:
 *         Environment: Production
 *   exampleAssignment:
 *     type: azure:authorization:Assignment
 *     name: example
 *     properties:
 *       principalId: ${exampleKubernetesCluster.kubeletIdentity.objectId}
 *       roleDefinitionName: AcrPull
 *       scope: ${exampleRegistry.id}
 *       skipServicePrincipalAadCheck: true
 * ```
 * 
 * ## Import
 * Container Registries can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:containerservice/registry:Registry example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ContainerRegistry/registries/myregistry1
 * ```
 */
public class Registry internal constructor(
    override val javaResource: com.pulumi.azure.containerservice.Registry,
) : KotlinCustomResource(javaResource, RegistryMapper) {
    /**
     * Specifies whether the admin user is enabled. Defaults to `false`.
     */
    public val adminEnabled: Output?
        get() = javaResource.adminEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Password associated with the Container Registry Admin account - if the admin account is enabled.
     */
    public val adminPassword: Output
        get() = javaResource.adminPassword().applyValue({ args0 -> args0 })

    /**
     * The Username associated with the Container Registry Admin account - if the admin account is enabled.
     */
    public val adminUsername: Output
        get() = javaResource.adminUsername().applyValue({ args0 -> args0 })

    /**
     * Whether allows anonymous (unauthenticated) pull access to this Container Registry? This is only supported on resources with the `Standard` or `Premium` SKU.
     */
    public val anonymousPullEnabled: Output?
        get() = javaResource.anonymousPullEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether to enable dedicated data endpoints for this Container Registry? This is only supported on resources with the `Premium` SKU.
     */
    public val dataEndpointEnabled: Output?
        get() = javaResource.dataEndpointEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `encryption` block as documented below.
     */
    public val encryption: Output
        get() = javaResource.encryption().applyValue({ args0 ->
            args0.let({ args0 ->
                registryEncryptionToKotlin(args0)
            })
        })

    /**
     * Boolean value that indicates whether export policy is enabled. Defaults to `true`. In order to set it to `false`, make sure the `public_network_access_enabled` is also set to `false`.
     * > **NOTE:** `quarantine_policy_enabled`, `retention_policy`, `trust_policy`, `export_policy_enabled` and `zone_redundancy_enabled` are only supported on resources with the `Premium` SKU.
     */
    public val exportPolicyEnabled: Output?
        get() = javaResource.exportPolicyEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `georeplications` block as documented below.
     * > **NOTE:** The `georeplications` is only supported on new resources with the `Premium` SKU.
     * > **NOTE:** The `georeplications` list cannot contain the location where the Container Registry exists.
     * > **NOTE:** If more than one `georeplications` block is specified, they are expected to follow the alphabetic order on the `location` property.
     */
    public val georeplications: Output>?
        get() = javaResource.georeplications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        registryGeoreplicationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    registryIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The URL that can be used to log into the container registry.
     */
    public val loginServer: Output
        get() = javaResource.loginServer().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Container Registry. Only Alphanumeric characters allowed. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Whether to allow trusted Azure services to access a network restricted Container Registry? Possible values are `None` and `AzureServices`. Defaults to `AzureServices`.
     */
    public val networkRuleBypassOption: Output?
        get() = javaResource.networkRuleBypassOption().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `network_rule_set` block as documented below.
     */
    public val networkRuleSet: Output
        get() = javaResource.networkRuleSet().applyValue({ args0 ->
            args0.let({ args0 ->
                registryNetworkRuleSetToKotlin(args0)
            })
        })

    /**
     * Whether public network access is allowed for the container registry. Defaults to `true`.
     */
    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Boolean value that indicates whether quarantine policy is enabled.
     */
    public val quarantinePolicyEnabled: Output?
        get() = javaResource.quarantinePolicyEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource group in which to create the Container Registry. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `retention_policy` block as documented below.
     */
    public val retentionPolicy: Output
        get() = javaResource.retentionPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                registryRetentionPolicyToKotlin(args0)
            })
        })

    /**
     * The SKU name of the container registry. Possible values are `Basic`, `Standard` and `Premium`.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `trust_policy` block as documented below.
     */
    public val trustPolicy: Output
        get() = javaResource.trustPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                registryTrustPolicyToKotlin(args0)
            })
        })

    /**
     * Whether zone redundancy is enabled for this Container Registry? Changing this forces a new resource to be created. Defaults to `false`.
     */
    public val zoneRedundancyEnabled: Output?
        get() = javaResource.zoneRedundancyEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object RegistryMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.containerservice.Registry::class == javaResource::class

    override fun map(javaResource: Resource): Registry = Registry(
        javaResource as
            com.pulumi.azure.containerservice.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