appliance_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 appliance_plans contains functionality for working with ECL Virtual Network Appliance Plan resources.

Example to List Virtual Network Appliance Plans

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

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

allVirtualNetworkAppliancePlans, err := appliance_plans.ExtractVirtualNetworkAppliancePlans(allPages)
if err != nil {
	panic(err)
}

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

Example to Show Virtual Network Appliance Plan

virtualNetworkAppliancePlanID := "37556569-87f2-4699-b5ff-bf38e7cbf8a7"

virtualNetworkAppliancePlan, err := appliance_plans.Get(networkClient, virtualNetworkAppliancePlanID, nil).Extract()
if err != nil {
	panic(err)
}

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

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 Virtual Network Appliance 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 Virtual Network Appliance Plans. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type AvailabilityZone

type AvailabilityZone struct {
	AvailabilityZone string `json:"availability_zone"`
	Available        bool   `json:"available"`
	Rank             int    `json:"rank"`
}

Availability Zone of Virtual Network Appliance

type GetOpts

type GetOpts struct {
	VirtualNetworkAppliancePlanId string `q:"virtual_network_appliance_plan_id"`
	Details                       bool   `q:"details"`
}

GetOpts represents result of Virtual Network Appliance Plan API response.

func (GetOpts) ToProcessQuery

func (opts GetOpts) ToProcessQuery() (string, error)

ToProcessQuery formats a GetOpts into a query string.

type GetOptsBuilder

type GetOptsBuilder interface {
	ToProcessQuery() (string, error)
}

GetOptsBuilder allows extensions to add additional parameters to the Virtual Network Appliance Plan API 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 Virtual Network Appliance Plan.

func Get

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

Get retrieves a specific Virtual Network Appliance Plan based on its unique ID.

func (GetResult) Extract

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

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

type License

type License struct {
	LicenseType string `json:"license_type"`
}

License of Virtual Network Appliance

type ListOpts

type ListOpts struct {
	ID                        string `q:"id"`
	Name                      string `q:"name"`
	Description               string `q:"description"`
	ApplianceType             string `q:"appliance_type"`
	Version                   string `q:"version"`
	Flavor                    string `q:"flavor"`
	NumberOfInterfaces        int    `q:"number_of_interfaces"`
	Enabled                   bool   `q:"enabled"`
	MaxNumberOfAap            int    `q:"max_number_of_aap"`
	Details                   bool   `q:"details"`
	AvailabilityZone          string `q:"availability_zone"`
	AvailabilityZoneAvailable bool   `q:"availability_zone.available"`
}

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 Virtual Network Appliance Plan attributes you want to see returned.

func (ListOpts) ToVirtualNetworkAppliancePlanListQuery

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

ToVirtualNetworkAppliancePlanListQuery formats a ListOpts into a query string.

type VirtualNetworkAppliancePlan

type VirtualNetworkAppliancePlan struct {

	// UUID representing the Virtual Network Appliance Plan.
	ID string `json:"id"`

	// Name of the Virtual Network Appliance Plan.
	Name string `json:"name"`

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

	// Type of appliance
	ApplianceType string `json:"appliance_type"`

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

	// Nova flavor
	Flavor string `json:"flavor"`

	// Number of Interfaces
	NumberOfInterfaces int `json:"number_of_interfaces"`

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

	// Max Number of allowed_address_pairs
	MaxNumberOfAap int `json:"max_number_of_aap"`

	// Licenses
	Licenses []License `json:"licenses"`

	// AvailabilityZones
	AvailabilityZones []AvailabilityZone `json:"availability_zones"`
}

VirtualNetworkAppliancePlan represents a Virtual Network Appliance Plan. See package documentation for a top-level description of what this is.

func ExtractVirtualNetworkAppliancePlans

func ExtractVirtualNetworkAppliancePlans(r pagination.Page) ([]VirtualNetworkAppliancePlan, error)

ExtractVirtualNetworkAppliancePlans accepts a Page struct, specifically a VirtualNetworkAppliancePlanPage struct, and extracts the elements into a slice of Virtual Network Appliance Plan structs. In other words, a generic collection is mapped into a relevant slice.

type VirtualNetworkAppliancePlanPage

type VirtualNetworkAppliancePlanPage struct {
	pagination.LinkedPageBase
}

VirtualNetworkAppliancePlanPage is the page returned by a pager when traversing over a collection of virtual network appliance plans.

func (VirtualNetworkAppliancePlanPage) IsEmpty

IsEmpty checks whether a VirtualNetworkAppliancePlanPage struct is empty.

Directories

Path Synopsis
Virtual Network Appliance Plans unit tests
Virtual Network Appliance Plans unit tests

Jump to

Keyboard shortcuts

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