policies

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (err error)

Types

type Certificates

type Certificates struct {
	// Certificate ID.
	ID string `json:"id"`
	// Certificate name.
	Name string `json:"name"`
	// Timestamp when the certificate is uploaded.
	CreatedAt int64 `json:"timestamp"`
}

type CreateOpts

type CreateOpts struct {
	// Policy name.
	// The policy name can contain only digits, letters, and underscores (_) and cannot exceed 64 characters.
	Name string `json:"name" required:"true"`
}

type ListOpts

type ListOpts struct {
	// Number of records on each page.
	// The maximum value is 100. If this parameter is not specified, the default value -1 is used.
	// All policies are queried regardless of the value of Page
	PageSize string `q:"pageSize,omitempty"`
	// Page. Default value: 1
	Page string `q:"page,omitempty"`
	// Policy name. Fuzzy search is supported.
	Name string `q:"name,omitempty"`
}

type ModulexOptions

type ModulexOptions struct {
	// Status of the global rate limiting function (counting requests to all WAF instances when limiting traffic).
	GlobalRateEnabled *bool `json:"global_rate_enabled"`
	// Protection mode of the global rate limiting function.
	GlobalRateMode string `json:"global_rate_mode"`
	// Status of the intelligent precise protection.
	PreciseRulesEnabled *bool `json:"precise_rules_enabled"`
	// Protection mode of the intelligent precise protection.
	// log: WAF logs the event only.
	// block: WAF blocks requests.
	PreciseRulesMode string `json:"precise_rules_mode"`
	// Management mode of the intelligent precise protection.
	// auto: WAF manages automatically generated rules.
	// manual: You can manage rules that are automatically generated by WAF.
	PreciseRulesManagedMode string `json:"precise_rules_managed_mode"`
	// Aging mode of the intelligent precise protection.
	// manual: You can customize the maximum age of the rule.
	// auto: Automatic
	PreciseRulesAgingMode string `json:"precise_rules_aging_mode"`
	// Maximum age of the intelligent precise protection.
	PreciseRulesRetention int `json:"precise_rules_retention"`
	// Status of the intelligent CC attack protection.
	CcRulesEnabled *bool `json:"cc_rules_enabled"`
	// Protection mode of the intelligent CC attack protection rule.
	// log: WAF logs the event only.
	// block: WAF blocks requests.
	CcRulesMode string `json:"cc_rules_mode"`
	// Management mode of the intelligent CC attack protection.
	// auto: WAF manages automatically generated rules.
	// manual: You can manage rules that are automatically generated by WAF.
	CcRulesManagedMode string `json:"cc_rules_managed_mode"`
	// Aging mode of the intelligent CC attack protection.
	// manual: You can customize the maximum age of the rule.
	// auto: Automatic
	CcRulesAgingMode string `json:"cc_rules_aging_mode"`
	// Maximum age of the intelligent CC attack protection.
	CcRulesRetention int `json:"cc_rules_retention"`
}

type Policy

