This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
results.go
55 lines (47 loc) · 1.6 KB
/
results.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ccattackprotection_rules
import (
"github.com/huaweicloud/golangsdk"
)
type CcAttack struct {
Id string `json:"id"`
PolicyID string `json:"policy_id"`
Url string `json:"path"`
LimitNum int `json:"limit_num"`
LimitPeriod int `json:"limit_period"`
LockTime int `json:"lock_time"`
TagType string `json:"tag_type"`
TagIndex string `json:"tag_index"`
TagCondition TagCondition `json:"tag_condition"`
Action Action `json:"action"`
Default bool `json:"default"`
TimeStamp int `json:"timestamp"`
}
type commonResult struct {
golangsdk.Result
}
// Extract is a function that accepts a result and extracts a cc attack protection rule.
func (r commonResult) Extract() (*CcAttack, error) {
var response CcAttack
err := r.ExtractInto(&response)
return &response, err
}
// CreateResult represents the result of a create operation. Call its Extract
// method to interpret it as a cc attack protection rule.
type CreateResult struct {
commonResult
}
// UpdateResult represents the result of a update operation. Call its Extract
// method to interpret it as a cc attack protection rule.
type UpdateResult struct {
commonResult
}
// GetResult represents the result of a get operation. Call its Extract
// method to interpret it as a cc attack protection rule.
type GetResult struct {
commonResult
}
// DeleteResult represents the result of a delete operation. Call its ExtractErr
// method to determine if the request succeeded or failed.
type DeleteResult struct {
golangsdk.ErrResult
}