Skip to content

Latest commit

 

History

History
311 lines (230 loc) · 9.99 KB

WafActiveRulesApi.md

File metadata and controls

311 lines (230 loc) · 9.99 KB

Fastly.WafActiveRulesApi

const apiInstance = new Fastly.WafActiveRulesApi();

Methods

Method Fastly API endpoint Description
bulkUpdateWafActiveRules PATCH /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/bulk Update multiple active rules
createWafActiveRule POST /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules Add a rule to a WAF as an active rule
createWafActiveRulesTag POST /waf/firewalls/{firewall_id}/versions/{version_id}/tags/{waf_tag_name}/active-rules Create active rules by tag
deleteWafActiveRule DELETE /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id} Delete an active rule
getWafActiveRule GET /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id} Get an active WAF rule object
listWafActiveRules GET /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules List active rules on a WAF
updateWafActiveRule PATCH /waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id} Update an active rule

bulkUpdateWafActiveRules

bulkUpdateWafActiveRules({ firewall_id, version_id, [body] })

Bulk update all active rules on a firewall version. This endpoint will not add new active rules, only update existing active rules.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  body: {"type":"waf_active_rule","attributes":{"revision":"latest"}},
};

apiInstance.bulkUpdateWafActiveRules(options)
  .then(() => {
    console.log('API called successfully.');
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
body WafActiveRuleData [optional]

Return type

null (empty response body)

createWafActiveRule

createWafActiveRule({ firewall_id, version_id, [waf_active_rule] })

Create an active rule for a particular firewall version.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  waf_active_rule: {"data":{"type":"waf_active_rule","attributes":{"status":"log"},"relationships":{"waf_rule_revision":{"data":[{"type":"waf_rule_revision","id":"r3Vg2uUGZzb2W9Euo4mo0R"}]}}}},
};

apiInstance.createWafActiveRule(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
waf_active_rule WafActiveRule [optional]

Return type

WafActiveRuleCreationResponse

createWafActiveRulesTag

createWafActiveRulesTag({ firewall_id, version_id, waf_tag_name, [waf_active_rule] })

Create active rules by tag. This endpoint will create active rules using the latest revision available for each rule.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  waf_tag_name: "waf_tag_name_example", // required
  waf_active_rule: {"data":{"type":"waf_active_rule","attributes":{"status":"log"}}},
};

apiInstance.createWafActiveRulesTag(options)
  .then(() => {
    console.log('API called successfully.');
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
waf_tag_name String Name of the tag.
waf_active_rule WafActiveRule [optional]

Return type

null (empty response body)

deleteWafActiveRule

deleteWafActiveRule({ firewall_id, version_id, waf_rule_id })

Delete an active rule for a particular firewall version.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  waf_rule_id: "waf_rule_id_example", // required
};

apiInstance.deleteWafActiveRule(options)
  .then(() => {
    console.log('API called successfully.');
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
waf_rule_id String Alphanumeric string identifying a WAF rule.

Return type

null (empty response body)

getWafActiveRule

getWafActiveRule({ firewall_id, version_id, waf_rule_id, [include] })

Get a specific active rule object. Includes details of the rule revision associated with the active rule object by default.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  waf_rule_id: "waf_rule_id_example", // required
  include: waf_rule_revision,waf_firewall_version,
};

apiInstance.getWafActiveRule(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
waf_rule_id String Alphanumeric string identifying a WAF rule.
include String Include relationships. Optional, comma-separated values. Permitted values: waf_rule_revision and waf_firewall_version. [optional]

Return type

WafActiveRuleResponse

listWafActiveRules

listWafActiveRules({ firewall_id, version_id, [filter_status, ][filter_waf_rule_revision_message, ][filter_waf_rule_revision_modsec_rule_id, ][filter_outdated, ][include, ][page_number, ][page_size] })

List all active rules for a particular firewall version.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  filter_status: "filter_status_example",
  filter_waf_rule_revision_message: "filter_waf_rule_revision_message_example",
  filter_waf_rule_revision_modsec_rule_id: "filter_waf_rule_revision_modsec_rule_id_example",
  filter_outdated: "filter_outdated_example",
  include: waf_rule_revision,waf_firewall_version,
  page_number: 1,
  page_size: 20,
};

apiInstance.listWafActiveRules(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
filter_status String Limit results to active rules with the specified status. [optional]
filter_waf_rule_revision_message String Limit results to active rules with the specified message. [optional]
filter_waf_rule_revision_modsec_rule_id String Limit results to active rules that represent the specified ModSecurity modsec_rule_id. [optional]
filter_outdated String Limit results to active rules referencing an outdated rule revision. [optional]
include String Include relationships. Optional, comma-separated values. Permitted values: waf_rule_revision and waf_firewall_version. [optional]
page_number Number Current page. [optional]
page_size Number Number of records per page. [optional] [defaults to 20]

Return type

WafActiveRulesResponse

updateWafActiveRule

updateWafActiveRule({ firewall_id, version_id, waf_rule_id, [waf_active_rule] })

Update an active rule's status for a particular firewall version.

Example

const options = {
  firewall_id: "firewall_id_example", // required
  version_id: 56, // required
  waf_rule_id: "waf_rule_id_example", // required
  waf_active_rule: {"data":{"id":"3krg2uUGZzb2W9Euo4moOR","type":"waf_active_rule","attributes":{"status":"block"}}},
};

apiInstance.updateWafActiveRule(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
firewall_id String Alphanumeric string identifying a WAF Firewall.
version_id Number Integer identifying a service version.
waf_rule_id String Alphanumeric string identifying a WAF rule.
waf_active_rule WafActiveRule [optional]

Return type

WafActiveRuleResponse

[Back to top] [Back to API list] [Back to README]