rules

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HostName RuleType = "HOST_NAME"
	Path     RuleType = "PATH"

	EqualTo    CompareType = "EQUAL_TO"
	Regex      CompareType = "REGEX"
	StartsWith CompareType = "STARTS_WITH"
)

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient, policyID string, opts ListOptsBuilder) pagination.Pager

Types

type CompareType

type CompareType string

type Condition added in v0.6.0

type Condition struct {
	// Specifies the key of match item.
	Key string `json:"key"`

	// Specifies the value of the match item.
	Value string `json:"value" required:"true"`
}

type CreateOpts

type CreateOpts struct {
	// Specifies the conditions contained in a forwarding rule.
	// This parameter will take effect when enhance_l7policy_enable is set to true.
	// If conditions is specified, key and value will not take effect,
	// and the value of this parameter will contain all conditions configured for the forwarding rule.
	// The keys in the list must be the same, whereas each value must be unique.
	Conditions []Condition `json:"conditions,omitempty"`
	// Specifies the match content. The value can be one of the following:
	//
	//    HOST_NAME: A domain name will be used for matching.
	//    PATH: A URL will be used for matching.
	// If type is set to HOST_NAME, PATH, METHOD, or SOURCE_IP, only one forwarding rule can be created for each type.
	Type RuleType `json:"type" required:"true"`

	// Specifies how requests are matched and forwarded.
	//
	//    If type is set to HOST_NAME, this parameter can only be set to EQUAL_TO. Asterisks (*) can be used as wildcard characters.
	//    If type is set to PATH, this parameter can be set to REGEX, STARTS_WITH, or EQUAL_TO.
	CompareType CompareType `json:"compare_type" required:"true"`

	// Specifies the value of the match item. For example, if a domain name is used for matching, value is the domain name.
	//
	//    If type is set to HOST_NAME, the value can contain letters, digits, hyphens (-), and periods (.) and must
	//    start with a letter or digit. If you want to use a wildcard domain name, enter an asterisk (*) as the leftmost
	//    label of the domain name.
	//
	//    If type is set to PATH and compare_type to STARTS_WITH or EQUAL_TO, the value must start with a slash (/) and
	//    can contain only letters, digits, and special characters _~';@^-%#&$.*+?,=!:|/()[]{}
	Value string `json:"value" required:"true"`

	// Specifies the project ID.
	ProjectID string `json:"project_id,omitempty"`
}

func (CreateOpts) ToRuleCreateMap

func (opts CreateOpts) ToRuleCreateMap() (map[string]interface{}, error)

type CreateOptsBuilder

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

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

func Create

func Create(client *golangsdk.ServiceClient, policyID string, opts CreateOptsBuilder) (r CreateResult)

func (CreateResult) Extract

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

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

func Delete

func Delete(client *golangsdk.ServiceClient, policyID, id string) (r DeleteResult)

type ForwardingRule

type ForwardingRule struct {
	ID          string      `json:"id"`
	Type        RuleType    `json:"type"`
	CompareType CompareType `json:"compare_type"`
	Value       string      `json:"value"`
	ProjectID   string      `json:"project_id"`
	Conditions  []Condition `json:"conditions"`
}

func ExtractRules

func ExtractRules(p pagination.Page) ([]ForwardingRule, error)

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

func Get

func Get(client *golangsdk.ServiceClient, policyID, id string) (r GetResult)

func (GetResult) Extract

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

type ListOpts

type ListOpts struct {
	ID          []string      `q:"id"`
	CompareType []CompareType `q:"compare_type"`
	Value       []string      `q:"value"`
	Type        []RuleType    `q:"type"`

	Limit       int    `q:"limit"`
	Marker      string `q:"marker"`
	PageReverse bool   `q:"page_reverse"`
}

type ListOptsBuilder

type ListOptsBuilder interface {
	ToRuleListQuery() (string, error)
}

type RulePage

type RulePage struct {
	pagination.PageWithInfo
}

func (RulePage) IsEmpty

func (p RulePage) IsEmpty() (bool, error)

type RuleType

type RuleType string

type UpdateOpts

type UpdateOpts struct {
	CompareType CompareType `json:"compare_type,omitempty"`
	Value       string      `json:"value,omitempty"`
	Conditions  []Condition `json:"conditions,omitempty"`
}

func (UpdateOpts) ToUpdateRuleMap

func (opts UpdateOpts) ToUpdateRuleMap() (map[string]interface{}, error)

type UpdateOptsBuilder

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

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

func Update

func Update(client *golangsdk.ServiceClient, policyID, id string, opts UpdateOptsBuilder) (r UpdateResult)

func (UpdateResult) Extract

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

Jump to

Keyboard shortcuts

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