policies

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 1 Imported by: 1

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 {
	//Protective Action
	Category string `json:"category" required:"true"`
}

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

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

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.

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 (GetResult) Extract

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

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

type Options

type Options struct {
	//Whether Basic Web Protection is enabled
	WebAttack *bool `json:"webattack,omitempty"`
	//Whether General Check in Basic Web Protection is enabled
	Common *bool `json:"common,omitempty"`
	//Whether the master crawler detection switch in Basic Web Protection is enabled
	Crawler *bool `json:"crawler,omitempty"`
	//Whether the Search Engine switch in Basic Web Protection is enabled
	CrawlerEngine *bool `json:"crawler_engine,omitempty"`
	//Whether the Scanner switch in Basic Web Protection is enabled
	CrawlerScanner *bool `json:"crawler_scanner,omitempty"`
	//Whether the Script Tool switch in Basic Web Protection is enabled
	CrawlerScript *bool `json:"crawler_script,omitempty"`
	//Whether detection of other crawlers in Basic Web Protection is enabled
	CrawlerOther *bool `json:"crawler_other,omitempty"`
	//Whether webshell detection in Basic Web Protection is enabled
	WebShell *bool `json:"webshell,omitempty"`
	//Whether CC Attack Protection is enabled
	Cc *bool `json:"cc,omitempty"`
	//Whether Precise Protection is enabled
	Custom *bool `json:"custom,omitempty"`
	//Whether Blacklist and Whitelist is enabled
	WhiteblackIp *bool `json:"whiteblackip,omitempty"`
	//Whether Data Masking is enabled
	Privacy *bool `json:"privacy,omitempty"`
	//Whether False Alarm Masking is enabled
	Ignore *bool `json:"ignore,omitempty"`
	//Whether Web Tamper Protection is enabled
	AntiTamper *bool `json:"antitamper,omitempty"`
}

type Policy

type Policy struct {
	//Policy ID
	Id string `json:"id"`
	//Policy Name
	Name string `json:"name"`
	//Protective Action
	Action Action `json:"action"`
	//Protection Switches
	Options Options `json:"options"`
	//Protection Level
	Level int `json:"level"`
	//Detection Mode
	FullDetection bool `json:"full_detection"`
	//Domain IDs
	Hosts []string `json:"hosts"`
}

type UpdateHostsOpts

type UpdateHostsOpts struct {
	//Domain IDs
	Hosts []string `json:"hosts" required:"true"`
}

UpdateHostsOpts contains all the values needed to update a policy hosts.

func (UpdateHostsOpts) ToPolicyHostsUpdateMap

func (opts UpdateHostsOpts) ToPolicyHostsUpdateMap() (map[string]interface{}, error)

ToPolicyHostsUpdateMap builds a update request body from UpdateHostsOpts.

type UpdateHostsOptsBuilder

type UpdateHostsOptsBuilder interface {
	ToPolicyHostsUpdateMap() (map[string]interface{}, error)
}

UpdateHostsOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateOpts

type UpdateOpts struct {
	//Policy name
	Name string `json:"name,omitempty"`
	//Protective Action
	Action *Action `json:"action,omitempty"`
	//Protection Switches
	Options *Options `json:"options,omitempty"`
	//Protection Level
	Level int `json:"level,omitempty"`
	//Detection Mode
	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

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)

Update 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