floatingips

package
v1.12.0 Latest Latest
Warning

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

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

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, resellClient, fipID)
if err != nil {
  log.Fatal(err)
}
fmt.Println(floatingIP)

Example of getting all floating ips

allFloatingIPs, _, err := floatingips.List(ctx, resellClient, 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(ctx, resellClient, 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(ctx, resellClient, "412a04ba-4cb2-4823-abd1-fcd48952b882")
if err != nil {
  log.Fatal(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

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"`
}

FloatingIP represents a single Resell Floating IP.

func Create

func Create(ctx context.Context, client *selvpcclient.ServiceClient, projectID string, createOpts FloatingIPOpts) ([]*FloatingIP, *selvpcclient.ResponseResult, error)

Create requests a creation of the floating ip in the specified project.

func Get

Get returns a single floating ip by its id.

func List

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 added in v1.1.0

type ListOpts struct {
	Detailed bool `param:"detailed"`
}

ListOpts represents options for the floating ips List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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