"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.Service = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages an Active Directory Domain Service.
 *
 * > **Note:** Before using this resource, there must exist in your tenant a service principal for the Domain Services published application. This service principal cannot be easily managed by Terraform and it's recommended to create this manually, as it does not exist by default. See [official documentation](https://docs.microsoft.com/azure/active-directory-domain-services/powershell-create-instance#create-required-azure-ad-resources) for details.
 *
 * > **Note:** At present this resource only supports **User Forest** mode and _not_ **Resource Forest** mode. [Read more](https://docs.microsoft.com/azure/active-directory-domain-services/concepts-resource-forest) about the different operation modes for this service.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 *
 * const deploy = new azure.core.ResourceGroup("deploy", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const deployVirtualNetwork = new azure.network.VirtualNetwork("deploy", {
 *     name: "deploy-vnet",
 *     location: deploy.location,
 *     resourceGroupName: deploy.name,
 *     addressSpaces: ["10.0.1.0/16"],
 * });
 * const deploySubnet = new azure.network.Subnet("deploy", {
 *     name: "deploy-subnet",
 *     resourceGroupName: deploy.name,
 *     virtualNetworkName: deployVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const deployNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("deploy", {
 *     name: "deploy-nsg",
 *     location: deploy.location,
 *     resourceGroupName: deploy.name,
 *     securityRules: [
 *         {
 *             name: "AllowSyncWithAzureAD",
 *             priority: 101,
 *             direction: "Inbound",
 *             access: "Allow",
 *             protocol: "Tcp",
 *             sourcePortRange: "*",
 *             destinationPortRange: "443",
 *             sourceAddressPrefix: "AzureActiveDirectoryDomainServices",
 *             destinationAddressPrefix: "*",
 *         },
 *         {
 *             name: "AllowRD",
 *             priority: 201,
 *             direction: "Inbound",
 *             access: "Allow",
 *             protocol: "Tcp",
 *             sourcePortRange: "*",
 *             destinationPortRange: "3389",
 *             sourceAddressPrefix: "CorpNetSaw",
 *             destinationAddressPrefix: "*",
 *         },
 *         {
 *             name: "AllowPSRemoting",
 *             priority: 301,
 *             direction: "Inbound",
 *             access: "Allow",
 *             protocol: "Tcp",
 *             sourcePortRange: "*",
 *             destinationPortRange: "5986",
 *             sourceAddressPrefix: "AzureActiveDirectoryDomainServices",
 *             destinationAddressPrefix: "*",
 *         },
 *         {
 *             name: "AllowLDAPS",
 *             priority: 401,
 *             direction: "Inbound",
 *             access: "Allow",
 *             protocol: "Tcp",
 *             sourcePortRange: "*",
 *             destinationPortRange: "636",
 *             sourceAddressPrefix: "*",
 *             destinationAddressPrefix: "*",
 *         },
 *     ],
 * });
 * const deploySubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("deploy", {
 *     subnetId: deploySubnet.id,
 *     networkSecurityGroupId: deployNetworkSecurityGroup.id,
 * });
 * const dcAdmins = new azuread.Group("dc_admins", {
 *     displayName: "AAD DC Administrators",
 *     securityEnabled: true,
 * });
 * const admin = new azuread.User("admin", {
 *     userPrincipalName: "dc-admin@hashicorp-example.com",
 *     displayName: "DC Administrator",
 *     password: "Pa55w0Rd!!1",
 * });
 * const adminGroupMember = new azuread.GroupMember("admin", {
 *     groupObjectId: dcAdmins.objectId,
 *     memberObjectId: admin.objectId,
 * });
 * const example = new azuread.ServicePrincipal("example", {applicationId: "2565bd9d-da50-47d4-8b85-4c97f669dc36"});
 * const aadds = new azure.core.ResourceGroup("aadds", {
 *     name: "aadds-rg",
 *     location: "westeurope",
 * });
 * const exampleService = new azure.domainservices.Service("example", {
 *     name: "example-aadds",
 *     location: aadds.location,
 *     resourceGroupName: aadds.name,
 *     domainName: "widgetslogin.net",
 *     sku: "Enterprise",
 *     filteredSyncEnabled: false,
 *     initialReplicaSet: {
 *         subnetId: deploySubnet.id,
 *     },
 *     notifications: {
 *         additionalRecipients: [
 *             "notifyA@example.net",
 *             "notifyB@example.org",
 *         ],
 *         notifyDcAdmins: true,
 *         notifyGlobalAdmins: true,
 *     },
 *     security: {
 *         syncKerberosPasswords: true,
 *         syncNtlmPasswords: true,
 *         syncOnPremPasswords: true,
 *     },
 *     tags: {
 *         Environment: "prod",
 *     },
 * }, {
 *     dependsOn: [
 *         example,
 *         deploySubnetNetworkSecurityGroupAssociation,
 *     ],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.AAD` - 2021-05-01
 *
 * ## Import
 *
 * Domain Services can be imported using the resource ID, together with the Replica Set ID that you wish to designate as the initial replica set, e.g.
 *
 * ```sh
 * $ pulumi import azure:domainservices/service:Service example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.AAD/domainServices/instance1/initialReplicaSetId/00000000-0000-0000-0000-000000000000
 * ```
 */
class Service extends pulumi.CustomResource {
    /**
     * Get an existing Service 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 Service(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:domainservices/service:Service';
    /**
     * Returns true if the given object is an instance of Service.  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'] === Service.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["deploymentId"] = state?.deploymentId;
            resourceInputs["domainConfigurationType"] = state?.domainConfigurationType;
            resourceInputs["domainName"] = state?.domainName;
            resourceInputs["filteredSyncEnabled"] = state?.filteredSyncEnabled;
            resourceInputs["initialReplicaSet"] = state?.initialReplicaSet;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["notifications"] = state?.notifications;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["resourceId"] = state?.resourceId;
            resourceInputs["secureLdap"] = state?.secureLdap;
            resourceInputs["security"] = state?.security;
            resourceInputs["sku"] = state?.sku;
            resourceInputs["syncOwner"] = state?.syncOwner;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["tenantId"] = state?.tenantId;
            resourceInputs["version"] = state?.version;
        }
        else {
            const args = argsOrState;
            if (args?.domainName === undefined && !opts.urn) {
                throw new Error("Missing required property 'domainName'");
            }
            if (args?.initialReplicaSet === undefined && !opts.urn) {
                throw new Error("Missing required property 'initialReplicaSet'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.sku === undefined && !opts.urn) {
                throw new Error("Missing required property 'sku'");
            }
            resourceInputs["domainConfigurationType"] = args?.domainConfigurationType;
            resourceInputs["domainName"] = args?.domainName;
            resourceInputs["filteredSyncEnabled"] = args?.filteredSyncEnabled;
            resourceInputs["initialReplicaSet"] = args?.initialReplicaSet;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["notifications"] = args?.notifications;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["secureLdap"] = args?.secureLdap;
            resourceInputs["security"] = args?.security;
            resourceInputs["sku"] = args?.sku;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["deploymentId"] = undefined /*out*/;
            resourceInputs["resourceId"] = undefined /*out*/;
            resourceInputs["syncOwner"] = undefined /*out*/;
            resourceInputs["tenantId"] = undefined /*out*/;
            resourceInputs["version"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Service.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Service = Service;
//# sourceMappingURL=service.js.map