// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
import * as waf from "oci-waf";
import common = require("oci-common");
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();
(async () => {
try {
// Create a service client
const client = new waf.WafClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const updateWebAppFirewallPolicyDetails = {
displayName: "EXAMPLE-displayName-Value",
actions: [{
type: "RETURN_HTTP_RESPONSE", code: 186,
headers: [{
name: "EXAMPLE-name-Value",
value: "EXAMPLE-value-Value",
}
],
body: {
type: "DYNAMIC", template: "EXAMPLE-template-Value"
}
,
name: "EXAMPLE-name-Value"
}
],
requestAccessControl: {
defaultActionName: "EXAMPLE-defaultActionName-Value",
rules: [{
type: "ACCESS_CONTROL", name: "EXAMPLE-name-Value",
conditionLanguage: waf.models.WebAppFirewallPolicyRule.ConditionLanguage.Jmespath,
condition: "EXAMPLE-condition-Value",
actionName: "EXAMPLE-actionName-Value"
}
],
}
,
requestRateLimiting: {
rules: [{
type: "REQUEST_RATE_LIMITING", configurations: [{
periodInSeconds: 7979,
requestsLimit: 851,
actionDurationInSeconds: 84884,
}
],
name: "EXAMPLE-name-Value",
conditionLanguage: waf.models.WebAppFirewallPolicyRule.ConditionLanguage.Jmespath,
condition: "EXAMPLE-condition-Value",
actionName: "EXAMPLE-actionName-Value"
}
],
}
,
requestProtection: {
rules: [{
type: "PROTECTION", protectionCapabilities: [{
key: "EXAMPLE-key-Value",
version: 755,
exclusions: {
requestCookies: ["EXAMPLE--Value" ],
args: ["EXAMPLE--Value" ],
}
,
actionName: "EXAMPLE-actionName-Value",
collaborativeActionThreshold: 241,
collaborativeWeights: [{
key: "EXAMPLE-key-Value",
weight: 217,
}
],
}
],
protectionCapabilitySettings: {
maxNumberOfArguments: 8843,
maxSingleArgumentLength: 852370,
maxTotalArgumentLength: 11330169,
maxHttpRequestHeaders: 684,
maxHttpRequestHeaderLength: 973091,
allowedHttpMethods: ["EXAMPLE--Value" ],
}
,
isBodyInspectionEnabled: false,
name: "EXAMPLE-name-Value",
conditionLanguage: waf.models.WebAppFirewallPolicyRule.ConditionLanguage.Jmespath,
condition: "EXAMPLE-condition-Value",
actionName: "EXAMPLE-actionName-Value"
}
],
bodyInspectionSizeLimitInBytes: 687,
bodyInspectionSizeLimitExceededActionName: "EXAMPLE-bodyInspectionSizeLimitExceededActionName-Value",
}
,
responseAccessControl: {
rules: [{
type: "ACCESS_CONTROL", name: "EXAMPLE-name-Value",
conditionLanguage: waf.models.WebAppFirewallPolicyRule.ConditionLanguage.Jmespath,
condition: "EXAMPLE-condition-Value",
actionName: "EXAMPLE-actionName-Value"
}
],
}
,
responseProtection: {
rules: [{
type: "PROTECTION", protectionCapabilities: [{
key: "EXAMPLE-key-Value",
version: 829,
exclusions: {
requestCookies: ["EXAMPLE--Value" ],
args: ["EXAMPLE--Value" ],
}
,
actionName: "EXAMPLE-actionName-Value",
collaborativeActionThreshold: 76,
collaborativeWeights: [{
key: "EXAMPLE-key-Value",
weight: 798,
}
],
}
],
protectionCapabilitySettings: {
maxNumberOfArguments: 9016,
maxSingleArgumentLength: 360603,
maxTotalArgumentLength: 42464295,
maxHttpRequestHeaders: 796,
maxHttpRequestHeaderLength: 269848,
allowedHttpMethods: ["EXAMPLE--Value" ],
}
,
isBodyInspectionEnabled: false,
name: "EXAMPLE-name-Value",
conditionLanguage: waf.models.WebAppFirewallPolicyRule.ConditionLanguage.Jmespath,
condition: "EXAMPLE-condition-Value",
actionName: "EXAMPLE-actionName-Value"
}
],
}
,
freeformTags: {
EXAMPLE_KEY_ibBXS :"EXAMPLE_VALUE_fqEVivqrWp0lcm54zjwa"
},
definedTags: {
EXAMPLE_KEY_gUiuy :{
EXAMPLE_KEY_n42gi :"EXAMPLE--Value"
}
},
systemTags: {
EXAMPLE_KEY_dMW0S :{
EXAMPLE_KEY_BpFoM :"EXAMPLE--Value"
}
},
}
const updateWebAppFirewallPolicyRequest: waf.requests.UpdateWebAppFirewallPolicyRequest = {
webAppFirewallPolicyId: "ocid1.test.oc1..<unique_ID>EXAMPLE-webAppFirewallPolicyId-Value",
updateWebAppFirewallPolicyDetails: updateWebAppFirewallPolicyDetails,
ifMatch: "EXAMPLE-ifMatch-Value",
opcRequestId: "VMIXGD4WPXWNQOXPOPTH<unique_ID>",
};
// Send request to the Client.
const updateWebAppFirewallPolicyResponse = await client.updateWebAppFirewallPolicy(updateWebAppFirewallPolicyRequest);
}
catch (error) {
console.log("updateWebAppFirewallPolicy Failed with error " + error);
}
})();