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

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

package com.pulumi.azure.keyvault.kotlin

import com.pulumi.azure.keyvault.CertificateContactsArgs.builder
import com.pulumi.azure.keyvault.kotlin.inputs.CertificateContactsContactArgs
import com.pulumi.azure.keyvault.kotlin.inputs.CertificateContactsContactArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages Key Vault Certificate Contacts.
 * ## Disclaimers
 * 
 * > **Note:** It's possible to define Key Vault Certificate Contacts both within the `azure.keyvault.KeyVault` resource via the `contact` block and by using the `azure.keyvault.CertificateContacts` resource. However it's not possible to use both methods to manage Certificate Contacts within a KeyVault, since there'll be conflicts.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "examplekeyvault",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "premium",
 * });
 * const exampleAccessPolicy = new azure.keyvault.AccessPolicy("example", {
 *     keyVaultId: exampleKeyVault.id,
 *     tenantId: current.then(current => current.tenantId),
 *     objectId: current.then(current => current.objectId),
 *     certificatePermissions: ["ManageContacts"],
 *     keyPermissions: ["Create"],
 *     secretPermissions: ["Set"],
 * });
 * const exampleCertificateContacts = new azure.keyvault.CertificateContacts("example", {
 *     keyVaultId: exampleKeyVault.id,
 *     contacts: [
 *         {
 *             email: "[email protected]",
 *             name: "example",
 *             phone: "01234567890",
 *         },
 *         {
 *             email: "[email protected]",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_key_vault = azure.keyvault.KeyVault("example",
 *     name="examplekeyvault",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     tenant_id=current.tenant_id,
 *     sku_name="premium")
 * example_access_policy = azure.keyvault.AccessPolicy("example",
 *     key_vault_id=example_key_vault.id,
 *     tenant_id=current.tenant_id,
 *     object_id=current.object_id,
 *     certificate_permissions=["ManageContacts"],
 *     key_permissions=["Create"],
 *     secret_permissions=["Set"])
 * example_certificate_contacts = azure.keyvault.CertificateContacts("example",
 *     key_vault_id=example_key_vault.id,
 *     contacts=[
 *         azure.keyvault.CertificateContactsContactArgs(
 *             email="[email protected]",
 *             name="example",
 *             phone="01234567890",
 *         ),
 *         azure.keyvault.CertificateContactsContactArgs(
 *             email="[email protected]",
 *         ),
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
 *     {
 *         Name = "examplekeyvault",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         SkuName = "premium",
 *     });
 *     var exampleAccessPolicy = new Azure.KeyVault.AccessPolicy("example", new()
 *     {
 *         KeyVaultId = exampleKeyVault.Id,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *         CertificatePermissions = new[]
 *         {
 *             "ManageContacts",
 *         },
 *         KeyPermissions = new[]
 *         {
 *             "Create",
 *         },
 *         SecretPermissions = new[]
 *         {
 *             "Set",
 *         },
 *     });
 *     var exampleCertificateContacts = new Azure.KeyVault.CertificateContacts("example", new()
 *     {
 *         KeyVaultId = exampleKeyVault.Id,
 *         Contacts = new[]
 *         {
 *             new Azure.KeyVault.Inputs.CertificateContactsContactArgs
 *             {
 *                 Email = "[email protected]",
 *                 Name = "example",
 *                 Phone = "01234567890",
 *             },
 *             new Azure.KeyVault.Inputs.CertificateContactsContactArgs
 *             {
 *                 Email = "[email protected]",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
 * 			Name:              pulumi.String("examplekeyvault"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			TenantId:          pulumi.String(current.TenantId),
 * 			SkuName:           pulumi.String("premium"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = keyvault.NewAccessPolicy(ctx, "example", &keyvault.AccessPolicyArgs{
 * 			KeyVaultId: exampleKeyVault.ID(),
 * 			TenantId:   pulumi.String(current.TenantId),
 * 			ObjectId:   pulumi.String(current.ObjectId),
 * 			CertificatePermissions: pulumi.StringArray{
 * 				pulumi.String("ManageContacts"),
 * 			},
 * 			KeyPermissions: pulumi.StringArray{
 * 				pulumi.String("Create"),
 * 			},
 * 			SecretPermissions: pulumi.StringArray{
 * 				pulumi.String("Set"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = keyvault.NewCertificateContacts(ctx, "example", &keyvault.CertificateContactsArgs{
 * 			KeyVaultId: exampleKeyVault.ID(),
 * 			Contacts: keyvault.CertificateContactsContactArray{
 * 				&keyvault.CertificateContactsContactArgs{
 * 					Email: pulumi.String("[email protected]"),
 * 					Name:  pulumi.String("example"),
 * 					Phone: pulumi.String("01234567890"),
 * 				},
 * 				&keyvault.CertificateContactsContactArgs{
 * 					Email: pulumi.String("[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.azure.core.CoreFunctions;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.keyvault.KeyVault;
 * import com.pulumi.azure.keyvault.KeyVaultArgs;
 * import com.pulumi.azure.keyvault.AccessPolicy;
 * import com.pulumi.azure.keyvault.AccessPolicyArgs;
 * import com.pulumi.azure.keyvault.CertificateContacts;
 * import com.pulumi.azure.keyvault.CertificateContactsArgs;
 * import com.pulumi.azure.keyvault.inputs.CertificateContactsContactArgs;
 * 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) {
 *         final var current = CoreFunctions.getClientConfig();
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
 *             .name("examplekeyvault")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .skuName("premium")
 *             .build());
 *         var exampleAccessPolicy = new AccessPolicy("exampleAccessPolicy", AccessPolicyArgs.builder()
 *             .keyVaultId(exampleKeyVault.id())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .certificatePermissions("ManageContacts")
 *             .keyPermissions("Create")
 *             .secretPermissions("Set")
 *             .build());
 *         var exampleCertificateContacts = new CertificateContacts("exampleCertificateContacts", CertificateContactsArgs.builder()
 *             .keyVaultId(exampleKeyVault.id())
 *             .contacts(
 *                 CertificateContactsContactArgs.builder()
 *                     .email("[email protected]")
 *                     .name("example")
 *                     .phone("01234567890")
 *                     .build(),
 *                 CertificateContactsContactArgs.builder()
 *                     .email("[email protected]")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleKeyVault:
 *     type: azure:keyvault:KeyVault
 *     name: example
 *     properties:
 *       name: examplekeyvault
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       tenantId: ${current.tenantId}
 *       skuName: premium
 *   exampleAccessPolicy:
 *     type: azure:keyvault:AccessPolicy
 *     name: example
 *     properties:
 *       keyVaultId: ${exampleKeyVault.id}
 *       tenantId: ${current.tenantId}
 *       objectId: ${current.objectId}
 *       certificatePermissions:
 *         - ManageContacts
 *       keyPermissions:
 *         - Create
 *       secretPermissions:
 *         - Set
 *   exampleCertificateContacts:
 *     type: azure:keyvault:CertificateContacts
 *     name: example
 *     properties:
 *       keyVaultId: ${exampleKeyVault.id}
 *       contacts:
 *         - email: [email protected]
 *           name: example
 *           phone: '01234567890'
 *         - email: [email protected]
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Key Vault Certificate Contacts can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:keyvault/certificateContacts:CertificateContacts example https://example-keyvault.vault.azure.net/certificates/contacts
 * ```
 * @property contacts One or more `contact` blocks as defined below.
 * -->
 * @property keyVaultId The ID of the Key Vault. Changing this forces a new resource to be created.
 */
public data class CertificateContactsArgs(
    public val contacts: Output>? = null,
    public val keyVaultId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.keyvault.CertificateContactsArgs =
        com.pulumi.azure.keyvault.CertificateContactsArgs.builder()
            .contacts(
                contacts?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .keyVaultId(keyVaultId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [CertificateContactsArgs].
 */
@PulumiTagMarker
public class CertificateContactsArgsBuilder internal constructor() {
    private var contacts: Output>? = null

    private var keyVaultId: Output? = null

    /**
     * @param value One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("mtwcbdbsinhvohtr")
    public suspend fun contacts(`value`: Output>) {
        this.contacts = value
    }

    @JvmName("boigfmayqcjiksrx")
    public suspend fun contacts(vararg values: Output) {
        this.contacts = Output.all(values.asList())
    }

    /**
     * @param values One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("unsundutyaoqrjtj")
    public suspend fun contacts(values: List>) {
        this.contacts = Output.all(values)
    }

    /**
     * @param value The ID of the Key Vault. Changing this forces a new resource to be created.
     */
    @JvmName("qufdvxugrdndoblk")
    public suspend fun keyVaultId(`value`: Output) {
        this.keyVaultId = value
    }

    /**
     * @param value One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("uwoiwrtokevqinye")
    public suspend fun contacts(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.contacts = mapped
    }

    /**
     * @param argument One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("aoppsigkajelmhvu")
    public suspend
    fun contacts(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            CertificateContactsContactArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.contacts = mapped
    }

    /**
     * @param argument One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("oleuvgumwetwoagm")
    public suspend fun contacts(
        vararg
        argument: suspend CertificateContactsContactArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            CertificateContactsContactArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.contacts = mapped
    }

    /**
     * @param argument One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("uiupldiaqscsojcn")
    public suspend fun contacts(argument: suspend CertificateContactsContactArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            CertificateContactsContactArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.contacts = mapped
    }

    /**
     * @param values One or more `contact` blocks as defined below.
     * -->
     */
    @JvmName("etitanpkwtsyqjov")
    public suspend fun contacts(vararg values: CertificateContactsContactArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.contacts = mapped
    }

    /**
     * @param value The ID of the Key Vault. Changing this forces a new resource to be created.
     */
    @JvmName("bhwffmuattemjeby")
    public suspend fun keyVaultId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyVaultId = mapped
    }

    internal fun build(): CertificateContactsArgs = CertificateContactsArgs(
        contacts = contacts,
        keyVaultId = keyVaultId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy