packngo

package module
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: BSD-3-Clause, MIT Imports: 20 Imported by: 278

README

packngo

Maintained Release GoDoc Go Report Card Slack Twitter Follow

A Golang client for the Equinix Metal API. (Packet is now Equinix Metal)

Installation

To import this library into your Go project:

import "github.com/packethost/packngo"

Note: A minimum of Go 1.14 is required for development.

Download module with:

go get github.com/packethost/packngo

Stability and Compatibility

This repository is Maintained meaning that this software is supported by Equinix Metal and its community - available to use in production environments.

Packngo is currently provided with a major version of v0. We'll try to avoid breaking changes to this library, but they will certainly happen as we work towards a stable v1 library. See CHANGELOG.md for details on the latest additions, removals, fixes, and breaking changes.

While packngo provides an interface to most of the Equinix Metal API, the API is regularly adding new features. To request or contribute support for more API end-points or added fields, create an issue.

See SUPPORT.md for any other issues.

Usage

To authenticate to the Equinix Metal API, you must have your API token exported in env var PACKET_AUTH_TOKEN.

This code snippet initializes Equinix Metal API client, and lists your Projects:

package main

import (
	"log"

	"github.com/packethost/packngo"
)

func main() {
	c, err := packngo.NewClient()
	if err != nil {
		log.Fatal(err)
	}

	ps, _, err := c.Projects.List(nil)
	if err != nil {
		log.Fatal(err)
	}
	for _, p := range ps {
		log.Println(p.ID, p.Name)
	}
}

This library is used by the official terraform-provider-equinix.

You can also learn a lot from the *_test.go sources. Almost all out tests touch the Equinix Metal API, so you can see how auth, querying and POSTing works. For example devices_test.go.

Linked Resources
Linked resources in Get* and List* functions

The Equinix Metal API includes references to related entities for a wide selection of resource types, indicated by href fields. The Equinix Metal API allows for these entities to be included in the API response, saving the user from making more round-trip API requests. This is useful for linked resources, e.g members of a project, devices in a project. Similarly, by excluding entities that are included by default, you can reduce the API response time and payload size.

Control of this behavior is provided through common attributes that can be used to toggle, by field name, which referenced resources will be included as values in API responses. The API exposes this feature through ?include= and ?exclude= query parameters which accept a comma-separated list of field names. These field names can be dotted to reference nested entities.

Most of the packngo Get functions take references to GetOptions parameters (or ListOptions for List functions). These types include an Include and Exclude slice that will be converted to query parameters upon request.

For example, if you want to list users in a project, you can fetch the project via Projects.Get(pid, nil) call. The result of this call will be a Project which has a Users []User attribute. The items in the []User slice only have a non-zero URL attribute, the rest of the fields will be type defaults. You can then parse the ID of the User resources and fetch them consequently.

Optionally, you can use the ListOptions struct in the project fetch call to include the Users (members JSON tag). Then, every item in the []User slice will have all (not only the Href) attributes populated.

Projects.Get(pid, &packngo.ListOptions{Includes: []{'members'}})

The following is a more comprehensive illustration of Includes and Excludes.

import (
	"log"

	"github.com/packethost/packngo"
)

func listProjectsAndUsers(lo *packngo.ListOptions) {
	c, err := packngo.NewClient()
	if err != nil {
		log.Fatal(err)
	}

	ps, _, err := c.Projects.List(lo)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Listing for listOptions %+v\n", lo)
	for _, p := range ps {
		log.Printf("project resource %s has %d users", p.Name, len(p.Users))
		for _, u := range p.Users {
			if u.Email != "" && u.FullName != "" {
				log.Printf("  user %s has email %s\n", u.FullName, u.Email)
			} else {
				log.Printf("  only got user link %s\n", u.URL)
			}
		}
	}
}

func main() {
	loMembers := &packngo.ListOptions{Includes: []string{"members"}}
	loMembersOut := &packngo.ListOptions{Excludes: []string{"members"}}
	listProjectsAndUsers(loMembers)
	listProjectsAndUsers(nil)
	listProjectsAndUsers(loMembersOut)
}
Deprecation and Sunset

If the Equinix Metal API returns a RFC-8594 Deprecation or Sunset header, packngo will log this header to stderr with any accompanied Link headers.

Example:

WARNING: "POST /deprecate-and-sunset" reported deprecation
WARNING: "POST /deprecate-and-sunset" reported sunsetting on Sat, 1 Aug 2020 23:59:59 GMT
WARNING: See <https://api.example.com/deprecation/field-a> for deprecation details
WARNING: See <https://api.example.com/sunset/value-a> for sunset details
WARNING: See <https://api.example.com/sunset> for sunset details
WARNING: See <https://api.example.com/deprecation> for deprecation details

Contributing

See CONTIBUTING.md.

Documentation

Overview

Package packngo implements the Equinix Metal API documented at https://metal.equinix.com/developers/api.

Index

Constants

View Source
const (
	IncludeParam       = "include"
	ExcludeParam       = "exclude"
	PageParam          = "page"
	PerPageParam       = "per_page"
	SearchParam        = "search"
	SortByParam        = "sort_by"
	SortDirectionParam = "sort_direction"
)
View Source
const (
	ConnectionShared        ConnectionType       = "shared"
	ConnectionDedicated     ConnectionType       = "dedicated"
	ConnectionRedundant     ConnectionRedundancy = "redundant"
	ConnectionPrimary       ConnectionRedundancy = "primary"
	ConnectionPortPrimary   ConnectionPortRole   = "primary"
	ConnectionPortSecondary ConnectionPortRole   = "secondary"
	ConnectionModeStandard  ConnectionMode       = "standard"
	ConnectionModeTunnel    ConnectionMode       = "tunnel"
	ConnectionDeleteTimeout                      = 60 * time.Second
	ConnectionDeleteCheck                        = 2 * time.Second
)
View Source
const (
	NetworkTypeHybrid       = "hybrid"
	NetworkTypeL2Bonded     = "layer2-bonded"
	NetworkTypeL2Individual = "layer2-individual"
	NetworkTypeL3           = "layer3"
)

Variables

View Source
var (

	// Facilities DEPRECATED Use Facilities.List
	Facilities = []string{
		"yyz1", "nrt1", "atl1", "mrs1", "hkg1", "ams1",
		"ewr1", "sin1", "dfw1", "lax1", "syd1", "sjc1",
		"ord1", "iad1", "fra1", "sea1", "dfw2"}

	// FacilityFeatures DEPRECATED Use Facilities.List
	FacilityFeatures = []string{
		"baremetal", "layer_2", "backend_transfer", "storage", "global_ipv4"}

	// UtilizationLevels DEPRECATED
	UtilizationLevels = []string{"unavailable", "critical", "limited", "normal"}

	// DevicePlans DEPRECATED Use Plans.List
	DevicePlans = []string{"c2.medium.x86", "g2.large.x86",
		"m2.xlarge.x86", "x2.xlarge.x86", "baremetal_2a", "baremetal_2a2",
		"baremetal_1", "baremetal_3", "baremetal_2", "baremetal_s",
		"baremetal_0", "baremetal_1e",
	}
)
View Source
var (
	// Version of the packngo package. Version will be updated at runtime.
	Version = "(devel)"

	// UserAgent is the default HTTP User-Agent Header value that will be used by NewClient.
	// init() will update the version to match the built version of packngo.
	UserAgent = "packngo/(devel)"
)

Functions

func StreamToString

func StreamToString(stream io.Reader) (string, error)

StreamToString converts a reader to a string DEPRECATED This is unused and should not be exported by packngo

func Stringify

func Stringify(message interface{}) string

Stringify creates a string representation of the provided message DEPRECATED This is used internally and should not be exported by packngo

func ValidateUUID added in v0.20.0

func ValidateUUID(uuid string) error

validate UUID

Types

type APIKey added in v0.3.0

type APIKey struct {
	// ID is the UUIDv4 representing an API key in API requests and responses.
	ID string `json:"id"`

	// Description is any text description of the key. This can be used to
	// describe the purpose of the key.
	Description string `json:"description"`

	// Token is a sensitive credential that can be used as a `Client.APIKey` to
	// access Equinix Metal resources.
	Token string `json:"token"`

	// ReadOnly keys can not create new resources.
	ReadOnly bool `json:"read_only"`

	// Created is the creation date of the API key.
	Created string `json:"created_at"`

	// Updated is the last-update date of the API key.
	Updated string `json:"updated_at"`

	// User will be non-nil when getting or listing an User API key.
	User *User `json:"user"`

	// Project will be non-nil when getting or listing a Project API key
	Project *Project `json:"project"`
}

type APIKeyCreateRequest added in v0.3.0

type APIKeyCreateRequest struct {
	// Description is any text description of the key. This can be used to
	// describe the purpose of the key.
	Description string `json:"description"`

	// ReadOnly keys can not create new resources.
	ReadOnly bool `json:"read_only"`

	// ProjectID when non-empty will result in the creation of a Project API
	// key.
	ProjectID string `json:"-"`
}

APIKeyCreateRequest type used to create an api key.

func (APIKeyCreateRequest) String added in v0.3.0

func (s APIKeyCreateRequest) String() string

type APIKeyService added in v0.3.0

type APIKeyService interface {
	UserList(*ListOptions) ([]APIKey, *Response, error)
	ProjectList(string, *ListOptions) ([]APIKey, *Response, error)
	UserGet(string, *GetOptions) (*APIKey, error)
	ProjectGet(string, string, *GetOptions) (*APIKey, error)
	Create(*APIKeyCreateRequest) (*APIKey, *Response, error)
	Delete(string) (*Response, error)
}

APIKeyService interface defines available device methods

type APIKeyServiceOp added in v0.3.0

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

APIKeyServiceOp implements APIKeyService

func (*APIKeyServiceOp) Create added in v0.3.0

func (s *APIKeyServiceOp) Create(createRequest *APIKeyCreateRequest) (*APIKey, *Response, error)

Create creates a new API key.

The API key can be either an User API key or a Project API key, determined by the value (or emptiness) of `APIKeyCreateRequest.ProjectID`. Either `User` or `Project` will be non-nil in the `APIKey` depending on this factor.

func (*APIKeyServiceOp) Delete added in v0.3.0

func (s *APIKeyServiceOp) Delete(apiKeyID string) (*Response, error)

Delete deletes an API key by `APIKey.ID`

The API key can be either an User API key or a Project API key.

Project API keys can not be used to delete themselves.

func (*APIKeyServiceOp) ProjectGet added in v0.3.0

func (s *APIKeyServiceOp) ProjectGet(projectID, apiKeyID string, opts *GetOptions) (*APIKey, error)

ProjectGet returns the Project API key with the given `APIKey.ID`.

In other methods, it is typical for a Response to be returned, which could include a StatusCode of `http.StatusNotFound` (404 error) when the resource was not found. The Equinix Metal API does not expose a get by ID endpoint for APIKeys. That is why in this method, all API keys are listed and compared for a match. Therefor, the Response is not returned and a custom error will be returned when the key is not found.

func (*APIKeyServiceOp) ProjectList added in v0.3.0

func (s *APIKeyServiceOp) ProjectList(projectID string, opts *ListOptions) ([]APIKey, *Response, error)

ProjectList lists the API keys associated with a project having `projectID` match `Project.ID`.

func (*APIKeyServiceOp) UserGet added in v0.3.0

func (s *APIKeyServiceOp) UserGet(apiKeyID string, opts *GetOptions) (*APIKey, error)

UserGet returns the User API key with the given `APIKey.ID`.

In other methods, it is typical for a Response to be returned, which could include a StatusCode of `http.StatusNotFound` (404 error) when the resource was not found. The Equinix Metal API does not expose a get by ID endpoint for APIKeys. That is why in this method, all API keys are listed and compared for a match. Therefor, the Response is not returned and a custom error will be returned when the key is not found.

func (*APIKeyServiceOp) UserList added in v0.3.0

func (s *APIKeyServiceOp) UserList(opts *ListOptions) ([]APIKey, *Response, error)

UserList returns the API keys for the User associated with the `Client.APIKey`.

When `Client.APIKey` is a Project API key, this method will return an access denied error.

type Address

type Address struct {
	ID          string       `json:"id,omitempty"`
	Address     string       `json:"address"`
	Address2    *string      `json:"address2,omitempty"`
	City        *string      `json:"city,omitempty"`
	State       *string      `json:"state,omitempty"`
	ZipCode     string       `json:"zip_code"`
	Country     string       `json:"country"`
	Coordinates *Coordinates `json:"coordinates,omitempty"`
}

Address - the physical address of the facility

func (Address) String

func (a Address) String() string

type AddressRequest added in v0.2.0

type AddressRequest struct {
	AddressFamily int  `json:"address_family"`
	Public        bool `json:"public"`
}

type AddressStruct added in v0.2.0

type AddressStruct struct {
	Address string `json:"address"`
}

AddressStruct is a helper type for request/response with dict like {"address": ... }

type AnnualReservationPricing added in v0.26.0

type AnnualReservationPricing struct {
	OneYear   *Pricing `json:"one_year"`
	ThreeYear *Pricing `json:"three_year"`
}

func (AnnualReservationPricing) String added in v0.26.0

func (m AnnualReservationPricing) String() string

type AvailableRequest added in v0.2.0

type AvailableRequest struct {
	CIDR int `json:"cidr"`
}

AvailableRequest is a type for listing available addresses from a reserved block.

type AvailableResponse added in v0.2.0

type AvailableResponse struct {
	Available []string `json:"available"`
}

AvailableResponse is a type for listing of available addresses from a reserved block.

type BGPConfig added in v0.2.0

type BGPConfig struct {
	ID             string       `json:"id,omitempty"`
	Status         string       `json:"status,omitempty"`
	DeploymentType string       `json:"deployment_type,omitempty"`
	Asn            int          `json:"asn,omitempty"`
	RouteObject    string       `json:"route_object,omitempty"`
	Md5            string       `json:"md5,omitempty"`
	MaxPrefix      int          `json:"max_prefix,omitempty"`
	Project        Project      `json:"project,omitempty"`
	CreatedAt      Timestamp    `json:"created_at,omitempty"`
	RequestedAt    Timestamp    `json:"requested_at,omitempty"`
	Sessions       []BGPSession `json:"sessions,omitempty"`
	Href           string       `json:"href,omitempty"`
}

BGPConfig represents an Equinix Metal BGP Config

type BGPConfigService added in v0.2.0

type BGPConfigService interface {
	Get(projectID string, getOpt *GetOptions) (*BGPConfig, *Response, error)
	Create(projectID string, request CreateBGPConfigRequest) (*Response, error)
}

BGPConfigService interface defines available BGP config methods

type BGPConfigServiceOp added in v0.2.0

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

BGPConfigServiceOp implements BgpConfigService

func (*BGPConfigServiceOp) Create added in v0.2.0

func (s *BGPConfigServiceOp) Create(projectID string, request CreateBGPConfigRequest) (*Response, error)

Create function

func (*BGPConfigServiceOp) Get added in v0.2.0

func (s *BGPConfigServiceOp) Get(projectID string, opts *GetOptions) (bgpConfig *BGPConfig, resp *Response, err error)

Get function

type BGPDiscoverResponse added in v0.23.0

type BGPDiscoverResponse struct {
	UpdatedAt Timestamp `json:"updated_at"`
}

BGPDiscoverResponse struct is returned from the bgp/discover endpoint

type BGPNeighbor added in v0.3.0

type BGPNeighbor struct {
	AddressFamily int        `json:"address_family"`
	CustomerAs    int        `json:"customer_as"`
	CustomerIP    string     `json:"customer_ip"`
	Md5Enabled    bool       `json:"md5_enabled"`
	Md5Password   string     `json:"md5_password"`
	Multihop      bool       `json:"multihop"`
	PeerAs        int        `json:"peer_as"`
	PeerIps       []string   `json:"peer_ips"`
	RoutesIn      []BGPRoute `json:"routes_in"`
	RoutesOut     []BGPRoute `json:"routes_out"`
}

BGPNeighor is struct for listing BGP neighbors of a device

type BGPRoute added in v0.3.0

type BGPRoute struct {
	Route string `json:"route"`
	Exact bool   `json:"exact"`
}

BGPRoute is a struct for Route in BGP neighbor listing

type BGPSession added in v0.2.0

type BGPSession struct {
	ID            string   `json:"id,omitempty"`
	Status        string   `json:"status,omitempty"`
	LearnedRoutes []string `json:"learned_routes,omitempty"`
	AddressFamily string   `json:"address_family,omitempty"`
	Device        Device   `json:"device,omitempty"`
	Href          string   `json:"href,omitempty"`
	DefaultRoute  *bool    `json:"default_route,omitempty"`
}

BGPSession represents an Equinix Metal BGP Session

type BGPSessionService added in v0.2.0

type BGPSessionService interface {
	Get(string, *GetOptions) (*BGPSession, *Response, error)
	Create(string, CreateBGPSessionRequest) (*BGPSession, *Response, error)
	Delete(string) (*Response, error)
}

BGPSessionService interface defines available BGP session methods

type BGPSessionServiceOp added in v0.2.0

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

BGPSessionServiceOp implements BgpSessionService

func (*BGPSessionServiceOp) Create added in v0.2.0

func (s *BGPSessionServiceOp) Create(deviceID string, request CreateBGPSessionRequest) (*BGPSession, *Response, error)

Create function

func (*BGPSessionServiceOp) Delete added in v0.2.0

func (s *BGPSessionServiceOp) Delete(id string) (*Response, error)

Delete function

func (*BGPSessionServiceOp) Get added in v0.2.0

func (s *BGPSessionServiceOp) Get(id string, opts *GetOptions) (session *BGPSession, response *Response, err error)

Get function

type BackToL3Request added in v0.2.0

type BackToL3Request struct {
	RequestIPs []AddressRequest `json:"request_ips"`
}

type BandwidthComponent added in v0.15.0

