siteconnections

package
v1.1.39 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package siteconnections allows management and retrieval of IPSec site connections in the OpenStack Networking Service.

Example to create an IPSec site connection

createOpts := siteconnections.CreateOpts{
		Name:           "Connection1",
		PSK:            "secret",
		Initiator:      siteconnections.InitiatorBiDirectional,
		AdminStateUp:   gophercloud.Enabled,
		IPSecPolicyID:  "4ab0a72e-64ef-4809-be43-c3f7e0e5239b",
		PeerEPGroupID:  "5f5801b1-b383-4cf0-bf61-9e85d4044b2d",
		IKEPolicyID:    "47a880f9-1da9-468c-b289-219c9eca78f0",
		VPNServiceID:   "692c1ec8-a7cd-44d9-972b-8ed3fe4cc476",
		LocalEPGroupID: "498bb96a-1517-47ea-b1eb-c4a53db46a16",
		PeerAddress:    "172.24.4.233",
		PeerID:         "172.24.4.233",
		MTU:            1500,
	}
	connection, err := siteconnections.Create(client, createOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Show the details of a specific IPSec site connection by ID

conn, err := siteconnections.Get(client, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c").Extract()
if err != nil {
	panic(err)
}

Example to Delete a site connection

connID := "38aee955-6283-4279-b091-8b9c828000ec"
err := siteconnections.Delete(networkClient, connID).ExtractErr()
if err != nil {
	panic(err)
}

Example to List site connections

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

allConnections, err := siteconnections.ExtractConnections(allPages)
if err != nil {
	panic(err)
}

Example to Update an IPSec site connection

description := "updated connection"
name := "updatedname"
updateOpts := siteconnections.UpdateOpts{
	Name:        &name,
	Description: &description,
}
updatedConnection, err := siteconnections.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract()
if err != nil {
	panic(err)
}

Index

Constants

View Source
const (
	ActionHold             Action    = "hold"
	ActionClear            Action    = "clear"
	ActionRestart          Action    = "restart"
	ActionDisabled         Action    = "disabled"
	ActionRestartByPeer    Action    = "restart-by-peer"
	InitiatorBiDirectional Initiator = "bi-directional"
	InitiatorResponseOnly  Initiator = "response-only"
)

Variables

This section is empty.

Functions

func List

List returns a Pager which allows you to iterate over a collection of IPSec site connections. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type Action

type Action string

type Connection

type Connection struct {
	// IKEPolicyID is the ID of the IKE policy.
	IKEPolicyID string `json:"ikepolicy_id"`

	// VPNServiceID is the ID of the VPN service.
	VPNServiceID string `json:"vpnservice_id"`

	// LocalEPGroupID is the ID for the endpoint group that contains private subnets for the local side of the connection.
	LocalEPGroupID string `json:"local_ep_group_id"`

	// IPSecPolicyID is the ID of the IPSec policy
	IPSecPolicyID string `json:"ipsecpolicy_id"`

	// PeerID is the peer router identity for authentication.
	PeerID string `json:"peer_id"`

	// TenantID is the ID of the project.
	TenantID string `json:"tenant_id"`

	// ProjectID is the ID of the project.
	ProjectID string `json:"project_id"`

	// PeerEPGroupID is the ID for the endpoint group that contains private CIDRs in the form < net_address > / < prefix >
	// for the peer side of the connection.
	PeerEPGroupID string `json:"peer_ep_group_id"`

	// LocalID is an ID to be used instead of the external IP address for a virtual router used in traffic
	// between instances on different networks in east-west traffic.
	LocalID string `json:"local_id"`

	// Name is the human readable name of the connection.
	Name string `json:"name"`

	// Description is the human readable description of the connection.
	Description string `json:"description"`

	// PeerAddress is the peer gateway public IPv4 or IPv6 address or FQDN.
	PeerAddress string `json:"peer_address"`

	// RouteMode is the route mode.
	RouteMode string `json:"route_mode"`

	// PSK is the pre-shared key.
	PSK string `json:"psk"`

	// Initiator indicates whether this VPN can only respond to connections or both respond to and initiate connections.
	Initiator string `json:"initiator"`

	// PeerCIDRs is a unique list of valid peer private CIDRs in the form < net_address > / < prefix > .
	PeerCIDRs []string `json:"peer_cidrs"`

	// AdminStateUp is the administrative state of the connection.
	AdminStateUp bool `json:"admin_state_up"`

	// DPD is the dead peer detection (DPD) protocol controls.
	DPD DPD `json:"dpd"`

	// AuthMode is the authentication mode.
	AuthMode string `json:"auth_mode"`

	// MTU is the maximum transmission unit (MTU) value to address fragmentation.
	MTU int `json:"mtu"`

	// Status indicates whether the IPsec connection is currently operational.
	// Values are ACTIVE, DOWN, BUILD, ERROR, PENDING_CREATE, PENDING_UPDATE, or PENDING_DELETE.
	Status string `json:"status"`

	// ID is the id of the connection
	ID string `json:"id"`
}

Connection is an IPSec site connection

func ExtractConnections

func ExtractConnections(r pagination.Page) ([]Connection, error)

ExtractConnections accepts a Page struct, specifically a Connection struct, and extracts the elements into a slice of Connection structs. In other words, a generic collection is mapped into a relevant slice.

type ConnectionPage

type ConnectionPage struct {
	pagination.LinkedPageBase
}

ConnectionPage is the page returned by a pager when traversing over a collection of IPSec site connections.

func (ConnectionPage) IsEmpty

func (r ConnectionPage) IsEmpty() (bool, error)

IsEmpty checks whether a ConnectionPage struct is empty.

func (ConnectionPage) NextPageURL

func (r ConnectionPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of IPSec site connections has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type CreateOpts

type CreateOpts struct {
	// The ID of the IKE policy
	IKEPolicyID string `json:"ikepolicy_id"`

	// The ID of the VPN Service
	VPNServiceID string `json:"vpnservice_id"`

	// The ID for the endpoint group that contains private subnets for the local side of the connection.
	// You must specify this parameter with the peer_ep_group_id parameter unless
	// in backward- compatible mode where peer_cidrs is provided with a subnet_id for the VPN service.
	LocalEPGroupID string `json:"local_ep_group_id,omitempty"`

	// The ID of the IPsec policy.
	IPSecPolicyID string `json:"ipsecpolicy_id"`

	// The peer router identity for authentication.
	// A valid value is an IPv4 address, IPv6 address, e-mail address, key ID, or FQDN.
	// Typically, this value matches the peer_address value.
	PeerID string `json:"peer_id"`

	// The ID of the project
	TenantID string `json:"tenant_id,omitempty"`

	// The ID for the endpoint group that contains private CIDRs in the form < net_address > / < prefix >
	// for the peer side of the connection.
	// You must specify this parameter with the local_ep_group_id parameter unless in backward-compatible mode
	// where peer_cidrs is provided with a subnet_id for the VPN service.
	PeerEPGroupID string `json:"peer_ep_group_id,omitempty"`

	// An ID to be used instead of the external IP address for a virtual router used in traffic between instances on different networks in east-west traffic.
	// Most often, local ID would be domain name, email address, etc.
	// If this is not configured then the external IP address will be used as the ID.
	LocalID string `json:"local_id,omitempty"`

	// The human readable name of the connection.
	// Does not have to be unique.
	// Default is an empty string
	Name string `json:"name,omitempty"`

	// The human readable description of the connection.
	// Does not have to be unique.
	// Default is an empty string
	Description string `json:"description,omitempty"`

	// The peer gateway public IPv4 or IPv6 address or FQDN.
	PeerAddress string `json:"peer_address"`

	// The pre-shared key.
	// A valid value is any string.
	PSK string `json:"psk"`

	// Indicates whether this VPN can only respond to connections or both respond to and initiate connections.
	// A valid value is response-only or bi-directional. Default is bi-directional.
	Initiator Initiator `json:"initiator,omitempty"`

	// Unique list of valid peer private CIDRs in the form < net_address > / < prefix > .
	PeerCIDRs []string `json:"peer_cidrs,omitempty"`

	// The administrative state of the resource, which is up (true) or down (false).
	// Default is false
	AdminStateUp *bool `json:"admin_state_up,omitempty"`

	// A dictionary with dead peer detection (DPD) protocol controls.
	DPD *DPDCreateOpts `json:"dpd,omitempty"`

	// The maximum transmission unit (MTU) value to address fragmentation.
	// Minimum value is 68 for IPv4, and 1280 for IPv6.
	MTU int `json:"mtu,omitempty"`
}

CreateOpts contains all the values needed to create a new IPSec site connection

func (CreateOpts) ToConnectionCreateMap

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

ToConnectionCreateMap casts a CreateOpts struct to a map.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToConnectionCreateMap() (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 Connection.

func Create

Create accepts a CreateOpts struct and uses the values to create a new IPSec site connection.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts an IPSec site connection.

type DPD

type DPD struct {
	// Action is the dead peer detection (DPD) action.
	Action string `json:"action"`

	// Timeout is the dead peer detection (DPD) timeout in seconds.
	Timeout int `json:"timeout"`

	// Interval is the dead peer detection (DPD) interval in seconds.
	Interval int `json:"interval"`
}

type DPDCreateOpts

type DPDCreateOpts struct {
	// The dead peer detection (DPD) action.
	// A valid value is clear, hold, restart, disabled, or restart-by-peer.
	// Default value is hold.
	Action Action `json:"action,omitempty"`

	// The dead peer detection (DPD) timeout in seconds.
	// A valid value is a positive integer that is greater than the DPD interval value.
	// Default is 120.
	Timeout int `json:"timeout,omitempty"`

	// The dead peer detection (DPD) interval, in seconds.
	// A valid value is a positive integer.
	// Default is 30.
	Interval int `json:"interval,omitempty"`
}

DPDCreateOpts contains all the values needed to create a valid configuration for Dead Peer detection protocols

type DPDUpdateOpts

type DPDUpdateOpts struct {
	Action   Action `json:"action,omitempty"`
	Timeout  int    `json:"timeout,omitempty"`
	Interval int    `json:"interval,omitempty"`
}

UpdateOpts contains the values used when updating the DPD of an IPSec site connection

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the operation succeeded or failed.

func Delete

func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete will permanently delete a particular IPSec site connection based on its unique ID.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Connection.

func Get

func Get(c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a particular IPSec site connection based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Connection, error)

Extract is a function that accepts a result and extracts an IPSec site connection.

type Initiator

type Initiator string

type ListOpts

type ListOpts struct {
	IKEPolicyID    string    `q:"ikepolicy_id"`
	VPNServiceID   string    `q:"vpnservice_id"`
	LocalEPGroupID string    `q:"local_ep_group_id"`
	IPSecPolicyID  string    `q:"ipsecpolicy_id"`
	PeerID         string    `q:"peer_id"`
	TenantID       string    `q:"tenant_id"`
	ProjectID      string    `q:"project_id"`
	PeerEPGroupID  string    `q:"peer_ep_group_id"`
	LocalID        string    `q:"local_id"`
	Name           string    `q:"name"`
	Description    string    `q:"description"`
	PeerAddress    string    `q:"peer_address"`
	PSK            string    `q:"psk"`
	Initiator      Initiator `q:"initiator"`
	AdminStateUp   *bool     `q:"admin_state_up"`
	MTU            int       `q:"mtu"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the IPSec site connection attributes you want to see returned.

func (ListOpts) ToConnectionListQuery

func (opts ListOpts) ToConnectionListQuery() (string, error)

ToConnectionListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToConnectionListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type UpdateOpts

type UpdateOpts struct {
	Description    *string        `json:"description,omitempty"`
	Name           *string        `json:"name,omitempty"`
	LocalID        string         `json:"local_id,omitempty"`
	PeerAddress    string         `json:"peer_address,omitempty"`
	PeerID         string         `json:"peer_id,omitempty"`
	PeerCIDRs      []string       `json:"peer_cidrs,omitempty"`
	LocalEPGroupID string         `json:"local_ep_group_id,omitempty"`
	PeerEPGroupID  string         `json:"peer_ep_group_id,omitempty"`
	MTU            int            `json:"mtu,omitempty"`
	Initiator      Initiator      `json:"initiator,omitempty"`
	PSK            string         `json:"psk,omitempty"`
	DPD            *DPDUpdateOpts `json:"dpd,omitempty"`
	AdminStateUp   *bool          `json:"admin_state_up,omitempty"`
}

UpdateOpts contains the values used when updating an IPSec site connection

func (UpdateOpts) ToConnectionUpdateMap

func (opts UpdateOpts) ToConnectionUpdateMap() (map[string]interface{}, error)

ToConnectionUpdateMap casts an UpdateOpts struct to a map.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToConnectionUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a connection

func Update

Update allows IPSec site connections to be updated.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Connection, error)

Extract is a function that accepts a result and extracts an IPSec site connection.

Jump to

Keyboard shortcuts

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