Documentation ¶
Index ¶
- Variables
- type Action
- type BindHost
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListPolicyOpts
- type ListPolicyRst
- type Policy
- type PolicyOption
- type UpdateHostsOpts
- type UpdateHostsOptsBuilder
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
var RequestOpts golangsdk.RequestOpts = golangsdk.RequestOpts{ MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"}, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Category string `json:"category,omitempty"` FollowedActionId string `json:"followed_action_id,omitempty"` }
Action contains actions after the attack is detected
type BindHost ¶
type BindHost struct { Id string `json:"id,omitempty"` Hostname string `json:"hostname,omitempty"` WafType string `json:"waf_type,omitempty"` Mode string `json:"mode,omitempty"` }
BindHost the hosts bound to this policy.
type CreateOpts ¶
type CreateOpts struct { //Policy name Name string `json:"name" required:"true"` }
CreateOpts contains all the values needed to create a new policy.
func (CreateOpts) ToPolicyCreateMap ¶
func (opts CreateOpts) ToPolicyCreateMap() (map[string]interface{}, error)
ToPolicyCreateMap builds a create request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Policy.
func Create ¶
func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create will create a new policy based on the values in CreateOpts.
type DeleteResult ¶
DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(c *golangsdk.ServiceClient, id string) (r DeleteResult)
Delete will permanently delete a particular policy based on its unique ID.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Policy.
type ListPolicyOpts ¶
type ListPolicyOpts struct { Page int `q:"page"` Pagesize int `q:"pagesize"` // policy name Name string `q:"name"` }
ListPolicyOpts
type ListPolicyRst ¶
type ListPolicyRst struct { // total policy count. Total int `json:"total"` // the policy list Items []Policy `json:"items"` }
ListPolicyRst
func ListPolicy ¶
func ListPolicy(c *golangsdk.ServiceClient, opts ListPolicyOpts) (*ListPolicyRst, error)
ListPolicy retrieve waf policy by ListPolicyOpts
type Policy ¶
type Policy struct { Id string `json:"id"` Name string `json:"name"` Action Action `json:"action"` Options PolicyOption `json:"options"` Level int `json:"level"` FullDetection bool `json:"full_detection"` BindHosts []BindHost `json:"bind_host"` }
Policy contains the infomateion of the policy.
type PolicyOption ¶
type PolicyOption struct { Webattack bool `json:"webattack,omitempty"` Common bool `json:"common,omitempty"` Crawler bool `json:"crawler,omitempty"` CrawlerEngine bool `json:"crawler_engine,omitempty"` CrawlerScanner bool `json:"crawler_scanner,omitempty"` CrawlerScript bool `json:"crawler_script,omitempty"` CrawlerOther bool `json:"crawler_other,omitempty"` Webshell bool `json:"webshell,omitempty"` Cc bool `json:"cc,omitempty"` Custom bool `json:"custom,omitempty"` Whiteblackip bool `json:"whiteblackip,omitempty"` Ignore bool `json:"ignore,omitempty"` Privacy bool `json:"privacy,omitempty"` Antitamper bool `json:"antitamper,omitempty"` }
PolicyOption contains the protection rule of a policy
type UpdateHostsOpts ¶
type UpdateHostsOpts struct { //Domain ID Hosts []string `q:"hosts" required:"true"` }
UpdateHostsOpts contains all the values needed to update a policy hosts.
func (UpdateHostsOpts) ToUpdateHostsQuery ¶
func (opts UpdateHostsOpts) ToUpdateHostsQuery() (string, error)
ToUpdateHostsQuery builds a update request query from UpdateHostsOpts.
type UpdateHostsOptsBuilder ¶
UpdateHostsOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateOpts ¶
type UpdateOpts struct { Name string `json:"name,omitempty"` Action *Action `json:"action,omitempty"` Options *PolicyOption `json:"options,omitempty"` Level int `json:"level,omitempty"` FullDetection *bool `json:"full_detection,omitempty"` }
UpdateOpts contains all the values needed to update a policy.
func (UpdateOpts) ToPolicyUpdateMap ¶
func (opts UpdateOpts) ToPolicyUpdateMap() (map[string]interface{}, error)
ToPolicyUpdateMap builds a update request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of a update operation. Call its Extract method to interpret it as a Policy.
func Update ¶
func Update(c *golangsdk.ServiceClient, policyID string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and uses the values to update a policy.The response code from api is 200
func UpdateHosts ¶
func UpdateHosts(c *golangsdk.ServiceClient, policyId string, opts UpdateHostsOptsBuilder) (r UpdateResult)
UpdateHosts accepts a UpdateHostsOpts struct and uses the values to update a policy hosts.The response code from api is 200