portforwarding

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 1 Imported by: 10

Documentation

Overview

package portforwarding enables management and retrieval of port forwarding resources for Floating IPs from the OpenStack Networking service.

Example to Create a Port Forwarding for a floating IP

createOpts := &portforwarding.CreateOpts{
	Protocol:          "tcp",
	InternalPort:      25,
	ExternalPort:      2230,
	InternalIPAddress: internalIP,
	InternalPortID:    portID,
}

pf, err := portforwarding.Create(networkingClient, floatingIPID, createOpts).Extract()

if err != nil {
	panic(err)
}

Example to Delete a Port forwarding

fipID := "2f245a7b-796b-4f26-9cf9-9e82d248fda7"
pfID := "725ade3c-9760-4880-8080-8fc2dbab9acc"
err := floatingips.Delete(networkClient, fipID, pfID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	InternalPortID    string `json:"internal_port_id"`
	InternalIPAddress string `json:"internal_ip_address"`
	InternalPort      int    `json:"internal_port"`
	ExternalPort      int    `json:"external_port"`
	Protocol          string `json:"protocol"`
}

CreateOpts contains all the values needed to create a new port forwarding resource. All attributes are required.

func (CreateOpts) ToPortForwardingCreateMap

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

ToPortForwardingCreateMap allows CreateOpts to satisfy the CreateOptsBuilder interface

type CreateOptsBuilder

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

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

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 PortForwarding.

func Create

func Create(c *gophercloud.ServiceClient, floatingIpId string, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and uses the values provided to create a new port forwarding for an existing floating IP.

func (CreateResult) Extract

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

Extract will extract a Port Forwarding resource from a result.

func (CreateResult) ExtractInto

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

type DeleteResult

type DeleteResult struct {
	gophercloud.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 *gophercloud.ServiceClient, floatingIpId string, pfId string) (r DeleteResult)

Delete will permanently delete a particular port forwarding for a given floating ID.

type PortForwarding

type PortForwarding struct {
	// The ID of the floating IP port forwarding
	ID string `json:"id"`

	// The ID of the Neutron port associated to the floating IP port forwarding.
	InternalPortID string `json:"internal_port_id"`

	// The TCP/UDP/other protocol port number of the port forwarding’s floating IP address.
	ExternalPort int `json:"external_port"`

	// The IP protocol used in the floating IP port forwarding.
	Protocol string `json:"protocol"`

	// The TCP/UDP/other protocol port number of the Neutron port fixed
	// IP address associated to the floating ip port forwarding.
	InternalPort int `json:"internal_port"`

	// The fixed IPv4 address of the Neutron port associated
	// to the floating IP port forwarding.
	InternalIPAddress string `json:"internal_ip_address"`
}

Directories

Path Synopsis
port forwarding unit tests
port forwarding unit tests

Jump to

Keyboard shortcuts

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