external

package
v0.0.0-...-38f4f47 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

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 {
	vpcs.CreateOptsBuilder
	External *bool `json:"router:external,omitempty"`
}

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

func (CreateOptsExt) ToVPCCreateMap

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

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

type ListOptsExt

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

ListOptsExt adds the external network options to the base ListOpts.

func (ListOptsExt) ToVPCListQuery

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

ToVPCListQuery 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 {
	vpcs.UpdateOptsBuilder
	External *bool `json:"router:external,omitempty"`
}

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

func (UpdateOptsExt) ToVPCUpdateMap

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

ToVPCUpdateMap 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