routerinsertion

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package routerinsertion implements the fwaasrouterinsertion Firewall extension. It is used to manage the router information of a firewall.

Example to List Firewalls with Router Information

type FirewallsWithRouters struct {
	firewalls.Firewall
	routerinsertion.FirewallExt
}

var allFirewalls []FirewallsWithRouters

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

err = firewalls.ExtractFirewallsInto(allPages, &allFirewalls)
if err != nil {
	panic(err)
}

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

Example to Create a Firewall with a Router

firewallCreateOpts := firewalls.CreateOpts{
	Name:     "firewall_1",
	PolicyID: "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c",
}

createOpts := routerinsertion.CreateOptsExt{
	CreateOptsBuilder: firewallCreateOpts,
	RouterIDs: []string{
		"8a3a0d6a-34b5-4a92-b65d-6375a4c1e9e8",
	},
}

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

Example to Update a Firewall with a Router

firewallID := "a6917946-38ab-4ffd-a55a-26c0980ce5ee"

firewallUpdateOpts := firewalls.UpdateOpts{
	Description: "updated firewall",
	PolicyID:    "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c",
}

updateOpts := routerinsertion.UpdateOptsExt{
	UpdateOptsBuilder: firewallUpdateOpts,
	RouterIDs: []string{
		"8a3a0d6a-34b5-4a92-b65d-6375a4c1e9e8",
	},
}

firewall, err := firewalls.Update(networkClient, firewallID, updateOpts).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 {
	firewalls.CreateOptsBuilder
	RouterIDs []string `json:"router_ids"`
}

CreateOptsExt adds the RouterIDs option to the base CreateOpts.

func (CreateOptsExt) ToFirewallCreateMap

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

ToFirewallCreateMap adds router_ids to the base firewall creation options.

type FirewallExt

type FirewallExt struct {
	// RouterIDs are the routers that the firewall is attached to.
	RouterIDs []string `json:"router_ids"`
}

FirewallExt is an extension to the base Firewall object

type UpdateOptsExt

type UpdateOptsExt struct {
	firewalls.UpdateOptsBuilder
	RouterIDs []string `json:"router_ids"`
}

UpdateOptsExt adds the RouterIDs option to the base UpdateOpts.

func (UpdateOptsExt) ToFirewallUpdateMap

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

ToFirewallUpdateMap adds router_ids to the base firewall update options.

Directories

Path Synopsis
routerinsertion unit tests
routerinsertion unit tests

Jump to

Keyboard shortcuts

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