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 PolicyPage
- 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"` Hostname string `json:"hostname"` WafType string `json:"waf_type"` Mode string `json:"mode"` }
BindHost the hosts bound to this policy.
type CreateOpts ¶
type CreateOpts struct { //Policy name Name string `json:"name" required:"true"` EnterpriseProjectId string `q:"enterprise_project_id" json:"-"` }
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.
func DeleteWithEpsID ¶
func DeleteWithEpsID(c *golangsdk.ServiceClient, id, epsID string) (r DeleteResult)
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.
func Get ¶
func Get(c *golangsdk.ServiceClient, id string) (r GetResult)
Get retrieves a particular policy based on its unique ID.
func GetWithEpsID ¶
func GetWithEpsID(c *golangsdk.ServiceClient, id, epsID string) (r GetResult)
type ListPolicyOpts ¶
type ListPolicyOpts struct { Page int `q:"page"` Pagesize int `q:"pagesize"` // policy name Name string `q:"name"` EnterpriseProjectId string `q:"enterprise_project_id"` }
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"` RobotAction Action `json:"robot_action"` Options PolicyOption `json:"options"` Level int `json:"level"` FullDetection bool `json:"full_detection"` Hosts []string `json:"hosts"` BindHosts []BindHost `json:"bind_host"` Extend map[string]string `json:"extend"` }
Policy contains the infomateion of the policy.
func ExtractPolicies ¶
func ExtractPolicies(r pagination.Page) ([]Policy, error)
func List ¶
func List(c *golangsdk.ServiceClient, opts ListPolicyOpts) ([]Policy, error)
List using to query all pages WAF policies
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"` GeoIP *bool `json:"geoip,omitempty"` Antileakage *bool `json:"antileakage,omitempty"` BotEnable *bool `json:"bot_enable,omitempty"` FollowedAction *bool `json:"followed_action,omitempty"` Anticrawler *bool `json:"anticrawler,omitempty"` }
PolicyOption contains the protection rule of a policy
type PolicyPage ¶
type PolicyPage struct {
pagination.PageSizeBase
}
func (PolicyPage) IsEmpty ¶
func (r PolicyPage) IsEmpty() (bool, error)
type UpdateHostsOpts ¶
type UpdateHostsOpts struct { //Domain ID Hosts []string `q:"hosts" required:"true"` EnterpriseProjectId string `q:"enterprise_project_id"` }
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 { FullDetection *bool `json:"full_detection,omitempty"` RobotAction *Action `json:"robot_action,omitempty"` Action *Action `json:"action,omitempty"` Options *PolicyOption `json:"options,omitempty"` Name string `json:"name,omitempty"` Level int `json:"level,omitempty"` Extend map[string]string `json:"extend,omitempty"` EnterpriseProjectId string `q:"enterprise_project_id" json:"-"` }
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