type BandwidthComponent struct {
	// Datapoints
	Datapoints []Datapoint `json:"datapoints"`

	// Tags
	Tags BandwidthTags `json:"tags"`

	// Target
	Target BandwidthTarget `json:"target"`
}

BandwidthComponent

type BandwidthIO added in v0.15.0

type BandwidthIO struct {
	Inbound  BandwidthComponent `json:"inbound"`
	Outbound BandwidthComponent `json:"outbound"`
}

func (*BandwidthIO) UnmarshalJSON added in v0.15.0

func (b *BandwidthIO) UnmarshalJSON(buf []byte) error

type BandwidthOpts added in v0.15.0

type BandwidthOpts struct {
	From  *Timestamp `json:"from,omitempty"`
	Until *Timestamp `json:"until,omitempty"`
}

func (*BandwidthOpts) Encode added in v0.15.0

func (b *BandwidthOpts) Encode() string

func (*BandwidthOpts) WithQuery added in v0.15.0

func (b *BandwidthOpts) WithQuery(apiPath string) string

type BandwidthTags added in v0.15.0

type BandwidthTags struct {
	// AggregatedBy
	AggregatedBy string `json:"aggregatedBy"`

	// Name
	Name string `json:"name"`
}

BandwidthTags

type BandwidthTarget added in v0.15.0

type BandwidthTarget string
const (
	BandwidthInbound  BandwidthTarget = "inbound"
	BandwidthOutbound BandwidthTarget = "outbound"
)

BandwidthTarget enums

type Batch added in v0.2.0

type Batch struct {
	ID            string   `json:"id"`
	ErrorMessages []string `json:"error_messages,omitempty"`

	// State may be 'failed' or 'completed'
	State     string     `json:"state,omitempty"`
	Quantity  int32      `json:"quantity,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
	Href      string     `json:"href,omitempty"`
	Project   Href       `json:"project,omitempty"`
	Devices   []Device   `json:"devices,omitempty"`
}

Batch type

type BatchCreateDevice added in v0.2.0

type BatchCreateDevice struct {
	DeviceCreateRequest
	Quantity               int32   `json:"quantity"`
	FacilityDiversityLevel int32   `json:"facility_diversity_level,omitempty"`
	SpotInstance           bool    `json:"spot_instance,omitempty"`
	SpotPriceMax           float64 `json:"spot_price_max,omitempty"`
}

BatchCreateDevice type used to describe batch instances

type BatchCreateRequest added in v0.2.0

type BatchCreateRequest struct {
	Batches []BatchCreateDevice `json:"batches"`
}

BatchCreateRequest type used to create batch of device instances

type BatchService added in v0.2.0

type BatchService interface {
	Get(batchID string, getOpt *GetOptions) (*Batch, *Response, error)
	List(ProjectID string, listOpt *ListOptions) ([]Batch, *Response, error)
	Create(projectID string, batches *BatchCreateRequest) ([]Batch, *Response, error)
	Delete(string, bool) (*Response, error)
}

BatchService interface defines available batch methods

type BatchServiceOp added in v0.2.0

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

BatchServiceOp implements BatchService

func (*BatchServiceOp) Create added in v0.2.0

func (s *BatchServiceOp) Create(projectID string, request *BatchCreateRequest) ([]Batch, *Response, error)

Create function to create batch of device instances

func (*BatchServiceOp) Delete added in v0.2.0

func (s *BatchServiceOp) Delete(id string, removeDevices bool) (*Response, error)

Delete function to remove an instance batch

func (*BatchServiceOp) Get added in v0.2.0

func (s *BatchServiceOp) Get(batchID string, opts *GetOptions) (*Batch, *Response, error)

Get returns batch details

func (*BatchServiceOp) List added in v0.2.0

func (s *BatchServiceOp) List(projectID string, opts *ListOptions) (batches []Batch, resp *Response, err error)

List returns batches on a project

type BatchedVLANAssignment added in v0.19.0

type BatchedVLANAssignment struct {
	// VirtualNetworkID is the VirtualNetwork.ID of the VLAN the assignment was made to
	VirtualNetworkID string `json:"id,omitempty"`

	// Native indicates the VLAN is the native VLAN on the port and packets for this vlan will be untagged
	Native bool `json:"native,omitempty"`

	// State of the assignment
	State VLANAssignmentState `json:"state,omitempty"`

	// VLAN is the VirtualNetwork.VXLAN of the VLAN the assignment was made to
	VLAN int `json:"vlan,omitempty"`
}

BatchedVLANAssignment represents the data requested in the batch before being processed. ID represents the VLAN ID, not the VLAN Assignment ID.

type BillingAddress added in v0.2.0

type BillingAddress struct {
	StreetAddress string `json:"street_address,omitempty"`
	PostalCode    string `json:"postal_code,omitempty"`
	CountryCode   string `json:"country_code_alpha2,omitempty"`
}

type BondData added in v0.3.0

type BondData struct {
	// ID is the Port.ID of the bonding port
	ID string `json:"id"`

	// Name of the port interface for the bond ("bond0")
	Name string `json:"name"`
}

type BondRequest added in v0.2.0

type BondRequest struct {
	BulkEnable bool `json:"bulk_enable"`
}

type CPR added in v0.3.0

type CPR struct {
	Disks []struct {
		Device     string `json:"device"`
		WipeTable  bool   `json:"wipeTable"`
		Partitions []struct {
			Label  string `json:"label"`
			Number int    `json:"number"`
			Size   string `json:"size"`
		} `json:"partitions"`
	} `json:"disks"`
	Raid []struct {
		Devices []string `json:"devices"`
		Level   string   `json:"level"`
		Name    string   `json:"name"`
	} `json:"raid,omitempty"`
	Filesystems []struct {
		Mount struct {
			Device string `json:"device"`
			Format string `json:"format"`
			Point  string `json:"point"`
			Create struct {
				Options []string `json:"options"`
			} `json:"create"`
		} `json:"mount"`
	} `json:"filesystems"`
}

CPR is a struct for custom partitioning and RAID If you don't want to bother writing the struct, just write the CPR conf to a string and then do

	var cpr CPR
 err := json.Unmarshal([]byte(cprString), &cpr)
	if err != nil {
		log.Fatal(err)
	}

type CapacityInput added in v0.2.0

type CapacityInput struct {
	Servers []ServerInfo `json:"servers,omitempty"`
}

CapacityInput struct

type CapacityList added in v0.2.0

type CapacityList struct {
	Capacity CapacityReport `json:"capacity,omitempty"`
}

CapacityList struct

type CapacityPerBaremetal added in v0.2.0

type CapacityPerBaremetal struct {
	Level string `json:"level,omitempty"`
}

CapacityPerBaremetal struct

type CapacityReport added in v0.2.0

type CapacityReport map[string]map[string]CapacityPerBaremetal

CapacityReport map

type CapacityService added in v0.2.0

type CapacityService interface {
	List() (*CapacityReport, *Response, error)
	ListMetros() (*CapacityReport, *Response, error)
	Check(*CapacityInput) (*CapacityInput, *Response, error)
	CheckMetros(*CapacityInput) (*CapacityInput, *Response, error)
}

CapacityService interface defines available capacity methods

type CapacityServiceOp added in v0.2.0

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

CapacityServiceOp implements CapacityService

func (*CapacityServiceOp) Check added in v0.2.0

func (s *CapacityServiceOp) Check(input *CapacityInput) (capInput *CapacityInput, resp *Response, err error)

Check validates if a deploy can be fulfilled in a capacity.

func (*CapacityServiceOp) CheckMetros added in v0.8.0

func (s *CapacityServiceOp) CheckMetros(input *CapacityInput) (capInput *CapacityInput, resp *Response, err error)

Check validates if a deploy can be fulfilled in a metro.

func (*CapacityServiceOp) List added in v0.2.0

List returns a list of facilities and plans with their current capacity.

func (*CapacityServiceOp) ListMetros added in v0.8.0

func (s *CapacityServiceOp) ListMetros() (*CapacityReport, *Response, error)

ListMetros returns a list of metros and plans with their current capacity.

type Client

type Client struct {
	BaseURL *url.URL

	UserAgent     string
	ConsumerToken string
	APIKey        string

	RateLimit Rate

	// Equinix Metal Api Objects
	APIKeys                APIKeyService
	BGPConfig              BGPConfigService
	BGPSessions            BGPSessionService
	Batches                BatchService
	CapacityService        CapacityService
	Connections            ConnectionService
	DeviceIPs              DeviceIPService
	Devices                DeviceService
	Emails                 EmailService
	Events                 EventService
	Facilities             FacilityService
	HardwareReservations   HardwareReservationService
	Invitations            InvitationService
	Members                MemberService
	Metros                 MetroService
	Notifications          NotificationService
	OperatingSystems       OSService
	Organizations          OrganizationService
	Plans                  PlanService
	Ports                  PortService
	ProjectIPs             ProjectIPService
	ProjectVirtualNetworks ProjectVirtualNetworkService
	Projects               ProjectService
	SSHKeys                SSHKeyService
	SpotMarket             SpotMarketService
	SpotMarketRequests     SpotMarketRequestService
	MetalGateways          MetalGatewayService
	TwoFactorAuth          TwoFactorAuthService
	Users                  UserService
	VirtualCircuits        VirtualCircuitService
	VLANAssignments        VLANAssignmentService
	VolumeAttachments      VolumeAttachmentService
	Volumes                VolumeService
	VRFs                   VRFService

	// DevicePorts
	//
	// Deprecated: Use Client.Ports or Device methods
	DevicePorts DevicePortService
	// contains filtered or unexported fields
}

Client is the base API Client

func NewClient

func NewClient(opts ...ClientOpt) (*Client, error)

NewClient initializes and returns a Client. The opts are functions such as WithAuth, WithHTTPClient, etc.

An example:

c, err := NewClient()

An alternative example, which avoids reading PACKET_AUTH_TOKEN environment variable:

c, err := NewClient(WithAuth("packngo lib", packetAuthToken))

func NewClientWithAuth added in v0.2.0

func NewClientWithAuth(consumerToken string, apiKey string, httpClient *http.Client) *Client

NewClientWithAuth initializes and returns a Client, use this to get an API Client to operate on N.B.: Equinix Metal's API certificate requires Go 1.5+ to successfully parse. If you are using an older version of Go, pass in a custom http.Client with a custom TLS configuration that sets "InsecureSkipVerify" to "true"

func NewClientWithBaseURL

func NewClientWithBaseURL(consumerToken string, apiKey string, httpClient *http.Client, apiBaseURL string) (*Client, error)

NewClientWithBaseURL returns a Client pointing to nonstandard API URL, e.g. for mocking the remote API

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do executes the http request

func (*Client) DoRequest added in v0.2.0

func (c *Client) DoRequest(method, path string, body, v interface{}) (*Response, error)

DoRequest is a convenience method, it calls NewRequest followed by Do v is the interface to unmarshal the response JSON into

func (*Client) DoRequestWithHeader added in v0.2.0

func (c *Client) DoRequestWithHeader(method string, headers map[string]string, path string, body, v interface{}) (*Response, error)

DoRequestWithHeader same as DoRequest

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)

NewRequest inits a new http request with the proper headers

type ClientOpt added in v0.29.0

type ClientOpt func(*Client) error

ClientOpt is an option usable as an argument to NewClient constructor.

func WithAuth added in v0.29.0

func WithAuth(consumerToken string, apiKey string) ClientOpt

WithAuth configures Client with a specific consumerToken and apiKey for subsequent HTTP requests.

func WithBaseURL added in v0.29.0

func WithBaseURL(apiBaseURL string) ClientOpt

WithBaseURL configures Client to use a nonstandard API URL, e.g. for mocking the remote API.

func WithHTTPClient added in v0.29.0

func WithHTTPClient(httpClient *http.Client) ClientOpt

WithHTTPClient configures Client to use a specific httpClient for subsequent HTTP requests.

func WithHeader added in v0.29.0

func WithHeader(header http.Header) ClientOpt

WithHeader configures Client to use the given HTTP header set. The headers X-Auth-Token, X-Consumer-Token, User-Agent will be ignored even if provided in the set.

type Connection added in v0.6.0

type Connection struct {
	ID               string               `json:"id"`
	ContactEmail     string               `json:"contact_email,omitempty"`
	Name             string               `json:"name,omitempty"`
	Status           string               `json:"status,omitempty"`
	Redundancy       ConnectionRedundancy `json:"redundancy,omitempty"`
	Facility         *Facility            `json:"facility,omitempty"`
	Metro            *Metro               `json:"metro,omitempty"`
	Type             ConnectionType       `json:"type,omitempty"`
	Mode             *ConnectionMode      `json:"mode,omitempty"`
	Description      string               `json:"description,omitempty"`
	Project          *Project             `json:"project,omitempty"`
	Organization     *Organization        `json:"organization,omitempty"`
	Speed            uint64               `json:"speed,omitempty"`
	Token            string               `json:"token,omitempty"`
	Tokens           []FabricServiceToken `json:"service_tokens,omitempty"`
	Tags             []string             `json:"tags,omitempty"`
	Ports            []ConnectionPort     `json:"ports,omitempty"`
	ServiceTokenType string               `json:"service_token_type,omitempty"`
}

func (*Connection) PortByRole added in v0.6.0

func (c *Connection) PortByRole(r ConnectionPortRole) *ConnectionPort

type ConnectionCreateRequest added in v0.6.0

type ConnectionCreateRequest struct {
	ContactEmail     string                 `json:"contact_email,omitempty"`
	Description      *string                `json:"description,omitempty"`
	Facility         string                 `json:"facility,omitempty"`
	Metro            string                 `json:"metro,omitempty"`
	Mode             ConnectionMode         `json:"mode,omitempty"`
	Name             string                 `json:"name,omitempty"`
	Project          string                 `json:"project,omitempty"`
	Redundancy       ConnectionRedundancy   `json:"redundancy,omitempty"`
	ServiceTokenType FabricServiceTokenType `json:"service_token_type,omitempty"`
	Speed            uint64                 `json:"speed,omitempty"`
	Tags             []string               `json:"tags,omitempty"`
	Type             ConnectionType         `json:"type,omitempty"`
	VLANs            []int                  `json:"vlans,omitempty"`
}

type ConnectionMode added in v0.16.0

type ConnectionMode string

type ConnectionPort added in v0.6.0

type ConnectionPort struct {
	*Href        `json:",inline"`
	ID           string             `json:"id"`
	LinkStatus   string             `json:"link_status,omitempty"`
	Name         string             `json:"name,omitempty"`
	Organization *Organization      `json:"organization,omitempty"`
	Role         ConnectionPortRole `json:"role,omitempty"`
	// Speed is the maximum allowed throughput. This value inherits changes made in the Equinix Fabric API.
	Speed           uint64               `json:"speed,omitempty"`
	Status          string               `json:"status,omitempty"`
	Tokens          []FabricServiceToken `json:"tokens,omitempty"`
	VirtualCircuits []VirtualCircuit     `json:"virtual_circuits,omitempty"`
}

type ConnectionPortRole added in v0.6.0

type ConnectionPortRole string

type ConnectionRedundancy added in v0.6.0

type ConnectionRedundancy string

type ConnectionService added in v0.6.0

type ConnectionServiceOp added in v0.6.0

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

func (*ConnectionServiceOp) Delete added in v0.6.0

func (s *ConnectionServiceOp) Delete(id string, wait bool) (*Response, error)

func (*ConnectionServiceOp) Events added in v0.6.0

func (s *ConnectionServiceOp) Events(id string, opts *GetOptions) ([]Event, *Response, error)

func (*ConnectionServiceOp) Get added in v0.6.0

func (*ConnectionServiceOp) OrganizationCreate added in v0.6.0

func (s *ConnectionServiceOp) OrganizationCreate(id string, createRequest *ConnectionCreateRequest) (*Connection, *Response, error)

func (*ConnectionServiceOp) OrganizationList added in v0.6.0

func (s *ConnectionServiceOp) OrganizationList(id string, opts *GetOptions) ([]Connection, *Response, error)

func (*ConnectionServiceOp) Port added in v0.6.0

func (s *ConnectionServiceOp) Port(connID, portID string, opts *GetOptions) (*ConnectionPort, *Response, error)

func (*ConnectionServiceOp) PortEvents added in v0.6.0

func (s *ConnectionServiceOp) PortEvents(connID, portID string, opts *GetOptions) ([]Event, *Response, error)

func (*ConnectionServiceOp) Ports added in v0.6.0

func (s *ConnectionServiceOp) Ports(connID string, opts *GetOptions) ([]ConnectionPort, *Response, error)

func (*ConnectionServiceOp) ProjectCreate added in v0.6.0

func (s *ConnectionServiceOp) ProjectCreate(id string, createRequest *ConnectionCreateRequest) (*Connection, *Response, error)

func (*ConnectionServiceOp) ProjectList added in v0.6.0

func (s *ConnectionServiceOp) ProjectList(id string, opts *GetOptions) ([]Connection, *Response, error)

func (*ConnectionServiceOp) Update added in v0.16.0

func (s *ConnectionServiceOp) Update(id string, updateRequest *ConnectionUpdateRequest, opts *GetOptions) (*Connection, *Response, error)

func (*ConnectionServiceOp) VirtualCircuits added in v0.6.0

func (s *ConnectionServiceOp) VirtualCircuits(connID, portID string, opts *GetOptions) (vcs []VirtualCircuit, resp *Response, err error)

type ConnectionType added in v0.6.0

type ConnectionType string

type ConnectionUpdateRequest added in v0.16.0

type ConnectionUpdateRequest struct {
	Redundancy  ConnectionRedundancy `json:"redundancy,omitempty"`
	Mode        *ConnectionMode      `json:"mode,omitempty"`
	Description *string              `json:"description,omitempty"`
	Tags        []string             `json:"tags,omitempty"`
}

type Coordinates added in v0.17.0

type Coordinates struct {
	Latitude  *string `json:"latitude,omitempty"`
	Longitude *string `json:"longitude,omitempty"`
}

Coordinates struct for Coordinates

type Cpus

type Cpus struct {
	Count int    `json:"count,omitempty"`
	Type  string `json:"type,omitempty"`
}

Cpus - the CPU config details for specs on a plan

func (Cpus) String

func (c Cpus) String() string

type CreateBGPConfigRequest added in v0.2.0

type CreateBGPConfigRequest struct {
	DeploymentType string `json:"deployment_type,omitempty"`
	Asn            int    `json:"asn,omitempty"`
	Md5            string `json:"md5,omitempty"`
	UseCase        string `json:"use_case,omitempty"`
}

CreateBGPConfigRequest struct

type CreateBGPSessionRequest added in v0.2.0

type CreateBGPSessionRequest struct {
	AddressFamily string `json:"address_family"`
	DefaultRoute  *bool  `json:"default_route,omitempty"`
}

CreateBGPSessionRequest struct

type Datapoint added in v0.15.0

type Datapoint struct {
	// Rate is the aggregated sum of Bytes/Second across all ports
	Rate *float64 `json:"rate"`

	// When the rate was captured
	When Timestamp `json:"when"`
}

func (*Datapoint) UnmarshalJSON added in v0.15.0

func (d *Datapoint) UnmarshalJSON(buf []byte) error

type Device

type Device struct {
	ID                  string                 `json:"id"`
	Href                string                 `json:"href,omitempty"`
	Hostname            string                 `json:"hostname,omitempty"`
	Description         *string                `json:"description,omitempty"`
	State               string                 `json:"state,omitempty"`
	Created             string                 `json:"created_at,omitempty"`
	CreatedBy           *UserLite              `json:"created_by,omitempty"`
	Updated             string                 `json:"updated_at,omitempty"`
	Locked              bool                   `json:"locked,omitempty"`
	BillingCycle        string                 `json:"billing_cycle,omitempty"`
	Storage             *CPR                   `json:"storage,omitempty"`
	Tags                []string               `json:"tags,omitempty"`
	Network             []*IPAddressAssignment `json:"ip_addresses"`
	Volumes             []*Volume              `json:"volumes"`
	OS                  *OS                    `json:"operating_system,omitempty"`
	Plan                *Plan                  `json:"plan,omitempty"`
	Facility            *Facility              `json:"facility,omitempty"`
	Metro               *Metro                 `json:"metro,omitempty"`
	Project             *Project               `json:"project,omitempty"`
	ProvisionEvents     []*Event               `json:"provisioning_events,omitempty"`
	ProvisionPer        float32                `json:"provisioning_percentage,omitempty"`
	UserData            string                 `json:"userdata,omitempty"`
	User                string                 `json:"user,omitempty"`
	RootPassword        string                 `json:"root_password,omitempty"`
	IPXEScriptURL       string                 `json:"ipxe_script_url,omitempty"`
	AlwaysPXE           bool                   `json:"always_pxe,omitempty"`
	HardwareReservation *HardwareReservation   `json:"hardware_reservation,omitempty"`
	SpotInstance        bool                   `json:"spot_instance,omitempty"`
	SpotPriceMax        float64                `json:"spot_price_max,omitempty"`
	TerminationTime     *Timestamp             `json:"termination_time,omitempty"`
	NetworkPorts        []Port                 `json:"network_ports,omitempty"`
	CustomData          map[string]interface{} `json:"customdata,omitempty"`
	SSHKeys             []SSHKey               `json:"ssh_keys,omitempty"`
	ShortID             string                 `json:"short_id,omitempty"`
	SwitchUUID          string                 `json:"switch_uuid,omitempty"`
}

Device represents an Equinix Metal device from API

func (*Device) GetBondPorts added in v0.3.0

func (d *Device) GetBondPorts() map[string]*Port

func (*Device) GetNetworkInfo added in v0.2.0

func (d *Device) GetNetworkInfo() NetworkInfo

func (*Device) GetNetworkType added in v0.3.0

func (d *Device) GetNetworkType() string

GetNetworkType returns a composite network type identification for a device based on the plan, network_type, and IP management state of the device. GetNetworkType provides the same composite state rendered in the Packet Portal for a given device.

func (*Device) GetPhysicalPorts added in v0.3.0

func (d *Device) GetPhysicalPorts() map[string]*Port

func (*Device) GetPortByName added in v0.3.0

func (d *Device) GetPortByName(name string) (*Port, error)

func (*Device) GetPortsInBond added in v0.3.0

func (d *Device) GetPortsInBond(name string) map[string]*Port

func (*Device) HasManagementIPs added in v0.5.0

func (d *Device) HasManagementIPs() bool

func (*Device) NumOfBonds added in v0.3.0

func (d *Device) NumOfBonds() int

func (Device) String

func (d Device) String() string

type DeviceActionRequest

type DeviceActionRequest struct {
	Type string `json:"type"`
}

DeviceActionRequest type used to execute actions on devices

func (DeviceActionRequest) String

func (d DeviceActionRequest) String() string

type DeviceCreateRequest

type DeviceCreateRequest struct {
	Hostname              string     `json:"hostname,omitempty"`
	Plan                  string     `json:"plan"`
	Facility              []string   `json:"facility,omitempty"`
	Metro                 string     `json:"metro,omitempty"`
	OS                    string     `json:"operating_system"`
	BillingCycle          string     `json:"billing_cycle,omitempty"`
	ProjectID             string     `json:"project_id"`
	UserData              string     `json:"userdata,omitempty"`
	Storage               *CPR       `json:"storage,omitempty"`
	Tags                  []string   `json:"tags"`
	Description           string     `json:"description,omitempty"`
	IPXEScriptURL         string     `json:"ipxe_script_url,omitempty"`
	PublicIPv4SubnetSize  int        `json:"public_ipv4_subnet_size,omitempty"`
	AlwaysPXE             bool       `json:"always_pxe,omitempty"`
	HardwareReservationID string     `json:"hardware_reservation_id,omitempty"`
	SpotInstance          bool       `json:"spot_instance,omitempty"`
	SpotPriceMax          float64    `json:"spot_price_max,omitempty,string"`
	TerminationTime       *Timestamp `json:"termination_time,omitempty"`
	CustomData            string     `json:"customdata,omitempty"`
	// UserSSHKeys is a list of user UUIDs - essentially a list of
	// collaborators. The users must be a collaborator in the same project
	// where the device is created. The user's SSH keys then go to the
	// device
	UserSSHKeys []string `json:"user_ssh_keys,omitempty"`
	// Project SSHKeys is a list of SSHKeys resource UUIDs. If this param
	// is supplied, only the listed SSHKeys will go to the device.
	// Any other Project SSHKeys and any User SSHKeys will not be present
	// in the device.
	ProjectSSHKeys []string                 `json:"project_ssh_keys,omitempty"`
	Features       map[string]string        `json:"features,omitempty"`
	IPAddresses    []IPAddressCreateRequest `json:"ip_addresses,omitempty"`
	NoSSHKeys      bool                     `json:"no_ssh_keys,omitempty"`
}

DeviceCreateRequest type used to create an Equinix Metal device

func (DeviceCreateRequest) String

func (d DeviceCreateRequest) String() string

type DeviceDeleteRequest added in v0.3.0

type DeviceDeleteRequest struct {
	Force bool `json:"force_delete"`
}

type DeviceIPService added in v0.2.0

type DeviceIPService interface {
	Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error)
	Unassign(assignmentID string) (*Response, error)
	Get(assignmentID string, getOpt *GetOptions) (*IPAddressAssignment, *Response, error)
	List(deviceID string, opts *ListOptions) ([]IPAddressAssignment, *Response, error)
}

DeviceIPService handles assignment of addresses from reserved blocks to instances in a project.

type DeviceIPServiceOp added in v0.2.0

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

DeviceIPServiceOp is interface for IP-address assignment methods.

func (*DeviceIPServiceOp) Assign added in v0.2.0

func (i *DeviceIPServiceOp) Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error)

Assign assigns an IP address to a device. The IP address must be in one of the IP ranges assigned to the device’s project.

func (*DeviceIPServiceOp) Get added in v0.2.0

func (i *DeviceIPServiceOp) Get(assignmentID string, opts *GetOptions) (*IPAddressAssignment, *Response, error)

Get returns assignment by ID.

func (*DeviceIPServiceOp) List added in v0.3.0

func (i *DeviceIPServiceOp) List(deviceID string, opts *ListOptions) ([]IPAddressAssignment, *Response, error)

List list all of the IP address assignments on a device

func (*DeviceIPServiceOp) Unassign added in v0.2.0

func (i *DeviceIPServiceOp) Unassign(assignmentID string) (*Response, error)

Unassign unassigns an IP address from the device to which it is currently assigned. This will remove the relationship between an IP and the device and will make the IP address available to be assigned to another device.

type DevicePortService deprecated added in v0.2.0

type DevicePortService interface {
	Assign(*PortAssignRequest) (*Port, *Response, error)
	Unassign(*PortAssignRequest) (*Port, *Response, error)
	AssignNative(*PortAssignRequest) (*Port, *Response, error)
	UnassignNative(string) (*Port, *Response, error)
	Bond(*Port, bool) (*Port, *Response, error)
	Disbond(*Port, bool) (*Port, *Response, error)
	DeviceToNetworkType(string, string) (*Device, error)
	DeviceNetworkType(string) (string, error)
	PortToLayerTwo(string, string) (*Port, *Response, error)
	PortToLayerThree(string, string) (*Port, *Response, error)
	GetPortByName(string, string) (*Port, error)
	GetOddEthPorts(*Device) (map[string]*Port, error)
	GetAllEthPorts(*Device) (map[string]*Port, error)
	ConvertDevice(*Device, string) error
}

DevicePortService handles operations on a port which belongs to a particular device

Deprecated: use PortService or Device methods

type DevicePortServiceOp deprecated added in v0.2.0

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

DevicePortServiceOp implements DevicePortService on the Equinix Metal API

Deprecated: use PortServiceOp or Device methods

func (*DevicePortServiceOp) Assign deprecated added in v0.2.0

Assign the specified VLAN to the specified Port

Deprecated: use PortServiceOp.Assign

func (*DevicePortServiceOp) AssignNative deprecated added in v0.2.0

func (i *DevicePortServiceOp) AssignNative(par *PortAssignRequest) (*Port, *Response, error)

AssignNative designates the specified VLAN as the native VLAN for the specified Port

Deprecated: use PortServiceOp.AssignNative

func (*DevicePortServiceOp) Bond deprecated added in v0.2.0

func (i *DevicePortServiceOp) Bond(p *Port, bulk_enable bool) (*Port, *Response, error)

Bond enabled bonding on the specified port

Deprecated: use PortServiceOp.Bond

func (*DevicePortServiceOp) ConvertDevice deprecated added in v0.5.0

func (i *DevicePortServiceOp) ConvertDevice(d *Device, targetType string) error

ConvertDevice converts the specified device's network ports (including addresses and vlans) to the named network type, consistent with the Equinix Metal console experience.

Deprecated: Equinix Metal devices may support more than two ports and the whole-device single word network type can no longer capture the capabilities and permutations of device port configurations.

func (*DevicePortServiceOp) DeviceNetworkType deprecated added in v0.2.0

func (i *DevicePortServiceOp) DeviceNetworkType(deviceID string) (string, error)

DeviceNetworkType fetches the specified Device and returns a heuristic single word network type consistent with the Equinix Metal console experience.

Deprecated: use Device.GetNetworkType

func (*DevicePortServiceOp) DeviceToNetworkType deprecated added in v0.2.0

func (i *DevicePortServiceOp) DeviceToNetworkType(deviceID string, targetType string) (*Device, error)

DeviceToNetworkType fetches the specified device and converts its network ports (including addresses and vlans) to the named network type, consistent with the Equinix Metal console experience.

Deprecated: use DevicePortServiceOp.ConvertDevice which this function thinly wraps.

func (*DevicePortServiceOp) Disbond deprecated added in v0.2.0

func (i *DevicePortServiceOp) Disbond(p *Port, bulk_disable bool) (*Port, *Response, error)

Disbond disables bonding on the specified port

Deprecated: use PortServiceOp.Disbond

func (*DevicePortServiceOp) GetAllEthPorts deprecated added in v0.5.0

func (i *DevicePortServiceOp) GetAllEthPorts(d *Device) (map[string]*Port, error)

GetAllEthPorts fetches the specified Device and returns a heuristic single word network type consistent with the Equinix Metal console experience.

Deprecated: use Device.GetPhysicalPorts

func (*DevicePortServiceOp) GetOddEthPorts deprecated added in v0.5.0

func (i *DevicePortServiceOp) GetOddEthPorts(d *Device) (map[string]*Port, error)

GetOddEthPorts fetches the specified Device and returns physical ports eth1 and eth3.

Deprecated: use Device.GetPhysicalPorts and filter the map to only the keys ending with odd digits

func (*DevicePortServiceOp) GetPortByName deprecated added in v0.2.0

func (i *DevicePortServiceOp) GetPortByName(deviceID, name string) (*Port, error)

GetPortByName returns the matching Port on the specified device

Deprecated: use Device.GetPortByName

func (*DevicePortServiceOp) PortToLayerThree deprecated added in v0.2.0

func (i *DevicePortServiceOp) PortToLayerThree(deviceID, portName string) (*Port, *Response, error)

PortToLayerThree fetches the specified device, finds the matching port by name, and converts it to layer3. A port may already be in a layer3 mode, in which case the port will be returned with a nil response and nil error with no additional action taking place.

When switching to Layer3, a new set of IP addresses will be requested including Public IPv4, Public IPv6, and Private IPv6 addresses.

Deprecated: use PortServiceOp.ConvertToLayerTwo

func (*DevicePortServiceOp) PortToLayerTwo deprecated added in v0.2.0

func (i *DevicePortServiceOp) PortToLayerTwo(deviceID, portName string) (*Port, *Response, error)

PortToLayerTwo fetches the specified device, finds the matching port by name, and converts it to layer2. A port may already be in a layer2 mode, in which case the port will be returned with a nil response and nil error with no additional action taking place.

Deprecated: use PortServiceOp.ConvertToLayerTwo

func (*DevicePortServiceOp) Unassign deprecated added in v0.2.0

func (i *DevicePortServiceOp) Unassign(par *PortAssignRequest) (*Port, *Response, error)

Unassign removes the specified VLAN from the specified Port

Deprecated: use PortServiceOp.Unassign

func (*DevicePortServiceOp) UnassignNative deprecated added in v0.2.0

func (i *DevicePortServiceOp) UnassignNative(portID string) (*Port, *Response, error)

UnassignNative removes the native VLAN from the specified Port

Deprecated: use PortServiceOp.UnassignNative

type DeviceReinstallFields added in v0.17.0

type DeviceReinstallFields struct {
	OperatingSystem string `json:"operating_system,omitempty"`
	PreserveData    bool   `json:"preserve_data,omitempty"`
	DeprovisionFast bool   `json:"deprovision_fast,omitempty"`
}

type DeviceReinstallRequest added in v0.17.0

type DeviceReinstallRequest struct {
	DeviceActionRequest
	*DeviceReinstallFields
}

type DeviceService

type DeviceService interface {
	List(ProjectID string, opts *ListOptions) ([]Device, *Response, error)
	Get(DeviceID string, opts *GetOptions) (*Device, *Response, error)
	Create(*DeviceCreateRequest) (*Device, *Response, error)
	Update(string, *DeviceUpdateRequest) (*Device, *Response, error)
	Delete(string, bool) (*Response, error)
	Reboot(string) (*Response, error)
	Reinstall(string, *DeviceReinstallFields) (*Response, error)
	PowerOff(string) (*Response, error)
	PowerOn(string) (*Response, error)
	Lock(string) (*Response, error)
	Unlock(string) (*Response, error)
	ListBGPSessions(deviceID string, opts *ListOptions) ([]BGPSession, *Response, error)
	ListBGPNeighbors(deviceID string, opts *ListOptions) ([]BGPNeighbor, *Response, error)
	ListEvents(deviceID string, opts *ListOptions) ([]Event, *Response, error)
	GetBandwidth(deviceID string, opts *BandwidthOpts) (*BandwidthIO, *Response, error)
}

DeviceService interface defines available device methods

type DeviceServiceOp

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

DeviceServiceOp implements DeviceService

func (*DeviceServiceOp) Create

func (s *DeviceServiceOp) Create(createRequest *DeviceCreateRequest) (*Device, *Response, error)

Create creates a new device

func (*DeviceServiceOp) Delete

func (s *DeviceServiceOp) Delete(deviceID string, force bool) (*Response, error)

Delete deletes a device

func (*DeviceServiceOp) Get

func (s *DeviceServiceOp) Get(deviceID string, opts *GetOptions) (*Device, *Response, error)

Get returns a device by id

func (*DeviceServiceOp) GetBandwidth added in v0.15.0

func (d *DeviceServiceOp) GetBandwidth(deviceID string, opts *BandwidthOpts) (*BandwidthIO, *Response, error)

func (*DeviceServiceOp) List

func (s *DeviceServiceOp) List(projectID string, opts *ListOptions) (devices []Device, resp *Response, err error)

List returns devices on a project

Regarding ListOptions.Search: The API documentation does not provide guidance on the fields that will be searched using this parameter, so this behavior is undefined and prone to change.

As of 2020-10-20, ListOptions.Search will look for matches in the following Device properties: Hostname, Description, Tags, ID, ShortID, Network.Address, Plan.Name, Plan.Slug, Facility.Code, Facility.Name, OS.Name, OS.Slug, HardwareReservation.ID, HardwareReservation.ShortID

func (*DeviceServiceOp) ListBGPNeighbors added in v0.3.0

func (s *DeviceServiceOp) ListBGPNeighbors(deviceID string, opts *ListOptions) ([]BGPNeighbor, *Response, error)

func (*DeviceServiceOp) ListBGPSessions added in v0.2.0

func (s *DeviceServiceOp) ListBGPSessions(deviceID string, opts *ListOptions) (bgpSessions []BGPSession, resp *Response, err error)

ListBGPSessions returns all BGP Sessions associated with the device

func (*DeviceServiceOp) ListEvents added in v0.2.0

func (s *DeviceServiceOp) ListEvents(deviceID string, opts *ListOptions) ([]Event, *Response, error)

ListEvents returns list of device events

func (*DeviceServiceOp) Lock

func (s *DeviceServiceOp) Lock(deviceID string) (*Response, error)

Lock sets a device to "locked"

func (*DeviceServiceOp) PowerOff

func (s *DeviceServiceOp) PowerOff(deviceID string) (*Response, error)

PowerOff powers on a device

func (*DeviceServiceOp) PowerOn

func (s *DeviceServiceOp) PowerOn(deviceID string) (*Response, error)

PowerOn powers on a device

func (*DeviceServiceOp) Reboot

func (s *DeviceServiceOp) Reboot(deviceID string) (*Response, error)

Reboot reboots on a device

func (*DeviceServiceOp) Reinstall added in v0.17.0

func (s *DeviceServiceOp) Reinstall(deviceID string, fields *DeviceReinstallFields) (*Response, error)

Reinstall reinstalls a device

func (*DeviceServiceOp) Unlock

func (s *DeviceServiceOp) Unlock(deviceID string) (*Response, error)

Unlock sets a device to "unlocked"

func (*DeviceServiceOp) Update

func (s *DeviceServiceOp) Update(deviceID string, updateRequest *DeviceUpdateRequest) (*Device, *Response, error)

Update updates an existing device

type DeviceUpdateRequest

type DeviceUpdateRequest struct {
	Hostname      *string   `json:"hostname,omitempty"`
	Description   *string   `json:"description,omitempty"`
	UserData      *string   `json:"userdata,omitempty"`
	Locked        *bool     `json:"locked,omitempty"`
	Tags          *[]string `json:"tags,omitempty"`
	AlwaysPXE     *bool     `json:"always_pxe,omitempty"`
	IPXEScriptURL *string   `json:"ipxe_script_url,omitempty"`
	CustomData    *string   `json:"customdata,omitempty"`
}

DeviceUpdateRequest type used to update an Equinix Metal device

type DisbondRequest added in v0.2.0

type DisbondRequest struct {
	BulkDisable bool `json:"bulk_disable"`
}

type Drives

type Drives struct {
	Count int    `json:"count,omitempty"`
	Size  string `json:"size,omitempty"`
	Type  string `json:"type,omitempty"`
}

Drives - the storage config details for specs on a plan

func (Drives) String

func (d Drives) String() string

type Email

type Email struct {
	ID      string `json:"id"`
	Address string `json:"address"`
	Default bool   `json:"default,omitempty"`
	URL     string `json:"href,omitempty"`
}

Email represents a user's email address

func (Email) String

func (e Email) String() string

type EmailRequest added in v0.2.0

type EmailRequest struct {
	Address string `json:"address,omitempty"`
	Default *bool  `json:"default,omitempty"`
}

EmailRequest type used to add an email address to the current user

type EmailService

type EmailService interface {
	Get(string, *GetOptions) (*Email, *Response, error)
	Create(*EmailRequest) (*Email, *Response, error)
	Update(string, *EmailRequest) (*Email, *Response, error)
	Delete(string) (*Response, error)
}

EmailService interface defines available email methods

type EmailServiceOp

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

EmailServiceOp implements EmailService

func (*EmailServiceOp) Create added in v0.2.0

func (s *EmailServiceOp) Create(request *EmailRequest) (*Email, *Response, error)

Create adds a new email address to the current user.

func (*EmailServiceOp) Delete added in v0.2.0

func (s *EmailServiceOp) Delete(emailID string) (*Response, error)

Delete removes the email address from the current user account

func (*EmailServiceOp) Get

func (s *EmailServiceOp) Get(emailID string, opts *GetOptions) (*Email, *Response, error)

Get retrieves an email by id

func (*EmailServiceOp) Update added in v0.2.0

func (s *EmailServiceOp) Update(emailID string, request *EmailRequest) (*Email, *Response, error)

Update email parameters

type ErrorResponse

type ErrorResponse struct {
	Response    *http.Response
	Errors      []string `json:"errors"`
	SingleError string   `json:"error"`
}

ErrorResponse is the http response used on errors

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Event added in v0.2.0

type Event struct {
	ID            string     `json:"id,omitempty"`
	State         string     `json:"state,omitempty"`
	Type          string     `json:"type,omitempty"`
	Body          string     `json:"body,omitempty"`
	Relationships []Href     `json:"relationships,omitempty"`
	Interpolated  string     `json:"interpolated,omitempty"`
	CreatedAt     *Timestamp `json:"created_at,omitempty"`
	Href          string     `json:"href,omitempty"`
}

Event struct

type EventService added in v0.2.0

type EventService interface {
	List(*ListOptions) ([]Event, *Response, error)
	Get(string, *GetOptions) (*Event, *Response, error)
}

EventService interface defines available event functions

type EventServiceOp added in v0.2.0

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

EventServiceOp implements EventService

func (*EventServiceOp) Get added in v0.2.0

func (s *EventServiceOp) Get(eventID string, getOpt *GetOptions) (*Event, *Response, error)

Get returns an event by ID

func (*EventServiceOp) List added in v0.2.0

func (s *EventServiceOp) List(listOpt *ListOptions) ([]Event, *Response, error)

List returns all events

type FabricServiceToken added in v0.21.0

type FabricServiceToken struct {
	*Href            `json:",inline"`
	ExpiresAt        *Timestamp             `json:"expires_at,omitempty"`
	ID               string                 `json:"id"`
	MaxAllowedSpeed  uint64                 `json:"max_allowed_speed,omitempty"`
	Role             ConnectionPortRole     `json:"role,omitempty"`
	ServiceTokenType FabricServiceTokenType `json:"service_token_type,omitempty"`
	State            string                 `json:"state,omitempty"`
}

FabricServiceToken represents an Equinix Metal metro

func (FabricServiceToken) String added in v0.21.0

func (f FabricServiceToken) String() string

type FabricServiceTokenServiceOp added in v0.21.0

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

FabricServiceTokenServiceOp implements FabricServiceTokenService

func (*FabricServiceTokenServiceOp) Get added in v0.21.0

type FabricServiceTokenType added in v0.21.0

type FabricServiceTokenType string
const (
	FabricServiceTokenASide FabricServiceTokenType = "a_side"
	FabricServiceTokenZSide FabricServiceTokenType = "z_side"
)

type Facility

type Facility struct {
	ID       string   `json:"id"`
	Name     string   `json:"name,omitempty"`
	Code     string   `json:"code,omitempty"`
	Features []string `json:"features,omitempty"`
	Address  *Address `json:"address,omitempty"`
	Metro    *Metro   `json:"metro,omitempty"`
	URL      string   `json:"href,omitempty"`
}

Facility represents an Equinix Metal facility

func (Facility) String

func (f Facility) String() string

type FacilityService

type FacilityService interface {
	List(*ListOptions) ([]Facility, *Response, error)
}

FacilityService interface defines available facility methods

type FacilityServiceOp

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

FacilityServiceOp implements FacilityService

func (*FacilityServiceOp) List

func (s *FacilityServiceOp) List(opts *ListOptions) ([]Facility, *Response, error)

List returns all facilities

type Features

type Features struct {
	Raid bool `json:"raid,omitempty"`
	Txt  bool `json:"txt,omitempty"`
}

Features - other features in the specs for a plan

func (Features) String

func (f Features) String() string

type GetOptions added in v0.2.0

type GetOptions struct {
	// Includes are a list of fields to expand in the request results.
	//
	// For resources that contain collections of other resources, the Equinix Metal API
	// will only return the `Href` value of these resources by default. In
	// nested API Go types, this will result in objects that have zero values in
	// all fiends except their `Href` field. When an object's associated field
	// name is "included", the returned fields will be Uumarshalled into the
	// nested object. Field specifiers can use a dotted notation up to three
	// references deep. (For example, "memberships.projects" can be used in
	// ListUsers.)
	Includes []string `url:"include,omitempty,comma"`

	// Excludes reduce the size of the API response by removing nested objects
	// that may be returned.
	//
	// The default behavior of the Equinix Metal API is to "exclude" fields, but some
	// API endpoints have an "include" behavior on certain fields. Nested Go
	// types unmarshalled into an "excluded" field will only have a values in
	// their `Href` field.
	Excludes []string `url:"exclude,omitempty,comma"`

	// QueryParams for API URL, used for arbitrary filters
	QueryParams map[string]string `url:"-"`

	// Page is the page of results to retrieve for paginated result sets
	Page int `url:"page,omitempty"`

	// PerPage is the number of results to return per page for paginated result
	// sets,
	PerPage int `url:"per_page,omitempty"`

	// Search is a special API query parameter that, for resources that support
	// it, will filter results to those with any one of various fields matching
	// the supplied keyword.  For example, a resource may have a defined search
	// behavior matches either a name or a fingerprint field, while another
	// resource may match entirely different fields.  Search is currently
	// implemented for SSHKeys and uses an exact match.
	Search string `url:"search,omitempty"`

	SortBy        string            `url:"sort_by,omitempty"`
	SortDirection ListSortDirection `url:"sort_direction,omitempty"`

	Meta meta `url:"-"`
}

GetOptions are options common to Equinix Metal API GET requests

func (*GetOptions) AddParam added in v0.19.0

func (g *GetOptions) AddParam(key, value string) *GetOptions

AddParam adds key=value to URL path

func (*GetOptions) CopyOrNew added in v0.6.0

func (g *GetOptions) CopyOrNew() *GetOptions

func (*GetOptions) Encode added in v0.6.0

func (g *GetOptions) Encode() string

Encode generates a URL query string ("?foo=bar")

func (*GetOptions) Excluding added in v0.11.0

func (g *GetOptions) Excluding(refs ...string) *GetOptions

Excluding ensures that the variadic refs are included in the "Excluded" param in a copy of the options. Unknown values within refs will be silently ignore by the API.

func (*GetOptions) Filter added in v0.19.0

func (g *GetOptions) Filter(key, value string) *GetOptions

func (*GetOptions) GetOptions added in v0.3.0

func (g *GetOptions) GetOptions() *GetOptions

GetOptions returns GetOptions from GetOptions (and is nil-receiver safe)

func (*GetOptions) GetPage added in v0.6.0

func (g *GetOptions) GetPage() int

func (*GetOptions) Including added in v0.5.0

func (g *GetOptions) Including(refs ...string) *GetOptions

Including ensures that the variadic refs are included in a copy of the options, resulting in expansion of the the referred sub-resources. Unknown values within refs will be silently ignore by the API.

func (*GetOptions) WithQuery added in v0.6.0

func (g *GetOptions) WithQuery(apiPath string) string

type HardwareReservation added in v0.2.0

type HardwareReservation struct {
	ID            string    `json:"id,omitempty"`
	ShortID       string    `json:"short_id,omitempty"`
	Facility      Facility  `json:"facility,omitempty"`
	Plan          Plan      `json:"plan,omitempty"`
	Provisionable bool      `json:"provisionable,omitempty"`
	Spare         bool      `json:"spare,omitempty"`
	SwitchUUID    string    `json:"switch_uuid,omitempty"`
	Intervals     int       `json:"intervals,omitempty"`
	CurrentPeriod int       `json:"current_period,omitempty"`
	Href          string    `json:"href,omitempty"`
	Project       Project   `json:"project,omitempty"`
	Device        *Device   `json:"device,omitempty"`
	CreatedAt     Timestamp `json:"created_at,omitempty"`
}

HardwareReservation struct

type HardwareReservationService added in v0.2.0

type HardwareReservationService interface {
	Get(hardwareReservationID string, getOpt *GetOptions) (*HardwareReservation, *Response, error)
	List(projectID string, listOpt *ListOptions) ([]HardwareReservation, *Response, error)
	Move(string, string) (*HardwareReservation, *Response, error)
}

HardwareReservationService interface defines available hardware reservation functions

type HardwareReservationServiceOp added in v0.2.0

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

HardwareReservationServiceOp implements HardwareReservationService

func (*HardwareReservationServiceOp) Get added in v0.2.0

func (s *HardwareReservationServiceOp) Get(hardwareReservationdID string, opts *GetOptions) (*HardwareReservation, *Response, error)

Get returns a single hardware reservation

func (*HardwareReservationServiceOp) List added in v0.2.0

func (s *HardwareReservationServiceOp) List(projectID string, opts *ListOptions) (reservations []HardwareReservation, resp *Response, err error)

List returns all hardware reservations for a given project

func (*HardwareReservationServiceOp) Move added in v0.2.0

func (s *HardwareReservationServiceOp) Move(hardwareReservationdID, projectID string) (*HardwareReservation, *Response, error)

Move a hardware reservation to another project

type Href added in v0.2.0

type Href struct {
	Href string `json:"href"`
}

Href is an API link

type IPAddressAssignment added in v0.2.0

type IPAddressAssignment struct {
	IpAddressCommon
	AssignedTo Href `json:"assigned_to"`
}

IPAddressAssignment is created when an IP address from reservation block is assigned to a device.

func (IPAddressAssignment) String added in v0.2.0

func (i IPAddressAssignment) String() string

type IPAddressCreateRequest added in v0.2.0

type IPAddressCreateRequest struct {
	// Address Family for IP Address
	AddressFamily int `json:"address_family"`

	// Address Type for IP Address
	Public bool `json:"public"`

	// CIDR Size for the IP Block created. Valid values depends on the operating system provisioned.
	CIDR int `json:"cidr,omitempty"`

	// Reservations are UUIDs of any IP reservations to use when assigning IPs
	Reservations []string `json:"ip_reservations,omitempty"`
}

type IPAddressReservation added in v0.2.0

type IPAddressReservation struct {
	IpAddressCommon
	Assignments  []*IPAddressAssignment `json:"assignments"`
	Facility     *Facility              `json:"facility,omitempty"`
	Available    string                 `json:"available"`
	Addon        bool                   `json:"addon"`
	Bill         bool                   `json:"bill"`
	State        IPReservationState     `json:"state"`
	Description  *string                `json:"details"`
	Enabled      bool                   `json:"enabled"`
	MetalGateway *MetalGatewayLite      `json:"metal_gateway,omitempty"`
	RequestedBy  *UserLite              `json:"requested_by,omitempty"`
}

IPAddressReservation is created when user sends IP reservation request for a project (considering it's within quota).

func (IPAddressReservation) String added in v0.2.0

func (i IPAddressReservation) String() string

type IPAddressUpdateRequest added in v0.22.0

type IPAddressUpdateRequest struct {
	Tags        *[]string   `json:"tags,omitempty"`
	Description *string     `json:"details,omitempty"`
	CustomData  interface{} `json:"customdata,omitempty"`
}

IPAddressUpdateRequest represents the body of an IPAddress patch

type IPReservationCreateRequest added in v0.23.0

type IPReservationCreateRequest struct {
	// Type of IP reservation.
	Type        IPReservationType `json:"type"`
	Quantity    int               `json:"quantity"`
	Description string            `json:"details,omitempty"`
	Facility    *string           `json:"facility,omitempty"`
	Metro       *string           `json:"metro,omitempty"`
	Tags        []string          `json:"tags,omitempty"`
	CustomData  interface{}       `json:"customdata,omitempty"`
	// FailOnApprovalRequired if the IP request cannot be approved
	// automatically, rather than sending to the longer Equinix Metal approval
	// process, fail immediately with a 422 error
	FailOnApprovalRequired bool `json:"fail_on_approval_required,omitempty"`

	// Comments in support of the request for additional addresses when the
	// request must be manually approved.
	Comments string `json:"comments,omitempty"`

	// VRFID is the ID of the VRF to associate and draw the IP range from.
	// * Required when Type is VRFIPRange, not valid otherwise
	// * Network and CIDR are required when set
	// * Metro and Facility are not required when set
	VRFID string `json:"vrf_id,omitempty"`

	// Network an unreserved network address from an existing VRF ip_range.
	// * Required when Type is VRFIPRange, not valid otherwise
	Network string `json:"network,omitempty"`

	// CIDR the size of the network to reserve from an existing VRF ip_range.
	// * Required when Type is VRFIPRange, not valid otherwise
	// * Minimum range is 22-29, with 30-31 supported and necessary for virtual-circuits
	CIDR int `json:"cidr,omitempty"`
}

IPReservationCreateRequest represents the body of an IP reservation request.

type IPReservationRequest

type IPReservationRequest = IPReservationCreateRequest

IPReservationRequest represents the body of an IP reservation request Deprecated: use IPReservationCreateRequest

type IPReservationState added in v0.21.0

type IPReservationState string
const (
	// IPReservationStatePending fixed string representation of pending
	IPReservationStatePending IPReservationState = "pending"

	// IPReservationStateCreated fixed string representation of created
	IPReservationStateCreated IPReservationState = "created"

	// IPReservationStateDenied fixed string representation of denied
	IPReservationStateDenied IPReservationState = "denied"
)

type IPReservationType added in v0.23.0

type IPReservationType string
const (
	// PublicIPv4 fixed string representation of public ipv4
	PublicIPv4 IPReservationType = "public_ipv4"
	// PrivateIPv4 fixed string representation of private ipv4
	PrivateIPv4 IPReservationType = "private_ipv4"
	// GlobalIPv4 fixed string representation of global ipv4
	GlobalIPv4 IPReservationType = "global_ipv4"
	// PublicIPv6 fixed string representation of public ipv6
	PublicIPv6 IPReservationType = "public_ipv6"
	// PrivateIPv6 fixed string representation of private ipv6
	PrivateIPv6 IPReservationType = "private_ipv6"
	// GlobalIPv6 fixed string representation of global ipv6
	GlobalIPv6 IPReservationType = "global_ipv6"
	// VRFIPRange fixed string representation of vrf (virtual routing and forwarding). This may be any VRF supported range, including public and RFC-1918 IPv4 and IPv6 ranges.
	VRFIPRange IPReservationType = "vrf"
)

type Invitation added in v0.27.0

type Invitation struct {
	*Href        `json:",inline"`
	ID           string     `json:"id,omitempty"`
	Invitation   Href       `json:"invitation,omitempty"`
	InvitedBy    Href       `json:"invited_by,omitempty"`
	Invitee      string     `json:"invitee,omitempty"`
	Nonce        string     `json:"nonce,omitempty"`
	Organization Href       `json:"organization,omitempty"`
	Projects     []Href     `json:"projects,omitempty"`
	Roles        []string   `json:"roles,omitempty"`
	CreatedAt    *Timestamp `json:"created_at,omitempty"`
	UpdatedAt    *Timestamp `json:"updated_at,omitempty"`
}

Invitation represents an Equinix Metal invitation

func (Invitation) String added in v0.27.0

func (u Invitation) String() string

type InvitationCreateRequest added in v0.27.0

type InvitationCreateRequest struct {
	// Invitee is the email address of the recipient
	Invitee     string   `json:"invitee"`
	Message     string   `json:"message,omitempty"`
	ProjectsIDs []string `json:"projects_ids,omitempty"`
	Roles       []string `json:"roles,omitempty"`
}

InvitationCreateRequest struct for InvitationService.Create

type InvitationService added in v0.27.0

InvitationService interface defines available invitation methods

type InvitationServiceOp added in v0.27.0

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

InvitationServiceOp implements InvitationService

func (*InvitationServiceOp) Accept added in v0.27.0

func (s *InvitationServiceOp) Accept(id string, updateRequest *InvitationUpdateRequest) (*Invitation, *Response, error)

Update updates the current invitation

func (*InvitationServiceOp) Create added in v0.27.0

func (s *InvitationServiceOp) Create(organizationID string, createRequest *InvitationCreateRequest, opts *GetOptions) (*Invitation, *Response, error)

Create a Invitation with the given InvitationCreateRequest. New invitation VerificationStage will be AccountCreated, unless InvitationCreateRequest contains an valid InvitationID and Nonce in which case the VerificationStage will be Verified.

func (*InvitationServiceOp) Delete added in v0.27.0

func (s *InvitationServiceOp) Delete(id string) (*Response, error)

Update updates the current invitation

func (*InvitationServiceOp) Get added in v0.27.0

func (s *InvitationServiceOp) Get(invitationID string, opts *GetOptions) (*Invitation, *Response, error)

func (*InvitationServiceOp) List added in v0.27.0

func (s *InvitationServiceOp) List(organizationID string, opts *ListOptions) (invitations []Invitation, resp *Response, err error)

Lists open invitations to the project

func (*InvitationServiceOp) Resend added in v0.27.0

func (s *InvitationServiceOp) Resend(id string) (*Invitation, *Response, error)

Update updates the current invitation

type InvitationUpdateRequest added in v0.27.0

type InvitationUpdateRequest struct{}

InvitationUpdateRequest struct for InvitationService.Update

type IpAddressCommon added in v0.2.0

type IpAddressCommon struct {
	ID            string            `json:"id"`
	Address       string            `json:"address"`
	Gateway       string            `json:"gateway"`
	Network       string            `json:"network"`
	AddressFamily int               `json:"address_family"`
	Netmask       string            `json:"netmask"`
	Public        bool              `json:"public"`
	CIDR          int               `json:"cidr"`
	Created       string            `json:"created_at,omitempty"`
	Updated       string            `json:"updated_at,omitempty"`
	Href          string            `json:"href"`
	Management    bool              `json:"management"`
	Manageable    bool              `json:"manageable"`
	Metro         *Metro            `json:"metro,omitempty"`
	Project       Href              `json:"project"`
	Global        bool              `json:"global_ip"`
	Tags          []string          `json:"tags,omitempty"`
	ParentBlock   *ParentBlock      `json:"parent_block,omitempty"`
	CustomData    interface{}       `json:"customdata,omitempty"`
	Type          IPReservationType `json:"type"`
	VRF           *VRF              `json:"vrf,omitempty"`
}

type ListOptions

type ListOptions = GetOptions

type ListSortDirection added in v0.6.0

type ListSortDirection string
const (
	SortDirectionAsc  ListSortDirection = "asc"
	SortDirectionDesc ListSortDirection = "desc"
)

type Member added in v0.28.0

type Member struct {
	*Href         `json:",inline"`
	ID            string       `json:"id"`
	Roles         []string     `json:"roles"`
	ProjectsCount int          `json:"projects_count"`
	User          User         `json:"user"`
	Organization  Organization `json:"organization"`
	Projects      []Project    `json:"projects"`
}

Member is the returned from organization/id/members

type MemberService added in v0.28.0

type MemberService interface {
	List(string, *ListOptions) ([]Member, *Response, error)
	Delete(string, string) (*Response, error)
}

OrganizationService interface defines available organization methods

type MemberServiceOp added in v0.28.0

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

MemberServiceOp implements MemberService

func (*MemberServiceOp) Delete added in v0.28.0

func (s *MemberServiceOp) Delete(organizationID, memberID string) (*Response, error)

Delete removes the given member from the given organization

func (*MemberServiceOp) List added in v0.28.0

func (s *MemberServiceOp) List(organizationID string, opts *ListOptions) (orgs []Member, resp *Response, err error)

List returns the members in an organization

type Memory

type Memory struct {
	Total string `json:"total,omitempty"`
}

Memory - the RAM config details for specs on a plan

func (Memory) String

func (m Memory) String() string

type MetalGateway added in v0.17.0

type MetalGateway struct {
	ID             string                `json:"id"`
	State          MetalGatewayState     `json:"state"`
	Project        *Project              `json:"project,omitempty"`
	VirtualNetwork *VirtualNetwork       `json:"virtual_network,omitempty"`
	IPReservation  *IPAddressReservation `json:"ip_reservation,omitempty"`
	Href           string                `json:"href"`
	CreatedAt      string                `json:"created_at,omitempty"`
	UpdatedAt      string                `json:"updated_at,omitempty"`
	VRF            *VRF                  `json:"vrf,omitempty"`
}

type MetalGatewayCreateRequest added in v0.17.0

type MetalGatewayCreateRequest struct {
	// VirtualNetworkID virtual network UUID.
	VirtualNetworkID string `json:"virtual_network_id"`

	// IPReservationID (optional) IP Reservation UUID (Public or VRF). Required for VRF.
	IPReservationID string `json:"ip_reservation_id,omitempty"`

	// PrivateIPv4SubnetSize (optional) Power of 2 between 8 and 128 (8, 16, 32, 64, 128). Invalid for VRF.
	PrivateIPv4SubnetSize int `json:"private_ipv4_subnet_size,omitempty"`
}

type MetalGatewayLite added in v0.22.0

type MetalGatewayLite struct {
	ID string `json:"id,omitempty"`
	// The current state of the Metal Gateway. 'Ready' indicates the gateway record has been configured, but is currently not active on the network. 'Active' indicates the gateway has been configured on the network. 'Deleting' is a temporary state used to indicate that the gateway is in the process of being un-configured from the network, after which the gateway record will be deleted.
	State     string     `json:"state,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
	UpdatedAt *Timestamp `json:"updated_at,omitempty"`
	// The gateway address with subnet CIDR value for this Metal Gateway. For example, a Metal Gateway using an IP reservation with block 10.1.2.0/27 would have a gateway address of 10.1.2.1/27.
	GatewayAddress string `json:"gateway_address,omitempty"`
	// The VLAN id of the Virtual Network record associated to this Metal Gateway. Example: 1001.
	VLAN int    `json:"vlan,omitempty"`
	Href string `json:"href,omitempty"`
}

