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

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

    public var args: CustomDomainArgs = CustomDomainArgs()

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

/**
 * Manages an Azure Web PubSub Custom Domain.
 * ## Example Usage
 * 
 * ```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.webpubsub.Service;
 * import com.pulumi.azure.webpubsub.ServiceArgs;
 * import com.pulumi.azure.webpubsub.inputs.ServiceIdentityArgs;
 * import com.pulumi.azure.keyvault.KeyVault;
 * import com.pulumi.azure.keyvault.KeyVaultArgs;
 * import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
 * import com.pulumi.azure.keyvault.Certificate;
 * import com.pulumi.azure.keyvault.CertificateArgs;
 * import com.pulumi.azure.keyvault.inputs.CertificateCertificateArgs;
 * import com.pulumi.azure.webpubsub.CustomCertificate;
 * import com.pulumi.azure.webpubsub.CustomCertificateArgs;
 * import com.pulumi.azure.webpubsub.CustomDomain;
 * import com.pulumi.azure.webpubsub.CustomDomainArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 exampleService = new Service("exampleService", ServiceArgs.builder()
 *             .name("example-webpubsub")
 *             .location(testAzurermResourceGroup.location())
 *             .resourceGroupName(testAzurermResourceGroup.name())
 *             .sku(Map.ofEntries(
 *                 Map.entry("name", "Premium_P1"),
 *                 Map.entry("capacity", 1)
 *             ))
 *             .identity(ServiceIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 *         var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
 *             .name("examplekeyvault")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .skuName("premium")
 *             .accessPolicies(
 *                 KeyVaultAccessPolicyArgs.builder()
 *                     .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *                     .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *                     .certificatePermissions(
 *                         "Create",
 *                         "Get",
 *                         "List")
 *                     .secretPermissions(
 *                         "Get",
 *                         "List")
 *                     .build(),
 *                 KeyVaultAccessPolicyArgs.builder()
 *                     .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *                     .objectId(testAzurermWebPubsub.identity()[0].principalId())
 *                     .certificatePermissions(
 *                         "Create",
 *                         "Get",
 *                         "List")
 *                     .secretPermissions(
 *                         "Get",
 *                         "List")
 *                     .build())
 *             .build());
 *         var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
 *             .name("imported-cert")
 *             .keyVaultId(exampleKeyVault.id())
 *             .certificate(CertificateCertificateArgs.builder()
 *                 .contents(StdFunctions.filebase64(Filebase64Args.builder()
 *                     .input("certificate-to-import.pfx")
 *                     .build()).result())
 *                 .password("")
 *                 .build())
 *             .build());
 *         var test = new CustomCertificate("test", CustomCertificateArgs.builder()
 *             .name("example-cert")
 *             .webPubsubId(exampleService.id())
 *             .customCertificateId(exampleCertificate.id())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleAzurermKeyVaultAccessPolicy)
 *                 .build());
 *         var testCustomDomain = new CustomDomain("testCustomDomain", CustomDomainArgs.builder()
 *             .name("example-domain")
 *             .domainName("tftest.com")
 *             .webPubsubId(testAzurermWebPubsub.id())
 *             .webPubsubCustomCertificateId(test.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleService:
 *     type: azure:webpubsub:Service
 *     name: example
 *     properties:
 *       name: example-webpubsub
 *       location: ${testAzurermResourceGroup.location}
 *       resourceGroupName: ${testAzurermResourceGroup.name}
 *       sku:
 *         - name: Premium_P1
 *           capacity: 1
 *       identity:
 *         type: SystemAssigned
 *   exampleKeyVault:
 *     type: azure:keyvault:KeyVault
 *     name: example
 *     properties:
 *       name: examplekeyvault
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       tenantId: ${current.tenantId}
 *       skuName: premium
 *       accessPolicies:
 *         - tenantId: ${current.tenantId}
 *           objectId: ${current.objectId}
 *           certificatePermissions:
 *             - Create
 *             - Get
 *             - List
 *           secretPermissions:
 *             - Get
 *             - List
 *         - tenantId: ${current.tenantId}
 *           objectId: ${testAzurermWebPubsub.identity[0].principalId}
 *           certificatePermissions:
 *             - Create
 *             - Get
 *             - List
 *           secretPermissions:
 *             - Get
 *             - List
 *   exampleCertificate:
 *     type: azure:keyvault:Certificate
 *     name: example
 *     properties:
 *       name: imported-cert
 *       keyVaultId: ${exampleKeyVault.id}
 *       certificate:
 *         contents:
 *           fn::invoke:
 *             Function: std:filebase64
 *             Arguments:
 *               input: certificate-to-import.pfx
 *             Return: result
 *         password:
 *   test:
 *     type: azure:webpubsub:CustomCertificate
 *     properties:
 *       name: example-cert
 *       webPubsubId: ${exampleService.id}
 *       customCertificateId: ${exampleCertificate.id}
 *     options:
 *       dependson:
 *         - ${exampleAzurermKeyVaultAccessPolicy}
 *   testCustomDomain:
 *     type: azure:webpubsub:CustomDomain
 *     name: test
 *     properties:
 *       name: example-domain
 *       domainName: tftest.com
 *       webPubsubId: ${testAzurermWebPubsub.id}
 *       webPubsubCustomCertificateId: ${test.id}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Custom Domain for a Web PubSub service can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:webpubsub/customDomain:CustomDomain example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.SignalRService/webPubSub/webpubsub1/customDomains/customDomain1
 * ```
 */
public class CustomDomain internal constructor(
    override val javaResource: com.pulumi.azure.webpubsub.CustomDomain,
) : KotlinCustomResource(javaResource, CustomDomainMapper) {
    /**
     * Specifies the custom domain name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * > **NOTE:** Please ensure the custom domain name is included in the Subject Alternative Names of the selected Web PubSub Custom Certificate.
     */
    public val domainName: Output
        get() = javaResource.domainName().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the Web PubSub Custom Certificate ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     */
    public val webPubsubCustomCertificateId: Output
        get() = javaResource.webPubsubCustomCertificateId().applyValue({ args0 -> args0 })

    /**
     * Specifies the Web PubSub ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     */
    public val webPubsubId: Output
        get() = javaResource.webPubsubId().applyValue({ args0 -> args0 })
}

public object CustomDomainMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.webpubsub.CustomDomain::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy