/**
 * Web Application Acceleration and Security Services API
 * OCI Web Application Acceleration and Security Services
 * OpenAPI spec version: 20181116
 *
 *
 * NOTE: This class is auto generated by OracleSDKGenerator.
 * Do not edit the class manually.
 *
 * Copyright (c) 2020, 2022, Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */ import * as model from "../model" ; import common = require ( "oci-common" ) ; /**
 * A content access rule. An access rule specifies an action to take if a set of criteria is matched by a request.
 */ export interface AccessRule { /**
     * The unique name of the access rule.
     */ "name" : string ; /**
     * The list of access rule criteria. The rule would be applied only for the requests that matched all the listed conditions.
     */ "criteria" : Array < model . AccessRuleCriteria > ; /**
      * The action to take when the access criteria are met for a rule. If unspecified, defaults to `ALLOW`.
  * <p>
  - **ALLOW:** Takes no action, just logs the request.
  * <p>
  - **DETECT:** Takes no action, but creates an alert for the request.
  * <p>
  - **BLOCK:** Blocks the request by returning specified response code or showing error page.
  * <p>
  - **BYPASS:** Bypasses some or all challenges.
  * <p>
  - **REDIRECT:** Redirects the request to the specified URL. These fields are required when `REDIRECT` is selected: `redirectUrl`, `redirectResponseCode`.
  * <p>
  - **SHOW_CAPTCHA:** Show a CAPTCHA Challenge page instead of the requested page.
  * <p>
  Regardless of action, no further rules are processed once a rule is matched.
      */ "action" : AccessRule . Action ; /**
     * The method used to block requests if `action` is set to `BLOCK` and the access criteria are met. If unspecified, defaults to `SET_RESPONSE_CODE`.
     */ "blockAction" ? : AccessRule . BlockAction ; /**
     * The response status code to return when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the access criteria are met. If unspecified, defaults to `403`. The list of available response codes: `200`, `201`, `202`, `204`, `206`, `300`, `301`, `302`, `303`, `304`, `307`, `400`, `401`, `403`, `404`, `405`, `408`, `409`, `411`, `412`, `413`, `414`, `415`, `416`, `422`, `444`, `494`, `495`, `496`, `497`, `499`, `500`, `501`, `502`, `503`, `504`, `507`. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
     */ "blockResponseCode" ? : number ; /**
     * The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access to the website is blocked.'
     */ "blockErrorPageMessage" ? : string ; /**
     * The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access rules'.
     */ "blockErrorPageCode" ? : string ; /**
     * The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the access criteria are met. If unspecified, defaults to 'Access blocked by website owner. Please contact support.'
     */ "blockErrorPageDescription" ? : string ; /**
      * The list of challenges to bypass when `action` is set to `BYPASS`. If unspecified or empty, all challenges are bypassed.
  * <p>
  - **JS_CHALLENGE:** Bypasses JavaScript Challenge.
  * <p>
  - **DEVICE_FINGERPRINT_CHALLENGE:** Bypasses Device Fingerprint Challenge.
  * <p>
  - **HUMAN_INTERACTION_CHALLENGE:** Bypasses Human Interaction Challenge.
  * <p>
  - **CAPTCHA:** Bypasses CAPTCHA Challenge.
      */ "bypassChallenges" ? : Array < AccessRule . BypassChallenges > ; /**
     * The target to which the request should be redirected, represented as a URI reference. Required when `action` is `REDIRECT`.
     */ "redirectUrl" ? : string ; /**
      * The response status code to return when `action` is set to `REDIRECT`.
  * <p>
  - **MOVED_PERMANENTLY:** Used for designating the permanent movement of a page (numerical code - 301).
  * <p>
  - **FOUND:** Used for designating the temporary movement of a page (numerical code - 302).
      */ "redirectResponseCode" ? : AccessRule . RedirectResponseCode ; /**
     * The title used when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.
     */ "captchaTitle" ? : string ; /**
     * The text to show in the header when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.
     */ "captchaHeader" ? : string ; /**
     * The text to show in the footer when showing a CAPTCHA challenge when `action` is set to `SHOW_CAPTCHA` and the request is challenged.
     */ "captchaFooter" ? : string ; /**
     * The text to show on the label of the CAPTCHA challenge submit button when `action` is set to `SHOW_CAPTCHA` and the request is challenged.
     */ "captchaSubmitLabel" ? : string ; /**
     * An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of `action` value.
     */ "responseHeaderManipulation" ? : Array < model . HeaderManipulationAction > ; } export namespace AccessRule { export enum Action { Allow = "ALLOW" , Detect = "DETECT" , Block = "BLOCK" , Bypass = "BYPASS" , Redirect = "REDIRECT" , ShowCaptcha = "SHOW_CAPTCHA" , /**
         * This value is used if a service returns a value for this enum that is not recognized by this
         * version of the SDK.
         */ UnknownValue = "UNKNOWN_VALUE" } export enum BlockAction { SetResponseCode = "SET_RESPONSE_CODE" , ShowErrorPage = "SHOW_ERROR_PAGE" , /**
         * This value is used if a service returns a value for this enum that is not recognized by this
         * version of the SDK.
         */ UnknownValue = "UNKNOWN_VALUE" } export enum BypassChallenges { JsChallenge = "JS_CHALLENGE" , DeviceFingerprintChallenge = "DEVICE_FINGERPRINT_CHALLENGE" , HumanInteractionChallenge = "HUMAN_INTERACTION_CHALLENGE" , Captcha = "CAPTCHA" , /**
         * This value is used if a service returns a value for this enum that is not recognized by this
         * version of the SDK.
         */ UnknownValue = "UNKNOWN_VALUE" } export enum RedirectResponseCode { MovedPermanently = "MOVED_PERMANENTLY" , Found = "FOUND" , /**
         * This value is used if a service returns a value for this enum that is not recognized by this
         * version of the SDK.
         */ UnknownValue = "UNKNOWN_VALUE" } export function getJsonObj ( obj ) { const jsonObj = { ... obj , ... { "criteria" : obj . criteria ? obj . criteria . map ( item => { return model . AccessRuleCriteria . getJsonObj ( item ) ; } ) : undefined , "responseHeaderManipulation" : obj . responseHeaderManipulation ? obj . responseHeaderManipulation . map ( item => { return model . HeaderManipulationAction . getJsonObj ( item ) ; } ) : undefined } } ; return jsonObj ; } export function getDeserializedJsonObj ( obj ) { const jsonObj = { ... obj , ... { "criteria" : obj . criteria ? obj . criteria . map ( item => { return model . AccessRuleCriteria . getDeserializedJsonObj ( item ) ; } ) : undefined , "responseHeaderManipulation" : obj . responseHeaderManipulation ? obj . responseHeaderManipulation . map ( item => { return model . HeaderManipulationAction . getDeserializedJsonObj ( item ) ; } ) : undefined } } ; return jsonObj ; } }