MetalGatewayLite struct representation of a Metal Gateway

type MetalGatewayService added in v0.17.0

type MetalGatewayService interface {
	List(projectID string, opts *ListOptions) ([]MetalGateway, *Response, error)
	Create(projectID string, input *MetalGatewayCreateRequest) (*MetalGateway, *Response, error)
	Get(metalGatewayID string, opts *GetOptions) (*MetalGateway, *Response, error)
	Delete(metalGatewayID string) (*Response, error)
}

type MetalGatewayServiceOp added in v0.17.0

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

func (*MetalGatewayServiceOp) Create added in v0.17.0

func (*MetalGatewayServiceOp) Delete added in v0.17.0

func (s *MetalGatewayServiceOp) Delete(metalGatewayID string) (*Response, error)

func (*MetalGatewayServiceOp) Get added in v0.17.0

func (s *MetalGatewayServiceOp) Get(metalGatewayID string, opts *GetOptions) (*MetalGateway, *Response, error)

func (*MetalGatewayServiceOp) List added in v0.17.0

func (s *MetalGatewayServiceOp) List(projectID string, opts *ListOptions) (metalGateways []MetalGateway, resp *Response, err error)

type MetalGatewayState added in v0.17.0

type MetalGatewayState string
const (
	MetalGatewayActive   MetalGatewayState = "active"
	MetalGatewayReady    MetalGatewayState = "ready"
	MetalGatewayDeleting MetalGatewayState = "deleting"
)

