external

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 4 Imported by: 97

Documentation

Overview

Package external provides information and interaction with the external extension for the OpenStack Networking service.

Example to List Networks with External Information

iTrue := true
networkListOpts := networks.ListOpts{}
listOpts := external.ListOptsExt{
	ListOptsBuilder: networkListOpts,
	External: &iTrue,
}

type NetworkWithExternalExt struct {
	networks.Network
	external.NetworkExternalExt
}

var allNetworks []NetworkWithExternalExt

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 to Create a Network with External Information

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

createOpts := external.CreateOptsExt{
	networkCreateOpts,
	&iTrue,
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptsExt

type CreateOptsExt struct {
	networks.CreateOptsBuilder
	External *bool `json:"router:external,omitempty"`
}

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

func (CreateOptsExt) ToNetworkCreateMap

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

ToNetworkCreateMap adds the router:external options to the base network creation options.

type ListOptsExt

type ListOptsExt struct {
	networks.ListOptsBuilder
	External *bool `q:"router:external"`
}

ListOptsExt adds the external network options to the base ListOpts.

func (ListOptsExt) ToNetworkListQuery

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

ToNetworkListQuery adds the router:external option to the base network list options.

type NetworkExternalExt

type NetworkExternalExt struct {
	// Specifies whether the network is an external network or not.
	External bool `json:"router:external"`
}

NetworkExternalExt represents a decorated form of a Network with based on the "external-net" extension.

type UpdateOptsExt

type UpdateOptsExt struct {
	networks.UpdateOptsBuilder
	External *bool `json:"router:external,omitempty"`
}

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

func (UpdateOptsExt) ToNetworkUpdateMap

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

ToNetworkUpdateMap casts an UpdateOpts struct to a map.

Directories

Path Synopsis
external unit tests
external unit tests

Jump to

Keyboard shortcuts

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