// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.webpubsub;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.webpubsub.CustomDomainArgs;
import com.pulumi.azure.webpubsub.inputs.CustomDomainState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;

/**
 * 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 exampleResourceGroup = new ResourceGroup(&#34;exampleResourceGroup&#34;, ResourceGroupArgs.builder()        
 *             .location(&#34;West Europe&#34;)
 *             .build());
 * 
 *         var exampleService = new Service(&#34;exampleService&#34;, ServiceArgs.builder()        
 *             .location(azurerm_resource_group.test().location())
 *             .resourceGroupName(azurerm_resource_group.test().name())
 *             .sku(Map.ofEntries(
 *                 Map.entry(&#34;name&#34;, &#34;Premium_P1&#34;),
 *                 Map.entry(&#34;capacity&#34;, 1)
 *             ))
 *             .identity(ServiceIdentityArgs.builder()
 *                 .type(&#34;SystemAssigned&#34;)
 *                 .build())
 *             .build());
 * 
 *         var exampleKeyVault = new KeyVault(&#34;exampleKeyVault&#34;, KeyVaultArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .tenantId(current.applyValue(getClientConfigResult -&gt; getClientConfigResult.tenantId()))
 *             .skuName(&#34;premium&#34;)
 *             .accessPolicies(            
 *                 KeyVaultAccessPolicyArgs.builder()
 *                     .tenantId(current.applyValue(getClientConfigResult -&gt; getClientConfigResult.tenantId()))
 *                     .objectId(current.applyValue(getClientConfigResult -&gt; getClientConfigResult.objectId()))
 *                     .certificatePermissions(                    
 *                         &#34;Create&#34;,
 *                         &#34;Get&#34;,
 *                         &#34;List&#34;)
 *                     .secretPermissions(                    
 *                         &#34;Get&#34;,
 *                         &#34;List&#34;)
 *                     .build(),
 *                 KeyVaultAccessPolicyArgs.builder()
 *                     .tenantId(current.applyValue(getClientConfigResult -&gt; getClientConfigResult.tenantId()))
 *                     .objectId(azurerm_web_pubsub.test().identity()[0].principal_id())
 *                     .certificatePermissions(                    
 *                         &#34;Create&#34;,
 *                         &#34;Get&#34;,
 *                         &#34;List&#34;)
 *                     .secretPermissions(                    
 *                         &#34;Get&#34;,
 *                         &#34;List&#34;)
 *                     .build())
 *             .build());
 * 
 *         var exampleCertificate = new Certificate(&#34;exampleCertificate&#34;, CertificateArgs.builder()        
 *             .keyVaultId(exampleKeyVault.id())
 *             .certificate(CertificateCertificateArgs.builder()
 *                 .contents(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get(&#34;certificate-to-import.pfx&#34;))))
 *                 .password(&#34;&#34;)
 *                 .build())
 *             .build());
 * 
 *         var testCustomCertificate = new CustomCertificate(&#34;testCustomCertificate&#34;, CustomCertificateArgs.builder()        
 *             .webPubsubId(exampleService.id())
 *             .customCertificateId(exampleCertificate.id())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(azurerm_key_vault_access_policy.example())
 *                 .build());
 * 
 *         var testCustomDomain = new CustomDomain(&#34;testCustomDomain&#34;, CustomDomainArgs.builder()        
 *             .domainName(&#34;tftest.com&#34;)
 *             .webPubsubId(azurerm_web_pubsub.test().id())
 *             .webPubsubCustomCertificateId(testCustomCertificate.id())
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## 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
 * ```
 * 
 */
@ResourceType(type="azure:webpubsub/customDomain:CustomDomain")
public class CustomDomain extends com.pulumi.resources.CustomResource {
    /**
     * Specifies the custom domain name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     * &gt; **NOTE:** Please ensure the custom domain name is included in the Subject Alternative Names of the selected Web PubSub Custom Certificate.
     * 
     */
    @Export(name="domainName", refs={String.class}, tree="[0]")
    private Output<String> domainName;

    /**
     * @return Specifies the custom domain name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     * &gt; **NOTE:** Please ensure the custom domain name is included in the Subject Alternative Names of the selected Web PubSub Custom Certificate.
     * 
     */
    public Output<String> domainName() {
        return this.domainName;
    }
    /**
     * Specifies the name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return Specifies the name of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * Specifies the Web PubSub Custom Certificate ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="webPubsubCustomCertificateId", refs={String.class}, tree="[0]")
    private Output<String> webPubsubCustomCertificateId;

    /**
     * @return Specifies the Web PubSub Custom Certificate ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> webPubsubCustomCertificateId() {
        return this.webPubsubCustomCertificateId;
    }
    /**
     * Specifies the Web PubSub ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="webPubsubId", refs={String.class}, tree="[0]")
    private Output<String> webPubsubId;

    /**
     * @return Specifies the Web PubSub ID of the Web PubSub Custom Domain. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> webPubsubId() {
        return this.webPubsubId;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public CustomDomain(String name) {
        this(name, CustomDomainArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public CustomDomain(String name, CustomDomainArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public CustomDomain(String name, CustomDomainArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:webpubsub/customDomain:CustomDomain", name, args == null ? CustomDomainArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private CustomDomain(String name, Output<String> id, @Nullable CustomDomainState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:webpubsub/customDomain:CustomDomain", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static CustomDomain get(String name, Output<String> id, @Nullable CustomDomainState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new CustomDomain(name, id, state, options);
    }
}
