appliances

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package appliances contains functionality for working with ECL Commnon Function Gateway resources.

Example to List VirtualNetworkAppliances

listOpts := virtual_network_appliances.ListOpts{
	TenantID: "a99e9b4e620e4db09a2dfb6e42a01e66",
}

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

allVirtualNetworkAppliances, err := virtual_network_appliances.ExtractVirtualNetworkAppliances(allPages)
if err != nil {
	panic(err)
}

for _, virtual_network_appliances := range allVirtualNetworkAppliances {
	fmt.Printf("%+v", virtual_network_appliances)
}

Example to Create a virtual_network_appliances

createOpts := virtual_network_appliances.CreateOpts{
	Name:         "network_1",
}

virtual_network_appliances, err := virtual_network_appliances.Create(networkClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Update a virtual_network_appliances

virtualNetworkApplianceID := "484cda0e-106f-4f4b-bb3f-d413710bbe78"

updateOpts := virtual_network_appliances.UpdateOpts{
	Name: "new_name",
}

virtual_network_appliances, err := virtual_network_appliances.Update(networkClient, virtualNetworkApplianceID, updateOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete a virtual_network_appliances

virtualNetworkApplianceID := "484cda0e-106f-4f4b-bb3f-d413710bbe78"
err := virtual_network_appliances.Delete(networkClient, virtualNetworkApplianceID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAppliancesInto

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

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

func IDFromName

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

IDFromName is a convenience function that returns a virtual network appliance's ID, given its name.

func List

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

Types

type AllowedAddressPairInResponse

type AllowedAddressPairInResponse struct {
	IPAddress  string      `json:"ip_address"`
	MACAddress string      `json:"mac_address"`
	Type       string      `json:"type"`
	VRID       interface{} `json:"vrid"`
}

AllowedAddressPairInResponse represents each element of allowed address pair of virtual network appliance.

type Appliance

type Appliance struct {
	Name               string               `json:"name"`
	ID                 string               `json:"id"`
	ApplianceType      string               `json:"appliance_type"`
	Description        string               `json:"description"`
	DefaultGateway     string               `json:"default_gateway"`
	AvailabilityZone   string               `json:"availability_zone"`
	OSMonitoringStatus string               `json:"os_monitoring_status"`
	OSLoginStatus      string               `json:"os_login_status"`
	VMStatus           string               `json:"vm_status"`
	OperationStatus    string               `json:"operation_status"`
	AppliancePlanID    string               `json:"virtual_network_appliance_plan_id"`
	TenantID           string               `json:"tenant_id"`
	Tags               map[string]string    `json:"tags"`
	Interfaces         InterfacesInResponse `json:"interfaces"`
}

Appliance represents, well, a virtual network appliance.

func ExtractAppliances

func ExtractAppliances(r pagination.Page) ([]Appliance, error)

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

type AppliancePage

type AppliancePage struct {
	pagination.LinkedPageBase
}

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

func (AppliancePage) IsEmpty

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

IsEmpty checks whether a AppliancePage struct is empty.

func (AppliancePage) NextPageURL

func (r AppliancePage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of virtual network appliance

has reached the end of a page and the pager seeks to traverse over a new one.

In order to do this, it needs to construct the next page's URL.

type CreateOpts

type CreateOpts struct {
	Name                          string               `json:"name,omitempty"`
	Description                   string               `json:"description,omitempty"`
	DefaultGateway                string               `json:"default_gateway,omitempty"`
	AvailabilityZone              string               `json:"availability_zone,omitempty"`
	VirtualNetworkAppliancePlanID string               `json:"virtual_network_appliance_plan_id" required:"true"`
	TenantID                      string               `json:"tenant_id,omitempty"`
	Tags                          map[string]string    `json:"tags,omitempty"`
	Interfaces                    CreateOptsInterfaces `json:"interfaces" required:"true"`
}

CreateOpts represents options used to create a virtual network appliance.

func (CreateOpts) ToApplianceCreateMap

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

ToApplianceCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToApplianceCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateOptsFixedIP

type CreateOptsFixedIP struct {
	IPAddress string `json:"ip_address" required:"true"`
}

CreateOptsFixedIP represents fixed ip information in virtual network appliance creation.

type CreateOptsInterface

type CreateOptsInterface struct {
	Name        string               `json:"name,omitempty"`
	Description string               `json:"description,omitempty"`
	NetworkID   string               `json:"network_id" required:"true"`
	Tags        map[string]string    `json:"tags,omitempty"`
	FixedIPs    [1]CreateOptsFixedIP `json:"fixed_ips" required:"true"`
}

CreateOptsInterface represents each parameters in virtual network appliance creation.

type CreateOptsInterfaces

type CreateOptsInterfaces struct {
	Interface1 CreateOptsInterface `json:"interface_1" required:"true"`
}

CreateOptsInterfaces represents 1st interface in virtual network appliance creation.

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 Virtual Network Appliance.

func Create

Create accepts a CreateOpts struct and creates a new virtual network appliance using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a virtual network appliance resource.

func (CreateResult) ExtractInto

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

Extract interprets any commonResult as a Virtual Network Appliance, 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, virtualNetworkApplianceID string) (r DeleteResult)

Delete accepts a unique ID and deletes the virtual network appliance associated with it.

type FixedIPInResponse

type FixedIPInResponse struct {
	IPAddress string `json:"ip_address"`
	SubnetID  string `json:"subnet_id"`
}

FixedIPInResponse represents each element of fixed ips of virtual network appliance.

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.

func Get

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

Get retrieves a specific virtual network appliance based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a virtual network appliance resource.

func (GetResult) ExtractInto

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

Extract interprets any commonResult as a Virtual Network Appliance, if possible.

type InterfaceInResponse

type InterfaceInResponse struct {
	Name                string                         `json:"name"`
	Description         string                         `json:"description"`
	NetworkID           string                         `json:"network_id"`
	Updatable           bool                           `json:"updatable"`
	Tags                map[string]string              `json:"tags"`
	FixedIPs            []FixedIPInResponse            `json:"fixed_ips"`
	AllowedAddressPairs []AllowedAddressPairInResponse `json:"allowed_address_pairs"`
}

InterfaceInResponse works as parent element of each interface of virtual network appliance.

type InterfacesInResponse

type InterfacesInResponse struct {
	Interface1 InterfaceInResponse `json:"interface_1"`
	Interface2 InterfaceInResponse `json:"interface_2"`
	Interface3 InterfaceInResponse `json:"interface_3"`
	Interface4 InterfaceInResponse `json:"interface_4"`
	Interface5 InterfaceInResponse `json:"interface_5"`
	Interface6 InterfaceInResponse `json:"interface_6"`
	Interface7 InterfaceInResponse `json:"interface_7"`
	Interface8 InterfaceInResponse `json:"interface_8"`
}

InterfacesInResponse works as list of interfaces of virtual network appliance.

type ListOpts

type ListOpts struct {
	Name                          string `q:"name"`
	ID                            string `q:"id"`
	ApplianceType                 string `q:"appliance_type"`
	Description                   string `q:"description"`
	AvailabilityZone              string `q:"availability_zone"`
	OSMonitoringStatus            string `q:"os_monitoring_status"`
	OSLoginStatus                 string `q:"os_login_status"`
	VMStatus                      string `q:"vm_status"`
	OperationStatus               string `q:"operation_status"`
	VirtualNetworkAppliancePlanID string `q:"virtual_network_appliance_plan_id"`
	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 virtual network appliance attributes you want to see returned.

func (ListOpts) ToVirtualNetworkApplianceListQuery

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

ToVirtualNetworkApplianceListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type UpdateAllowedAddressPairAddressInfo

type UpdateAllowedAddressPairAddressInfo struct {
	IPAddress  string       `json:"ip_address" required:"true"`
	MACAddress *string      `json:"mac_address" required:"true"`
	Type       *string      `json:"type" required:"true"`
	VRID       *interface{} `json:"vrid" required:"true"`
}

UpdateAllowedAddressPairAddressInfo represents options used to update virtual network appliance allowed address pairs.

type UpdateAllowedAddressPairInterface

type UpdateAllowedAddressPairInterface struct {
	AllowedAddressPairs *[]UpdateAllowedAddressPairAddressInfo `json:"allowed_address_pairs,omitempty"`
}

UpdateAllowedAddressPairInterface represents allowed address pairs list in update options used to update virtual network appliance allowed address pairs.

type UpdateAllowedAddressPairInterfaces

type UpdateAllowedAddressPairInterfaces struct {
	Interface1 *UpdateAllowedAddressPairInterface `json:"interface_1,omitempty"`
	Interface2 *UpdateAllowedAddressPairInterface `json:"interface_2,omitempty"`
	Interface3 *UpdateAllowedAddressPairInterface `json:"interface_3,omitempty"`
	Interface4 *UpdateAllowedAddressPairInterface `json:"interface_4,omitempty"`
	Interface5 *UpdateAllowedAddressPairInterface `json:"interface_5,omitempty"`
	Interface6 *UpdateAllowedAddressPairInterface `json:"interface_6,omitempty"`
	Interface7 *UpdateAllowedAddressPairInterface `json:"interface_7,omitempty"`
	Interface8 *UpdateAllowedAddressPairInterface `json:"interface_8,omitempty"`
}

UpdateAllowedAddressPairInterfaces represents interface list of update options used to update virtual network appliance allowed address pairs.

type UpdateAllowedAddressPairOpts

type UpdateAllowedAddressPairOpts struct {
	Interfaces *UpdateAllowedAddressPairInterfaces `json:"interfaces,omitempty"`
}

UpdateAllowedAddressPairOpts represents parent element of interfaces in update options used to update virtual network appliance allowed address pairs.

func (UpdateAllowedAddressPairOpts) ToApplianceUpdateMap

func (opts UpdateAllowedAddressPairOpts) ToApplianceUpdateMap() (map[string]interface{}, error)

ToApplianceUpdateMap builds a request body from UpdateAllowedAddressPairOpts.

type UpdateFixedIPAddressInfo

type UpdateFixedIPAddressInfo struct {
	IPAddress string `json:"ip_address" required:"true"`
}

UpdateFixedIPAddressInfo represents ip address part of virtual network appliance update.

type UpdateFixedIPInterface

type UpdateFixedIPInterface struct {
	NetworkID *string                     `json:"network_id,omitempty"`
	FixedIPs  *[]UpdateFixedIPAddressInfo `json:"fixed_ips,omitempty"`
}

UpdateFixedIPInterface represents each interface information in updating network connection and fixed ip address of virtual network appliance.

type UpdateFixedIPInterfaces

type UpdateFixedIPInterfaces struct {
	Interface1 *UpdateFixedIPInterface `json:"interface_1,omitempty"`
	Interface2 *UpdateFixedIPInterface `json:"interface_2,omitempty"`
	Interface3 *UpdateFixedIPInterface `json:"interface_3,omitempty"`
	Interface4 *UpdateFixedIPInterface `json:"interface_4,omitempty"`
	Interface5 *UpdateFixedIPInterface `json:"interface_5,omitempty"`
	Interface6 *UpdateFixedIPInterface `json:"interface_6,omitempty"`
	Interface7 *UpdateFixedIPInterface `json:"interface_7,omitempty"`
	Interface8 *UpdateFixedIPInterface `json:"interface_8,omitempty"`
}

UpdateFixedIPInterfaces represents interface list of update options used to update virtual network appliance network connection and fixed ips.

type UpdateFixedIPOpts

type UpdateFixedIPOpts struct {
	Interfaces *UpdateFixedIPInterfaces `json:"interfaces,omitempty"`
}

UpdateFixedIPOpts represents parent element of interfaces in update options used to update virtual network appliance network connection and fixed ips.

func (UpdateFixedIPOpts) ToApplianceUpdateMap

func (opts UpdateFixedIPOpts) ToApplianceUpdateMap() (map[string]interface{}, error)

ToApplianceUpdateMap builds a request body from UpdateFixedIPOpts.

type UpdateMetadataInterface

type UpdateMetadataInterface struct {
	Name        *string            `json:"name,omitempty"`
	Description *string            `json:"description,omitempty"`
	Tags        *map[string]string `json:"tags,omitempty"`
}

UpdateMetadataInterface represents options used to update virtual network appliance metadata of interface.

type UpdateMetadataInterfaces

type UpdateMetadataInterfaces struct {
	Interface1 *UpdateMetadataInterface `json:"interface_1,omitempty"`
	Interface2 *UpdateMetadataInterface `json:"interface_2,omitempty"`
	Interface3 *UpdateMetadataInterface `json:"interface_3,omitempty"`
	Interface4 *UpdateMetadataInterface `json:"interface_4,omitempty"`
	Interface5 *UpdateMetadataInterface `json:"interface_5,omitempty"`
	Interface6 *UpdateMetadataInterface `json:"interface_6,omitempty"`
	Interface7 *UpdateMetadataInterface `json:"interface_7,omitempty"`
	Interface8 *UpdateMetadataInterface `json:"interface_8,omitempty"`
}

UpdateMetadataInterfaces represents list of interfaces for updating virtual network appliance metadata.

type UpdateMetadataOpts

type UpdateMetadataOpts struct {
	Name        *string                   `json:"name,omitempty"`
	Description *string                   `json:"description,omitempty"`
	Tags        *map[string]string        `json:"tags,omitempty"`
	Interfaces  *UpdateMetadataInterfaces `json:"interfaces,omitempty"`
}

UpdateMetadataOpts represents metadata of virtual network appliance itself and pararent element for list of interfaces which are used by virtual network appliance metadata update.

func (UpdateMetadataOpts) ToApplianceUpdateMap

func (opts UpdateMetadataOpts) ToApplianceUpdateMap() (map[string]interface{}, error)

ToApplianceUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToApplianceUpdateMap() (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 an update operation. Call its Extract method to interpret it as a Virtual Network Appliance.

func Update

func Update(c *eclcloud.ServiceClient, virtualNetworkApplianceID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing virtual network appliance using the values provided. For more information, see the Create function.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a virtual network appliance resource.

func (UpdateResult) ExtractInto

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

Extract interprets any commonResult as a Virtual Network Appliance, if possible.

Directories

Path Synopsis
Package testing contains virtual network appliance unit tests
Package testing contains virtual network appliance unit tests

Jump to

Keyboard shortcuts

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