plans

package
v4.0.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 plans contains functionality for working with ECL Managed Load Balancer resources.

Example to list plans

listOpts := plans.ListOpts{}

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

allPlans, err := plans.ExtractPlans(allPages)
if err != nil {
	panic(err)
}

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

Example to show a plan

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPlansInto

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

ExtractPlansInto interprets the results of a single page from a List() call, producing a slice of plan 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 plans. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

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"`

	// - Bandwidth of the plan
	Bandwidth string `q:"bandwidth"`

	// - Redundancy of the plan
	Redundancy string `q:"redundancy"`

	// - Maximum number of interfaces for the plan
	MaxNumberOfInterfaces int `q:"max_number_of_interfaces"`

	// - Maximum number of health monitors for the plan
	MaxNumberOfHealthMonitors int `q:"max_number_of_health_monitors"`

	// - Maximum number of listeners for the plan
	MaxNumberOfListeners int `q:"max_number_of_listeners"`

	// - Maximum number of policies for the plan
	MaxNumberOfPolicies int `q:"max_number_of_policies"`

	// - Maximum number of routes for the plan
	MaxNumberOfRoutes int `q:"max_number_of_routes"`

	// - Maximum number of target groups for the plan
	MaxNumberOfTargetGroups int `q:"max_number_of_target_groups"`

	// - Maximum number of members for the target group of plan
	MaxNumberOfMembers int `q:"max_number_of_members"`

	// - Maximum number of rules for the policy of plan
	MaxNumberOfRules int `q:"max_number_of_rules"`

	// - Maximum number of conditions in the rule of the plan
	MaxNumberOfConditions int `q:"max_number_of_conditions"`

	// - Whether a new load balancer can be created with this plan
	Enabled bool `q:"enabled"`
}

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 plan attributes you want to see returned.

func (ListOpts) ToPlanListQuery

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

ToPlanListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type Plan

type Plan struct {

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

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

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

	// - Bandwidth of the load balancer created with this plan
	Bandwidth string `json:"bandwidth"`

	// - Redundancy of the load balancer created with this plan
	Redundancy string `json:"redundancy"`

	// - Maximum number of interfaces for the load balancer created with this plan
	MaxNumberOfInterfaces int `json:"max_number_of_interfaces"`

	// - Maximum number of health monitors for the load balancer created with this plan
	MaxNumberOfHealthMonitors int `json:"max_number_of_health_monitors"`

	// - Maximum number of listeners for the load balancer created with this plan
	MaxNumberOfListeners int `json:"max_number_of_listeners"`

	// - Maximum number of routes for the load balancer created with this plan
	MaxNumberOfPolicies int `json:"max_number_of_policies"`

	// - Maximum number of routes for the load balancer created with this plan
	MaxNumberOfRoutes int `json:"max_number_of_routes"`

	// - Maximum number of target groups for the load balancer created with this plan
	MaxNumberOfTargetGroups int `json:"max_number_of_target_groups"`

	// - Maximum number of members for the target group of load balancer created with this plan
	MaxNumberOfMembers int `json:"max_number_of_members"`

	// - Maximum number of rules for the policy of load balancer created with this plan
	MaxNumberOfRules int `json:"max_number_of_rules"`

	// - Maximum number of conditions in the rule of load balancer created with this plan
	MaxNumberOfConditions int `json:"max_number_of_conditions"`

	// - Whether a new load balancer can be created with this plan
	Enabled bool `json:"enabled"`
}

Plan represents a plan.

func ExtractPlans

func ExtractPlans(r pagination.Page) ([]Plan, error)

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

type PlanPage

type PlanPage struct {
	pagination.LinkedPageBase
}

PlanPage is the page returned by a pager when traversing over a collection of plan.

func (PlanPage) IsEmpty

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

IsEmpty checks whether a PlanPage struct is empty.

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

func Show

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

Show retrieves a specific plan based on its unique ID.

func (ShowResult) Extract

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

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

func (ShowResult) ExtractInto

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

ExtractInto interprets any commonResult as a plan, if possible.

Directories

Path Synopsis
Package testing contains plan unit tests
Package testing contains plan unit tests

Jump to

Keyboard shortcuts

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