floatingips

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

Create accepts a CreateOpts struct and creates a new floating ip using the values provided.

func Delete

func Delete(c *gcorecloud.ServiceClient, floatingID string) (r tasks.Result)

Delete accepts a unique ID and deletes the floating ip associated with it.

func ExtractFloatingIPIDFromTask

func ExtractFloatingIPIDFromTask(task *tasks.Task) (string, error)

func ExtractFloatingIPsInto

func ExtractFloatingIPsInto(r pagination.Page, v interface{}) error

Types

type CreateOpts

type CreateOpts struct {
	PortID         string            `json:"port_id,omitempty"`
	FixedIPAddress net.IP            `json:"fixed_ip_address,omitempty"`
	Metadata       map[string]string `json:"metadata,omitempty"`
}

CreateOpts represents options used to create a floating ip.

func (CreateOpts) ToFloatingIPCreateMap

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

ToFloatingIPCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToFloatingIPCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder adds additional parameters to the 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 FloatingIP.

func (CreateResult) Extract

func (r CreateResult) Extract() (*instances.FloatingIP, error)

Extract is a function that accepts a result and extracts a floating ip resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type FloatingIPDetail

type FloatingIPDetail struct {
	FloatingIPAddress net.IP                   `json:"floating_ip_address"`
	RouterID          string                   `json:"router_id"`
	SubnetID          string                   `json:"subnet_id"`
	Status            string                   `json:"status"`
	ID                string                   `json:"id"`
	PortID            string                   `json:"port_id"`
	DNSDomain         string                   `json:"dns_domain"`
	DNSName           string                   `json:"dns_name"`
	FixedIPAddress    net.IP                   `json:"fixed_ip_address"`
	UpdatedAt         *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	CreatedAt         gcorecloud.JSONRFC3339Z  `json:"created_at"`
	CreatorTaskID     *string                  `json:"creator_task_id"`
	ProjectID         int                      `json:"project_id"`
	RegionID          int                      `json:"region_id"`
	Region            string                   `json:"region"`
	Instance          instances.Instance       `json:"instance,omitempty"`
	Metadata          []metadata.Metadata      `json:"metadata"`
}

FloatingIPDetail represents a floating IP with details.

func ExtractFloatingIPs

func ExtractFloatingIPs(r pagination.Page) ([]FloatingIPDetail, error)

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

func ListAll

ListAll is a convenience function that returns all floating IPs.

type FloatingIPPage

type FloatingIPPage struct {
	pagination.LinkedPageBase
}

FloatingIPPage is the page returned by a pager when traversing over a collection of security groups.

func (FloatingIPPage) IsEmpty

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

IsEmpty checks whether a FloatingIPPage struct is empty.

func (FloatingIPPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of floating ips 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 FloatingIPTaskResult

type FloatingIPTaskResult struct {
	FloatingIPs []string `json:"floatingips"`
}

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 FloatingIP.

func Get

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

Get retrieves a specific floating ip based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*instances.FloatingIP, error)

Extract is a function that accepts a result and extracts a floating ip resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	MetadataK  string            `q:"metadata_k" validate:"omitempty"`
	MetadataKV map[string]string `q:"metadata_kv" validate:"omitempty"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToFloatingIPListQuery

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

ToFloatingIPListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToFloatingIPUpdateMap() (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 assign or unassign operation. Call its Extract method to interpret it as a FloatingIP.

func Assign

func Assign(c *gcorecloud.ServiceClient, floatingIPID string, opts CreateOptsBuilder) (r UpdateResult)

Assign accepts a CreateOpts struct and assign floating IP.

func UnAssign

func UnAssign(c *gcorecloud.ServiceClient, floatingIPID string) (r UpdateResult)

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*instances.FloatingIP, error)

Extract is a function that accepts a result and extracts a floating ip resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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