Documentation ¶
Overview ¶
Package floatingips provides the ability to retrieve and manage floating ips through the Resell v2 API.
Example of getting a single floating ip referenced by its id
floatingIP, _, err := floatingips.Get(context, client, fipID) if err != nil { log.Fatal(err) } fmt.Println(floatingIP)
Example of getting all floating ips
allFloatingIPs, _, err := floatingips.List(client, floatingips.ListOpts{}) if err != nil { log.Fatal(err) } for _, floatingIP := range floatingips { fmt.Println(floatingIP) }
Example of creating floating ips in a project
newFloatingIPsOpts := floatingips.FloatingIPOpts{ FloatingIPs: []floatingips.FloatingIPOpt{ { Region: "ru-2", Quantity: 2, }, }, } projectID := "49338ac045f448e294b25d013f890317" newFloatingIPs, _, err := floatingips.Create(client, projectID, newFloatingIPsOpts) if err != nil { log.Fatal(err) } for _, newFloatingIP := range newFloatingIPs { fmt.Println(newFloatingIPs) }
Example of deleting a single floating ip
_, err = floatingips.Delete(client, "412a04ba-4cb2-4823-abd1-fcd48952b882") if err != nil { log.Fatal(err) }
Index ¶
- func Delete(client *selvpcclient.Client, id string) (*clientservices.ResponseResult, error)
- type FloatingIP
- func Create(client *selvpcclient.Client, projectID string, createOpts FloatingIPOpts) ([]*FloatingIP, *clientservices.ResponseResult, error)
- func Get(client *selvpcclient.Client, id string) (*FloatingIP, *clientservices.ResponseResult, error)
- func List(client *selvpcclient.Client, opts ListOpts) ([]*FloatingIP, *clientservices.ResponseResult, error)
- type FloatingIPOpt
- type FloatingIPOpts
- type ListOpts
- type LoadBalancer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(client *selvpcclient.Client, id string) (*clientservices.ResponseResult, error)
Delete deletes a single floating ip by its id.
Types ¶
type FloatingIP ¶
type FloatingIP struct { // FloatingIPAddress represents IP address. FloatingIPAddress string `json:"floating_ip_address"` // ID is a unique id of the floating ip. ID string `json:"id"` // ProjectID represents an associated Identity service project. ProjectID string `json:"project_id"` // PortID contains a Networking service uuid of the port to which floating ip is associated to. PortID string `json:"port_id"` // FixedIPAddress contains an IP address of the port to which floating ip is // associated to. FixedIPAddress string `json:"fixed_ip_address"` // Region represents an Identity service region of where the floating ip resides. Region string `json:"region"` // Status represents a current status of the floating ip. Status string `json:"status"` // Servers contains info about servers to which floating ip is associated to. Servers []servers.Server `json:"servers"` // LoadBalancer contains info about load balancer to which floating ip is associated to. LoadBalancer *LoadBalancer `json:"loadbalancer"` }
FloatingIP represents a single Resell Floating IP.
func Create ¶
func Create(client *selvpcclient.Client, projectID string, createOpts FloatingIPOpts) ([]*FloatingIP, *clientservices.ResponseResult, error)
Create requests a creation of the floating ip in the specified project.
func Get ¶
func Get(client *selvpcclient.Client, id string) (*FloatingIP, *clientservices.ResponseResult, error)
Get returns a single floating ip by its id.
func List ¶
func List(client *selvpcclient.Client, opts ListOpts) ([]*FloatingIP, *clientservices.ResponseResult, error)
List gets a list of floating ips in the current domain.
type FloatingIPOpt ¶
type FloatingIPOpt struct { // Region represents an Identity service region of where the floating ips should reside. Region string `json:"region"` // Quantity represents how many floating ips do we need to create in a single request. Quantity int `json:"quantity"` }
FloatingIPOpt represents options for the single floating ip.
type FloatingIPOpts ¶
type FloatingIPOpts struct { // FloatingIPs represents options for all floating ips. FloatingIPs []FloatingIPOpt `json:"floatingips"` }
FloatingIPOpts represents options for the floating ips Create request.
type ListOpts ¶
type ListOpts struct {
Detailed bool `url:"detailed"`
}
ListOpts represents options for the floating ips List request.
type LoadBalancer ¶
type LoadBalancer struct { // ID is a unique id of the load balancer. ID string `json:"id"` // Name is a human-readable name of the load balancer. Name string `json:"name"` }
LoadBalancer represents a Load Balancer.