l7policies

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionRedirectToPool Action = "REDIRECT_TO_POOL"
	ActionRedirectToURL  Action = "REDIRECT_TO_URL"
	ActionRedirectPrefix Action = "REDIRECT_PREFIX"
	ActionReject         Action = "REJECT"

	TypeCookie          RuleType = "COOKIE"
	TypeFileType        RuleType = "FILE_TYPE"
	TypeHeader          RuleType = "HEADER"
	TypeHostName        RuleType = "HOST_NAME"
	TypePath            RuleType = "PATH"
	TypeSSLConnHasCert  RuleType = "SSL_CONN_HAS_CERT"
	TypeSSLVerifyResult RuleType = "SSL_VERIFY_RESULT"
	TypeSSLDNField      RuleType = "SSL_DN_FIELD"

	CompareTypeContains  CompareType = "CONTAINS"
	CompareTypeEndWith   CompareType = "ENDS_WITH"
	CompareTypeEqual     CompareType = "EQUAL_TO"
	CompareTypeRegex     CompareType = "REGEX"
	CompareTypeStartWith CompareType = "STARTS_WITH"
)

Variables

This section is empty.

Functions

func Create

Create accepts a CreateOpts struct and creates a new policy using the values provided.

func CreateRule

func CreateRule(c *edgecloud.ServiceClient, policyID string, opts CreateRuleOptsBuilder) (r tasks.Result)

CreateRule accepts a policy id and CreateRuleOpts struct and creates a new rule using the values provided.

func Delete

func Delete(c *edgecloud.ServiceClient, policyID string) (r tasks.Result)

Delete accepts a policy id and delete existing policy.

func DeleteRule

func DeleteRule(c *edgecloud.ServiceClient, policyID, ruleID string) (r tasks.Result)

DeleteRule accepts a policy id, rule id and delete existing rule.

func ExtractL7PolicesInto

func ExtractL7PolicesInto(r pagination.Page, v interface{}) error

func ExtractL7PolicyIDFromTask

func ExtractL7PolicyIDFromTask(task *tasks.Task) (string, error)

func ExtractRuleIDFromTask

func ExtractRuleIDFromTask(task *tasks.Task) (string, error)

func ExtractRuleInto

func ExtractRuleInto(r pagination.Page, v interface{}) error

func List

List retrieves list of policies.

func ListRule

func ListRule(c *edgecloud.ServiceClient, policyID string) pagination.Pager

ListRule accept a policy id and retrieves list of rules.

func Replace

func Replace(c *edgecloud.ServiceClient, policyID string, opts ReplaceOptsBuilder) (r tasks.Result)

Replace accepts a ReplaceOpts struct and policy id and replaced an existing policy using the values provided.

func ReplaceRule

func ReplaceRule(c *edgecloud.ServiceClient, policyID, ruleID string, opts CreateRuleOptsBuilder) (r tasks.Result)

ReplaceRule accepts a CreateRuleOpts struct, rule id and policy id and replaced an existing rule using the values provided.

Types

type Action

type Action string

func (Action) IsValid

func (a Action) IsValid() error

func (Action) List

func (a Action) List() []Action

func (*Action) MarshalJSON

func (a *Action) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface.

func (Action) String

func (a Action) String() string

func (Action) StringList

func (a Action) StringList() []string

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface.

func (Action) ValidOrNil

func (a Action) ValidOrNil() (*Action, error)

type CompareType

type CompareType string

func (CompareType) IsValid

func (ct CompareType) IsValid() error

func (CompareType) List

func (ct CompareType) List() []CompareType

func (*CompareType) MarshalJSON