type Metro added in v0.8.0

type Metro struct {
	ID      string `json:"id"`
	Name    string `json:"name,omitempty"`
	Code    string `json:"code,omitempty"`
	Country string `json:"country,omitempty"`
}

Metro represents an Equinix Metal metro

func (Metro) String added in v0.8.0

func (f Metro) String() string

type MetroPricing added in v0.26.0

type MetroPricing map[string]AnnualReservationPricing

type MetroService added in v0.8.0

type MetroService interface {
	List(*ListOptions) ([]Metro, *Response, error)
}

MetroService interface defines available metro methods

type MetroServiceOp added in v0.8.0

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

MetroServiceOp implements MetroService

func (*MetroServiceOp) List added in v0.8.0

func (s *MetroServiceOp) List(opts *ListOptions) ([]Metro, *Response, error)

List returns all metros

type NetworkInfo added in v0.2.0

type NetworkInfo struct {
	PublicIPv4  string
	PublicIPv6  string
	PrivateIPv4 string
}

type Nics

type Nics struct {
	Count int    `json:"count,omitempty"`
	Type  string `json:"type,omitempty"`
}

Nics - the network hardware details for specs on a plan

func (Nics) String

func (n Nics) String() string

type Notification added in v0.2.0

type Notification struct {
	ID        string    `json:"id,omitempty"`
	Type      string    `json:"type,omitempty"`
	Body      string    `json:"body,omitempty"`
	Severity  string    `json:"severity,omitempty"`
	Read      bool      `json:"read,omitempty"`
	Context   string    `json:"context,omitempty"`
	CreatedAt Timestamp `json:"created_at,omitempty"`
	UpdatedAt Timestamp `json:"updated_at,omitempty"`
	User      Href      `json:"user,omitempty"`
	Href      string    `json:"href,omitempty"`
}

Notification struct

type NotificationService added in v0.2.0

type NotificationService interface {
	List(*ListOptions) ([]Notification, *Response, error)
	Get(string, *GetOptions) (*Notification, *Response, error)
	MarkAsRead(string) (*Notification, *Response, error)
}

NotificationService interface defines available event functions

type NotificationServiceOp added in v0.2.0

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

NotificationServiceOp implements NotificationService

func (*NotificationServiceOp) Get added in v0.2.0

func (s *NotificationServiceOp) Get(notificationID string, opts *GetOptions) (*Notification, *Response, error)

Get returns a notification by ID

func (*NotificationServiceOp) List added in v0.2.0

func (s *NotificationServiceOp) List(listOpt *ListOptions) ([]Notification, *Response, error)

List returns all notifications

func (*NotificationServiceOp) MarkAsRead added in v0.2.0

func (s *NotificationServiceOp) MarkAsRead(notificationID string) (*Notification, *Response, error)

Marks notification as read by ID

type OS

type OS struct {
	Name            string   `json:"name"`
	Slug            string   `json:"slug"`
	Distro          string   `json:"distro"`
	Version         string   `json:"version"`
	ProvisionableOn []string `json:"provisionable_on"`
}

OS represents an Equinix Metal operating system

func (OS) String

func (o OS) String() string

type OSService

type OSService interface {
	List() ([]OS, *Response, error)
}

OSService interface defines available operating_systems methods

type OSServiceOp

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

OSServiceOp implements OSService

func (*OSServiceOp) List

func (s *OSServiceOp) List() ([]OS, *Response, error)

List returns all available operating systems

type OptionsGetter added in v0.3.0

type OptionsGetter interface {
	GetOptions() *GetOptions
}

OptionsGetter provides GetOptions

type Organization added in v0.2.0

type Organization struct {
	ID           string    `json:"id"`
	Name         string    `json:"name,omitempty"`
	Description  string    `json:"description,omitempty"`
	Website      string    `json:"website,omitempty"`
	Twitter      string    `json:"twitter,omitempty"`
	Created      string    `json:"created_at,omitempty"`
	Updated      string    `json:"updated_at,omitempty"`
	Address      Address   `json:"address,omitempty"`
	TaxID        string    `json:"tax_id,omitempty"`
	MainPhone    string    `json:"main_phone,omitempty"`
	BillingPhone string    `json:"billing_phone,omitempty"`
	CreditAmount float64   `json:"credit_amount,omitempty"`
	LogoThumb    string    `json:"logo_thumb,omitempty"`
	Projects     []Project `json:"projects,omitempty"`
	URL          string    `json:"href,omitempty"`
	Members      []Member  `json:"members,omitempty"`
	Owners       []User    `json:"owners,omitempty"`
	PrimaryOwner User      `json:"primary_owner,omitempty"`
}

Organization represents an Equinix Metal organization

func (Organization) String added in v0.2.0

func (o Organization) String() string

type OrganizationCreateRequest added in v0.2.0

type OrganizationCreateRequest struct {
	Name        string  `json:"name"`
	Description string  `json:"description,omitempty"`
	Website     string  `json:"website,omitempty"`
	Twitter     string  `json:"twitter,omitempty"`
	Address     Address `json:"address,omitempty"`
}

OrganizationCreateRequest type used to create an Equinix Metal organization

func (OrganizationCreateRequest) String added in v0.2.0

func (o OrganizationCreateRequest) String() string

type OrganizationService added in v0.2.0

type OrganizationService interface {
	List(*ListOptions) ([]Organization, *Response, error)
	Get(string, *GetOptions) (*Organization, *Response, error)
	Create(*OrganizationCreateRequest) (*Organization, *Response, error)
	Update(string, *OrganizationUpdateRequest) (*Organization, *Response, error)
	Delete(string) (*Response, error)
	ListPaymentMethods(string) ([]PaymentMethod, *Response, error)
	ListEvents(string, *ListOptions) ([]Event, *Response, error)
}

OrganizationService interface defines available organization methods

type OrganizationServiceOp added in v0.2.0

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

OrganizationServiceOp implements OrganizationService

func (*OrganizationServiceOp) Create added in v0.2.0

Create creates a new organization

func (*OrganizationServiceOp) Delete added in v0.2.0

func (s *OrganizationServiceOp) Delete(organizationID string) (*Response, error)

Delete deletes an organizationID

func (*OrganizationServiceOp) Get added in v0.2.0

func (s *OrganizationServiceOp) Get(organizationID string, opts *GetOptions) (*Organization, *Response, error)

Get returns a organization by id

func (*OrganizationServiceOp) List added in v0.2.0

func (s *OrganizationServiceOp) List(opts *ListOptions) (orgs []Organization, resp *Response, err error)

List returns the user's organizations

func (*OrganizationServiceOp) ListEvents added in v0.2.0

func (s *OrganizationServiceOp) ListEvents(organizationID string, listOpt *ListOptions) ([]Event, *Response, error)

ListEvents returns list of organization events

func (*OrganizationServiceOp) ListPaymentMethods added in v0.2.0

func (s *OrganizationServiceOp) ListPaymentMethods(organizationID string) ([]PaymentMethod, *Response, error)

ListPaymentMethods returns PaymentMethods for an organization

func (*OrganizationServiceOp) Update added in v0.2.0

Update updates an organization

type OrganizationUpdateRequest added in v0.2.0

type OrganizationUpdateRequest struct {
	Name        *string  `json:"name,omitempty"`
	Description *string  `json:"description,omitempty"`
	Website     *string  `json:"website,omitempty"`
	Twitter     *string  `json:"twitter,omitempty"`
	Address     *Address `json:"address,omitempty"`
}

OrganizationUpdateRequest type used to update an Equinix Metal organization

func (OrganizationUpdateRequest) String added in v0.2.0

func (o OrganizationUpdateRequest) String() string

type ParentBlock added in v0.17.0

type ParentBlock struct {
	Network string  `json:"network"`
	Netmask string  `json:"netmask"`
	CIDR    int     `json:"cidr"`
	Href    *string `json:"href,omitempty"`
}

ParentBlock is the network block for the parent of an IP address

type PaymentMethod added in v0.2.0

type PaymentMethod struct {
	ID             string         `json:"id"`
	Name           string         `json:"name,omitempty"`
	Created        string         `json:"created_at,omitempty"`
	Updated        string         `json:"updated_at,omitempty"`
	Nonce          string         `json:"nonce,omitempty"`
	Default        bool           `json:"default,omitempty"`
	Organization   Organization   `json:"organization,omitempty"`
	Projects       []Project      `json:"projects,omitempty"`
	Type           string         `json:"type,omitempty"`
	CardholderName string         `json:"cardholder_name,omitempty"`
	ExpMonth       string         `json:"expiration_month,omitempty"`
	ExpYear        string         `json:"expiration_year,omitempty"`
	Last4          string         `json:"last_4,omitempty"`
	BillingAddress BillingAddress `json:"billing_address,omitempty"`
	URL            string         `json:"href,omitempty"`
}

PaymentMethod represents an Equinix Metal payment method of an organization

func (PaymentMethod) String added in v0.2.0

func (pm PaymentMethod) String() string

type PaymentMethodCreateRequest added in v0.2.0

type PaymentMethodCreateRequest struct {
	Name           string `json:"name"`
	Nonce          string `json:"nonce"`
	CardholderName string `json:"cardholder_name,omitempty"`
	ExpMonth       string `json:"expiration_month,omitempty"`
	ExpYear        string `json:"expiration_year,omitempty"`
	BillingAddress string `json:"billing_address,omitempty"`
}

