load_balancer_plans

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 load_balancer_plans contains functionality for working with ECL Load Balancer Plan resources.

Example to List Load Balancer Plans

listOpts := load_balancer_plans.ListOpts{
	Description: "general",
}

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

allLoadBalancerPlans, err := load_balancer_plans.ExtractLoadBalancerPlans(allPages)
if err != nil {
	panic(err)
}

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

Example to Show Load Balancer Plan

loadBalancerPlanID := "a46eeb5a-bc0a-40fa-b455-e5dc13b1220a"

loadBalancerPlan, err := load_balancer_plans.Get(networkClient, loadBalancerPlanID).Extract()
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromName

func IDFromName(client *eclcloud.ServiceClient, name string) (string, error)

IDFromName is a convenience function that returns a Load Balancer Plan's ID, given its name.

func List

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

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

Default policy settings return only those Load Balancer Plans that are owned by the tenant who submits the request, unless the request is submitted by a user with administrative rights.

Types

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 Load Balancer Plan.

func Get

func Get(c *eclcloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific Load Balancer Plan based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a Load Balancer Plan resource.

type ListOpts

type ListOpts struct {
	Description          string `q:"description"`
	ID                   string `q:"id"`
	MaximumSyslogServers int    `q:"maximum_syslog_servers"`
	Name                 string `q:"name"`
	Vendor               string `q:"vendor"`
	Version              string `q:"version"`
}

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 Load Balancer Plan attributes you want to see returned. SortKey allows you to sort by a particular Load Balancer Plan attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToLoadBalancerPlansListQuery

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

ToLoadBalancerPlansListQuery formats a ListOpts into a query string.

type LoadBalancerPlan

type LoadBalancerPlan struct {

	// Description is description
	Description string `json:"description"`

	// Is user allowed to create new load balancers with this plan.
	Enabled bool `json:"enabled"`

	// UUID representing the Load Balancer Plan.
	ID string `json:"id"`

	// Maximum number of syslog servers
	MaximumSyslogServers int `json:"maximum_syslog_servers"`

	// Model of load balancer
	Model Model `json:"model"`

	// Name of the Load Balancer Plan
	Name string `json:"name"`

	// Load Balancer Type
	Vendor string `json:"vendor"`

	// Version name
	Version string `json:"version"`
}

LoadBalancerPlan represents a Load Balancer Plan. See package documentation for a top-level description of what this is.

func ExtractLoadBalancerPlans

func ExtractLoadBalancerPlans(r pagination.Page) ([]LoadBalancerPlan, error)

ExtractLoadBalancerPlans accepts a Page struct, specifically a LoadBalancerPage struct, and extracts the elements into a slice of Load Balancer Plan structs. In other words, a generic collection is mapped into a relevant slice.

type LoadBalancerPlanPage

type LoadBalancerPlanPage struct {
	pagination.LinkedPageBase
}

LoadBalancerPlanPage is the page returned by a pager when traversing over a collection of load balancer plans.

func (LoadBalancerPlanPage) IsEmpty

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

IsEmpty checks whether a LoadBalancerPlanPage struct is empty.

type Model

type Model struct {
	Edition string `json:"edition"`
	Size    string `json:"size"`
}

Model of Load Balancer.

Directories

Path Synopsis
Load Balancer Plans unit tests
Load Balancer Plans unit tests

Jump to

Keyboard shortcuts

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