policies

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package policies contains functionality for working with ECL Managed Load Balancer resources.

Example to list policies

listOpts := policies.ListOpts{}

allPages, err := policies.List(managedLoadBalancerClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allPolicies, err := policies.ExtractPolicies(allPages)
if err != nil {
	panic(err)
}

for _, policy := range allPolicies {
	fmt.Printf("%+v\n", policy)
}

Example to create a policy

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

createOpts := policies.CreateOpts{
	Name: "policy",
	Description: "description",
	Tags: tags,
	Algorithm: "round-robin",
	Persistence: "cookie",
	IdleTimeout: 600,
	SorryPageUrl: "https://example.com/sorry",
	SourceNat: "enable",
	CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
	HealthMonitorID: "dd7a96d6-4e66-4666-baca-a8555f0c472c",
	ListenerID: "68633f4f-f52a-402f-8572-b8173418904f",
	DefaultTargetGroupID: "a44c4072-ed90-4b50-a33a-6b38fb10c7db",
	TLSPolicyID: "4ba79662-f2a1-41a4-a3d9-595799bbcd86",
	LoadBalancerID: "67fea379-cff0-4191-9175-de7d6941a040",
}

policy, err := policies.Create(managedLoadBalancerClient, createOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policy)

Example to show a policy

showOpts := policies.ShowOpts{}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
policy, err := policies.Show(managedLoadBalancerClient, id, showOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policy)

Example to update a policy

name := "policy"
description := "description"

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

updateOpts := policies.UpdateOpts{
	Name: &name,
	Description: &description,
	Tags: &tags,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
policy, err := policies.Update(managedLoadBalancerClient, updateOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policy)

Example to delete a policy

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := policies.Delete(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Example to create staged policy configurations

createStagedOpts := policies.CreateStagedOpts{
	Algorithm: "round-robin",
	Persistence: "cookie",
	IdleTimeout: 600,
	SorryPageUrl: "https://example.com/sorry",
	SourceNat: "enable",
	CertificateID: "f57a98fe-d63e-4048-93a0-51fe163f30d7",
	HealthMonitorID: "dd7a96d6-4e66-4666-baca-a8555f0c472c",
	ListenerID: "68633f4f-f52a-402f-8572-b8173418904f",
	DefaultTargetGroupID: "a44c4072-ed90-4b50-a33a-6b38fb10c7db",
	TLSPolicyID: "4ba79662-f2a1-41a4-a3d9-595799bbcd86",
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
policyConfigurations, err := policies.CreateStaged(managedLoadBalancerClient, id, createStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policyConfigurations)

Example to show staged policy configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
policyConfigurations, err := policies.ShowStaged(managedLoadBalancerClient, id).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policyConfigurations)

Example to update staged policy configurations

algorithm := "round-robin"
persistence := "cookie"
idleTimeout := 600
sorryPageUrl := "https://example.com/sorry"
sourceNat := "enable"
certificateID := "f57a98fe-d63e-4048-93a0-51fe163f30d7"
healthMonitorID := "dd7a96d6-4e66-4666-baca-a8555f0c472c"
listenerID := "68633f4f-f52a-402f-8572-b8173418904f"
defaultTargetGroupID := "a44c4072-ed90-4b50-a33a-6b38fb10c7db"
tlsPolicyID := "4ba79662-f2a1-41a4-a3d9-595799bbcd86"
updateStagedOpts := policies.UpdateStagedOpts{
	Algorithm: &algorithm,
	Persistence: &persistence,
	IdleTimeout: &idleTimeout,
	SorryPageUrl: &sorryPageUrl,
	SourceNat: &sourceNat,
	CertificateID: &certificateID,
	HealthMonitorID: &healthMonitorID,
	ListenerID: &listenerID,
	DefaultTargetGroupID: &defaultTargetGroupID,
	TLSPolicyID: &tlsPolicyID,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
policyConfigurations, err := policies.UpdateStaged(managedLoadBalancerClient, updateStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", policyConfigurations)

Example to cancel staged policy configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := policies.CancelStaged(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPoliciesInto

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

ExtractPoliciesInto interprets the results of a single page from a List() call, producing a slice of policy entities.

func List

func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns a Pager which allows you to iterate over a collection of policies. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type CancelStagedResult

type CancelStagedResult struct {
	eclcloud.ErrResult
}

CancelStagedResult represents the result of a CancelStaged operation. Call its ExtractErr method to determine if the request succeeded or failed.

func CancelStaged

func CancelStaged(c *eclcloud.ServiceClient, id string) (r CancelStagedResult)

CancelStaged accepts a unique ID and deletes policy configurations associated with it.

type ConfigurationInResponse

type ConfigurationInResponse struct {

	// - Load balancing algorithm (method) of the policy
	Algorithm string `json:"algorithm,omitempty"`

	// - Persistence setting of the policy
	// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
	Persistence string `json:"persistence,omitempty"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
	// - If `listener.protocol` is `"tcp"` or `"udp"`
	//   - Default value is 120
	// - If `listener.protocol` is `"http"` or `"https"`
	//   - Default value is 600
	//   - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
	IdleTimeout int `json:"idle_timeout,omitempty"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	// - If protocol is not `"http"` or `"https"`, returns `""`
	SorryPageUrl string `json:"sorry_page_url,omitempty"`

	// - Source NAT setting of the policy
	// - If `source_nat` is `"enable"` and `listener.protocol` is `"http"` or `"https"` ,
	//   - The source IP address of the request is replaced with `virtual_ip_address` which is assigned to the interface from which the request was sent
	//   - `X-Forwarded-For` header with the IP address of the client is added
	SourceNat string `json:"source_nat,omitempty"`

	// - ID of the certificate that assigned to the policy
	// - If protocol is not `"https"`, returns `""`
	CertificateID string `json:"certificate_id,omitempty"`

	// - ID of the health monitor that assigned to the policy
	HealthMonitorID string `json:"health_monitor_id,omitempty"`

	// - ID of the listener that assigned to the policy
	ListenerID string `json:"listener_id,omitempty"`

	// - ID of the default target group that assigned to the policy
	DefaultTargetGroupID string `json:"default_target_group_id,omitempty"`

	// - ID of the TLS policy that assigned to the policy
	// - If protocol is not `"https"`, returns `""`
	TLSPolicyID string `json:"tls_policy_id,omitempty"`
}

ConfigurationInResponse represents a configuration in a policy.

type CreateOpts

type CreateOpts struct {

	// - Name of the policy
	// - This field accepts single-byte characters only
	Name string `json:"name,omitempty"`

	// - Description of the policy
	// - This field accepts single-byte characters only
	Description string `json:"description,omitempty"`

	// - Tags of the policy
	// - Set JSON object up to 32,768 characters
	//   - Nested structure is permitted
	// - This field accepts single-byte characters only
	Tags map[string]interface{} `json:"tags,omitempty"`

	// - Load balancing algorithm (method) of the policy
	Algorithm string `json:"algorithm,omitempty"`

	// - Persistence setting of the policy
	// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
	Persistence string `json:"persistence,omitempty"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
	// - If `listener.protocol` is `"tcp"` or `"udp"`
	//   - Default value is 120
	// - If `listener.protocol` is `"http"` or `"https"`
	//   - Default value is 600
	//   - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
	IdleTimeout int `json:"idle_timeout,omitempty"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
	// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
	SorryPageUrl string `json:"sorry_page_url,omitempty"`

	// - Source NAT setting of the policy
	// - If `source_nat` is `"enable"` and `listener.protocol` is `"http"` or `"https"`
	//   - The source IP address of the request is replaced with `virtual_ip_address` which is assigned to the interface from which the request was sent
	//   - `X-Forwarded-For` header with the IP address of the client is added
	SourceNat string `json:"source_nat,omitempty"`

	// - ID of the certificate that assigned to the policy
	// - You can set a ID of the certificate in which `ca_cert.status`, `ssl_cert.status` and `ssl_key.status` are all `"UPLOADED"`
	// - If `listener.protocol` is `"https"`, set `certificate.id`
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	CertificateID string `json:"certificate_id,omitempty"`

	// - ID of the health monitor that assigned to the policy
	// - Must not set ID of the health monitor that `configuration_status` is `"DELETE_STAGED"`
	HealthMonitorID string `json:"health_monitor_id"`

	// - ID of the listener that assigned to the policy
	// - Must not set ID of the listener that `configuration_status` is `"DELETE_STAGED"`
	// - Must not set ID of the listener that already assigned to the other policy
	ListenerID string `json:"listener_id"`

	// - ID of the default target group that assigned to the policy
	// - Must not set ID of the target group that `configuration_status` is `"DELETE_STAGED"`
	DefaultTargetGroupID string `json:"default_target_group_id"`

	// - ID of the TLS policy that assigned to the policy
	// - If `listener.protocol` is `"https"`, you can set this parameter explicitly
	//   - If not set this parameter, the ID of the `tls_policy` with `default: true` will be automatically set
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	TLSPolicyID string `json:"tls_policy_id,omitempty"`

	// - ID of the load balancer which the policy belongs to
	LoadBalancerID string `json:"load_balancer_id"`
}

CreateOpts represents options used to create a new policy.

func (CreateOpts) ToPolicyCreateMap

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

ToPolicyCreateMap builds a 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 *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

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

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (CreateResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

type CreateStagedOpts

type CreateStagedOpts struct {

	// - Load balancing algorithm (method) of the policy
	Algorithm string `json:"algorithm,omitempty"`

	// - Persistence setting of the policy
	// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
	Persistence string `json:"persistence,omitempty"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
	// - If `listener.protocol` is `"tcp"` or `"udp"`
	//   - Default value is 120
	// - If `listener.protocol` is `"http"` or `"https"`
	//   - Default value is 600
	//   - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
	IdleTimeout int `json:"idle_timeout,omitempty"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
	// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"http"` or `"https"` to others, set `""`
	SorryPageUrl string `json:"sorry_page_url,omitempty"`

	// - Source NAT setting of the policy
	// - If `source_nat` is `"enable"` and `listener.protocol` is `"http"` or `"https"`
	//   - The source IP address of the request is replaced with `virtual_ip_address` which is assigned to the interface from which the request was sent
	//   - `X-Forwarded-For` header with the IP address of the client is added
	SourceNat string `json:"source_nat,omitempty"`

	// - ID of the certificate that assigned to the policy
	// - You can set a ID of the certificate in which `ca_cert.status`, `ssl_cert.status` and `ssl_key.status` are all `"UPLOADED"`
	// - If `listener.protocol` is `"https"`, set `certificate.id`
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"https"` to others, set `""`
	CertificateID string `json:"certificate_id,omitempty"`

	// - ID of the health monitor that assigned to the policy
	// - Must not set ID of the health monitor that `configuration_status` is `"DELETE_STAGED"`
	HealthMonitorID string `json:"health_monitor_id,omitempty"`

	// - ID of the listener that assigned to the policy
	// - Must not set ID of the listener that `configuration_status` is `"DELETE_STAGED"`
	// - Must not set ID of the listener that already assigned to the other policy
	ListenerID string `json:"listener_id,omitempty"`

	// - ID of the default target group that assigned to the policy
	// - Must not set ID of the target group that `configuration_status` is `"DELETE_STAGED"`
	DefaultTargetGroupID string `json:"default_target_group_id,omitempty"`

	// - ID of the TLS policy that assigned to the policy
	// - If `listener.protocol` is `"https"`, you can set this parameter explicitly
	//   - If not set this parameter, the ID of the `tls_policy` with `default: true` will be automatically set
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"https"` to others, set `""`
	TLSPolicyID string `json:"tls_policy_id,omitempty"`
}

CreateStagedOpts represents options used to create new policy configurations.

func (CreateStagedOpts) ToPolicyCreateStagedMap

func (opts CreateStagedOpts) ToPolicyCreateStagedMap() (map[string]interface{}, error)

ToPolicyCreateStagedMap builds a request body from CreateStagedOpts.

type CreateStagedOptsBuilder

type CreateStagedOptsBuilder interface {
	ToPolicyCreateStagedMap() (map[string]interface{}, error)
}

CreateStagedOptsBuilder allows extensions to add additional parameters to the CreateStaged request.

type CreateStagedResult

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

CreateStagedResult represents the result of a CreateStaged operation. Call its Extract method to interpret it as a Policy.

func CreateStaged

func CreateStaged(c *eclcloud.ServiceClient, id string, opts CreateStagedOptsBuilder) (r CreateStagedResult)

CreateStaged accepts a CreateStagedOpts struct and creates new policy configurations using the values provided.

func (CreateStagedResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (CreateStagedResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

type DeleteResult

type DeleteResult struct {
	eclcloud.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 *eclcloud.ServiceClient, id string) (r DeleteResult)

Delete accepts a unique ID and deletes the policy associated with it.

type ListOpts

type ListOpts struct {

	// - ID of the resource
	ID string `q:"id"`

	// - Name of the resource
	// - This field accepts single-byte characters only
	Name string `q:"name"`

	// - Description of the resource
	// - This field accepts single-byte characters only
	Description string `q:"description"`

	// - Configuration status of the resource
	ConfigurationStatus string `q:"configuration_status"`

	// - Operation status of the resource
	OperationStatus string `q:"operation_status"`

	// - Load balancing algorithm (method) of the policy
	Algorithm string `q:"algorithm"`

	// - Persistence setting of the policy
	Persistence string `q:"persistence"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	IdleTimeout int `q:"idle_timeout"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	SorryPageUrl string `q:"sorry_page_url"`

	// - Source NAT setting of the policy
	SourceNat string `q:"source_nat"`

	// - ID of the certificate that assigned to the policy
	CertificateID string `q:"certificate_id"`

	// - ID of the health monitor that assigned to the policy
	HealthMonitorID string `q:"health_monitor_id"`

	// - ID of the listener that assigned to the policy
	ListenerID string `q:"listener_id"`

	// - ID of the default target group that assigned to the policy
	DefaultTargetGroupID string `q:"default_target_group_id"`

	// - ID of the TLS policy that assigned to the policy
	TLSPolicyID string `q:"tls_policy_id"`

	// - ID of the load balancer which the resource belongs to
	LoadBalancerID string `q:"load_balancer_id"`

	// - ID of the owner tenant of the resource
	TenantID string `q:"tenant_id"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the policy attributes you want to see returned.

func (ListOpts) ToPolicyListQuery

func (opts ListOpts) ToPolicyListQuery() (string, error)

ToPolicyListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add additional parameters to the List request.

type Policy

type Policy struct {

	// - ID of the policy
	ID string `json:"id"`

	// - Name of the policy
	Name string `json:"name"`

	// - Description of the policy
	Description string `json:"description"`

	// - Tags of the policy (JSON object format)
	Tags map[string]interface{} `json:"tags"`

	// - Configuration status of the policy
	//   - `"ACTIVE"`
	//     - There are no configurations of the policy that waiting to be applied
	//   - `"CREATE_STAGED"`
	//     - The policy has been added and waiting to be applied
	//   - `"UPDATE_STAGED"`
	//     - Changed configurations of the policy exists that waiting to be applied
	//   - `"DELETE_STAGED"`
	//     - The policy has been removed and waiting to be applied
	ConfigurationStatus string `json:"configuration_status"`

	// - Operation status of the load balancer which the policy belongs to
	//   - `"NONE"` :
	//     - There are no operations of the load balancer
	//     - The load balancer and related resources can be operated
	//   - `"PROCESSING"`
	//     - The latest operation of the load balancer is processing
	//     - The load balancer and related resources cannot be operated
	//   - `"COMPLETE"`
	//     - The latest operation of the load balancer has been succeeded
	//     - The load balancer and related resources can be operated
	//   - `"STUCK"`
	//     - The latest operation of the load balancer has been stopped
	//     - Operators of NTT Communications will investigate the operation
	//     - The load balancer and related resources cannot be operated
	//   - `"ERROR"`
	//     - The latest operation of the load balancer has been failed
	//     - The operation was roll backed normally
	//     - The load balancer and related resources can be operated
	OperationStatus string `json:"operation_status"`

	// - ID of the load balancer which the policy belongs to
	LoadBalancerID string `json:"load_balancer_id"`

	// - ID of the owner tenant of the policy
	TenantID string `json:"tenant_id"`

	// - Load balancing algorithm (method) of the policy
	Algorithm string `json:"algorithm,omitempty"`

	// - Persistence setting of the policy
	// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
	Persistence string `json:"persistence,omitempty"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
	// - If `listener.protocol` is `"tcp"` or `"udp"`
	//   - Default value is 120
	// - If `listener.protocol` is `"http"` or `"https"`
	//   - Default value is 600
	//   - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
	IdleTimeout int `json:"idle_timeout,omitempty"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	// - If protocol is not `"http"` or `"https"`, returns `""`
	SorryPageUrl string `json:"sorry_page_url,omitempty"`

	// - Source NAT setting of the policy
	// - If `source_nat` is `"enable"` and `listener.protocol` is `"http"` or `"https"` ,
	//   - The source IP address of the request is replaced with `virtual_ip_address` which is assigned to the interface from which the request was sent
	//   - `X-Forwarded-For` header with the IP address of the client is added
	SourceNat string `json:"source_nat,omitempty"`

	// - ID of the certificate that assigned to the policy
	// - If protocol is not `"https"`, returns `""`
	CertificateID string `json:"certificate_id,omitempty"`

	// - ID of the health monitor that assigned to the policy
	HealthMonitorID string `json:"health_monitor_id,omitempty"`

	// - ID of the listener that assigned to the policy
	ListenerID string `json:"listener_id,omitempty"`

	// - ID of the default target group that assigned to the policy
	DefaultTargetGroupID string `json:"default_target_group_id,omitempty"`

	// - ID of the TLS policy that assigned to the policy
	// - If protocol is not `"https"`, returns `""`
	TLSPolicyID string `json:"tls_policy_id,omitempty"`

	// - Running configurations of the policy
	// - If `changes` is `true`, return object
	// - If current configuration does not exist, return `null`
	Current ConfigurationInResponse `json:"current,omitempty"`

	// - Added or changed configurations of the policy that waiting to be applied
	// - If `changes` is `true`, return object
	// - If staged configuration does not exist, return `null`
	Staged ConfigurationInResponse `json:"staged,omitempty"`
}

Policy represents a policy.

func ExtractPolicies

func ExtractPolicies(r pagination.Page) ([]Policy, error)

ExtractPolicies accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Policy structs. In other words, a generic collection is mapped into a relevant slice.

type PolicyPage

type PolicyPage struct {
	pagination.LinkedPageBase
}

PolicyPage is the page returned by a pager when traversing over a collection of policy.

func (PolicyPage) IsEmpty

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

IsEmpty checks whether a PolicyPage struct is empty.

type ShowOpts

type ShowOpts struct {

	// - If `true` is set, `current` and `staged` are returned in response body
	Changes bool `q:"changes"`
}

ShowOpts represents options used to show a policy.

func (ShowOpts) ToPolicyShowQuery

func (opts ShowOpts) ToPolicyShowQuery() (string, error)

ToPolicyShowQuery formats a ShowOpts into a query string.

type ShowOptsBuilder

type ShowOptsBuilder interface {
	ToPolicyShowQuery() (string, error)
}

ShowOptsBuilder allows extensions to add additional parameters to the Show request.

type ShowResult

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

ShowResult represents the result of a Show operation. Call its Extract method to interpret it as a Policy.

func Show

func Show(c *eclcloud.ServiceClient, id string, opts ShowOptsBuilder) (r ShowResult)

Show retrieves a specific policy based on its unique ID.

func (ShowResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (ShowResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

type ShowStagedResult

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

ShowStagedResult represents the result of a ShowStaged operation. Call its Extract method to interpret it as a Policy.

func ShowStaged

func ShowStaged(c *eclcloud.ServiceClient, id string) (r ShowStagedResult)

ShowStaged retrieves specific policy configurations based on its unique ID.

func (ShowStagedResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (ShowStagedResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

type UpdateOpts

type UpdateOpts struct {

	// - Name of the policy
	// - This field accepts single-byte characters only
	Name *string `json:"name,omitempty"`

	// - Description of the policy
	// - This field accepts single-byte characters only
	Description *string `json:"description,omitempty"`

	// - Tags of the policy
	// - Set JSON object up to 32,768 characters
	//   - Nested structure is permitted
	// - This field accepts single-byte characters only
	Tags *map[string]interface{} `json:"tags,omitempty"`
}

UpdateOpts represents options used to update a existing policy.

func (UpdateOpts) ToPolicyUpdateMap

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

ToPolicyUpdateMap builds a 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 *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates a existing policy using the values provided.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (UpdateResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

type UpdateStagedOpts

type UpdateStagedOpts struct {

	// - Load balancing algorithm (method) of the policy
	Algorithm *string `json:"algorithm,omitempty"`

	// - Persistence setting of the policy
	// - If `listener.protocol` is `"http"` or `"https"`, `"cookie"` is available
	Persistence *string `json:"persistence,omitempty"`

	// - The duration (in seconds) during which a session is allowed to remain inactive
	// - There may be a time difference up to 60 seconds, between the set value and the actual timeout
	// - If `listener.protocol` is `"tcp"` or `"udp"`
	//   - Default value is 120
	// - If `listener.protocol` is `"http"` or `"https"`
	//   - Default value is 600
	//   - On session timeout, the load balancer sends TCP RST packets to both the client and the real server
	IdleTimeout *int `json:"idle_timeout,omitempty"`

	// - URL of the sorry page to which accesses are redirected if all members in the target group are down
	// - If `listener.protocol` is `"http"` or `"https"`, this parameter can be set
	// - If `listener.protocol` is neither `"http"` nor `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"http"` or `"https"` to others, set `""`
	SorryPageUrl *string `json:"sorry_page_url,omitempty"`

	// - Source NAT setting of the policy
	// - If `source_nat` is `"enable"` and `listener.protocol` is `"http"` or `"https"`
	//   - The source IP address of the request is replaced with `virtual_ip_address` which is assigned to the interface from which the request was sent
	//   - `X-Forwarded-For` header with the IP address of the client is added
	SourceNat *string `json:"source_nat,omitempty"`

	// - ID of the certificate that assigned to the policy
	// - You can set a ID of the certificate in which `ca_cert.status`, `ssl_cert.status` and `ssl_key.status` are all `"UPLOADED"`
	// - If `listener.protocol` is `"https"`, set `certificate.id`
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"https"` to others, set `""`
	CertificateID *string `json:"certificate_id,omitempty"`

	// - ID of the health monitor that assigned to the policy
	// - Must not set ID of the health monitor that `configuration_status` is `"DELETE_STAGED"`
	HealthMonitorID *string `json:"health_monitor_id,omitempty"`

	// - ID of the listener that assigned to the policy
	// - Must not set ID of the listener that `configuration_status` is `"DELETE_STAGED"`
	// - Must not set ID of the listener that already assigned to the other policy
	ListenerID *string `json:"listener_id,omitempty"`

	// - ID of the default target group that assigned to the policy
	// - Must not set ID of the target group that `configuration_status` is `"DELETE_STAGED"`
	DefaultTargetGroupID *string `json:"default_target_group_id,omitempty"`

	// - ID of the TLS policy that assigned to the policy
	// - If `listener.protocol` is `"https"`, you can set this parameter explicitly
	//   - If not set this parameter, the ID of the `tls_policy` with `default: true` will be automatically set
	// - If `listener.protocol` is not `"https"`, must not set this parameter or set `""`
	//   - If you change `listener.protocol` from `"https"` to others, set `""`
	TLSPolicyID *string `json:"tls_policy_id,omitempty"`
}

UpdateStagedOpts represents options used to update existing Policy configurations.

func (UpdateStagedOpts) ToPolicyUpdateStagedMap

func (opts UpdateStagedOpts) ToPolicyUpdateStagedMap() (map[string]interface{}, error)

ToPolicyUpdateStagedMap builds a request body from UpdateStagedOpts.

type UpdateStagedOptsBuilder

type UpdateStagedOptsBuilder interface {
	ToPolicyUpdateStagedMap() (map[string]interface{}, error)
}

UpdateStagedOptsBuilder allows extensions to add additional parameters to the UpdateStaged request.

type UpdateStagedResult

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

UpdateStagedResult represents the result of a UpdateStaged operation. Call its Extract method to interpret it as a Policy.

func UpdateStaged

func UpdateStaged(c *eclcloud.ServiceClient, id string, opts UpdateStagedOptsBuilder) (r UpdateStagedResult)

UpdateStaged accepts a UpdateStagedOpts struct and updates existing Policy configurations using the values provided.

func (UpdateStagedResult) Extract

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

Extract is a function that accepts a result and extracts a Policy resource.

func (UpdateStagedResult) ExtractInto

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

ExtractInto interprets any commonResult as a policy, if possible.

Directories

Path Synopsis
Package testing contains policy unit tests
Package testing contains policy unit tests

Jump to

Keyboard shortcuts

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