PaymentMethodCreateRequest type used to create an Equinix Metal payment method of an organization

func (PaymentMethodCreateRequest) String added in v0.2.0

func (pm PaymentMethodCreateRequest) String() string

type PaymentMethodService added in v0.2.0

type PaymentMethodService interface {
	List() ([]PaymentMethod, *Response, error)
	Get(string) (*PaymentMethod, *Response, error)
	Create(*PaymentMethodCreateRequest) (*PaymentMethod, *Response, error)
	Update(string, *PaymentMethodUpdateRequest) (*PaymentMethod, *Response, error)
	Delete(string) (*Response, error)
}

ProjectService interface defines available project methods

type PaymentMethodServiceOp added in v0.2.0

type PaymentMethodServiceOp struct {
}

PaymentMethodServiceOp implements PaymentMethodService

type PaymentMethodUpdateRequest added in v0.2.0

type PaymentMethodUpdateRequest struct {
	Name           *string `json:"name,omitempty"`
	CardholderName *string `json:"cardholder_name,omitempty"`
	ExpMonth       *string `json:"expiration_month,omitempty"`
	ExpYear        *string `json:"expiration_year,omitempty"`
	BillingAddress *string `json:"billing_address,omitempty"`
}

PaymentMethodUpdateRequest type used to update an Equinix Metal payment method of an organization

func (PaymentMethodUpdateRequest) String added in v0.2.0

func (pm PaymentMethodUpdateRequest) String() string

type Plan

type Plan struct {
	ID                 string              `json:"id"`
	Slug               string              `json:"slug,omitempty"`
	Name               string              `json:"name,omitempty"`
	Description        string              `json:"description,omitempty"`
	Line               string              `json:"line,omitempty"`
	Legacy             bool                `json:"legacy,omitempty"`
	Specs              *Specs              `json:"specs,omitempty"`
	Pricing            *Pricing            `json:"pricing,omitempty"`
	DeploymentTypes    []string            `json:"deployment_types"`
	Class              string              `json:"class"`
	AvailableIn        []Facility          `json:"available_in"`
	AvailableInMetros  []Metro             `json:"available_in_metros"`
	ReservationPricing *ReservationPricing `json:"reservation_pricing,omitempty"`

	Href string `json:"href,omitempty"`
}

Plan represents an Equinix Metal service plan

func (Plan) String

func (p Plan) String() string

type PlanService

type PlanService interface {
	List(*ListOptions) ([]Plan, *Response, error)
	ProjectList(string, *ListOptions) ([]Plan, *Response, error)
	OrganizationList(string, *ListOptions) ([]Plan, *Response, error)
}

PlanService interface defines available plan methods

type PlanServiceOp

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

PlanServiceOp implements PlanService

func (*PlanServiceOp) List

func (s *PlanServiceOp) List(opts *ListOptions) ([]Plan, *Response, error)

List method returns all available plans

func (*PlanServiceOp) OrganizationList added in v0.6.0

func (s *PlanServiceOp) OrganizationList(organizationID string, opts *ListOptions) ([]Plan, *Response, error)

OrganizationList method returns plans available in an organization

func (*PlanServiceOp) ProjectList added in v0.6.0

func (s *PlanServiceOp) ProjectList(projectID string, opts *ListOptions) ([]Plan, *Response, error)

ProjectList method returns plans available in a project

type Port added in v0.2.0

type Port struct {
	*Href `json:",inline"`

	// ID of the Port
	ID string `json:"id"`

	// Type is either "NetworkBondPort" for bond ports or "NetworkPort" for
	// bondable ethernet ports
	Type string `json:"type"`

	// Name of the interface for this port (such as "bond0" or "eth0")
	Name string `json:"name"`

	// Data about the port
	Data PortData `json:"data,omitempty"`

	// Indicates whether or not the bond can be broken on the port (when applicable).
	DisbondOperationSupported bool `json:"disbond_operation_supported,omitempty"`

	// NetworkType is either of layer2-bonded, layer2-individual, layer3,
	// hybrid, hybrid-bonded
	NetworkType string `json:"network_type,omitempty"`

	// NativeVirtualNetwork is the Native VLAN attached to the port
	// <https://metal.equinix.com/developers/docs/layer2-networking/native-vlan>
	NativeVirtualNetwork *VirtualNetwork `json:"native_virtual_network,omitempty"`

	// VLANs attached to the port
	AttachedVirtualNetworks []VirtualNetwork `json:"virtual_networks,omitempty"`

	// Bond details for ports with a NetworkPort type
	Bond *BondData `json:"bond,omitempty"`
}

Port is a hardware port associated with a reserved or instantiated hardware device.

type PortAssignRequest added in v0.2.0

type PortAssignRequest struct {
	// PortID of the Port
	//
	// Deprecated: this is redundant to the portID parameter in request
	// functions. This is kept for use by deprecated DevicePortServiceOps
	// methods.
	PortID string `json:"id,omitempty"`

	VirtualNetworkID string `json:"vnid"`
}

type PortData added in v0.2.0

type PortData struct {
	// MAC address is set for NetworkPort ports
	MAC string `json:"mac,omitempty"`

	// Bonded is true for NetworkPort ports in a bond and NetworkBondPort ports
	// that are active
	Bonded bool `json:"bonded"`
}

type PortService added in v0.7.0

type PortService interface {
	Assign(string, string) (*Port, *Response, error)
	Unassign(string, string) (*Port, *Response, error)
	AssignNative(string, string) (*Port, *Response, error)
	UnassignNative(string) (*Port, *Response, error)
	Bond(string, bool) (*Port, *Response, error)
	Disbond(string, bool) (*Port, *Response, error)
	ConvertToLayerTwo(string) (*Port, *Response, error)
	ConvertToLayerThree(string, []AddressRequest) (*Port, *Response, error)
	Get(string, *GetOptions) (*Port, *Response, error)
}

PortService handles operations on a port

type PortServiceOp added in v0.7.0

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

func (*PortServiceOp) Assign added in v0.7.0

func (i *PortServiceOp) Assign(portID, vlanID string) (*Port, *Response, error)

Assign adds a VLAN to a port

func (*PortServiceOp) AssignNative added in v0.7.0

func (i *PortServiceOp) AssignNative(portID, vlanID string) (*Port, *Response, error)

AssignNative assigns a virtual network to the port as a "native VLAN" The VLAN being assigned MUST first be added as a vlan using Assign() before you may assign it as the native VLAN

func (*PortServiceOp) Bond added in v0.7.0

func (i *PortServiceOp) Bond(portID string, bulkEnable bool) (*Port, *Response, error)

Bond enables bonding for one or all ports

func (*PortServiceOp) ConvertToLayerThree added in v0.7.0

func (i *PortServiceOp) ConvertToLayerThree(portID string, ips []AddressRequest) (*Port, *Response, error)

ConvertToLayerThree converts a bond port to Layer 3. VLANs must first be unassigned.

func (*PortServiceOp) ConvertToLayerTwo added in v0.7.0

func (i *PortServiceOp) ConvertToLayerTwo(portID string) (*Port, *Response, error)

ConvertToLayerTwo converts a bond port to Layer 2. IP assignments of the port will be removed.

portID is the UUID of a Bonding Port

func (*PortServiceOp) Disbond added in v0.7.0

func (i *PortServiceOp) Disbond(portID string, bulkEnable bool) (*Port, *Response, error)

Disbond disables bonding for one or all ports

func (*PortServiceOp) Get added in v0.7.0

func (s *PortServiceOp) Get(portID string, opts *GetOptions) (*Port, *Response, error)

Get returns a port by id

func (*PortServiceOp) Unassign added in v0.7.0

func (i *PortServiceOp) Unassign(portID, vlanID string) (*Port, *Response, error)

Unassign removes a VLAN from the port

func (*PortServiceOp) UnassignNative added in v0.7.0

func (i *PortServiceOp) UnassignNative(portID string) (*Port, *Response, error)

UnassignNative removes native VLAN from the supplied port

type PriceMap added in v0.2.0

type PriceMap map[string]map[string]float64

PriceMap is a map of [location][plan]-> float Price

type Pricing

type Pricing struct {
	Hour  float32 `json:"hour,omitempty"`
	Month float32 `json:"month,omitempty"`
}

Pricing - the pricing options on a plan

func (Pricing) String

func (p Pricing) String() string

type Project

type Project struct {
	ID              string        `json:"id"`
	Name            string        `json:"name,omitempty"`
	Organization    Organization  `json:"organization,omitempty"`
	Created         string        `json:"created_at,omitempty"`
	Updated         string        `json:"updated_at,omitempty"`
	Users           []User        `json:"members,omitempty"`
	Devices         []Device      `json:"devices,omitempty"`
	SSHKeys         []SSHKey      `json:"ssh_keys,omitempty"`
	URL             string        `json:"href,omitempty"`
	PaymentMethod   PaymentMethod `json:"payment_method,omitempty"`
	BackendTransfer bool          `json:"backend_transfer_enabled"`
}

Project represents an Equinix Metal project

func (Project) String

func (p Project) String() string

type ProjectCreateRequest

type ProjectCreateRequest struct {
	Name            string `json:"name"`
	PaymentMethodID string `json:"payment_method_id,omitempty"`
	OrganizationID  string `json:"organization_id,omitempty"`
}

ProjectCreateRequest type used to create an Equinix Metal project

func (ProjectCreateRequest) String

func (p ProjectCreateRequest) String() string

type ProjectIPService added in v0.2.0

type ProjectIPService interface {
	Get(reservationID string, getOpt *GetOptions) (*IPAddressReservation, *Response, error)
	List(projectID string, opts *ListOptions) ([]IPAddressReservation, *Response, error)
	// Deprecated Use Create instead of Request
	Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error)
	Create(projectID string, ipReservationReq *IPReservationCreateRequest) (*IPAddressReservation, *Response, error)
	Delete(ipReservationID string) (*Response, error)
	// Deprecated Use Delete instead of Remove
	Remove(ipReservationID string) (*Response, error)
	Update(assignmentID string, updateRequest *IPAddressUpdateRequest, opt *GetOptions) (*IPAddressReservation, *Response, error)
	AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error)
}

ProjectIPService handles reservation of IP address blocks for a project.

type ProjectIPServiceOp added in v0.2.0

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

ProjectIPServiceOp is interface for IP assignment methods.

func (*ProjectIPServiceOp) AvailableAddresses added in v0.2.0

func (i *ProjectIPServiceOp) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error)

AvailableAddresses lists addresses available from a reserved block

func (*ProjectIPServiceOp) Create added in v0.23.0

func (i *ProjectIPServiceOp) Create(projectID string, ipReservationReq *IPReservationCreateRequest) (*IPAddressReservation, *Response, error)

Create creates a request for more IP space for a project in order to have additional IP addresses to assign to devices.

func (*ProjectIPServiceOp) Delete added in v0.23.0

func (i *ProjectIPServiceOp) Delete(ipReservationID string) (*Response, error)

Delete removes the requests for specific IP within a project

func (*ProjectIPServiceOp) Get added in v0.2.0

func (i *ProjectIPServiceOp) Get(reservationID string, opts *GetOptions) (*IPAddressReservation, *Response, error)

Get returns reservation by ID.

func (*ProjectIPServiceOp) List added in v0.2.0

func (i *ProjectIPServiceOp) List(projectID string, opts *ListOptions) ([]IPAddressReservation, *Response, error)

List provides a list of IP resevations for a single project. opts be filtered to limit the type of reservations returned: opts.Filter("type", "vrf")

func (*ProjectIPServiceOp) Remove added in v0.2.0

func (i *ProjectIPServiceOp) Remove(ipReservationID string) (*Response, error)

Remove removes an IP reservation from the project. Deprecated: Use Delete instead.

func (*ProjectIPServiceOp) Request deprecated added in v0.2.0

func (i *ProjectIPServiceOp) Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error)

Request requests more IP space for a project in order to have additional IP addresses to assign to devices.

Deprecated: Use Create instead.

func (*ProjectIPServiceOp) Update added in v0.22.0

func (i *ProjectIPServiceOp) Update(reservationID string, updateRequest *IPAddressUpdateRequest, opts *GetOptions) (*IPAddressReservation, *Response, error)

Update updates an existing IP reservation.

type ProjectService

type ProjectService interface {
	List(listOpt *ListOptions) ([]Project, *Response, error)
	Get(string, *GetOptions) (*Project, *Response, error)
	Create(*ProjectCreateRequest) (*Project, *Response, error)
	Update(string, *ProjectUpdateRequest) (*Project, *Response, error)
	Delete(string) (*Response, error)
	ListBGPSessions(projectID string, listOpt *ListOptions) ([]BGPSession, *Response, error)
	DiscoverBGPSessions(projectID string, getOpt *GetOptions) (*BGPDiscoverResponse, *Response, error)
	ListEvents(string, *ListOptions) ([]Event, *Response, error)
	ListSSHKeys(projectID string, searchOpt *SearchOptions) ([]SSHKey, *Response, error)
}

ProjectService interface defines available project methods

type ProjectServiceOp

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

ProjectServiceOp implements ProjectService

func (*ProjectServiceOp) Create

func (s *ProjectServiceOp) Create(createRequest *ProjectCreateRequest) (*Project, *Response, error)

Create creates a new project

func (*ProjectServiceOp) Delete

func (s *ProjectServiceOp) Delete(projectID string) (*Response, error)

Delete deletes a project

func (*ProjectServiceOp) DiscoverBGPSessions added in v0.23.0

func (p *ProjectServiceOp) DiscoverBGPSessions(projectID string, opts *GetOptions) (*BGPDiscoverResponse, *Response, error)

Discover refreshes BGP session status

func (*ProjectServiceOp) Get

func (s *ProjectServiceOp) Get(projectID string, opts *GetOptions) (*Project, *Response, error)

Get returns a project by id

func (*ProjectServiceOp) List

func (s *ProjectServiceOp) List(opts *ListOptions) (projects []Project, resp *Response, err error)

List returns the user's projects

func (*ProjectServiceOp) ListBGPSessions added in v0.2.0

func (s *ProjectServiceOp) ListBGPSessions(projectID string, opts *ListOptions) (bgpSessions []BGPSession, resp *Response, err error)

ListBGPSessions returns all BGP Sessions associated with the project

func (*ProjectServiceOp) ListEvents added in v0.2.0

func (s *ProjectServiceOp) ListEvents(projectID string, listOpt *ListOptions) ([]Event, *Response, error)

ListEvents returns list of project events

func (*ProjectServiceOp) ListSSHKeys added in v0.3.0

func (s *ProjectServiceOp) ListSSHKeys(projectID string, opts *SearchOptions) (sshKeys []SSHKey, resp *Response, err error)

ListSSHKeys returns all SSH Keys associated with the project

func (*ProjectServiceOp) Update

func (s *ProjectServiceOp) Update(id string, updateRequest *ProjectUpdateRequest) (*Project, *Response, error)

Update updates a project

type ProjectUpdateRequest

type ProjectUpdateRequest struct {
	Name            *string `json:"name,omitempty"`
	PaymentMethodID *string `json:"payment_method_id,omitempty"`
	BackendTransfer *bool   `json:"backend_transfer_enabled,omitempty"`
}

ProjectUpdateRequest type used to update an Equinix Metal project

func (ProjectUpdateRequest) String

func (p ProjectUpdateRequest) String() string

type ProjectVirtualNetworkService added in v0.2.0

type ProjectVirtualNetworkService interface {
	List(projectID string, opts *ListOptions) (*VirtualNetworkListResponse, *Response, error)
	Create(*VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error)
	Get(string, *GetOptions) (*VirtualNetwork, *Response, error)
	Delete(virtualNetworkID string) (*Response, error)
}

DevicePortService handles operations on a port which belongs to a particular device

type ProjectVirtualNetworkServiceOp added in v0.2.0

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

func (*ProjectVirtualNetworkServiceOp) Create added in v0.2.0

func (*ProjectVirtualNetworkServiceOp) Delete added in v0.2.0

func (i *ProjectVirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error)

func (*ProjectVirtualNetworkServiceOp) Get added in v0.2.0

func (*ProjectVirtualNetworkServiceOp) List added in v0.2.0

type QueryAppender added in v0.6.0

type QueryAppender interface {
	WithQuery(path string) string // we use this in all List functions (urlQuery)
	GetPage() int                 // we use this in List
	Including(...string)          // we use this in Device List to add facility
	Excluding(...string)
}

type Rate

type Rate struct {
	RequestLimit      int       `json:"request_limit"`
	RequestsRemaining int       `json:"requests_remaining"`
	Reset             Timestamp `json:"rate_reset"`
}

Rate provides the API request rate limit details

func (Rate) String

func (r Rate) String() string

type ReservationPricing added in v0.26.0

type ReservationPricing struct {
	AnnualReservationPricing
	Metros MetroPricing
}

ReservationPricing - The reserved pricing for a plan

func (ReservationPricing) String added in v0.26.0

func (r ReservationPricing) String() string

func (*ReservationPricing) UnmarshalJSON added in v0.26.0

func (r *ReservationPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON - Custom unmarshal function to set up the ReservationPricing object

type Response

type Response struct {
	*http.Response
	Rate
}

Response is the http response from api calls

type SSHKey

type SSHKey struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Key         string `json:"key"`
	FingerPrint string `json:"fingerprint"`
	Created     string `json:"created_at"`
	Updated     string `json:"updated_at"`
	Owner       Href
	URL         string `json:"href,omitempty"`
}

SSHKey represents a user's ssh key

func (SSHKey) String

func (s SSHKey) String() string

type SSHKeyCreateRequest

type SSHKeyCreateRequest struct {
	Label     string `json:"label"`
	Key       string `json:"key"`
	ProjectID string `json:"-"`
}

SSHKeyCreateRequest type used to create an ssh key

func (SSHKeyCreateRequest) String

