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 ¶
- type AllocationPool
- type CreateNetworkParameters
- type CreatePortParameters
- type CreateSecurityGroupParameters
- type CreateSecurityGroupRuleParameters
- type CreateSubnetParameters
- type EndpointLink
- type ExternalGatewayInfo
- type FixedIP
- type HostRoute
- type IPProtocol
- type IPVersion
- type PortResponse
- type PortResponses
- type QueryParameters
- type Response
- type Router
- type SecurityGroup
- type SecurityGroupRule
- type Service
- func (networkService Service) CreateNetwork(parameters CreateNetworkParameters) (Response, error)
- func (networkService Service) CreatePort(parameters CreatePortParameters) (PortResponse, error)
- func (networkService Service) CreateRouter(networkID string) (Router, error)
- func (networkService Service) CreateSecurityGroup(parameters CreateSecurityGroupParameters) (SecurityGroup, error)
- func (networkService Service) CreateSecurityGroupRule(sgr CreateSecurityGroupRuleParameters) (SecurityGroupRule, error)
- func (networkService Service) CreateSubnet(parameters CreateSubnetParameters) (SubnetResponse, error)
- func (networkService Service) DeleteNetwork(name string) (err error)
- func (networkService Service) DeletePort(id string) error
- func (networkService Service) DeleteRouter(routerID string) (err error)
- func (networkService Service) DeleteSecurityGroup(securityGroupID string) (err error)
- func (networkService Service) DeleteSecurityGroupRule(securityGroupRuleID string) (err error)
- func (networkService Service) DeleteSubnet(id string) error
- func (networkService Service) Network(id string) (Response, error)
- func (networkService Service) NetworkIDsByName(name string) ([]string, error)
- func (networkService Service) Networks() ([]Response, error)
- func (networkService Service) Port(id string) (PortResponse, error)
- func (networkService Service) Ports() ([]PortResponse, error)
- func (networkService Service) QueryNetworks(q QueryParameters) ([]Response, error)
- func (networkService Service) Router(id string) (Router, error)
- func (networkService Service) Routers() ([]Router, error)
- func (networkService Service) SecurityGroup(id string) (SecurityGroup, error)
- func (networkService Service) SecurityGroups() ([]SecurityGroup, error)
- func (networkService Service) Subnet(id string) (SubnetResponse, error)
- func (networkService Service) Subnets() ([]SubnetResponse, error)
- type SubnetResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocationPool ¶
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"` 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 ¶
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 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 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"` }
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"` 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 ¶
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 ¶
DeleteNetwork will delete the specified network.
func (Service) DeletePort ¶
DeletePort issues a DELETE to the specified port url to delete it.
func (Service) DeleteRouter ¶
DeleteRouter will issue a delete query to delete the specified security group.
func (Service) DeleteSecurityGroup ¶
DeleteSecurityGroup will issue a delete query to delete the specified security group.
func (Service) DeleteSecurityGroupRule ¶
DeleteSecurityGroupRule will issue a delete query to delete the specified security group rule.
func (Service) DeleteSubnet ¶
DeleteSubnet issues a DELETE request to remove the subnet.
func (Service) NetworkIDsByName ¶
NetworkIDsByName will return the networks ID for that have the specified network name.
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 ¶
Router will issue a get query that returns a security group based on the id.
func (Service) Routers ¶
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