"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.Prefix = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a custom IPv4 prefix or custom IPv6 prefix.
 *
 * ## Example Usage
 *
 * *IPv4 custom prefix*
 * ```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 examplePrefix = new azure.customip.Prefix("example", {
 *     name: "example-CustomIPPrefix",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     cidr: "1.2.3.4/22",
 *     zones: [
 *         "1",
 *         "2",
 *         "3",
 *     ],
 *     commissioningEnabled: true,
 *     roaValidityEndDate: "2099-12-12",
 *     wanValidationSignedMessage: "signed message for WAN validation",
 *     tags: {
 *         env: "test",
 *     },
 * });
 * ```
 *
 * *IPv6 custom prefix*
 * ```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 global = new azure.customip.Prefix("global", {
 *     name: "example-Global-CustomIPPrefix",
 *     location: test.location,
 *     resourceGroupName: test.name,
 *     cidr: "2001:db8:1::/48",
 *     roaValidityEndDate: "2199-12-12",
 *     wanValidationSignedMessage: "signed message for WAN validation",
 * });
 * const regional = new azure.customip.Prefix("regional", {
 *     name: "example-Regional-CustomIPPrefix",
 *     location: test.location,
 *     resourceGroupName: test.name,
 *     parentCustomIpPrefixId: global.id,
 *     cidr: std.cidrsubnetOutput({
 *         input: global.cidr,
 *         newbits: 16,
 *         netnum: 1,
 *     }).apply(invoke => invoke.result),
 *     zones: ["1"],
 * });
 * ```
 *
 * ## Import
 *
 * A Custom IP Prefix can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:customip/prefix:Prefix example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/customIPPrefixes/customIPPrefix1
 * ```
 */
class Prefix extends pulumi.CustomResource {
    /**
     * Get an existing Prefix 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 Prefix(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:customip/prefix:Prefix';
    /**
     * Returns true if the given object is an instance of Prefix.  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'] === Prefix.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["cidr"] = state?.cidr;
            resourceInputs["commissioningEnabled"] = state?.commissioningEnabled;
            resourceInputs["internetAdvertisingDisabled"] = state?.internetAdvertisingDisabled;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["parentCustomIpPrefixId"] = state?.parentCustomIpPrefixId;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["roaValidityEndDate"] = state?.roaValidityEndDate;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["wanValidationSignedMessage"] = state?.wanValidationSignedMessage;
            resourceInputs["zones"] = state?.zones;
        }
        else {
            const args = argsOrState;
            if (args?.cidr === undefined && !opts.urn) {
                throw new Error("Missing required property 'cidr'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            resourceInputs["cidr"] = args?.cidr;
            resourceInputs["commissioningEnabled"] = args?.commissioningEnabled;
            resourceInputs["internetAdvertisingDisabled"] = args?.internetAdvertisingDisabled;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["parentCustomIpPrefixId"] = args?.parentCustomIpPrefixId;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["roaValidityEndDate"] = args?.roaValidityEndDate;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["wanValidationSignedMessage"] = args?.wanValidationSignedMessage;
            resourceInputs["zones"] = args?.zones;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Prefix.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Prefix = Prefix;
//# sourceMappingURL=prefix.js.map