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

com.pulumi.azure.appservice.kotlin.CertificateArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.appservice.kotlin

import com.pulumi.azure.appservice.CertificateArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages an App Service certificate.
 * ## Example Usage
 * This example provisions an App Service Certificate from a Local File.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleCertificate = new azure.appservice.Certificate("example", {
 *     name: "example-cert",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     pfxBlob: std.filebase64({
 *         input: "certificate.pfx",
 *     }).then(invoke => invoke.result),
 *     password: "password123!",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_std as std
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_certificate = azure.appservice.Certificate("example",
 *     name="example-cert",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     pfx_blob=std.filebase64(input="certificate.pfx").result,
 *     password="password123!")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleCertificate = new Azure.AppService.Certificate("example", new()
 *     {
 *         Name = "example-cert",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         PfxBlob = Std.Filebase64.Invoke(new()
 *         {
 *             Input = "certificate.pfx",
 *         }).Apply(invoke => invoke.Result),
 *         Password = "password123!",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"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
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "certificate.pfx",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewCertificate(ctx, "example", &appservice.CertificateArgs{
 * 			Name:              pulumi.String("example-cert"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			PfxBlob:           invokeFilebase64.Result,
 * 			Password:          pulumi.String("password123!"),
 * 		})
 * 		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.appservice.Certificate;
 * import com.pulumi.azure.appservice.CertificateArgs;
 * 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 exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
 *             .name("example-cert")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .pfxBlob(StdFunctions.filebase64(Filebase64Args.builder()
 *                 .input("certificate.pfx")
 *                 .build()).result())
 *             .password("password123!")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleCertificate:
 *     type: azure:appservice:Certificate
 *     name: example
 *     properties:
 *       name: example-cert
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       pfxBlob:
 *         fn::invoke:
 *           Function: std:filebase64
 *           Arguments:
 *             input: certificate.pfx
 *           Return: result
 *       password: password123!
 * ```
 * 
 * ## Import
 * App Service Certificates can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/certificate:Certificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/certificates/certificate1
 * ```
 * @property appServicePlanId The ID of the associated App Service plan. Must be specified when the certificate is used inside an App Service Environment hosted App Service. Changing this forces a new resource to be created.
 * @property keyVaultId
 * @property keyVaultSecretId The ID of the Key Vault secret. Changing this forces a new resource to be created.
 * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
 * @property location Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
 * @property name Specifies the name of the certificate. Changing this forces a new resource to be created.
 * @property password The password to access the certificate's private key. Changing this forces a new resource to be created.
 * @property pfxBlob The base64-encoded contents of the certificate. Changing this forces a new resource to be created.
 * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
 * @property resourceGroupName The name of the resource group in which to create the certificate. Changing this forces a new resource to be created.
 * > **NOTE:** The resource group must be the same as that which the app service plan is defined in - otherwise the certificate will not show as available for the app services.
 * @property tags
 */
public data class CertificateArgs(
    public val appServicePlanId: Output? = null,
    public val keyVaultId: Output? = null,
    public val keyVaultSecretId: Output? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val password: Output? = null,
    public val pfxBlob: Output? = null,
    public val resourceGroupName: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.appservice.CertificateArgs =
        com.pulumi.azure.appservice.CertificateArgs.builder()
            .appServicePlanId(appServicePlanId?.applyValue({ args0 -> args0 }))
            .keyVaultId(keyVaultId?.applyValue({ args0 -> args0 }))
            .keyVaultSecretId(keyVaultSecretId?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .password(password?.applyValue({ args0 -> args0 }))
            .pfxBlob(pfxBlob?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [CertificateArgs].
 */
@PulumiTagMarker
public class CertificateArgsBuilder internal constructor() {
    private var appServicePlanId: Output? = null

    private var keyVaultId: Output? = null

    private var keyVaultSecretId: Output? = null

    private var location: Output? = null

    private var name: Output? = null

    private var password: Output? = null

    private var pfxBlob: Output? = null

    private var resourceGroupName: Output? = null

    private var tags: Output>? = null

    /**
     * @param value The ID of the associated App Service plan. Must be specified when the certificate is used inside an App Service Environment hosted App Service. Changing this forces a new resource to be created.
     */
    @JvmName("dhmtjccuwyfdmfio")
    public suspend fun appServicePlanId(`value`: Output) {
        this.appServicePlanId = value
    }

    /**
     * @param value
     */
    @JvmName("kpluiushvseyyrul")
    public suspend fun keyVaultId(`value`: Output) {
        this.keyVaultId = value
    }

    /**
     * @param value The ID of the Key Vault secret. Changing this forces a new resource to be created.
     * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
     */
    @JvmName("avrdnmnboymnsyjm")
    public suspend fun keyVaultSecretId(`value`: Output) {
        this.keyVaultSecretId = value
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("nekmussjxelrgcra")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Specifies the name of the certificate. Changing this forces a new resource to be created.
     */
    @JvmName("wevskolhfuoqhjjq")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The password to access the certificate's private key. Changing this forces a new resource to be created.
     */
    @JvmName("jrhhtkgvamncownh")
    public suspend fun password(`value`: Output) {
        this.password = value
    }

    /**
     * @param value The base64-encoded contents of the certificate. Changing this forces a new resource to be created.
     * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
     */
    @JvmName("tkbwmhmmvmngqopd")
    public suspend fun pfxBlob(`value`: Output) {
        this.pfxBlob = value
    }

    /**
     * @param value The name of the resource group in which to create the certificate. Changing this forces a new resource to be created.
     * > **NOTE:** The resource group must be the same as that which the app service plan is defined in - otherwise the certificate will not show as available for the app services.
     */
    @JvmName("omghbtymgxikkjtl")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value
     */
    @JvmName("orjtmimwaaqgynas")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The ID of the associated App Service plan. Must be specified when the certificate is used inside an App Service Environment hosted App Service. Changing this forces a new resource to be created.
     */
    @JvmName("ogghwganhmmudahk")
    public suspend fun appServicePlanId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.appServicePlanId = mapped
    }

    /**
     * @param value
     */
    @JvmName("ewjynsktunsoqhet")
    public suspend fun keyVaultId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyVaultId = mapped
    }

    /**
     * @param value The ID of the Key Vault secret. Changing this forces a new resource to be created.
     * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
     */
    @JvmName("pffbrfhjevuglpxl")
    public suspend fun keyVaultSecretId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyVaultSecretId = mapped
    }

    /**
     * @param value Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    @JvmName("niubyjkbjosroxax")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Specifies the name of the certificate. Changing this forces a new resource to be created.
     */
    @JvmName("aujshelwyljgkjsq")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The password to access the certificate's private key. Changing this forces a new resource to be created.
     */
    @JvmName("hoejffgovrkdvgwg")
    public suspend fun password(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.password = mapped
    }

    /**
     * @param value The base64-encoded contents of the certificate. Changing this forces a new resource to be created.
     * > **NOTE:** Exactly one of `key_vault_secret_id` or `pfx_blob` must be specified.
     */
    @JvmName("plxfimkcadvojbpk")
    public suspend fun pfxBlob(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pfxBlob = mapped
    }

    /**
     * @param value The name of the resource group in which to create the certificate. Changing this forces a new resource to be created.
     * > **NOTE:** The resource group must be the same as that which the app service plan is defined in - otherwise the certificate will not show as available for the app services.
     */
    @JvmName("rwybllpergbhgrcm")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value
     */
    @JvmName("ljxaugpptnxkylwv")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values
     */
    @JvmName("toomvuwavvmthbsp")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): CertificateArgs = CertificateArgs(
        appServicePlanId = appServicePlanId,
        keyVaultId = keyVaultId,
        keyVaultSecretId = keyVaultSecretId,
        location = location,
        name = name,
        password = password,
        pfxBlob = pfxBlob,
        resourceGroupName = resourceGroupName,
        tags = tags,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy