"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomDomain = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a API Management Custom Domain.
 *
 * ## Disclaimers
 *
 * > **Note:** It's possible to define Custom Domains both within the `azure.apimanagement.Service` resource via the `hostnameConfigurations` block and by using this resource. However it's not possible to use both methods to manage Custom Domains within an API Management Service, since there will be conflicts.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const example = azure.keyvault.getKeyVault({
 *     name: "mykeyvault",
 *     resourceGroupName: "some-resource-group",
 * });
 * const exampleService = new azure.apimanagement.Service("example", {
 *     name: "example-apim",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     publisherName: "pub1",
 *     publisherEmail: "pub1@email.com",
 *     skuName: "Developer_1",
 * });
 * const exampleCertificate = new azure.keyvault.Certificate("example", {
 *     name: "example-certificate",
 *     keyVaultId: example.then(example => example.id),
 *     certificatePolicy: {
 *         issuerParameters: {
 *             name: "Self",
 *         },
 *         keyProperties: {
 *             exportable: true,
 *             keySize: 2048,
 *             keyType: "RSA",
 *             reuseKey: true,
 *         },
 *         lifetimeActions: [{
 *             action: {
 *                 actionType: "AutoRenew",
 *             },
 *             trigger: {
 *                 daysBeforeExpiry: 30,
 *             },
 *         }],
 *         secretProperties: {
 *             contentType: "application/x-pkcs12",
 *         },
 *         x509CertificateProperties: {
 *             keyUsages: [
 *                 "cRLSign",
 *                 "dataEncipherment",
 *                 "digitalSignature",
 *                 "keyAgreement",
 *                 "keyCertSign",
 *                 "keyEncipherment",
 *             ],
 *             subject: "CN=api.example.com",
 *             validityInMonths: 12,
 *             subjectAlternativeNames: {
 *                 dnsNames: [
 *                     "api.example.com",
 *                     "portal.example.com",
 *                 ],
 *             },
 *         },
 *     },
 * });
 * const exampleCustomDomain = new azure.apimanagement.CustomDomain("example", {
 *     apiManagementId: exampleService.id,
 *     gateways: [{
 *         hostName: "api.example.com",
 *         keyVaultId: exampleCertificate.versionlessSecretId,
 *     }],
 *     developerPortals: [{
 *         hostName: "portal.example.com",
 *         keyVaultId: exampleCertificate.versionlessSecretId,
 *     }],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.ApiManagement` - 2024-05-01
 *
 * ## Import
 *
 * API Management Custom Domains can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:apimanagement/customDomain:CustomDomain example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/customDomains/default
 * ```
 */
class CustomDomain extends pulumi.CustomResource {
    /**
     * Get an existing CustomDomain 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 Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new CustomDomain(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:apimanagement/customDomain:CustomDomain';
    /**
     * Returns true if the given object is an instance of CustomDomain.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === CustomDomain.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["apiManagementId"] = state?.apiManagementId;
            resourceInputs["developerPortals"] = state?.developerPortals;
            resourceInputs["gateways"] = state?.gateways;
            resourceInputs["managements"] = state?.managements;
            resourceInputs["portals"] = state?.portals;
            resourceInputs["scms"] = state?.scms;
        }
        else {
            const args = argsOrState;
            if (args?.apiManagementId === undefined && !opts.urn) {
                throw new Error("Missing required property 'apiManagementId'");
            }
            resourceInputs["apiManagementId"] = args?.apiManagementId;
            resourceInputs["developerPortals"] = args?.developerPortals;
            resourceInputs["gateways"] = args?.gateways;
            resourceInputs["managements"] = args?.managements;
            resourceInputs["portals"] = args?.portals;
            resourceInputs["scms"] = args?.scms;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(CustomDomain.__pulumiType, name, resourceInputs, opts);
    }
}
exports.CustomDomain = CustomDomain;
//# sourceMappingURL=customDomain.js.map