func (ct *CompareType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface.

func (CompareType) String

func (ct CompareType) String() string

func (CompareType) StringList

func (ct CompareType) StringList() []string

func (*CompareType) UnmarshalJSON

func (ct *CompareType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface.

func (CompareType) ValidOrNil

func (ct CompareType) ValidOrNil() (*CompareType, error)

type CreateOpts

type CreateOpts struct {
	Name             string   `json:"name,omitempty"`
	ListenerID       string   `json:"listener_id" required:"true" validate:"required,uuid"`
	Action           Action   `json:"action" required:"true" validate:"required,enum"`
	Position         int32    `json:"position,omitempty" validate:"gt=-1,omitempty"`
	RedirectHTTPCode int      `json:"redirect_http_code,omitempty"`
	RedirectPoolID   string   `json:"redirect_pool_id,omitempty" validate:"rfe=Action:REDIRECT_TO_POOL"`
	RedirectPrefix   string   `json:"redirect_prefix,omitempty" validate:"rfe=Action:REDIRECT_PREFIX"`
	RedirectURL      string   `json:"redirect_url,omitempty" validate:"rfe=Action:REDIRECT_TO_URL"`
	Tags             []string `json:"tags,omitempty"`
}

CreateOpts represents options used to create a l7 policy.

func (CreateOpts) ToL7PolicyCreateMap

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

ToL7PolicyCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateRuleOpts

type CreateRuleOpts struct {
	CompareType CompareType `json:"compare_type" required:"true" validate:"required,enum"`
	Invert      bool        `json:"invert"`
	Key         string      `json:"key,omitempty"`
	Type        RuleType    `json:"type" required:"true" validate:"required,enum"`
	Value       string      `json:"value" required:"true"`
	Tags        []string    `json:"tags,omitempty"`
}

CreateRuleOpts represents options used to create a rule for policy.

func (CreateRuleOpts) ToRuleCreateMap

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

ToRuleCreateMap builds a request body from CreateRuleOpts.

type CreateRuleOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

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 L7Policy.

func Get

func Get(c *edgecloud.ServiceClient, policyID string) (r GetResult)

Get retrieves a specific policy based on its unique ID.

func (GetResult) Extract

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

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

func (GetResult) ExtractRule

func (r GetResult) ExtractRule() (*L7Rule, error)

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

type GetRuleResult

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

GetRuleResult represents the result of a get operation. Call its Extract method to interpret it as a L7Rule.

func GetRule

func GetRule(c *edgecloud.ServiceClient, plid string, rlid string) (r GetRuleResult)

GetRule retrieves a specific policy based on its policy id and rule unique ID.

func (GetRuleResult) Extract

func (r GetRuleResult) Extract() (*L7Rule, error)

Extract is a function that accepts a result and extracts a l7 rule resource.

func (GetRuleResult) ExtractInto

func (r GetRuleResult) ExtractInto(v interface{}) error

type L7Policy

type L7Policy struct {
	ID                 string                  `json:"id"`
	Name               string                  `json:"name"`
	Action             Action                  `json:"action"`
	ListenerID         string                  `json:"listener_id"`
	RedirectPoolID     string                  `json:"redirect_pool_id"`
	Position           int32                   `json:"position"`
	ProjectID          int32                   `json:"project_id"`
	RegionID           int                     `json:"region_id"`
	Region             string                  `json:"region"`
	OperatingStatus    string                  `json:"operating_status"`
	ProvisioningStatus string                  `json:"provisioning_status"`
	RedirectHTTPCode   *int                    `json:"redirect_http_code"`
	RedirectPrefix     *string                 `json:"redirect_prefix"`
	RedirectURL        *string                 `json:"redirect_url"`
	Tags               []string                `json:"tags"`
	CreatedAt          edgecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt          *edgecloud.JSONRFC3339Z `json:"updated_at"`
	Rules              []L7Rule                `json:"rules"`
}

L7Policy represents a policy structure.

func ExtractL7Polices

func ExtractL7Polices(r pagination.Page) ([]L7Policy, error)

func ListAll

func ListAll(c *edgecloud.ServiceClient) ([]L7Policy, error)

ListAll retrieves list of policies.

type L7PolicyPage

type L7PolicyPage struct {
	pagination.LinkedPageBase
}

L7PolicyPage is the page returned by a pager when traversing over a collection of l7polices.

func (L7PolicyPage) IsEmpty

func (r L7PolicyPage) IsEmpty() (bool, error)

IsEmpty checks whether a L7PolicyPage struct is empty.

func (L7PolicyPage) NextPageURL

func (r L7PolicyPage) NextPageURL() (string, error)

type L7PolicyTaskResult

type L7PolicyTaskResult struct {
	L7Polices []string `json:"l7polices"`
}

type L7Rule

type L7Rule struct {
	ID                 string                  `json:"id"`
	CompareType        CompareType             `json:"compare_type"`
	Invert             bool                    `json:"invert"`
	Key                *string                 `json:"key"`
	OperatingStatus    string                  `json:"operating_status"`
	ProvisioningStatus string                  `json:"provisioning_status"`
	CreatedAt          edgecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt          *edgecloud.JSONRFC3339Z `json:"updated_at"`
	Type               RuleType                `json:"type"`
	Value              string                  `json:"value"`
	Tags               []string                `json:"tags"`
	ProjectID          int                     `json:"project_id"`
	RegionID           int                     `json:"region_id"`
	Region             string                  `json:"region"`
}

L7Rule represents layer 7 load balancing rule.

func ExtractL7Rules

func ExtractL7Rules(r pagination.Page) ([]L7Rule, error)

func ListAllRule

func ListAllRule(c *edgecloud.ServiceClient, policyID string) ([]L7Rule, error)

ListAllRule accept a policy id and retrieves list of rules.

type ReplaceOpts

type ReplaceOpts struct {
	Name             string   `json:"name,omitempty"`
	Action           Action   `json:"action" required:"true" validate:"required,enum"`
	Position         int32    `json:"position,omitempty" validate:"gt=-1,omitempty"`
	RedirectHTTPCode int      `json:"redirect_http_code,omitempty"`
	RedirectPoolID   string   `json:"redirect_pool_id,omitempty" validate:"rfe=Action:REDIRECT_TO_POOL"`
	RedirectPrefix   string   `json:"redirect_prefix,omitempty" validate:"rfe=Action:REDIRECT_PREFIX"`
	RedirectURL      string   `json:"redirect_url,omitempty" validate:"rfe=Action:REDIRECT_TO_URL"`
	Tags             []string `json:"tags,omitempty"`
}

ReplaceOpts represents options used to replace a l7 policy.

func (ReplaceOpts) ToL7PolicyReplaceMap

func (opts ReplaceOpts) ToL7PolicyReplaceMap() (map[string]interface{}, error)

ToL7PolicyReplaceMap builds a request body from ReplaceOpts.

type ReplaceOptsBuilder

type ReplaceOptsBuilder interface {
	ToL7PolicyReplaceMap() (map[string]interface{}, error)
}

ReplaceOptsBuilder allows extensions to add additional parameters to the Replace request.

type RulePage

type RulePage struct {
	pagination.LinkedPageBase
}

L7PolicyPage is the page returned by a pager when traversing over a collection of l7polices.

func (RulePage) IsEmpty

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

IsEmpty checks whether a RulePage struct is empty.

func (RulePage) NextPageURL

func (r RulePage) NextPageURL() (string, error)

type RuleTaskResult

type RuleTaskResult struct {
	L7Rules []string `json:"l7rules"`
}

type RuleType

type RuleType string

func (RuleType) IsValid

func (rt RuleType) IsValid() error

func (RuleType) List

func (rt RuleType) List() []RuleType

func (*RuleType) MarshalJSON

func (rt *RuleType) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface.

func (RuleType) String

func (rt RuleType) String() string

func (RuleType) StringList

func (rt RuleType) StringList() []string

func (*RuleType) UnmarshalJSON

func (rt *RuleType) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface.

func (RuleType) ValidOrNil

func (rt RuleType) ValidOrNil() (*RuleType, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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