policies

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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"`
	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

type CreateOptsBuilder interface {
	ToPolicyCreateMap() (map[string]interface{}, error)
}

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.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Policy, error)

Extract is a function that accepts a result and extracts a policy.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

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)

func (GetResult) Extract

func (r GetResult) Extract() (*Policy, error)

Extract is a function that accepts a result and extracts a policy.

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"`
	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"`
	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

type UpdateHostsOptsBuilder interface {
	ToUpdateHostsQuery() (string, error)
}

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"`
	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

type UpdateOptsBuilder interface {
	ToPolicyUpdateMap() (map[string]interface{}, error)
}

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

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Policy, error)

Extract is a function that accepts a result and extracts a policy.

Jump to

Keyboard shortcuts

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