type Policy struct {
	// Policy ID. This is the unique identifier generated by WAF.
	ID string `json:"id"`
	// Policy name.
	Name string `json:"name"`
	// Policy action
	Action *PolicyAction `json:"action"`
	// Feature-based anti-crawler protection mode.
	RobotAction *PolicyAction `json:"robot_action"`
	// Policy option
	Options *PolicyOption `json:"options"`
	// Protection level. A low protection level may result in a lower false-positive rate,
	// but also a lower attack detection rate. A high protection level may result in
	// a higher attack detection rate, but also a higher false-positive rate.
	// A medium protection level can balance both. Protection levels:
	// 1: Low
	// 2: Medium
	// 3: High
	Level int `json:"level"`
	// Detection mode in the precise protection rule
	// true: full detection.
	// WAF blocks all requests that hit the configured precise protection rule
	// when it finishes all threat detections.
	// false: instant detection.
	// WAF immediately ends threat detection and blocks the
	// request that hits the configured precise protection rule.
	FullDetection *bool `json:"full_detection"`
	// Array of protected domain names for which the policy is used.
	// Each policy can be used to one or more domain names.
	// You can specify a policy for a domain name when you add the domain name
	// to WAF by calling the API Adding a Protected Domain Name.
	BindHost []certificates.Hosts `json:"bind_host"`
	// Array of IDs of protected domain names.
	// The ID of a protected domain name is unique and generated by WAF when you add the domain name to WAF.
	// To obtain the IDs, call the API Querying Domain Names Protected by Dedicated WAF Engines.
	// To add a domain name to WAF, call the API Adding a Protected Domain Name.
	Hosts []string `json:"hosts"`
	// Switch for enabling or disabling Deep Inspection and Header Inspection in Basic Web Protection.
	Extend *PolicyExtend `json:"extend"`
	// Whether to share a policy. This parameter is reserved and can be ignored currently.
	ShareInfo *ShareInfo `json:"share_info"`
	// Whether to enable intelligent CC protection. This parameter is reserved and can be ignored currently.
	ModulexOptions *ModulexOptions `json:"modulex_options"`
	// Time the policy is created. The value is a 13-digit timestamp, in ms.
	CreatedAt int64 `json:"timestamp"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Policy, error)

Create will create a new Waf Policy on the values in CreateOpts.

func Get

func Get(client *golangsdk.ServiceClient, id string) (*Policy, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Policy, error)

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (*Policy, error)

type PolicyAction

type PolicyAction struct {
	// Protection level. The value can be:
	// block: WAF blocks attacks.
	// log: WAF only logs detected attacks.
	Category string `json:"category"`
}

type PolicyExtend

type PolicyExtend struct {
	// Protection statuses for advanced settings in basic web protection.
	// By default, this parameter is left blank, and the Deep Inspection and Header Inspection are disabled.
	// If deep_decode is set to true, the Deep Inspection is enabled.
	// If check_all_headers is set to true, the Header Inspection is enabled.
	// If deep_decode and check_all_headers are set to false,
	// the Deep Inspection and Header Inspection are disabled.
	Extend string `json:"extend"`
}

type PolicyOption

type PolicyOption struct {
	// Basic web protection includes many specific checks under Advanced Settings,
	// and there is a specific parameter allocated for each check,
	// for example, common for General Check. To enable any of these checks,
	// keep this parameter enabled first.
	WebAttack *bool `json:"webattack,omitempty"`
	// Whether general check is enabled.
	Common *bool `json:"common,omitempty"`
	// JavaScript anti-crawler function.
	AntiCrawler *bool `json:"anticrawler,omitempty"`
	// Whether the search engine is enabled.
	CrawlerEngine *bool `json:"crawler_engine,omitempty"`
	// Whether the scanner check in anti-crawler detection is enabled.
	CrawlerScanner *bool `json:"crawler_scanner,omitempty"`
	// Whether the JavaScript anti-crawler is enabled.
	CrawlerScript *bool `json:"crawler_script,omitempty"`
	// Whether other crawler check is enabled.
	CrawlerOther *bool `json:"crawler_other,omitempty"`
	// Whether webshell check is enabled.
	WebShell *bool `json:"webshell,omitempty"`
	// Whether the CC attack protection rule is enabled.
	Cc *bool `json:"cc,omitempty"`
	// Whether precise protection is enabled.
	Custom *bool `json:"custom,omitempty"`
	// Whether blacklist and whitelist protection is enabled.
	WhiteblackIp *bool `json:"whiteblackip,omitempty"`
	// Whether geolocation access control is enabled.
	GeoIp *bool `json:"geoip,omitempty"`
	// Whether false alarm masking is enabled.
	Ignore *bool `json:"ignore,omitempty"`
	// Whether data masking is enabled.
	Privacy *bool `json:"privacy,omitempty"`
	// Whether the web tamper protection is enabled.
	AntiTamper *bool `json:"antitamper,omitempty"`
	// Whether the information leakage prevention is enabled.
	AntiLeakage *bool `json:"antileakage,omitempty"`
	// Whether the Known Attack Source protection is enabled.
	FollowedAction *bool `json:"followed_action,omitempty"`
	// Feature-based anti-crawler. This feature includes many specific anti-crawler checks,
	// such as crawler_engine, crawler_scanner, crawler_script, and crawler_other.
	// To enable any of these checks, keep anti-crawler protection enabled
	BotEnable      *bool `json:"bot_enable,omitempty"`
	Crawler        *bool `json:"crawler,omitempty"`
	Precise        *bool `json:"precise,omitempty"`
	ModulexEnabled *bool `json:"modulex_enabled,omitempty"`
}

type ShareInfo

type ShareInfo struct {
	// Total number of the users who share the address group.
	ShareCount int `json:"share_count"`
	// Number of users who accept the sharing
	AcceptCount int `json:"accept_count"`
	// Status
	Status int `json:"process_status"`
}

type UpdateOpts

type UpdateOpts struct {
	// Policy name
	Name string `json:"name"`
	// Policy action
	Action *PolicyAction `json:"action"`
	// Policy option
	Options *PolicyOption `json:"options"`
	// Feature-based anti-crawler protection mode.
	// The default protection mode is Log only.
	RobotAction *PolicyAction `json:"robot_action"`
	// Protection level
	Level int `json:"level"`
	// Detection mode in the precise protection rule
	FullDetection *bool `json:"full_detection"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL