l7policies

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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 *gcorecloud.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 *gcorecloud.ServiceClient, policyID string) (r tasks.Result)

Delete accepts a policy id and delete existing policy.

func DeleteRule added in v0.3.45

func DeleteRule(c *gcorecloud.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 added in v0.3.45

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

ListRule accept a policy id and retrieves list of rules.

func Replace added in v0.3.45

func Replace(c *gcorecloud.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 added in v0.3.45

func ReplaceRule(c *gcorecloud.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 added in v0.3.45

func (a Action) IsValid() error

func (Action) List added in v0.3.45

func (a Action) List() []Action

func (*Action) MarshalJSON added in v0.3.45

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

MarshalJSON - implements Marshaler interface

func (Action) String added in v0.3.45

func (a Action) String() string

func (Action) StringList added in v0.3.45

func (a Action) StringList() []string

func (*Action) UnmarshalJSON added in v0.3.45

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

UnmarshalJSON - implements Unmarshaler interface

func (Action) ValidOrNil added in v0.3.45

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

type CompareType

type CompareType string

func (CompareType) IsValid added in v0.3.45

func (ct CompareType) IsValid() error

func (CompareType) List added in v0.3.45

func (ct CompareType) List() []CompareType

func (*CompareType) MarshalJSON added in v0.3.45

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

MarshalJSON - implements Marshaler interface

func (CompareType) String added in v0.3.45

func (ct CompareType) String() string

func (CompareType) StringList added in v0.3.45

func (ct CompareType) StringList() []string

func (*CompareType) UnmarshalJSON added in v0.3.45

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

UnmarshalJSON - implements Unmarshaler interface

func (CompareType) ValidOrNil added in v0.3.45

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 added in v0.3.45

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 added in v0.3.45

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 *gcorecloud.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 added in v0.3.45

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 *gcorecloud.ServiceClient, plid string, rlid string) (r GetRuleResult)

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

func (GetRuleResult) Extract added in v0.3.45

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

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

func (GetRuleResult) ExtractInto added in v0.3.45

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          gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt          *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	Rules              []L7Rule                 `json:"rules"`
}

L7Policy represents a policy structure.

func ExtractL7Polices

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

func ListAll added in v0.3.45

func ListAll(c *gcorecloud.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 added in v0.3.45

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          gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt          *gcorecloud.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 added in v0.3.45

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

func ListAllRule added in v0.3.45

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

ListAllRule accept a policy id and retrieves list of rules.

type ReplaceOpts added in v0.3.45

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 added in v0.3.45

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

ToL7PolicyReplaceMap builds a request body from ReplaceOpts.

type ReplaceOptsBuilder added in v0.3.45

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 added in v0.3.45

func (rt RuleType) IsValid() error

func (RuleType) List added in v0.3.45

func (rt RuleType) List() []RuleType

func (*RuleType) MarshalJSON added in v0.3.45

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

MarshalJSON - implements Marshaler interface

func (RuleType) String added in v0.3.45

func (rt RuleType) String() string

func (RuleType) StringList added in v0.3.45

func (rt RuleType) StringList() []string

func (*RuleType) UnmarshalJSON added in v0.3.45

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

UnmarshalJSON - implements Unmarshaler interface

func (RuleType) ValidOrNil added in v0.3.45

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