"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.FrontdoorOrigin = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Front Door (standard/premium) Origin.
 *
 * !> **Note:** If you are attempting to implement an Origin that uses its own Private Link Service with a Load Balancer the Profile resource in your configuration file **must** have a `dependsOn` meta-argument which references the `azure.privatedns.LinkService`, see `Example Usage With Private Link Service` below.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleFrontdoorProfile = new azure.cdn.FrontdoorProfile("example", {
 *     name: "example-profile",
 *     resourceGroupName: example.name,
 *     skuName: "Premium_AzureFrontDoor",
 * });
 * const exampleFrontdoorOriginGroup = new azure.cdn.FrontdoorOriginGroup("example", {
 *     name: "example-origingroup",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     loadBalancing: {},
 * });
 * const exampleFrontdoorOrigin = new azure.cdn.FrontdoorOrigin("example", {
 *     name: "example-origin",
 *     cdnFrontdoorOriginGroupId: exampleFrontdoorOriginGroup.id,
 *     enabled: true,
 *     certificateNameCheckEnabled: false,
 *     hostName: "contoso.com",
 *     httpPort: 80,
 *     httpsPort: 443,
 *     originHostHeader: "www.contoso.com",
 *     priority: 1,
 *     weight: 1,
 * });
 * ```
 *
 * ### With Private Link
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "examplestoracc",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Premium",
 *     accountReplicationType: "LRS",
 *     allowNestedItemsToBePublic: false,
 *     networkRules: {
 *         defaultAction: "Deny",
 *     },
 *     tags: {
 *         environment: "Example",
 *     },
 * });
 * const exampleFrontdoorProfile = new azure.cdn.FrontdoorProfile("example", {
 *     name: "example-profile",
 *     resourceGroupName: example.name,
 *     skuName: "Premium_AzureFrontDoor",
 * });
 * const exampleFrontdoorOriginGroup = new azure.cdn.FrontdoorOriginGroup("example", {
 *     name: "example-origin-group",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     loadBalancing: {},
 * });
 * const exampleFrontdoorOrigin = new azure.cdn.FrontdoorOrigin("example", {
 *     name: "example-origin",
 *     cdnFrontdoorOriginGroupId: exampleFrontdoorOriginGroup.id,
 *     enabled: true,
 *     certificateNameCheckEnabled: true,
 *     hostName: exampleAccount.primaryBlobHost,
 *     originHostHeader: exampleAccount.primaryBlobHost,
 *     priority: 1,
 *     weight: 500,
 *     privateLink: {
 *         requestMessage: "Request access for Private Link Origin CDN Frontdoor",
 *         targetType: "blob",
 *         location: exampleAccount.location,
 *         privateLinkTargetId: exampleAccount.id,
 *     },
 * });
 * ```
 *
 * ### With Private Link Service
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "vn-example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     addressSpaces: ["10.5.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "sn-example",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.5.1.0/24"],
 *     privateLinkServiceNetworkPoliciesEnabled: false,
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "ip-example",
 *     sku: "Standard",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     allocationMethod: "Static",
 * });
 * const exampleLoadBalancer = new azure.lb.LoadBalancer("example", {
 *     name: "lb-example",
 *     sku: "Standard",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     frontendIpConfigurations: [{
 *         name: examplePublicIp.name,
 *         publicIpAddressId: examplePublicIp.id,
 *     }],
 * });
 * const exampleLinkService = new azure.privatedns.LinkService("example", {
 *     name: "pls-example",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     visibilitySubscriptionIds: [current.then(current => current.subscriptionId)],
 *     loadBalancerFrontendIpConfigurationIds: [exampleLoadBalancer.frontendIpConfigurations.apply(frontendIpConfigurations => frontendIpConfigurations?.[0]?.id)],
 *     natIpConfigurations: [{
 *         name: "primary",
 *         privateIpAddress: "10.5.1.17",
 *         privateIpAddressVersion: "IPv4",
 *         subnetId: exampleSubnet.id,
 *         primary: true,
 *     }],
 * });
 * const exampleFrontdoorProfile = new azure.cdn.FrontdoorProfile("example", {
 *     name: "profile-example",
 *     resourceGroupName: example.name,
 *     skuName: "Premium_AzureFrontDoor",
 * }, {
 *     dependsOn: [exampleLinkService],
 * });
 * const exampleFrontdoorOriginGroup = new azure.cdn.FrontdoorOriginGroup("example", {
 *     name: "group-example",
 *     cdnFrontdoorProfileId: exampleFrontdoorProfile.id,
 *     loadBalancing: {
 *         additionalLatencyInMilliseconds: 0,
 *         sampleSize: 16,
 *         successfulSamplesRequired: 3,
 *     },
 * });
 * const exampleFrontdoorOrigin = new azure.cdn.FrontdoorOrigin("example", {
 *     name: "origin-example",
 *     cdnFrontdoorOriginGroupId: exampleFrontdoorOriginGroup.id,
 *     enabled: true,
 *     hostName: "example.com",
 *     originHostHeader: "example.com",
 *     priority: 1,
 *     weight: 1000,
 *     certificateNameCheckEnabled: false,
 *     privateLink: {
 *         requestMessage: "Request access for Private Link Origin CDN Frontdoor",
 *         location: example.location,
 *         privateLinkTargetId: exampleLinkService.id,
 *     },
 * });
 * ```
 *
 * ## Example HCL Configurations
 *
 * * Private Link Origin with Storage Account Blob
 * * Private Link Origin with Storage Account Static Web Site
 * * Private Link Origin with Linux Web Application
 * * Private Link Origin with Internal Load Balancer
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Cdn` - 2024-02-01
 *
 * ## Import
 *
 * Front Door Origins can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:cdn/frontdoorOrigin:FrontdoorOrigin example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1/origins/origin1
 * ```
 */
class FrontdoorOrigin extends pulumi.CustomResource {
    /**
     * Get an existing FrontdoorOrigin 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 FrontdoorOrigin(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:cdn/frontdoorOrigin:FrontdoorOrigin';
    /**
     * Returns true if the given object is an instance of FrontdoorOrigin.  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'] === FrontdoorOrigin.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["cdnFrontdoorOriginGroupId"] = state?.cdnFrontdoorOriginGroupId;
            resourceInputs["certificateNameCheckEnabled"] = state?.certificateNameCheckEnabled;
            resourceInputs["enabled"] = state?.enabled;
            resourceInputs["hostName"] = state?.hostName;
            resourceInputs["httpPort"] = state?.httpPort;
            resourceInputs["httpsPort"] = state?.httpsPort;
            resourceInputs["name"] = state?.name;
            resourceInputs["originHostHeader"] = state?.originHostHeader;
            resourceInputs["priority"] = state?.priority;
            resourceInputs["privateLink"] = state?.privateLink;
            resourceInputs["weight"] = state?.weight;
        }
        else {
            const args = argsOrState;
            if (args?.cdnFrontdoorOriginGroupId === undefined && !opts.urn) {
                throw new Error("Missing required property 'cdnFrontdoorOriginGroupId'");
            }
            if (args?.certificateNameCheckEnabled === undefined && !opts.urn) {
                throw new Error("Missing required property 'certificateNameCheckEnabled'");
            }
            if (args?.hostName === undefined && !opts.urn) {
                throw new Error("Missing required property 'hostName'");
            }
            resourceInputs["cdnFrontdoorOriginGroupId"] = args?.cdnFrontdoorOriginGroupId;
            resourceInputs["certificateNameCheckEnabled"] = args?.certificateNameCheckEnabled;
            resourceInputs["enabled"] = args?.enabled;
            resourceInputs["hostName"] = args?.hostName;
            resourceInputs["httpPort"] = args?.httpPort;
            resourceInputs["httpsPort"] = args?.httpsPort;
            resourceInputs["name"] = args?.name;
            resourceInputs["originHostHeader"] = args?.originHostHeader;
            resourceInputs["priority"] = args?.priority;
            resourceInputs["privateLink"] = args?.privateLink;
            resourceInputs["weight"] = args?.weight;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(FrontdoorOrigin.__pulumiType, name, resourceInputs, opts);
    }
}
exports.FrontdoorOrigin = FrontdoorOrigin;
//# sourceMappingURL=frontdoorOrigin.js.map