network

package
v0.0.0-...-d1703da Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package network is used to create, delete, and query, networks, ports and subnets

Package network is used to create, delete, and query, networks, ports and subnets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocationPool

type AllocationPool struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

AllocationPool is a set of values for an allocation pool of ip addresses.

type CreateNetworkParameters

type CreateNetworkParameters struct {
	Name         string `json:"name"`
	AdminStateUp bool   `json:"admin_state_up"`
	Shared       bool   `json:"shared"`
	TenantID     string `json:"tenant_id"`
}

CreateNetworkParameters contains parameters required to create a network.

type CreatePortParameters

type CreatePortParameters struct {
	AdminStateUp bool      `json:"admin_state_up"`
	Name         string    `json:"name"`
	NetworkID    string    `json:"network_id"`
	FixedIPs     []FixedIP `json:"fixed_ips"`
}

CreatePortParameters holds a set of values that specify how to create a new port.

type CreateSecurityGroupParameters

type CreateSecurityGroupParameters struct {
	TenantID    string `json:"tenant_id,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

CreateSecurityGroupParameters contains the required parameters for creating a new security group.

type CreateSecurityGroupRuleParameters

type CreateSecurityGroupRuleParameters struct {
	Direction       string      `json:"direction"`
	PortRangeMin    *int        `json:"port_range_min"`
	PortRangeMax    *int        `json:"port_range_max"`
	IPProtocol      *IPProtocol `json:"protocol"`
	SecurityGroupID string      `json:"security_group_id"`
	RemoteGroupID   *string     `json:"remote_group_id"`
	RemoteIPPrefix  *string     `json:"remote_ip_prefix"`
}

CreateSecurityGroupRuleParameters represents the request to create a new security group rule.

type CreateSubnetParameters

type CreateSubnetParameters struct {
	NetworkID       string           `json:"network_id"`
	IPVersion       IPVersion        `json:"ip_version"`
	CIDR            string           `json:"cidr"`
	AllocationPools []AllocationPool `json:"allocation_pools"`
}

CreateSubnetParameters is a set of values to create a new subnet.

type EndpointLink struct {
	HREF string `json:"href"`
	Rel  string `json:"rel"`
}

EndpointLink return the HREF and Rel of an Endpoint.

type ExternalGatewayInfo

type ExternalGatewayInfo struct {
	NetworkID  string `json:"network_id"`
	EnableSNAT bool   `json:"enable_snat,omitempty"`
}

ExternalGatewayInfo indicates a router is an external gateway.

type FixedIP

type FixedIP struct {
	SubnetID  string `json:"subnet_id,omitempty"`
	IPAddress string `json:"ip_address"`
}

FixedIP is holds data that specifies a fixed IP.

type HostRoute

type HostRoute struct {
	NextHop     string `json:"nexthop"`
	Destination string `json:"destination"`
}

HostRoute indicates the routing table for a subnet

type IPProtocol

type IPProtocol string

IPProtocol is the type that can be ICMP, TCP, or UDP

const (
	// ICMP is a constant for IPProtocol type.
	ICMP IPProtocol = "icmp"
	// TCP is a constant for IPProtocol type.
	TCP IPProtocol = "tcp"
	// UDP is a constant for IPProtocol type.
	UDP IPProtocol = "udp"
)

type IPVersion

type IPVersion int

IPVersion type indicates whether an ip address is IPV4 or IPV6.

const (
	// IPV4 indicates its an ip address version 4.
	IPV4 IPVersion = 4
	// IPV6 indicates its an ip address version 6
	IPV6 IPVersion = 6
)

type PortResponse

type PortResponse struct {
	ID                  string    `json:"id"`
	Name                string    `json:"name"`
	Status              string    `json:"status"`
	AdminStateUp        bool      `json:"admin_state_up"`
	PortSecurityEnabled bool      `json:"port_security_enabled"`
	DeviceID            string    `json:"device_id"`
	DeviceOwner         string    `json:"device_owner"`
	NetworkID           string    `json:"network_id"`
	TenantID            string    `json:"tenant_id"`
	MacAddress          string    `json:"mac_address"`
	FixedIPs            []FixedIP `json:"fixed_ips"`
	SecurityGroups      []string  `json:"security_groups"`
}

PortResponse returns a set of values of the a port response.

type PortResponses

type PortResponses []PortResponse

PortResponses is a type for a slice of PortResponses.

type QueryParameters

type QueryParameters struct {
	Name           string `json:"name"`
	Status         string `json:"status"`
	RouterExternal bool   `json:"router:external"`
	AdminStateUp   bool   `json:"admin_state_up"`
	Shared         bool   `json:"shared"`
}

QueryParameters is a structure that contains the filter parameters for a network.

type Response

type Response struct {
	ID                  string   `json:"id"`
	Name                string   `json:"name"`
	Status              string   `json:"status"`
	Subnets             []string `json:"subnets"`
	TenantID            string   `json:"tenant_id"`
	RouterExternal      bool     `json:"router:external"`
	AdminStateUp        bool     `json:"admin_state_up"`
	Shared              bool     `json:"shared"`
	PortSecurityEnabled bool     `json:"port_security_enabled"`
}

Response returns a set of values of the a network response.

type Router

type Router struct {
	Status              string              `json:"status"`
	ExternalGatewayInfo ExternalGatewayInfo `json:"external_gateway_info"`
	Name                string              `json:"name"`
	AdminStateUp        bool                `json:"admin_state_up"`
	TenantID            string              `json:"tenant_id"`
	ID                  string              `json:"id"`
}

Router is a structure has properties of the router from open stack.

type SecurityGroup

type SecurityGroup struct {
	ID                 string              `json:"id"`
	TenantID           string              `json:"tenant_id"`
	Name               string              `json:"name"`
	Description        string              `json:"description"`
	SecurityGroupRules []SecurityGroupRule `json:"security_group_rules"`
}

SecurityGroup represents a Security Group in Neutron

type SecurityGroupRule

type SecurityGroupRule struct {
	ID              string      `json:"id"`
	Direction       string      `json:"direction"`
	IPProtocol      *IPProtocol `json:"protocol"`
	EtherType       string      `json:"ethertype"`
	TenantID        string      `json:"tenant_id"`
	PortRangeMin    *int        `json:"port_range_min"`
	PortRangeMax    *int        `json:"port_range_max"`
	SecurityGroupID string      `json:"security_group_id"`
	RemoteGroupID   *string     `json:"remote_group_id"`
	RemoteIPPrefix  *string     `json:"remote_ip_prefix"`
}

SecurityGroupRule represents a Security Group Rule in Neutron

type Service

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

Service holds state that is use to make requests and get responses for networks, ports and subnets

func NewService

func NewService(authenticator common.Authenticator) Service

NewService creates a new network service client.

func (Service) CreateNetwork

func (networkService Service) CreateNetwork(parameters CreateNetworkParameters) (Response, error)

CreateNetwork will send a POST request to create a new network with the specified parameters.

func (Service) CreatePort

func (networkService Service) CreatePort(parameters CreatePortParameters) (PortResponse, error)

CreatePort issues a POST to create the specified port and return a PortResponse.

func (Service) CreateRouter

func (networkService Service) CreateRouter(networkID string) (Router, error)

CreateRouter will issue a Post query creates a new security group and returns the created value.

func (Service) CreateSecurityGroup

func (networkService Service) CreateSecurityGroup(parameters CreateSecurityGroupParameters) (SecurityGroup, error)

CreateSecurityGroup will create a new security group in Neutron

func (Service) CreateSecurityGroupRule

func (networkService Service) CreateSecurityGroupRule(sgr CreateSecurityGroupRuleParameters) (SecurityGroupRule, error)

CreateSecurityGroupRule creates a new security group rule in the specified parent.

func (Service) CreateSubnet

func (networkService Service) CreateSubnet(parameters CreateSubnetParameters) (SubnetResponse, error)

CreateSubnet issues a GET request to add a Subnet with the specified parameters and returns the Subnet created.

func (Service) DeleteNetwork

func (networkService Service) DeleteNetwork(name string) (err error)

DeleteNetwork will delete the specified network.

func (Service) DeletePort

func (networkService Service) DeletePort(id string) error

DeletePort issues a DELETE to the specified port url to delete it.

func (Service) DeleteRouter

func (networkService Service) DeleteRouter(routerID string) (err error)

DeleteRouter will issue a delete query to delete the specified security group.

func (Service) DeleteSecurityGroup

func (networkService Service) DeleteSecurityGroup(securityGroupID string) (err error)

DeleteSecurityGroup will issue a delete query to delete the specified security group.

func (Service) DeleteSecurityGroupRule

func (networkService Service) DeleteSecurityGroupRule(securityGroupRuleID string) (err error)

DeleteSecurityGroupRule will issue a delete query to delete the specified security group rule.

func (Service) DeleteSubnet

func (networkService Service) DeleteSubnet(id string) error

DeleteSubnet issues a DELETE request to remove the subnet.

func (Service) Network

func (networkService Service) Network(id string) (Response, error)

Network will issue a get request for a specific network.

func (Service) NetworkIDsByName

func (networkService Service) NetworkIDsByName(name string) ([]string, error)

NetworkIDsByName will return the networks ID for that have the specified network name.

func (Service) Networks

func (networkService Service) Networks() ([]Response, error)

Networks will issue a get query that returns a list of networks

func (Service) Port

func (networkService Service) Port(id string) (PortResponse, error)

Port issues a GET request that returns a specific port response.

func (Service) Ports

func (networkService Service) Ports() ([]PortResponse, error)

Ports issues a GET request that returns the found port responses

func (Service) QueryNetworks

func (networkService Service) QueryNetworks(q QueryParameters) ([]Response, error)

QueryNetworks will issue a get query that returns a list of networks

func (Service) Router

func (networkService Service) Router(id string) (Router, error)

Router will issue a get query that returns a security group based on the id.

func (Service) Routers

func (networkService Service) Routers() ([]Router, error)

Routers will issue a get query that returns a list of security groups in the system.

func (Service) SecurityGroup

func (networkService Service) SecurityGroup(id string) (SecurityGroup, error)

SecurityGroup will retrieve a single security group from Neutron

func (Service) SecurityGroups

func (networkService Service) SecurityGroups() ([]SecurityGroup, error)

SecurityGroups will retrieve a list of security groups from Neutron

func (Service) Subnet

func (networkService Service) Subnet(id string) (SubnetResponse, error)

Subnet issues a GET request to a specific url of a subnet and returns a subnet response.

func (Service) Subnets

func (networkService Service) Subnets() ([]SubnetResponse, error)

Subnets issues a GET request to return all subnets.

type SubnetResponse

type SubnetResponse struct {
	ID              string           `json:"id"`
	Name            string           `json:"name"`
	NetworkID       string           `json:"network_id"`
	TenantID        string           `json:"tenant_id"`
	EnableDHCP      bool             `json:"enable_dhcp"`
	DNSNameserver   []string         `json:"dns_nameservers"`
	AllocationPools []AllocationPool `json:"allocation_pools"`
	HostRoutes      []HostRoute      `json:"host_routes"`
	IPVersion       IPVersion        `json:"ip_version"`
	GatewayIP       string           `json:"gateway_ip"`
	CIDR            string           `json:"cidr"`
}

SubnetResponse returns a set of values of the a Subnet response

Jump to

Keyboard shortcuts

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