func (s SSHKeyCreateRequest) String() string

type SSHKeyService

type SSHKeyService interface {
	List() ([]SSHKey, *Response, error)
	ProjectList(string) ([]SSHKey, *Response, error)
	Get(string, *GetOptions) (*SSHKey, *Response, error)
	Create(*SSHKeyCreateRequest) (*SSHKey, *Response, error)
	Update(string, *SSHKeyUpdateRequest) (*SSHKey, *Response, error)
	Delete(string) (*Response, error)
}

SSHKeyService interface defines available device methods

type SSHKeyServiceOp

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

SSHKeyServiceOp implements SSHKeyService

func (*SSHKeyServiceOp) Create

func (s *SSHKeyServiceOp) Create(createRequest *SSHKeyCreateRequest) (*SSHKey, *Response, error)

Create creates a new ssh key

func (*SSHKeyServiceOp) Delete

func (s *SSHKeyServiceOp) Delete(sshKeyID string) (*Response, error)

Delete deletes an ssh key

func (*SSHKeyServiceOp) Get

func (s *SSHKeyServiceOp) Get(sshKeyID string, opts *GetOptions) (*SSHKey, *Response, error)

Get returns an ssh key by id

func (*SSHKeyServiceOp) List

func (s *SSHKeyServiceOp) List() ([]SSHKey, *Response, error)

List returns a user's ssh keys

func (*SSHKeyServiceOp) ProjectList added in v0.2.0

func (s *SSHKeyServiceOp) ProjectList(projectID string) ([]SSHKey, *Response, error)

ProjectList lists ssh keys of a project Deprecated: Use ProjectServiceOp.ListSSHKeys

func (*SSHKeyServiceOp) Update

func (s *SSHKeyServiceOp) Update(id string, updateRequest *SSHKeyUpdateRequest) (*SSHKey, *Response, error)

Update updates an ssh key

type SSHKeyUpdateRequest

type SSHKeyUpdateRequest struct {
	Label *string `json:"label,omitempty"`
	Key   *string `json:"key,omitempty"`
}

SSHKeyUpdateRequest type used to update an ssh key

func (SSHKeyUpdateRequest) String

func (s SSHKeyUpdateRequest) String() string

type SearchOptions added in v0.3.0

type SearchOptions = GetOptions

type ServerInfo added in v0.2.0

type ServerInfo struct {
	Facility  string `json:"facility,omitempty"`
	Metro     string `json:"metro,omitempty"`
	Plan      string `json:"plan,omitempty"`
	Quantity  int    `json:"quantity,omitempty"`
	Available bool   `json:"available,omitempty"`
}

ServerInfo struct

type SnapshotPolicy

type SnapshotPolicy struct {
	ID                string `json:"id"`
	Href              string `json:"href"`
	SnapshotFrequency string `json:"snapshot_frequency,omitempty"`
	SnapshotCount     int    `json:"snapshot_count,omitempty"`
}

SnapshotPolicy used to execute actions on volume

type SocialAccounts added in v0.17.0

type SocialAccounts struct {
	GitHub   string `json:"github,omitempty"`
	LinkedIn string `json:"linkedin,omitempty"`
	Twitter  string `json:"twitter,omitempty"`
	Gravatar string `json:"gravatar,omitempty"`
	Keybase  string `json:"keybase,omitempty"`
}

SocialAccounts are social usernames or urls

type Specs

type Specs struct {
	Cpus     []*Cpus   `json:"cpus,omitempty"`
	Memory   *Memory   `json:"memory,omitempty"`
	Drives   []*Drives `json:"drives,omitempty"`
	Nics     []*Nics   `json:"nics,omitempty"`
	Features *Features `json:"features,omitempty"`
}

Specs - the server specs for a plan

func (Specs) String

func (s Specs) String() string

type SpotMarketRequest added in v0.2.0

type SpotMarketRequest struct {
	SpotMarketRequestCreateRequest
	ID         string     `json:"id"`
	Devices    []Device   `json:"devices"`
	Facilities []Facility `json:"facilities,omitempty"`
	Metro      *Metro     `json:"metro,omitempty"`
	Project    Project    `json:"project"`
	Href       string     `json:"href"`
	Plan       Plan       `json:"plan"`
}

type SpotMarketRequestCreateRequest added in v0.2.0

type SpotMarketRequestCreateRequest struct {
	DevicesMax  int        `json:"devices_max"`
	DevicesMin  int        `json:"devices_min"`
	EndAt       *Timestamp `json:"end_at,omitempty"`
	FacilityIDs []string   `json:"facilities,omitempty"`
	Metro       string     `json:"metro,omitempty"`
	MaxBidPrice float64    `json:"max_bid_price"`

	Parameters SpotMarketRequestInstanceParameters `json:"instance_parameters"`
}

type SpotMarketRequestInstanceParameters added in v0.2.0

type SpotMarketRequestInstanceParameters struct {
	AlwaysPXE       bool       `json:"always_pxe,omitempty"`
	IPXEScriptURL   string     `json:"ipxe_script_url,omitempty"`
	BillingCycle    string     `json:"billing_cycle"`
	CustomData      string     `json:"customdata,omitempty"`
	Description     string     `json:"description,omitempty"`
	Features        []string   `json:"features,omitempty"`
	Hostname        string     `json:"hostname,omitempty"`
	Hostnames       []string   `json:"hostnames,omitempty"`
	Locked          bool       `json:"locked,omitempty"`
	OperatingSystem string     `json:"operating_system"`
	Plan            string     `json:"plan"`
	ProjectSSHKeys  []string   `json:"project_ssh_keys,omitempty"`
	Tags            []string   `json:"tags"`
	TerminationTime *Timestamp `json:"termination_time,omitempty"`
	UserSSHKeys     []string   `json:"user_ssh_keys,omitempty"`
	UserData        string     `json:"userdata"`
}

type SpotMarketRequestService added in v0.2.0

type SpotMarketRequestServiceOp added in v0.2.0

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

func (*SpotMarketRequestServiceOp) Create added in v0.2.0

func (*SpotMarketRequestServiceOp) Delete added in v0.2.0

func (s *SpotMarketRequestServiceOp) Delete(id string, forceDelete bool) (*Response, error)

func (*SpotMarketRequestServiceOp) Get added in v0.2.0

func (*SpotMarketRequestServiceOp) List added in v0.2.0

type SpotMarketService added in v0.2.0

type SpotMarketService interface {
	// Prices gets current spot market prices by facility.
	//
	// Deprecated: Use PricesByFacility
	Prices() (PriceMap, *Response, error)

	// PricesByFacility gets current spot market prices by facility. The map is
	// indexed by facility code and then plan name.
	PricesByFacility() (PriceMap, *Response, error)

	// PricesByMetro gets current spot market prices by metro. The map is
	// indexed by metro code and then plan name.
	PricesByMetro() (PriceMap, *Response, error)
}

SpotMarketService expooses Spot Market methods

type SpotMarketServiceOp added in v0.2.0

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

SpotMarketServiceOp implements SpotMarketService

func (*SpotMarketServiceOp) Prices deprecated added in v0.2.0

func (s *SpotMarketServiceOp) Prices() (PriceMap, *Response, error)

Prices gets current spot market prices by facility.

Deprecated: Use PricesByFacility which this function thinly wraps.

func (*SpotMarketServiceOp) PricesByFacility added in v0.12.0

func (s *SpotMarketServiceOp) PricesByFacility() (PriceMap, *Response, error)

PricesByFacility gets current spot market prices by facility. The map is indexed by facility code and then plan name.

price := client.SpotMarket.PricesByFacility()["ny5"]["c3.medium.x86"]

func (*SpotMarketServiceOp) PricesByMetro added in v0.12.0

func (s *SpotMarketServiceOp) PricesByMetro() (PriceMap, *Response, error)

PricesByMetro gets current spot market prices by metro. The map is indexed by metro code and then plan name.

price := client.SpotMarket.PricesByMetro()["sv"]["c3.medium.x86"]

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type TwoFactorAuthService added in v0.2.0

type TwoFactorAuthService interface {
	EnableApp(string) (*Response, error)
	DisableApp(string) (*Response, error)
	EnableSms(string) (*Response, error)
	DisableSms(string) (*Response, error)
	ReceiveSms() (*Response, error)
	SeedApp() (string, *Response, error)
}

TwoFactorAuthService interface defines available two factor authentication functions

type TwoFactorAuthServiceOp added in v0.2.0

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

TwoFactorAuthServiceOp implements TwoFactorAuthService

func (*TwoFactorAuthServiceOp) DisableApp added in v0.2.0

func (s *TwoFactorAuthServiceOp) DisableApp(token string) (resp *Response, err error)

DisableApp function disables two factor auth using

func (*TwoFactorAuthServiceOp) DisableSms added in v0.2.0

func (s *TwoFactorAuthServiceOp) DisableSms(token string) (resp *Response, err error)

DisableSms function disables two factor auth using

func (*TwoFactorAuthServiceOp) EnableApp added in v0.2.0

func (s *TwoFactorAuthServiceOp) EnableApp(token string) (resp *Response, err error)

EnableApp function enables two factor auth using authenticatior app

func (*TwoFactorAuthServiceOp) EnableSms added in v0.2.0

func (s *TwoFactorAuthServiceOp) EnableSms(token string) (resp *Response, err error)

EnableSms function enables two factor auth using sms

func (*TwoFactorAuthServiceOp) ReceiveSms added in v0.2.0

func (s *TwoFactorAuthServiceOp) ReceiveSms() (resp *Response, err error)

ReceiveSms orders the auth service to issue an SMS token

func (*TwoFactorAuthServiceOp) SeedApp added in v0.2.0

func (s *TwoFactorAuthServiceOp) SeedApp() (otpURI string, resp *Response, err error)

SeedApp orders the auth service to issue a token via google authenticator

type User

type User struct {
	ID               string          `json:"id"`
	ShortID          string          `json:"short_id"`
	FirstName        string          `json:"first_name,omitempty"`
	LastName         string          `json:"last_name,omitempty"`
	FullName         string          `json:"full_name,omitempty"`
	Email            string          `json:"email,omitempty"`
	SocialAccounts   *SocialAccounts `json:"social_accounts,omitempty"`
	CustomData       interface{}     `json:"customdata,omitempty"`
	OptIn            *bool           `json:"opt_in,omitempty"`
	OptInUpdatedAt   string          `json:"opt_in_updated_at,omitempty"`
	DefaultProjectID *string         `json:"default_project_id,omitempty"`
	NumberOfSSHKeys  int             `json:"number_of_ssh_keys,omitempty"`
	Language         *string         `json:"language,omitempty"`
	// MailingAddress TODO: format
	VerificationStage string `json:"verification_stage,omitempty"`
	MaxProjects       *int   `json:"max_projects,omitempty"`
	LastLogin         string `json:"last_login_at,omitempty"`

	// Features effect the behavior of the API and UI
	Features []string `json:"features,omitempty"`

	// TwoFactorAuth is the form of two factor auth, "app" or "sms"
	// Renamed from TwoFactor in packngo v0.16 to match API
	TwoFactorAuth         string  `json:"two_factor_auth,omitempty"`
	DefaultOrganizationID string  `json:"default_organization_id,omitempty"`
	AvatarURL             string  `json:"avatar_url,omitempty"`
	AvatarThumbURL        string  `json:"avatar_thumb_url,omitempty"`
	Created               string  `json:"created_at,omitempty"`
	Updated               string  `json:"updated_at,omitempty"`
	TimeZone              string  `json:"timezone,omitempty"`
	Emails                []Email `json:"emails,omitempty"`
	PhoneNumber           string  `json:"phone_number,omitempty"`
	URL                   string  `json:"href,omitempty"`
	Restricted            bool    `json:"restricted,omitempty"`
	Staff                 bool    `json:"staff,omitempty"`
}

User represents an Equinix Metal user

func (User) String

func (u User) String() string

type UserCreateRequest added in v0.27.0

type UserCreateRequest struct {
	InvitationID string         `json:"invitation_id,omitempty"`
	Nonce        string         `json:"nonce,omitempty"`
	FirstName    string         `json:"first_name,omitempty"`
	LastName     string         `json:"last_name,omitempty"`
	Password     string         `json:"password,omitempty"`
	Customdata   *interface{}   `json:"customdata,omitempty"`
	Emails       []EmailRequest `json:"emails,omitempty"`
}

UserCreateRequest struct for UserService.Create

type UserLite added in v0.20.0

type UserLite struct {
	*Href          `json:",inline"`
	ID             string     `json:"id"`
	ShortID        string     `json:"short_id"`
	FirstName      string     `json:"first_name,omitempty"`
	LastName       string     `json:"last_name,omitempty"`
	FullName       string     `json:"full_name,omitempty"`
	Email          string     `json:"email,omitempty"`
	CreatedAt      *Timestamp `json:"created_at,omitempty"`
	UpdatedAt      *Timestamp `json:"updated_at,omitempty"`
	Level          string     `json:"level,omitempty"`
	AvatarThumbURL string     `json:"avatar_thumb_url,omitempty"`
}

UserLite is an abbreviated listing of an Equinix Metal user

type UserService

type UserService interface {
	Create(*UserCreateRequest) (*User, *Response, error)
	Current() (*User, *Response, error)
	List(*ListOptions) ([]User, *Response, error)
	Get(string, *GetOptions) (*User, *Response, error)
	Update(*UserUpdateRequest) (*User, *Response, error)
}

UserService interface defines available user methods

type UserServiceOp

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

UserServiceOp implements UserService

func (*UserServiceOp) Create added in v0.27.0

func (s *UserServiceOp) Create(createRequest *UserCreateRequest) (*User, *Response, error)

Create a User with the given UserCreateRequest. New user VerificationStage will be AccountCreated, unless UserCreateRequest contains an valid InvitationID and Nonce in which case the VerificationStage will be Verified.

func (*UserServiceOp) Current added in v0.2.0

func (s *UserServiceOp) Current() (*User, *Response, error)

Returns the user object for the currently logged-in user.

func (*UserServiceOp) Get

func (s *UserServiceOp) Get(userID string, opts *GetOptions) (*User, *Response, error)

func (*UserServiceOp) List added in v0.2.0

func (s *UserServiceOp) List(opts *ListOptions) (users []User, resp *Response, err error)

Get method gets a user by userID

func (*UserServiceOp) Update added in v0.17.0

func (s *UserServiceOp) Update(updateRequest *UserUpdateRequest) (*User, *Response, error)

Update updates the current user

type UserUpdateRequest added in v0.17.0

type UserUpdateRequest struct {
	FirstName   *string      `json:"first_name,omitempty"`
	LastName    *string      `json:"last_name,omitempty"`
	PhoneNumber *string      `json:"phone_number,omitempty"`
	Timezone    *string      `json:"timezone,omitempty"`
	Password    *string      `json:"password,omitempty"`
	Avatar      *string      `json:"avatar,omitempty"`
	Customdata  *interface{} `json:"customdata,omitempty"`
}

UserUpdateRequest struct for UserService.Update

type VCCreateRequest added in v0.6.0

type VCCreateRequest struct {
	// VirtualNetworkID of the Virtual Network to connect to the Virtual Circuit (required when VRFID is not specified)
	VirtualNetworkID string `json:"vnid,omitempty"`
	// VRFID of the VRF to connect to the Virtual Circuit (required when VirtualNetworkID is not specified)
	VRFID string `json:"vrf_id,omitempty"`
	// PeerASN (optional, required with VRFID) The BGP ASN of the device the switch will peer with. Can be the used across several VCs, but cannot be the same as the local_asn.
	PeerASN int `json:"peer_asn,omitempty"`
	// Subnet (Required for VRF) A subnet from one of the IP blocks associated with the VRF that we
	// will help create an IP reservation for. Can only be either a /30 or /31.
	//  * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip.
	//  * For a /30 block, it will have four IP
	// addresses, but the first and last IP addresses are not usable. We will
	// default to the first usable IP address for the metal_ip.
	Subnet string `json:"subnet,omitempty"`
	// MetalIP (optional, required with VRFID) The IP address that’s set as “our” IP that is
	// configured on the rack_local_vlan SVI. Will default to the first usable
	// IP in the subnet.
	MetalIP string `json:"metal_ip,omitempty"`
	// CustomerIP (optional, requires VRFID) The IP address set as the customer IP which the CSR
	// switch will peer with. Will default to the other usable IP in the subnet.
	CustomerIP string `json:"customer_ip,omitempty"`
	// MD5 (optional, requires VRFID) The password that can be set for the VRF BGP peer
	MD5         string   `json:"md5,omitempty"`
	NniVLAN     int      `json:"nni_vlan,omitempty"`
	Name        string   `json:"name,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`

	// Speed is a bps representation of the VirtualCircuit throughput. This is informational only, the field is a user-controlled description of the speed. It may be presented as a whole number with a bps, mpbs, or gbps suffix (or the respective initial).
	Speed string `json:"speed,omitempty"`
}

type VCStatus added in v0.23.0

type VCStatus string
const (

	// VC is being create but not ready yet
	VCStatusPending VCStatus = "pending"

	// VC is ready with a VLAN
	VCStatusActive VCStatus = "active"

	// VC is ready without a VLAN
	VCStatusWaiting VCStatus = "waiting_on_customer_vlan"

	// VC is being deleted
	VCStatusDeleting VCStatus = "deleting"

	// not sure what the following states mean, or whether they exist
	// someone from the API side could check
	VCStatusActivating         VCStatus = "activating"
	VCStatusDeactivating       VCStatus = "deactivating"
	VCStatusActivationFailed   VCStatus = "activation_failed"
	VCStatusDeactivationFailed VCStatus = "dactivation_failed"
)

type VCUpdateRequest added in v0.6.0

type VCUpdateRequest struct {
	Name             *string   `json:"name,omitempty"`
	Tags             *[]string `json:"tags,omitempty"`
	Description      *string   `json:"description,omitempty"`
	VirtualNetworkID *string   `json:"vnid,omitempty"`

	// Speed is a bps representation of the VirtualCircuit throughput. This is informational only, the field is a user-controlled description of the speed. It may be presented as a whole number with a bps, mpbs, or gbps suffix (or the respective initial).
	Speed string `json:"speed,omitempty"`
}

type VLANAssignment added in v0.19.0

type VLANAssignment struct {
	// ID of the assignment
	ID string `json:"id,omitempty"`

	CreatedAt Timestamp `json:"created_at,omitempty"`
	UpdatedAt Timestamp `json:"updated_at,omitempty"`

	// Native indicates the VLAN is the native VLAN on the port and packets for this vlan will be untagged
	Native bool `json:"native,omitempty"`

	// State of the assignment
	State VLANAssignmentState `json:"state,omitempty"`

	// VLAN is the VirtualNetwork.VXLAN of the VLAN the assignment was made to
	VLAN int `json:"vlan,omitempty"`

	// Port is a reference to the Port the assignment was made on
	Port *Port `json:"port,omitempty"`

	// VirtualNetwork is a reference to the VLAN the assignment was made to
	VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"`
}

VLANAssignment struct for VLANAssignmentService.Get represents a port VLAN assignment that has been enacted

type VLANAssignmentBatch added in v0.19.0

type VLANAssignmentBatch struct {
	ID              string                   `json:"id,omitempty"`
	ErrorMessages   []string                 `json:"error_messages,omitempty"`
	Quantity        int                      `json:"quantity,omitempty"`
	State           VLANAssignmentBatchState `json:"state,omitempty"`
	CreatedAt       Timestamp                `json:"created_at,omitempty"`
	UpdatedAt       Timestamp                `json:"updated_at,omitempty"`
	Port            *Port                    `json:"port,omitempty"`
	Project         *Project                 `json:"project,omitempty"`
	VLANAssignments []BatchedVLANAssignment  `json:"vlan_assignments,omitempty"`
}

VLANAssignmentBatch struct for VLANAssignmentBatch

type VLANAssignmentBatchCreateRequest added in v0.19.0

type VLANAssignmentBatchCreateRequest struct {
	VLANAssignments []VLANAssignmentCreateRequest `json:"vlan_assignments"`
}

VLANAssignmentBatchCreateRequest struct for VLANAssignmentBatch Create

type VLANAssignmentBatchState added in v0.19.0

type VLANAssignmentBatchState string
const (
	VLANAssignmentBatchQueued     VLANAssignmentBatchState = "queued"
	VLANAssignmentBatchInProgress VLANAssignmentBatchState = "in_progress"
	VLANAssignmentBatchCompleted  VLANAssignmentBatchState = "completed"
	VLANAssignmentBatchFailed     VLANAssignmentBatchState = "failed"
)

type VLANAssignmentCreateRequest added in v0.19.0

type VLANAssignmentCreateRequest struct {
	VLAN   string              `json:"vlan,omitempty"`
	State  VLANAssignmentState `json:"state,omitempty"`
	Native *bool               `json:"native,omitempty"`
}

VLANAssignmentCreateRequest struct for VLANAssignmentBatchCreateRequest

type VLANAssignmentService added in v0.19.0

VLANAssignmentService handles operations on a VLANAssignment

type VLANAssignmentServiceOp added in v0.19.0

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

func (*VLANAssignmentServiceOp) CreateBatch added in v0.19.0

Create creates VLANAssignmentBatch objects

func (*VLANAssignmentServiceOp) Get added in v0.19.0

func (s *VLANAssignmentServiceOp) Get(portID, assignmentID string, opts *GetOptions) (*VLANAssignment, *Response, error)

Get returns a VLANAssignment by id

func (*VLANAssignmentServiceOp) GetBatch added in v0.19.0

func (s *VLANAssignmentServiceOp) GetBatch(portID, batchID string, opts *GetOptions) (*VLANAssignmentBatch, *Response, error)

Get returns a VLANAssignmentBatch by id

func (*VLANAssignmentServiceOp) List added in v0.19.0

func (s *VLANAssignmentServiceOp) List(portID string, opts *ListOptions) (results []VLANAssignment, resp *Response, err error)

List returns VLANAssignment

func (*VLANAssignmentServiceOp) ListBatch added in v0.19.0

func (s *VLANAssignmentServiceOp) ListBatch(portID string, opts *ListOptions) (results []VLANAssignmentBatch, resp *Response, err error)

List returns VLANAssignmentBatches

type VLANAssignmentState added in v0.19.0

type VLANAssignmentState string
const (
	VLANAssignmentAssigned   VLANAssignmentState = "assigned"
	VLANAssignmentUnassigned VLANAssignmentState = "unassigned"
)

type VRF added in v0.23.0

type VRF struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	LocalASN    int      `json:"local_asn,omitempty"`
	IPRanges    []string `json:"ip_ranges,omitempty"`
	Project     *Project `json:"project,omitempty"`
	Metro       *Metro   `json:"metro,omitempty"`
	Href        string   `json:"href"`
	CreatedAt   string   `json:"created_at,omitempty"`
	UpdatedAt   string   `json:"updated_at,omitempty"`
}

type VRFCreateRequest added in v0.23.0

type VRFCreateRequest struct {
	//  Metro id or code
	Metro string `json:"metro"`

	// Name is the name of the VRF. It must be unique per project.
	Name string `json:"name"`

	// Description of the VRF to be created.
	Description string `json:"description"`

	// LocalASN is the ASN of the local network.
	LocalASN int `json:"local_asn,omitempty"`

	// IPRanges is a list of all IPv4 and IPv6 Ranges that will be available to
	// BGP Peers. IPv4 addresses must be /8 or smaller with a minimum size of
	// /29. IPv6 must be /56 or smaller with a minimum size of /64. Ranges must
	// not overlap other ranges within the VRF.
	IPRanges []string `json:"ip_ranges,omitempty"`
}

type VRFService added in v0.23.0

type VRFService interface {
	List(projectID string, opts *ListOptions) ([]VRF, *Response, error)
	Create(projectID string, input *VRFCreateRequest) (*VRF, *Response, error)
	Update(vrfID string, update *VRFUpdateRequest) (*VRF, *Response, error)
	Get(vrfID string, opts *GetOptions) (*VRF, *Response, error)
	ListIPs(vrfID string, opts *GetOptions) ([]IPAddressReservation, *Response, error)
	Delete(vrfID string) (*Response, error)
}

type VRFServiceOp added in v0.23.0

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

func (*VRFServiceOp) Create added in v0.23.0

func (s *VRFServiceOp) Create(projectID string, input *VRFCreateRequest) (*VRF, *Response, error)

func (*VRFServiceOp) Delete added in v0.23.0

func (s *VRFServiceOp) Delete(vrfID string) (*Response, error)

func (*VRFServiceOp) Get added in v0.23.0

func (s *VRFServiceOp) Get(vrfID string, opts *GetOptions) (*VRF, *Response, error)

func (*VRFServiceOp) List added in v0.23.0

func (s *VRFServiceOp) List(projectID string, opts *ListOptions) (vrfs []VRF, resp *Response, err error)

func (*VRFServiceOp) ListIPs added in v0.23.0

func (s *VRFServiceOp) ListIPs(vrfID string, opts *ListOptions) (ips []IPAddressReservation, resp *Response, err error)

func (*VRFServiceOp) Update added in v0.23.0

func (s *VRFServiceOp) Update(vrfID string, updateRequest *VRFUpdateRequest) (*VRF, *Response, error)

Update updates an existing VRF

type VRFUpdateRequest added in v0.23.0

type VRFUpdateRequest struct {
	// Name is the name of the VRF. It must be unique per project.
	Name *string `json:"name,omitempty"`

	// Description of the VRF to be created.
	Description *string `json:"description,omitempty"`

	// LocalASN is the ASN of the local network.
	LocalASN *int `json:"local_asn,omitempty"`

	// IPRanges is a list of all IPv4 and IPv6 Ranges that will be available to
	// BGP Peers. IPv4 addresses must be /8 or smaller with a minimum size of
	// /29. IPv6 must be /56 or smaller with a minimum size of /64. Ranges must
	// not overlap other ranges within the VRF.
	IPRanges *[]string `json:"ip_ranges,omitempty"`
}

type VirtualCircuit added in v0.6.0

type VirtualCircuit struct {
	ID          string `json:"id"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	// Speed of the VirtualCircuit in bps
	Speed          int             `json:"speed,omitempty"`
	Status         VCStatus        `json:"status,omitempty"`
	VNID           int             `json:"vnid,omitempty"`
	NniVNID        int             `json:"nni_vnid,omitempty"`
	NniVLAN        int             `json:"nni_vlan,omitempty"`
	Project        *Project        `json:"project,omitempty"`
	Port           *ConnectionPort `json:"port,omitempty"`
	VirtualNetwork *VirtualNetwork `json:"virtual_network,omitempty"`
	Tags           []string        `json:"tags,omitempty"`
	// VRF connected to the Virtual Circuit
	VRF *VRF `json:"vrf,omitempty"`

	// PeerASN (optional, required with VRFID) The BGP ASN of the device the switch will peer with. Can be the used across several VCs, but cannot be the same as the local_asn.
	PeerASN int `json:"peer_asn,omitempty"`

	// Subnet (returned with VRF) A subnet from one of the IP blocks associated with the VRF that we
	// will help create an IP reservation for. Can only be either a /30 or /31.
	//  * For a /31 block, it will only have two IP addresses, which will be used for the metal_ip and customer_ip.
	//  * For a /30 block, it will have four IP
	// addresses, but the first and last IP addresses are not usable. We will
	// default to the first usable IP address for the metal_ip.
	Subnet string `json:"subnet,omitempty"`

	// MetalIP (returned with VRF) The IP address that’s set as “our” IP that is
	// configured on the rack_local_vlan SVI. Will default to the first usable
	// IP in the subnet.
	MetalIP string `json:"metal_ip,omitempty"`

	// CustomerIP (returned with VRF) The IP address set as the customer IP which the CSR
	// switch will peer with. Will default to the other usable IP in the subnet.
	CustomerIP string `json:"customer_ip,omitempty"`

	// MD5 (returned with VRF) The password that can be set for the VRF BGP peer
	MD5 string `json:"md5,omitempty"`
}

type VirtualCircuitService added in v0.6.0

type VirtualCircuitServiceOp added in v0.6.0

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

func (*VirtualCircuitServiceOp) Create added in v0.6.0

func (s *VirtualCircuitServiceOp) Create(projectID, connID, portID string, request *VCCreateRequest, opts *GetOptions) (*VirtualCircuit, *Response, error)

func (*VirtualCircuitServiceOp) Delete added in v0.6.0

func (s *VirtualCircuitServiceOp) Delete(id string) (*Response, error)

func (*VirtualCircuitServiceOp) Events added in v0.6.0

func (s *VirtualCircuitServiceOp) Events(id string, opts *GetOptions) ([]Event, *Response, error)

func (*VirtualCircuitServiceOp) Get added in v0.6.0

func (*VirtualCircuitServiceOp) Update added in v0.6.0

type VirtualNetwork added in v0.2.0

type VirtualNetwork struct {
	ID           string    `json:"id"`
	Description  string    `json:"description,omitempty"` // TODO: field can be null
	VXLAN        int       `json:"vxlan,omitempty"`
	FacilityCode string    `json:"facility_code,omitempty"`
	MetroCode    string    `json:"metro_code,omitempty"`
	CreatedAt    string    `json:"created_at,omitempty"`
	Href         string    `json:"href"`
	Project      *Project  `json:"assigned_to,omitempty"`
	Facility     *Facility `json:"facility,omitempty"`
	Metro        *Metro    `json:"metro,omitempty"`
	Instances    []*Device `json:"instances,omitempty"`
}

type VirtualNetworkCreateRequest added in v0.2.0

type VirtualNetworkCreateRequest struct {
	// ProjectID of the project where the VLAN will be made available.
	ProjectID string `json:"project_id"`

	// Description is a user supplied description of the VLAN.
	Description string `json:"description"`

	// Facility in which to create the VLAN. Mutually exclusive with Metro.
	Facility string `json:"facility,omitempty"`

	// Metro in which to create the VLAN. Mutually exclusive with Facility.
	Metro string `json:"metro,omitempty"`

	// VXLAN is the VLAN ID. VXLAN may be specified when Metro is defined. It is remotely incremented otherwise. Must be unique per Metro.
	VXLAN int `json:"vxlan,omitempty"`
}

type VirtualNetworkListResponse added in v0.2.0

type VirtualNetworkListResponse struct {
	VirtualNetworks []VirtualNetwork `json:"virtual_networks"`
}

type Volume

type Volume struct {
	Attachments      []*VolumeAttachment `json:"attachments,omitempty"`
	BillingCycle     string              `json:"billing_cycle,omitempty"`
	Created          string              `json:"created_at,omitempty"`
	Description      string              `json:"description,omitempty"`
	Facility         *Facility           `json:"facility,omitempty"`
	Href             string              `json:"href,omitempty"`
	ID               string              `json:"id"`
	Locked           bool                `json:"locked,omitempty"`
	Name             string              `json:"name,omitempty"`
	Plan             *Plan               `json:"plan,omitempty"`
	Project          *Project            `json:"project,omitempty"`
	Size             int                 `json:"size,omitempty"`
	SnapshotPolicies []*SnapshotPolicy   `json:"snapshot_policies,omitempty"`
	State            string              `json:"state,omitempty"`
	Updated          string              `json:"updated_at,omitempty"`
}

Volume represents a volume

func (Volume) String

func (v Volume) String() string

type VolumeAttachment added in v0.2.0

type VolumeAttachment struct {
	Href   string `json:"href"`
	ID     string `json:"id"`
	Volume Volume `json:"volume"`
	Device Device `json:"device"`
}

VolumeAttachment is a type from Equinix Metal API

type VolumeAttachmentService added in v0.2.0

type VolumeAttachmentService interface {
	Get(string, *GetOptions) (*VolumeAttachment, *Response, error)
	Create(string, string) (*VolumeAttachment, *Response, error)
	Delete(string) (*Response, error)
}

VolumeAttachmentService defines attachment methdods

type VolumeAttachmentServiceOp added in v0.2.0

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

VolumeAttachmentServiceOp implements VolumeService

func (*VolumeAttachmentServiceOp) Create added in v0.2.0

func (v *VolumeAttachmentServiceOp) Create(volumeID, deviceID string) (*VolumeAttachment, *Response, error)

Create Attachment, i.e. attach volume to a device

func (*VolumeAttachmentServiceOp) Delete added in v0.2.0

func (v *VolumeAttachmentServiceOp) Delete(attachmentID string) (*Response, error)

Delete deletes attachment by id

func (*VolumeAttachmentServiceOp) Get added in v0.2.0

func (v *VolumeAttachmentServiceOp) Get(attachmentID string, opts *GetOptions) (*VolumeAttachment, *Response, error)

Get gets attachment by id

type VolumeCreateRequest

type VolumeCreateRequest struct {
	BillingCycle     string            `json:"billing_cycle"`
	Description      string            `json:"description,omitempty"`
	Locked           bool              `json:"locked,omitempty"`
	Size             int               `json:"size"`
	PlanID           string            `json:"plan_id"`
	FacilityID       string            `json:"facility_id"`
	SnapshotPolicies []*SnapshotPolicy `json:"snapshot_policies,omitempty"`
}

VolumeCreateRequest type used to create an Equinix Metal volume

func (VolumeCreateRequest) String

func (v VolumeCreateRequest) String() string

type VolumeService

type VolumeService interface {
	List(string, *ListOptions) ([]Volume, *Response, error)
	Get(string, *GetOptions) (*Volume, *Response, error)
	Update(string, *VolumeUpdateRequest) (*Volume, *Response, error)
	Delete(string) (*Response, error)
	Create(*VolumeCreateRequest, string) (*Volume, *Response, error)
	Lock(string) (*Response, error)
	Unlock(string) (*Response, error)
}

VolumeService interface defines available Volume methods

type VolumeServiceOp

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

VolumeServiceOp implements VolumeService

func (*VolumeServiceOp) Create

func (v *VolumeServiceOp) Create(createRequest *VolumeCreateRequest, projectID string) (*Volume, *Response, error)

Create creates a new volume for a project

func (*VolumeServiceOp) Delete

func (v *VolumeServiceOp) Delete(volumeID string) (*Response, error)

Delete deletes a volume

func (*VolumeServiceOp) Get

func (v *VolumeServiceOp) Get(volumeID string, opts *GetOptions) (*Volume, *Response, error)

Get returns a volume by id

func (*VolumeServiceOp) List added in v0.2.0

func (v *VolumeServiceOp) List(projectID string, opts *ListOptions) (volumes []Volume, resp *Response, err error)

List returns the volumes for a project

func (*VolumeServiceOp) Lock added in v0.2.0

func (v *VolumeServiceOp) Lock(id string) (*Response, error)

Lock sets a volume to "locked"

func (*VolumeServiceOp) Unlock added in v0.2.0

func (v *VolumeServiceOp) Unlock(id string) (*Response, error)

Unlock sets a volume to "unlocked"

func (*VolumeServiceOp) Update

func (v *VolumeServiceOp) Update(id string, updateRequest *VolumeUpdateRequest) (*Volume, *Response, error)

Update updates a volume

type VolumeUpdateRequest

type VolumeUpdateRequest struct {
	Description  *string `json:"description,omitempty"`
	PlanID       *string `json:"plan_id,omitempty"`
	Size         *int    `json:"size,omitempty"`
	BillingCycle *string `json:"billing_cycle,omitempty"`
}

VolumeUpdateRequest type used to update an Equinix Metal volume

func (VolumeUpdateRequest) String

func (v VolumeUpdateRequest) String() string

Directories

Path Synopsis
Package metadata implements the Equinix Metal Metadata API available to Equinix Metal devices at https://metadata.platformequinix.com/metadata.
Package metadata implements the Equinix Metal Metadata API available to Equinix Metal devices at https://metadata.platformequinix.com/metadata.

Jump to

Keyboard shortcuts

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