github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf/v1/policies/results.go (about) 1 package policies 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 ) 6 7 type Policy struct { 8 // Policy ID 9 Id string `json:"id"` 10 // Policy Name 11 Name string `json:"name"` 12 // Protective Action 13 Action Action `json:"action"` 14 // Protection Switches 15 Options Options `json:"options"` 16 // Protection Level 17 Level int `json:"level"` 18 // Detection Mode 19 FullDetection bool `json:"full_detection"` 20 // Domain IDs 21 Hosts []string `json:"hosts"` 22 } 23 24 type Action struct { 25 // Protective Action 26 Category string `json:"category" required:"true"` 27 } 28 29 type Options struct { 30 // Whether Basic Web Protection is enabled 31 WebAttack *bool `json:"webattack,omitempty"` 32 // Whether General Check in Basic Web Protection is enabled 33 Common *bool `json:"common,omitempty"` 34 // Whether the master crawler detection switch in Basic Web Protection is enabled 35 Crawler *bool `json:"crawler,omitempty"` 36 // Whether the Search Engine switch in Basic Web Protection is enabled 37 CrawlerEngine *bool `json:"crawler_engine,omitempty"` 38 // Whether the Scanner switch in Basic Web Protection is enabled 39 CrawlerScanner *bool `json:"crawler_scanner,omitempty"` 40 // Whether the Script Tool switch in Basic Web Protection is enabled 41 CrawlerScript *bool `json:"crawler_script,omitempty"` 42 // Whether detection of other crawlers in Basic Web Protection is enabled 43 CrawlerOther *bool `json:"crawler_other,omitempty"` 44 // Whether webshell detection in Basic Web Protection is enabled 45 WebShell *bool `json:"webshell,omitempty"` 46 // Whether CC Attack Protection is enabled 47 Cc *bool `json:"cc,omitempty"` 48 // Whether Precise Protection is enabled 49 Custom *bool `json:"custom,omitempty"` 50 // Whether Blacklist and Whitelist is enabled 51 WhiteblackIp *bool `json:"whiteblackip,omitempty"` 52 // Whether Data Masking is enabled 53 Privacy *bool `json:"privacy,omitempty"` 54 // Whether False Alarm Masking is enabled 55 Ignore *bool `json:"ignore,omitempty"` 56 // Whether Web Tamper Protection is enabled 57 AntiTamper *bool `json:"antitamper,omitempty"` 58 } 59 60 type commonResult struct { 61 golangsdk.Result 62 } 63 64 // Extract is a function that accepts a result and extracts a policy. 65 func (r commonResult) Extract() (*Policy, error) { 66 var response Policy 67 err := r.ExtractInto(&response) 68 return &response, err 69 } 70 71 // CreateResult represents the result of a create operation. Call its Extract 72 // method to interpret it as a Policy. 73 type CreateResult struct { 74 commonResult 75 } 76 77 // UpdateResult represents the result of a update operation. Call its Extract 78 // method to interpret it as a Policy. 79 type UpdateResult struct { 80 commonResult 81 } 82 83 // GetResult represents the result of a get operation. Call its Extract 84 // method to interpret it as a Policy. 85 type GetResult struct { 86 commonResult 87 } 88 89 // DeleteResult represents the result of a delete operation. Call its ExtractErr 90 // method to determine if the request succeeded or failed. 91 type DeleteResult struct { 92 golangsdk.ErrResult 93 }