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

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

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

package com.pulumi.azure.appservice.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 [PublicCertificate].
 */
@PulumiTagMarker
public class PublicCertificateResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: PublicCertificateArgs = PublicCertificateArgs()

    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 PublicCertificateArgsBuilder.() -> Unit) {
        val builder = PublicCertificateArgsBuilder()
        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(): PublicCertificate {
        val builtJavaResource = com.pulumi.azure.appservice.PublicCertificate(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return PublicCertificate(builtJavaResource)
    }
}

/**
 * Manages an App Service Public Certificate.
 * ## Example Usage
 * 
 * ```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 examplePlan = new azure.appservice.Plan("example", {
 *     name: "example-app-service-plan",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: {
 *         tier: "Standard",
 *         size: "S1",
 *     },
 * });
 * const exampleAppService = new azure.appservice.AppService("example", {
 *     name: "example-app-service",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     appServicePlanId: examplePlan.id,
 * });
 * const examplePublicCertificate = new azure.appservice.PublicCertificate("example", {
 *     resourceGroupName: example.name,
 *     appServiceName: exampleAppService.name,
 *     certificateName: "example-public-certificate",
 *     certificateLocation: "Unknown",
 *     blob: std.filebase64({
 *         input: "app_service_public_certificate.cer",
 *     }).then(invoke => invoke.result),
 * });
 * ```
 * ```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_plan = azure.appservice.Plan("example",
 *     name="example-app-service-plan",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku={
 *         "tier": "Standard",
 *         "size": "S1",
 *     })
 * example_app_service = azure.appservice.AppService("example",
 *     name="example-app-service",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     app_service_plan_id=example_plan.id)
 * example_public_certificate = azure.appservice.PublicCertificate("example",
 *     resource_group_name=example.name,
 *     app_service_name=example_app_service.name,
 *     certificate_name="example-public-certificate",
 *     certificate_location="Unknown",
 *     blob=std.filebase64(input="app_service_public_certificate.cer").result)
 * ```
 * ```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 examplePlan = new Azure.AppService.Plan("example", new()
 *     {
 *         Name = "example-app-service-plan",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = new Azure.AppService.Inputs.PlanSkuArgs
 *         {
 *             Tier = "Standard",
 *             Size = "S1",
 *         },
 *     });
 *     var exampleAppService = new Azure.AppService.AppService("example", new()
 *     {
 *         Name = "example-app-service",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AppServicePlanId = examplePlan.Id,
 *     });
 *     var examplePublicCertificate = new Azure.AppService.PublicCertificate("example", new()
 *     {
 *         ResourceGroupName = example.Name,
 *         AppServiceName = exampleAppService.Name,
 *         CertificateName = "example-public-certificate",
 *         CertificateLocation = "Unknown",
 *         Blob = Std.Filebase64.Invoke(new()
 *         {
 *             Input = "app_service_public_certificate.cer",
 *         }).Apply(invoke => invoke.Result),
 *     });
 * });
 * ```
 * ```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
 * 		}
 * 		examplePlan, err := appservice.NewPlan(ctx, "example", &appservice.PlanArgs{
 * 			Name:              pulumi.String("example-app-service-plan"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku: &appservice.PlanSkuArgs{
 * 				Tier: pulumi.String("Standard"),
 * 				Size: pulumi.String("S1"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAppService, err := appservice.NewAppService(ctx, "example", &appservice.AppServiceArgs{
 * 			Name:              pulumi.String("example-app-service"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AppServicePlanId:  examplePlan.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "app_service_public_certificate.cer",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = appservice.NewPublicCertificate(ctx, "example", &appservice.PublicCertificateArgs{
 * 			ResourceGroupName:   example.Name,
 * 			AppServiceName:      exampleAppService.Name,
 * 			CertificateName:     pulumi.String("example-public-certificate"),
 * 			CertificateLocation: pulumi.String("Unknown"),
 * 			Blob:                pulumi.String(invokeFilebase64.Result),
 * 		})
 * 		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.Plan;
 * import com.pulumi.azure.appservice.PlanArgs;
 * import com.pulumi.azure.appservice.inputs.PlanSkuArgs;
 * import com.pulumi.azure.appservice.AppService;
 * import com.pulumi.azure.appservice.AppServiceArgs;
 * import com.pulumi.azure.appservice.PublicCertificate;
 * import com.pulumi.azure.appservice.PublicCertificateArgs;
 * 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 examplePlan = new Plan("examplePlan", PlanArgs.builder()
 *             .name("example-app-service-plan")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku(PlanSkuArgs.builder()
 *                 .tier("Standard")
 *                 .size("S1")
 *                 .build())
 *             .build());
 *         var exampleAppService = new AppService("exampleAppService", AppServiceArgs.builder()
 *             .name("example-app-service")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .appServicePlanId(examplePlan.id())
 *             .build());
 *         var examplePublicCertificate = new PublicCertificate("examplePublicCertificate", PublicCertificateArgs.builder()
 *             .resourceGroupName(example.name())
 *             .appServiceName(exampleAppService.name())
 *             .certificateName("example-public-certificate")
 *             .certificateLocation("Unknown")
 *             .blob(StdFunctions.filebase64(Filebase64Args.builder()
 *                 .input("app_service_public_certificate.cer")
 *                 .build()).result())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   examplePlan:
 *     type: azure:appservice:Plan
 *     name: example
 *     properties:
 *       name: example-app-service-plan
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku:
 *         tier: Standard
 *         size: S1
 *   exampleAppService:
 *     type: azure:appservice:AppService
 *     name: example
 *     properties:
 *       name: example-app-service
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       appServicePlanId: ${examplePlan.id}
 *   examplePublicCertificate:
 *     type: azure:appservice:PublicCertificate
 *     name: example
 *     properties:
 *       resourceGroupName: ${example.name}
 *       appServiceName: ${exampleAppService.name}
 *       certificateName: example-public-certificate
 *       certificateLocation: Unknown
 *       blob:
 *         fn::invoke:
 *           Function: std:filebase64
 *           Arguments:
 *             input: app_service_public_certificate.cer
 *           Return: result
 * ```
 * 
 * ## Import
 * App Service Public Certificates can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appservice/publicCertificate:PublicCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/sites/site1/publicCertificates/publicCertificate1
 * ```
 */
public class PublicCertificate internal constructor(
    override val javaResource: com.pulumi.azure.appservice.PublicCertificate,
) : KotlinCustomResource(javaResource, PublicCertificateMapper) {
    /**
     * The name of the App Service. Changing this forces a new App Service Public Certificate to be created.
     */
    public val appServiceName: Output
        get() = javaResource.appServiceName().applyValue({ args0 -> args0 })

    /**
     * The base64-encoded contents of the certificate. Changing this forces a new App Service Public Certificate to be created.
     */
    public val blob: Output
        get() = javaResource.blob().applyValue({ args0 -> args0 })

    /**
     * The location of the certificate. Possible values are `CurrentUserMy`, `LocalMachineMy` and `Unknown`. Changing this forces a new App Service Public Certificate to be created.
     */
    public val certificateLocation: Output
        get() = javaResource.certificateLocation().applyValue({ args0 -> args0 })

    /**
     * The name of the public certificate. Changing this forces a new App Service Public Certificate to be created.
     */
    public val certificateName: Output
        get() = javaResource.certificateName().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the App Service Public Certificate should exist. Changing this forces a new App Service Public Certificate to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The thumbprint of the public certificate.
     */
    public val thumbprint: Output
        get() = javaResource.thumbprint().applyValue({ args0 -> args0 })
}

public object PublicCertificateMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appservice.PublicCertificate::class == javaResource::class

    override fun map(javaResource: Resource): PublicCertificate = PublicCertificate(
        javaResource as
            com.pulumi.azure.appservice.PublicCertificate,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy