vlantransparent

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Overview

Package vlantransparent provides the ability to retrieve and manage networks with the vlan-transparent extension through the Neutron API.

Example of Listing Networks with the vlan-transparent extension

    iTrue := true
    networkListOpts := networks.ListOpts{}
    listOpts := vlantransparent.ListOptsExt{
        ListOptsBuilder: networkListOpts,
        VLANTransparent: &iTrue,
    }

    type NetworkWithVLANTransparentExt struct {
        networks.Network
        vlantransparent.NetworkVLANTransparentExt
    }

    var allNetworks []NetworkWithVLANTransparentExt

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

    err = networks.ExtractNetworksInto(allPages, &allNetworks)
    if err != nil {
        panic(err)
    }

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

Example of Getting a Network with the vlan-transparent extension

var network struct {
	networks.Network
	vlantransparent.TransparentExt
}

err := networks.Get(networkClient, "db193ab3-96e3-4cb3-8fc5-05f4296d0324").ExtractInto(&network)
if err != nil {
	panic(err)
}

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

Example of Creating Network with the vlan-transparent extension

iTrue := true
networkCreateOpts := networks.CreateOpts{
	Name:         "private",
}

createOpts := vlantransparent.CreateOptsExt{
	CreateOptsBuilder: &networkCreateOpts,
	VLANTransparent:   &iTrue,
}

var network struct {
	networks.Network
	vlantransparent.TransparentExt
}

err := networks.Create(networkClient, createOpts).ExtractInto(&network)
if err != nil {
	panic(err)
}

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

Example of Updating Network with the vlan-transparent extension

iFalse := false
networkUpdateOpts := networks.UpdateOpts{
	Name:         "new_network_name",
}

updateOpts := vlantransparent.UpdateOptsExt{
	UpdateOptsBuilder: &networkUpdateOpts,
	VLANTransparent:   &iFalse,
}

var network struct {
	networks.Network
	vlantransparent.TransparentExt
}

err := networks.Update(networkClient, updateOpts).ExtractInto(&network)
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptsExt

type CreateOptsExt struct {
	networks.CreateOptsBuilder
	VLANTransparent *bool `json:"vlan_transparent,omitempty"`
}

CreateOptsExt is the structure used when creating new vlan-transparent network resources. It embeds networks.CreateOpts and so inherits all of its required and optional fields, with the addition of the VLANTransparent field.

func (CreateOptsExt) ToNetworkCreateMap

func (opts CreateOptsExt) ToNetworkCreateMap() (map[string]interface{}, error)

ToNetworkCreateMap adds the vlan_transparent option to the base network creation options.

type ListOptsExt

type ListOptsExt struct {
	networks.ListOptsBuilder
	VLANTransparent *bool `q:"vlan_transparent"`
}

ListOptsExt adds the vlan-transparent network options to the base ListOpts.

func (ListOptsExt) ToNetworkListQuery

func (opts ListOptsExt) ToNetworkListQuery() (string, error)

ToNetworkListQuery adds the vlan_transparent option to the base network list options.

type TransparentExt

type TransparentExt struct {
	// VLANTransparent whether the network is a VLAN transparent network or not.
	VLANTransparent bool `json:"vlan_transparent"`
}

TransparentExt represents a decorated form of a network with "vlan-transparent" extension attributes.

type UpdateOptsExt

type UpdateOptsExt struct {
	networks.UpdateOptsBuilder
	VLANTransparent *bool `json:"vlan_transparent,omitempty"`
}

UpdateOptsExt is the structure used when updating existing vlan-transparent network resources. It embeds networks.UpdateOpts and so inherits all of its required and optional fields, with the addition of the VLANTransparent field.

func (UpdateOptsExt) ToNetworkUpdateMap

func (opts UpdateOptsExt) ToNetworkUpdateMap() (map[string]interface{}, error)

ToNetworkUpdateMap casts an UpdateOpts struct to a map.

Directories

Path Synopsis
vlantransparent extension unit tests
vlantransparent extension unit tests

Jump to

Keyboard shortcuts

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