"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.Policy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * This resource provides the Waas Policy resource in Oracle Cloud Infrastructure Web Application Acceleration and Security service.
 * Api doc link for the resource: https://docs.oracle.com/iaas/api/#/en/waas/latest/WaasPolicy
 *
 * Example terraform configs related to the resource : https://github.com/oracle/terraform-provider-oci/tree/master/examples/web_application_acceleration_and_security
 *
 * Creates a new Web Application Acceleration and Security (WAAS) policy in the specified compartment. A WAAS policy must be established before creating Web Application Firewall (WAF) rules. To use WAF rules, your web application's origin servers must defined in the `WaasPolicy` schema.
 *
 * A domain name must be specified when creating a WAAS policy. The domain name should be different from the origins specified in your `WaasPolicy`. Once domain name is entered and stored, it is unchangeable.
 *
 * Use the record data returned in the `cname` field of the `WaasPolicy` object to create a CNAME record in your DNS configuration that will direct your domain's traffic through the WAF.
 *
 * For the purposes of access control, you must provide the OCID of the compartment where you want the service to reside. For information about access control and compartments, see [Overview of the IAM Service](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/overview.htm).
 *
 * You must specify a display name and domain for the WAAS policy. The display name does not have to be unique and can be changed. The domain name should be different from every origin specified in `WaasPolicy`.
 *
 * All Oracle Cloud Infrastructure resources, including WAAS policies, receive a unique, Oracle-assigned ID called an Oracle Cloud Identifier (OCID). When a resource is created, you can find its OCID in the response. You can also retrieve a resource's OCID by using a list API operation for that resource type, or by viewing the resource in the Console. Fore more information, see [Resource Identifiers](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
 *
 * **Note:** After sending the POST request, the new object's state will temporarily be `CREATING`. Ensure that the resource's state has changed to `ACTIVE` before use.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as oci from "@pulumi/oci";
 *
 * const testWaasPolicy = new oci.waas.Policy("test_waas_policy", {
 *     compartmentId: compartmentId,
 *     domain: waasPolicyDomain,
 *     additionalDomains: waasPolicyAdditionalDomains,
 *     definedTags: {
 *         "Operations.CostCenter": "42",
 *     },
 *     displayName: waasPolicyDisplayName,
 *     freeformTags: {
 *         Department: "Finance",
 *     },
 *     originGroups: [{
 *         origins: waasPolicyOriginGroupsOrigins,
 *     }],
 *     origins: [{
 *         uri: waasPolicyOriginsUri,
 *         customHeaders: [{
 *             name: waasPolicyOriginsCustomHeadersName,
 *             value: waasPolicyOriginsCustomHeadersValue,
 *         }],
 *         httpPort: Number(waasPolicyOriginsHttpPort),
 *         httpsPort: Number(waasPolicyOriginsHttpsPort),
 *     }],
 *     policyConfig: {
 *         certificateId: testCertificate.id,
 *         cipherGroup: waasPolicyPolicyConfigCipherGroup,
 *         clientAddressHeader: waasPolicyPolicyConfigClientAddressHeader,
 *         healthChecks: {
 *             expectedResponseCodeGroups: waasPolicyPolicyConfigHealthChecksExpectedResponseCodeGroup,
 *             expectedResponseText: waasPolicyPolicyConfigHealthChecksExpectedResponseText,
 *             headers: waasPolicyPolicyConfigHealthChecksHeaders,
 *             healthyThreshold: Number(waasPolicyPolicyConfigHealthChecksHealthyThreshold),
 *             intervalInSeconds: Number(waasPolicyPolicyConfigHealthChecksIntervalInSeconds),
 *             isEnabled: waasPolicyPolicyConfigHealthChecksIsEnabled === "true",
 *             isResponseTextCheckEnabled: waasPolicyPolicyConfigHealthChecksIsResponseTextCheckEnabled === "true",
 *             method: waasPolicyPolicyConfigHealthChecksMethod,
 *             path: waasPolicyPolicyConfigHealthChecksPath,
 *             timeoutInSeconds: Number(waasPolicyPolicyConfigHealthChecksTimeoutInSeconds),
 *             unhealthyThreshold: Number(waasPolicyPolicyConfigHealthChecksUnhealthyThreshold),
 *         },
 *         isBehindCdn: waasPolicyPolicyConfigIsBehindCdn === "true",
 *         isCacheControlRespected: waasPolicyPolicyConfigIsCacheControlRespected === "true",
 *         isHttpsEnabled: waasPolicyPolicyConfigIsHttpsEnabled === "true",
 *         isHttpsForced: waasPolicyPolicyConfigIsHttpsForced === "true",
 *         isOriginCompressionEnabled: waasPolicyPolicyConfigIsOriginCompressionEnabled === "true",
 *         isResponseBufferingEnabled: waasPolicyPolicyConfigIsResponseBufferingEnabled === "true",
 *         isSniEnabled: waasPolicyPolicyConfigIsSniEnabled === "true",
 *         loadBalancingMethod: {
 *             method: waasPolicyPolicyConfigLoadBalancingMethodMethod,
 *             domain: waasPolicyPolicyConfigLoadBalancingMethodDomain,
 *             expirationTimeInSeconds: Number(waasPolicyPolicyConfigLoadBalancingMethodExpirationTimeInSeconds),
 *             name: waasPolicyPolicyConfigLoadBalancingMethodName,
 *         },
 *         tlsProtocols: waasPolicyPolicyConfigTlsProtocols,
 *         websocketPathPrefixes: waasPolicyPolicyConfigWebsocketPathPrefixes,
 *     },
 *     wafConfig: {
 *         accessRules: [{
 *             action: waasPolicyWafConfigAccessRulesAction,
 *             criterias: [{
 *                 condition: waasPolicyWafConfigAccessRulesCriteriaCondition,
 *                 value: waasPolicyWafConfigAccessRulesCriteriaValue,
 *                 isCaseSensitive: waasPolicyWafConfigAccessRulesCriteriaIsCaseSensitive === "true",
 *             }],
 *             name: waasPolicyWafConfigAccessRulesName,
 *             blockAction: waasPolicyWafConfigAccessRulesBlockAction,
 *             blockErrorPageCode: waasPolicyWafConfigAccessRulesBlockErrorPageCode,
 *             blockErrorPageDescription: waasPolicyWafConfigAccessRulesBlockErrorPageDescription,
 *             blockErrorPageMessage: waasPolicyWafConfigAccessRulesBlockErrorPageMessage,
 *             blockResponseCode: Number(waasPolicyWafConfigAccessRulesBlockResponseCode),
 *             bypassChallenges: waasPolicyWafConfigAccessRulesBypassChallenges,
 *             captchaFooter: waasPolicyWafConfigAccessRulesCaptchaFooter,
 *             captchaHeader: waasPolicyWafConfigAccessRulesCaptchaHeader,
 *             captchaSubmitLabel: waasPolicyWafConfigAccessRulesCaptchaSubmitLabel,
 *             captchaTitle: waasPolicyWafConfigAccessRulesCaptchaTitle,
 *             redirectResponseCode: waasPolicyWafConfigAccessRulesRedirectResponseCode,
 *             redirectUrl: waasPolicyWafConfigAccessRulesRedirectUrl,
 *             responseHeaderManipulations: [{
 *                 action: waasPolicyWafConfigAccessRulesResponseHeaderManipulationAction,
 *                 header: waasPolicyWafConfigAccessRulesResponseHeaderManipulationHeader,
 *                 value: waasPolicyWafConfigAccessRulesResponseHeaderManipulationValue,
 *             }],
 *         }],
 *         addressRateLimiting: {
 *             isEnabled: waasPolicyWafConfigAddressRateLimitingIsEnabled === "true",
 *             allowedRatePerAddress: Number(waasPolicyWafConfigAddressRateLimitingAllowedRatePerAddress),
 *             blockResponseCode: Number(waasPolicyWafConfigAddressRateLimitingBlockResponseCode),
 *             maxDelayedCountPerAddress: Number(waasPolicyWafConfigAddressRateLimitingMaxDelayedCountPerAddress),
 *         },
 *         cachingRules: [{
 *             action: waasPolicyWafConfigCachingRulesAction,
 *             criterias: [{
 *                 condition: waasPolicyWafConfigCachingRulesCriteriaCondition,
 *                 value: waasPolicyWafConfigCachingRulesCriteriaValue,
 *             }],
 *             name: waasPolicyWafConfigCachingRulesName,
 *             cachingDuration: waasPolicyWafConfigCachingRulesCachingDuration,
 *             clientCachingDuration: waasPolicyWafConfigCachingRulesClientCachingDuration,
 *             isClientCachingEnabled: waasPolicyWafConfigCachingRulesIsClientCachingEnabled === "true",
 *             key: waasPolicyWafConfigCachingRulesKey,
 *         }],
 *         captchas: [{
 *             failureMessage: waasPolicyWafConfigCaptchasFailureMessage,
 *             sessionExpirationInSeconds: Number(waasPolicyWafConfigCaptchasSessionExpirationInSeconds),
 *             submitLabel: waasPolicyWafConfigCaptchasSubmitLabel,
 *             title: waasPolicyWafConfigCaptchasTitle,
 *             url: waasPolicyWafConfigCaptchasUrl,
 *             footerText: waasPolicyWafConfigCaptchasFooterText,
 *             headerText: waasPolicyWafConfigCaptchasHeaderText,
 *         }],
 *         customProtectionRules: [{
 *             action: waasPolicyWafConfigCustomProtectionRulesAction,
 *             exclusions: [{
 *                 exclusions: waasPolicyWafConfigCustomProtectionRulesExclusionsExclusions,
 *                 target: waasPolicyWafConfigCustomProtectionRulesExclusionsTarget,
 *             }],
 *             id: waasPolicyWafConfigCustomProtectionRulesId,
 *         }],
 *         deviceFingerprintChallenge: {
 *             isEnabled: waasPolicyWafConfigDeviceFingerprintChallengeIsEnabled === "true",
 *             action: waasPolicyWafConfigDeviceFingerprintChallengeAction,
 *             actionExpirationInSeconds: Number(waasPolicyWafConfigDeviceFingerprintChallengeActionExpirationInSeconds),
 *             challengeSettings: {
 *                 blockAction: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsBlockAction,
 *                 blockErrorPageCode: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsBlockErrorPageCode,
 *                 blockErrorPageDescription: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsBlockErrorPageDescription,
 *                 blockErrorPageMessage: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsBlockErrorPageMessage,
 *                 blockResponseCode: Number(waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsBlockResponseCode),
 *                 captchaFooter: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsCaptchaFooter,
 *                 captchaHeader: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsCaptchaHeader,
 *                 captchaSubmitLabel: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsCaptchaSubmitLabel,
 *                 captchaTitle: waasPolicyWafConfigDeviceFingerprintChallengeChallengeSettingsCaptchaTitle,
 *             },
 *             failureThreshold: Number(waasPolicyWafConfigDeviceFingerprintChallengeFailureThreshold),
 *             failureThresholdExpirationInSeconds: Number(waasPolicyWafConfigDeviceFingerprintChallengeFailureThresholdExpirationInSeconds),
 *             maxAddressCount: Number(waasPolicyWafConfigDeviceFingerprintChallengeMaxAddressCount),
 *             maxAddressCountExpirationInSeconds: Number(waasPolicyWafConfigDeviceFingerprintChallengeMaxAddressCountExpirationInSeconds),
 *         },
 *         humanInteractionChallenge: {
 *             isEnabled: waasPolicyWafConfigHumanInteractionChallengeIsEnabled === "true",
 *             action: waasPolicyWafConfigHumanInteractionChallengeAction,
 *             actionExpirationInSeconds: Number(waasPolicyWafConfigHumanInteractionChallengeActionExpirationInSeconds),
 *             challengeSettings: {
 *                 blockAction: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsBlockAction,
 *                 blockErrorPageCode: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsBlockErrorPageCode,
 *                 blockErrorPageDescription: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsBlockErrorPageDescription,
 *                 blockErrorPageMessage: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsBlockErrorPageMessage,
 *                 blockResponseCode: Number(waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsBlockResponseCode),
 *                 captchaFooter: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsCaptchaFooter,
 *                 captchaHeader: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsCaptchaHeader,
 *                 captchaSubmitLabel: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsCaptchaSubmitLabel,
 *                 captchaTitle: waasPolicyWafConfigHumanInteractionChallengeChallengeSettingsCaptchaTitle,
 *             },
 *             failureThreshold: Number(waasPolicyWafConfigHumanInteractionChallengeFailureThreshold),
 *             failureThresholdExpirationInSeconds: Number(waasPolicyWafConfigHumanInteractionChallengeFailureThresholdExpirationInSeconds),
 *             interactionThreshold: Number(waasPolicyWafConfigHumanInteractionChallengeInteractionThreshold),
 *             isNatEnabled: waasPolicyWafConfigHumanInteractionChallengeIsNatEnabled === "true",
 *             recordingPeriodInSeconds: Number(waasPolicyWafConfigHumanInteractionChallengeRecordingPeriodInSeconds),
 *             setHttpHeader: {
 *                 name: waasPolicyWafConfigHumanInteractionChallengeSetHttpHeaderName,
 *                 value: waasPolicyWafConfigHumanInteractionChallengeSetHttpHeaderValue,
 *             },
 *         },
 *         jsChallenge: {
 *             isEnabled: waasPolicyWafConfigJsChallengeIsEnabled === "true",
 *             action: waasPolicyWafConfigJsChallengeAction,
 *             actionExpirationInSeconds: Number(waasPolicyWafConfigJsChallengeActionExpirationInSeconds),
 *             areRedirectsChallenged: waasPolicyWafConfigJsChallengeAreRedirectsChallenged === "true",
 *             challengeSettings: {
 *                 blockAction: waasPolicyWafConfigJsChallengeChallengeSettingsBlockAction,
 *                 blockErrorPageCode: waasPolicyWafConfigJsChallengeChallengeSettingsBlockErrorPageCode,
 *                 blockErrorPageDescription: waasPolicyWafConfigJsChallengeChallengeSettingsBlockErrorPageDescription,
 *                 blockErrorPageMessage: waasPolicyWafConfigJsChallengeChallengeSettingsBlockErrorPageMessage,
 *                 blockResponseCode: Number(waasPolicyWafConfigJsChallengeChallengeSettingsBlockResponseCode),
 *                 captchaFooter: waasPolicyWafConfigJsChallengeChallengeSettingsCaptchaFooter,
 *                 captchaHeader: waasPolicyWafConfigJsChallengeChallengeSettingsCaptchaHeader,
 *                 captchaSubmitLabel: waasPolicyWafConfigJsChallengeChallengeSettingsCaptchaSubmitLabel,
 *                 captchaTitle: waasPolicyWafConfigJsChallengeChallengeSettingsCaptchaTitle,
 *             },
 *             criterias: [{
 *                 condition: waasPolicyWafConfigJsChallengeCriteriaCondition,
 *                 value: waasPolicyWafConfigJsChallengeCriteriaValue,
 *                 isCaseSensitive: waasPolicyWafConfigJsChallengeCriteriaIsCaseSensitive === "true",
 *             }],
 *             failureThreshold: Number(waasPolicyWafConfigJsChallengeFailureThreshold),
 *             isNatEnabled: waasPolicyWafConfigJsChallengeIsNatEnabled === "true",
 *             setHttpHeader: {
 *                 name: waasPolicyWafConfigJsChallengeSetHttpHeaderName,
 *                 value: waasPolicyWafConfigJsChallengeSetHttpHeaderValue,
 *             },
 *         },
 *         origin: waasPolicyWafConfigOrigin,
 *         originGroups: waasPolicyWafConfigOriginGroups,
 *         protectionSettings: {
 *             allowedHttpMethods: waasPolicyWafConfigProtectionSettingsAllowedHttpMethods,
 *             blockAction: waasPolicyWafConfigProtectionSettingsBlockAction,
 *             blockErrorPageCode: waasPolicyWafConfigProtectionSettingsBlockErrorPageCode,
 *             blockErrorPageDescription: waasPolicyWafConfigProtectionSettingsBlockErrorPageDescription,
 *             blockErrorPageMessage: waasPolicyWafConfigProtectionSettingsBlockErrorPageMessage,
 *             blockResponseCode: Number(waasPolicyWafConfigProtectionSettingsBlockResponseCode),
 *             isResponseInspected: waasPolicyWafConfigProtectionSettingsIsResponseInspected === "true",
 *             maxArgumentCount: Number(waasPolicyWafConfigProtectionSettingsMaxArgumentCount),
 *             maxNameLengthPerArgument: Number(waasPolicyWafConfigProtectionSettingsMaxNameLengthPerArgument),
 *             maxResponseSizeInKiB: Number(waasPolicyWafConfigProtectionSettingsMaxResponseSizeInKiB),
 *             maxTotalNameLengthOfArguments: Number(waasPolicyWafConfigProtectionSettingsMaxTotalNameLengthOfArguments),
 *             mediaTypes: waasPolicyWafConfigProtectionSettingsMediaTypes,
 *             recommendationsPeriodInDays: Number(waasPolicyWafConfigProtectionSettingsRecommendationsPeriodInDays),
 *         },
 *         whitelists: [{
 *             name: waasPolicyWafConfigWhitelistsName,
 *             addressLists: waasPolicyWafConfigWhitelistsAddressLists,
 *             addresses: waasPolicyWafConfigWhitelistsAddresses,
 *         }],
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * WaasPolicies can be imported using the `id`, e.g.
 *
 * ```sh
 * $ pulumi import oci:Waas/policy:Policy test_waas_policy "id"
 * ```
 */
class Policy extends pulumi.CustomResource {
    /**
     * Get an existing Policy 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 Policy(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'oci:Waas/policy:Policy';
    /**
     * Returns true if the given object is an instance of Policy.  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'] === Policy.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["additionalDomains"] = state?.additionalDomains;
            resourceInputs["cname"] = state?.cname;
            resourceInputs["compartmentId"] = state?.compartmentId;
            resourceInputs["definedTags"] = state?.definedTags;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["domain"] = state?.domain;
            resourceInputs["freeformTags"] = state?.freeformTags;
            resourceInputs["originGroups"] = state?.originGroups;
            resourceInputs["origins"] = state?.origins;
            resourceInputs["policyConfig"] = state?.policyConfig;
            resourceInputs["state"] = state?.state;
            resourceInputs["timeCreated"] = state?.timeCreated;
            resourceInputs["wafConfig"] = state?.wafConfig;
        }
        else {
            const args = argsOrState;
            if (args?.compartmentId === undefined && !opts.urn) {
                throw new Error("Missing required property 'compartmentId'");
            }
            if (args?.domain === undefined && !opts.urn) {
                throw new Error("Missing required property 'domain'");
            }
            resourceInputs["additionalDomains"] = args?.additionalDomains;
            resourceInputs["compartmentId"] = args?.compartmentId;
            resourceInputs["definedTags"] = args?.definedTags;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["domain"] = args?.domain;
            resourceInputs["freeformTags"] = args?.freeformTags;
            resourceInputs["originGroups"] = args?.originGroups;
            resourceInputs["origins"] = args?.origins;
            resourceInputs["policyConfig"] = args?.policyConfig;
            resourceInputs["wafConfig"] = args?.wafConfig;
            resourceInputs["cname"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["timeCreated"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Policy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Policy = Policy;
//# sourceMappingURL=policy.js.map