latitude

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: BSD-3-Clause, MIT Imports: 17 Imported by: 3

README

latitudesh-go

GoDoc

latitudesh-go is a Go client library for accessing the Latitude.sh API.

You can view the API docs here: https://docs.latitude.sh/reference

Install

go get github.com/latitudesh/latitudesh-go@vX.Y.Z

where X.Y.Z is the version you need.

Usage

package main

import (
    latitude "github.com/latitudesh/latitudesh-go"
)

func main() {
    client := latitude.NewClientWithAuth("Latitude.sh", apiToken, nil)
}

Documentation

Index

Constants

View Source
const (
	IncludeParam       = "include"
	ExcludeParam       = "exclude"
	PageParam          = "page"
	PerPageParam       = "per_page"
	SearchParam        = "search"
	SortByParam        = "sort_by"
	SortDirectionParam = "sort_direction"
)

Variables

This section is empty.

Functions

func Stringify

func Stringify(message interface{}) string

func ValidateUUID

func ValidateUUID(uuid string) error

validate UUID

Types

type BandwidthService added in v0.1.5

type BandwidthService interface {
	TrafficQuota(opts *ListOptions) (*TrafficQuota, *Response, error)
	TrafficConsumption(opts *ListOptions) (*TrafficConsumption, *Response, error)
}

type BandwidthServiceOp added in v0.1.5

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

BandwidthServiceOp implements BandwidthService

func (*BandwidthServiceOp) TrafficConsumption added in v0.1.5

func (u *BandwidthServiceOp) TrafficConsumption(opts *ListOptions) (*TrafficConsumption, *Response, error)

TrafficConsumption returns consumed traffic

func (*BandwidthServiceOp) TrafficQuota added in v0.1.5

func (u *BandwidthServiceOp) TrafficQuota(opts *ListOptions) (*TrafficQuota, *Response, error)

TrafficQuota returns purchased quota

type Client

type Client struct {
	BaseURL       *url.URL
	UserAgent     string
	ConsumerToken string
	APIKey        string

	Projects         ProjectService
	Servers          ServerService
	UserData         UserDataService
	SSHKeys          SSHKeyService
	Plans            PlanService
	OperatingSystems OperatingSystemService
	VirtualNetworks  VirtualNetworkService
	VlanAssignments  VlanAssignmentService
	Regions          RegionService
	Tags             TagsService
	Teams            TeamService
	Bandwidth        BandwidthService
	Members          MemberService
	// contains filtered or unexported fields
}

Client is the base API Client

func NewClient

func NewClient() (*Client, error)

NewClient initializes and returns a Client

func NewClientWithAuth

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

NewClientWithAuth initializes and returns a Client

func NewClientWithBaseURL

func NewClientWithBaseURL(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

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

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 EmbedTag added in v0.3.2

type EmbedTag struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
}

type ErrorData

type ErrorData struct {
	Code   string `json:"code"`
	Status string `json:"status"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Errors   []ErrorData `json:"errors,omitempty"`
}

ErrorResponse is the http response used on errors

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type GetOptions

type GetOptions struct {
	// Includes are a list of fields to expand in the request results.
	//
	// For resources that contain collections of other resources, the Latitude 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 Latitude 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 Latitude API GET requests

func (*GetOptions) AddParam

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

AddParam adds key=value to URL path

func (*GetOptions) CopyOrNew

func (g *GetOptions) CopyOrNew() *GetOptions

func (*GetOptions) Encode

func (g *GetOptions) Encode() string

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

func (*GetOptions) Excluding

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

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

func (*GetOptions) GetOptions

func (g *GetOptions) GetOptions() *GetOptions

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

func (*GetOptions) GetPage

func (g *GetOptions) GetPage() int

func (*GetOptions) Including

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

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

type Href

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

Href is an API link

type ListOptions

type ListOptions = GetOptions

type ListSortDirection

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

type Member added in v0.3.1

type Member struct {
	ID         string `json:"id"`
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Email      string `json:"email"`
	MfaEnabled bool   `json:"mfa_enabled"`
	CreatedAt  string `json:"created_at"`
	UpdatedAt  string `json:"updated_at"`
	RoleName   string `json:"role"`
}

func NewFlatMember added in v0.3.1

func NewFlatMember(md MemberData) Member

Flatten latitude API data structure

func NewFlatMemberList added in v0.3.1

func NewFlatMemberList(md []MemberData) []Member

type MemberAttributes added in v0.3.1

type MemberAttributes struct {
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Email      string `json:"email"`
	MfaEnabled bool   `json:"mfa_enabled"`
	CreatedAt  string `json:"created_at"`
	UpdatedAt  string `json:"updated_at"`
	RoleName   string `json:"role"`
}

type MemberCreateAttributes added in v0.3.1

type MemberCreateAttributes struct {
	FirstName string     `json:"first_name"`
	LastName  string     `json:"last_name"`
	Email     string     `json:"email"`
	Role      MemberRole `json:"role"`
}

type MemberCreateData added in v0.3.1

type MemberCreateData struct {
	Type       string                 `json:"type"`
	Attributes MemberCreateAttributes `json:"attributes"`
}

type MemberCreateRequest added in v0.3.1

type MemberCreateRequest struct {
	Data MemberCreateData `json:"data"`
}

type MemberData added in v0.3.1

type MemberData struct {
	ID         string           `json:"id"`
	Type       string           `json:"type"`
	Attributes MemberAttributes `json:"attributes"`
}

type MemberListAttributes added in v0.3.1

type MemberListAttributes struct {
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Email      string `json:"email"`
	MfaEnabled bool   `json:"mfa_enabled"`
	CreatedAt  string `json:"created_at"`
	UpdatedAt  string `json:"updated_at"`
	Role       Role   `json:"role"`
}

type MemberListData added in v0.3.1

type MemberListData struct {
	ID         string               `json:"id"`
	Type       string               `json:"type"`
	Attributes MemberListAttributes `json:"attributes"`
}

type MemberListResponse added in v0.3.1

type MemberListResponse struct {
	Data []MemberListData `json:"data"`
	Meta meta             `json:"meta"`
}

type MemberResponse added in v0.3.1

type MemberResponse struct {
	Data MemberData `json:"data"`
	Meta meta       `json:"meta"`
}

type MemberRole added in v0.3.1

type MemberRole string
const (
	Owner         MemberRole = "owner"
	Administrator MemberRole = "administrator"
	Collaborator  MemberRole = "collaborator"
	Billing       MemberRole = "billing"
)

type MemberService added in v0.3.1

type MemberService interface {
	List(listOpt *ListOptions) ([]Member, *Response, error)
	Create(request *MemberCreateRequest) (*Member, *Response, error)
	Delete(UserID string) (*Response, error)
}

MemberService interface defines available member methods

type MemberServiceOp added in v0.3.1

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

MemberServiceOp implements MemberService

func (*MemberServiceOp) Create added in v0.3.1

func (s *MemberServiceOp) Create(request *MemberCreateRequest) (*Member, *Response, error)

Create creates a new team member

func (*MemberServiceOp) Delete added in v0.3.1

func (s *MemberServiceOp) Delete(MemberID string) (*Response, error)

Delete deletes a team member

func (*MemberServiceOp) List added in v0.3.1

func (s *MemberServiceOp) List(listOpts *ListOptions) (members []Member, resp *Response, err error)

List returns a list of team members

type OperatingSystem added in v0.1.4

type OperatingSystem struct {
	ID       string `json:"id"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	Distro   string `json:"distro"`
	Slug     string `json:"slug"`
	Version  string `json:"version"`
	User     string `json:"user"`
	Raid     bool   `json:"raid"`
	Rescue   bool   `json:"rescue"`
	SshKeys  bool   `json:"ssh_keys"`
	UserData bool   `json:"user_data"`
}

func NewFlatOperatingSystem added in v0.1.4

func NewFlatOperatingSystem(osd OperatingSystemData) OperatingSystem

func NewFlatOperatingSystemList added in v0.1.4

func NewFlatOperatingSystemList(osd []OperatingSystemData) []OperatingSystem

type OperatingSystemAttributes added in v0.1.4

type OperatingSystemAttributes struct {
	Name     string                  `json:"name"`
	Distro   string                  `json:"distro"`
	Slug     string                  `json:"slug"`
	Version  string                  `json:"version"`
	User     string                  `json:"user"`
	Features OperatingSystemFeatures `json:"features"`
}

type OperatingSystemData added in v0.1.4

type OperatingSystemData struct {
	ID         string                    `json:"id"`
	Type       string                    `json:"type"`
	Attributes OperatingSystemAttributes `json:"attributes"`
}

type OperatingSystemDistro added in v0.3.0

type OperatingSystemDistro struct {
	Name   string `json:"name"`
	Slug   string `json:"slug"`
	Series string `json:"series"`
}

type OperatingSystemFeatures added in v0.1.4

type OperatingSystemFeatures struct {
	Raid     bool `json:"raid"`
	Rescue   bool `json:"rescue"`
	SshKeys  bool `json:"ssh_keys"`
	UserData bool `json:"user_data"`
}

type OperatingSystemListResponse added in v0.1.4

type OperatingSystemListResponse struct {
	Data []OperatingSystemData `json:"data"`
	Meta meta                  `json:"meta"`
}

type OperatingSystemService added in v0.1.4

type OperatingSystemService interface {
	List(listOpt *ListOptions) ([]OperatingSystem, *Response, error)
}

OperatingSystemService interface defines available Operating Systems methods

type OperatingSystemServiceOp added in v0.1.4

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

func (*OperatingSystemServiceOp) List added in v0.1.4

func (os *OperatingSystemServiceOp) List(opts *ListOptions) (operatingSystems []OperatingSystem, resp *Response, err error)

List returns a list of Operating Systems

type OptionsGetter

type OptionsGetter interface {
	GetOptions() *GetOptions
}

OptionsGetter provides GetOptions

type Plan

type Plan struct {
	ID       string       `json:"id"`
	Type     string       `json:"type"`
	Name     string       `json:"name"`
	Slug     string       `json:"slug"`
	Features PlanFeatures `json:"features"`
	Specs    PlanSpecs    `json:"specs"`
	InStock  []string     `json:"in_stock"`
}

func NewFlatPlan

func NewFlatPlan(pd PlanData) Plan

Flatten latitude API data structures

func NewFlatPlanList

func NewFlatPlanList(pd []PlanData) []Plan

type PlanAttributes

type PlanAttributes struct {
	Name          string             `json:"name"`
	Slug          string             `json:"slug"`
	Features      PlanFeatures       `json:"features"`
	Specs         PlanSpecs          `json:"specs"`
	Regions       PlanRegions        `json:"regions"`
	Availablility []PlanAvailability `json:"available_in"`
}

type PlanAvailability

type PlanAvailability struct {
	Region  PlanRegion `json:"region"`
	Sites   []Site     `json:"sites"`
	Pricing Pricing    `json:"pricing"`
}

type PlanCPU

type PlanCPU struct {
	Type  string  `json:"type"`
	Clock float64 `json:"clock"`
	Cores int     `json:"cores"`
	Count int     `json:"count"`
}

type PlanData

type PlanData struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Attributes PlanAttributes `json:"attributes"`
}

type PlanDrive

type PlanDrive struct {
	Count int    `json:"count"`
	Size  string `json:"size"`
	Type  string `json:"type"`
}

type PlanFeatures

type PlanFeatures []string

type PlanListResponse

type PlanListResponse struct {
	Data []PlanData `json:"data"`
	Meta meta       `json:"meta"`
}

type PlanLocation added in v0.3.1

type PlanLocation struct {
	Available []string `json:"available"`
	InStock   []string `json:"in_stock"`
}

type PlanMemory

type PlanMemory struct {
	Total string `json:"total"`
}

func (*PlanMemory) UnmarshalJSON

func (p *PlanMemory) UnmarshalJSON(b []byte) error

type PlanNIC

type PlanNIC struct {
	Count int    `json:"count"`
	Type  string `json:"type"`
}

type PlanRegion

type PlanRegion struct {
	Name             string       `json:"name"`
	DeploysInstantly []string     `json:"deploys_instantly"`
	Locations        PlanLocation `json:"locations"`
	PlanPricing      Pricing      `json:"pricing"`
}

type PlanRegions added in v0.3.1

type PlanRegions []PlanRegion

type PlanRoot

type PlanRoot struct {
	Data PlanData `json:"data"`
	Meta meta     `json:"meta"`
}

Plan represents a Latitude plan

type PlanService

type PlanService interface {
	List(listOpt *ListOptions) ([]Plan, *Response, error)
	Get(string, *GetOptions) (*Plan, *Response, error)
}

PlanService interface defines available plan methods

type PlanServiceOp

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

PlanServiceOp implements PlanService

func (*PlanServiceOp) Get

func (s *PlanServiceOp) Get(planID string, opts *GetOptions) (*Plan, *Response, error)

Get returns a plan by id

func (*PlanServiceOp) List

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

List returns a list of plans

type PlanSpecs

type PlanSpecs struct {
	CPU    PlanCPU     `json:"cpu"`
	Memory PlanMemory  `json:"memory"`
	Drives []PlanDrive `json:"drives"`
	NICs   []PlanNIC   `json:"nics"`
}

type Pricing

type Pricing struct {
	USD PricingUSD `json:"USD"`
	BRL PricingBRL `json:"BRL"`
}

type PricingBRL

type PricingBRL struct {
	Hour  float64 `json:"hour"`
	Month float64 `json:"month"`
	Year  float64 `json:"year"`
}

type PricingUSD

type PricingUSD struct {
	Hour  float64 `json:"hour"`
	Month float64 `json:"month"`
	Year  float64 `json:"year"`
}

type Project

type Project struct {
	ID            string     `json:"id"`
	Name          string     `json:"name"`
	Slug          string     `json:"slug"`
	Description   string     `json:"description"`
	BillingType   string     `json:"billing_type"`
	BillingMethod string     `json:"billing_method"`
	Environment   string     `json:"environment"`
	CreatedAt     string     `json:"created_at"`
	UpdatedAt     string     `json:"updated_at"`
	Tags          []EmbedTag `json:"tags"`
}

func NewFlatProject added in v0.1.3

func NewFlatProject(pd ProjectData) Project

Flatten latitude API data structures

func NewFlatProjectList added in v0.1.3

func NewFlatProjectList(pd []ProjectData) []Project

type ProjectCreateAttributes

type ProjectCreateAttributes struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Environment string `json:"environment"`
}

type ProjectCreateData

type ProjectCreateData struct {
	Type       string                  `json:"type"`
	Attributes ProjectCreateAttributes `json:"attributes"`
}

type ProjectCreateRequest

type ProjectCreateRequest struct {
	Data ProjectCreateData `json:"data"`
}

ProjectCreateRequest type used to create a Latitude project

type ProjectData

type ProjectData struct {
	ID         string               `json:"id"`
	Type       string               `json:"type"`
	Attributes ProjectGetAttributes `json:"attributes"`
}

type ProjectGetAttributes added in v0.1.3

type ProjectGetAttributes struct {
	Name          string     `json:"name"`
	Slug          string     `json:"slug"`
	Description   string     `json:"description"`
	BillingType   string     `json:"billing_type"`
	BillingMethod string     `json:"billing_method"`
	Environment   string     `json:"environment"`
	CreatedAt     string     `json:"created_at"`
	UpdatedAt     string     `json:"updated_at"`
	Tags          []EmbedTag `json:"tags"`
}

type ProjectGetResponse added in v0.1.3

type ProjectGetResponse struct {
	Data ProjectData `json:"data"`
	Meta meta        `json:"meta"`
}

type ProjectListResponse

type ProjectListResponse struct {
	Data []ProjectData `json:"data"`
	Meta meta          `json:"meta"`
}

type ProjectRoot added in v0.1.3

type ProjectRoot struct {
	Data ProjectData `json:"data"`
	Meta meta        `json:"meta"`
}

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)
}

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) 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 a list of projects

func (*ProjectServiceOp) Update

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

Update updates a project

type ProjectUpdateAttributes added in v0.3.2

type ProjectUpdateAttributes struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Environment string   `json:"environment"`
	Tags        []string `json:"tags,omitempty"`
}

type ProjectUpdateData

type ProjectUpdateData struct {
	ID         string                  `json:"id"`
	Type       string                  `json:"type"`
	Attributes ProjectUpdateAttributes `json:"attributes"`
}

type ProjectUpdateRequest

type ProjectUpdateRequest struct {
	Data ProjectUpdateData `json:"data"`
}

ProjectUpdateRequest type used to update a Latitude project

type QueryAppender

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 QuotaDetail added in v0.1.5

type QuotaDetail struct {
	Granted    int64 `json:"granted"`
	Additional int64 `json:"additional"`
	Total      int64 `json:"total"`
}

type QuotaPerProject added in v0.1.5

type QuotaPerProject struct {
	ProjectID      string           `json:"project_id"`
	ProjectSlug    string           `json:"project_slug"`
	BillingMethod  string           `json:"billing_method"`
	QuotaPerRegion []QuotaPerRegion `json:"quota_per_region"`
}

type QuotaPerRegion added in v0.1.5

type QuotaPerRegion struct {
	RegionId    string      `json:"region_id"`
	RegionSlug  string      `json:"region_slug"`
	QuotaInTb   QuotaDetail `json:"quota_in_tb"`
	QuotaInMbps QuotaDetail `json:"quota_in_mbps"`
}

type Region

type Region struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Facility    string `json:"facility"`
	CountryName string `json:"country_name"`
	CountrySlug string `json:"country_slug"`
}

func NewFlatRegion

func NewFlatRegion(rd RegionData) Region

Flatten latitude API data structures

func NewFlatRegionList

func NewFlatRegionList(rd []RegionData) []Region

type RegionAttributes

type RegionAttributes struct {
	Name     string        `json:"name"`
	Slug     string        `json:"slug"`
	Facility string        `json:"facility"`
	Country  RegionCountry `json:"country"`
}

type RegionCountry

type RegionCountry struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type RegionData

type RegionData struct {
	ID         string           `json:"id"`
	Type       string           `json:"type"`
	Attributes RegionAttributes `json:"attributes"`
}

type RegionListResponse

type RegionListResponse struct {
	Data []RegionData `json:"data"`
	Meta meta         `json:"meta"`
}

type RegionRoot

type RegionRoot struct {
	Data RegionData `json:"data"`
	Meta meta       `json:"meta"`
}

Plan represents a Latitude plan

type RegionService

type RegionService interface {
	List(listOpt *ListOptions) ([]Region, *Response, error)
	Get(string, *GetOptions) (*Region, *Response, error)
}

RegionService interface defines available region methods

type RegionServiceOp

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

RegionServiceOp implements RegionService

func (*RegionServiceOp) Get

func (s *RegionServiceOp) Get(regionID string, opts *GetOptions) (*Region, *Response, error)

Get returns a region by id

func (*RegionServiceOp) List

func (s *RegionServiceOp) List(opts *ListOptions) (regions []Region, resp *Response, err error)

List returns a list of regions

type Response

type Response struct {
	*http.Response
}

Response is the http response from api calls

type Role added in v0.3.1

type Role struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SSHKey

type SSHKey struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	PublicKey   string     `json:"public_key"`
	Fingerprint string     `json:"fingerprint"`
	CreatedAt   string     `json:"created_at"`
	UpdatedAt   string     `json:"updated_at"`
	Tags        []EmbedTag `json:"tags"`
}

SSHKey represents a Latitude SSH key

func NewFlatSSHKey added in v0.1.3

func NewFlatSSHKey(sd SSHKeyData) SSHKey

Flatten latitude API data structures

func NewFlatSSHKeyList added in v0.1.3

func NewFlatSSHKeyList(sd []SSHKeyData) []SSHKey

type SSHKeyCreateAttributes

type SSHKeyCreateAttributes struct {
	Name      string `json:"name"`
	PublicKey string `json:"public_key"`
}

type SSHKeyCreateData

type SSHKeyCreateData struct {
	Type       string                 `json:"type"`
	Attributes SSHKeyCreateAttributes `json:"attributes"`
}

type SSHKeyCreateRequest

type SSHKeyCreateRequest struct {
	Data SSHKeyCreateData `json:"data"`
}

SSHKeyCreateRequest type used to create a Latitude SSH key

type SSHKeyData

type SSHKeyData struct {
	ID         string              `json:"id"`
	Type       string              `json:"type"`
	Attributes SSHKeyGetAttributes `json:"attributes"`
}

type SSHKeyGetAttributes added in v0.1.3

type SSHKeyGetAttributes struct {
	Name        string     `json:"name"`
	PublicKey   string     `json:"public_key"`
	Fingerprint string     `json:"fingerprint"`
	CreatedAt   string     `json:"created_at"`
	UpdatedAt   string     `json:"updated_at"`
	Tags        []EmbedTag `json:"tags"`
}

type SSHKeyGetResponse

type SSHKeyGetResponse struct {
	Data SSHKeyData `json:"data"`
	Meta meta       `json:"meta"`
}

type SSHKeyListResponse

type SSHKeyListResponse struct {
	Data []SSHKeyData `json:"data"`
	Meta meta         `json:"meta"`
}

type SSHKeyRoot added in v0.1.3

type SSHKeyRoot struct {
	Data ServerData `json:"data"`
	Meta meta       `json:"meta"`
}

type SSHKeyService

type SSHKeyService interface {
	List(projectID string, opts *ListOptions) ([]SSHKey, *Response, error)
	Get(sshKeyID string, projectID string, opts *GetOptions) (*SSHKey, *Response, error)
	Create(projectID string, request *SSHKeyCreateRequest) (*SSHKey, *Response, error)
	Update(sshKeyID string, projectID string, request *SSHKeyUpdateRequest) (*SSHKey, *Response, error)
	Delete(sshKeyID string, projectID string) (*Response, error)
}

type SSHKeyServiceOp

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

SSHKeyServiceOp implements SSHKeyService

func (*SSHKeyServiceOp) Create

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

Create creates a new SSH key

func (*SSHKeyServiceOp) Delete

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

Delete deletes an SSH Key

func (*SSHKeyServiceOp) Get

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

Get returns an SSH key by id

func (*SSHKeyServiceOp) List

func (s *SSHKeyServiceOp) List(projectID string, opts *ListOptions) (sshKeys []SSHKey, resp *Response, err error)

List returns a list of SSH Keys

func (*SSHKeyServiceOp) Update

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

Update updates an SSH key

type SSHKeyUpdateAttributes

type SSHKeyUpdateAttributes struct {
	Name string   `json:"name"`
	Tags []string `json:"tags,omitempty"`
}

type SSHKeyUpdateData

type SSHKeyUpdateData struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes SSHKeyUpdateAttributes `json:"attributes"`
}

type SSHKeyUpdateRequest

type SSHKeyUpdateRequest struct {
	Data SSHKeyUpdateData `json:"data"`
}

ProjectUpdateRequest type used to update a Latitude project

type SearchOptions

type SearchOptions = GetOptions

type Server

type Server struct {
	ID              string                `json:"id"`
	Hostname        string                `json:"hostname"`
	Label           string                `json:"label"`
	Role            string                `json:"role"`
	Status          string                `json:"status"`
	PrimaryIPv4     string                `json:"primary_ipv4"`
	IMPIStatus      string                `json:"impi_status"`
	CreatedAt       string                `json:"created_at"`
	Specs           ServerSpecs           `json:"specs"`
	Project         ServerProject         `json:"project"`
	OperatingSystem ServerOperatingSystem `json:"operating_system"`
	Plan            ServerPlan            `json:"plan"`
	Region          ServerRegion          `json:"region"`
	Tags            []EmbedTag            `json:"tags"`
}

func NewFlatServer

func NewFlatServer(sd ServerGetData) Server

Flatten latitude API data structures

func NewFlatServerList

func NewFlatServerList(sd []ServerGetData) []Server

type ServerAttributes

type ServerAttributes struct {
	Hostname string      `json:"hostname"`
	Label    string      `json:"label"`
	Role     string      `json:"role"`
	Status   string      `json:"status"`
	Specs    ServerSpecs `json:"specs"`
}

type ServerCreateAttributes

type ServerCreateAttributes struct {
	Project         string   `json:"project,omitempty"`
	Plan            string   `json:"plan,omitempty"`
	Site            string   `json:"site,omitempty"`
	OperatingSystem string   `json:"operating_system,omitempty"`
	Hostname        string   `json:"hostname"`
	SSHKeys         []string `json:"ssh_keys,omitempty"`
	UserData        string   `json:"user_data,omitempty"`
	Raid            string   `json:"raid,omitempty"`
	IpxeUrl         string   `json:"ipxe_url,omitempty"`
}

type ServerCreateData

type ServerCreateData struct {
	Type       string                 `json:"type"`
	Attributes ServerCreateAttributes `json:"attributes"`
}

type ServerCreateRequest

type ServerCreateRequest struct {
	Data ServerCreateData `json:"data"`
}

ServerCreateRequest type used to create a Latitude server

type ServerData

type ServerData struct {
	ID         string           `json:"id"`
	Type       string           `json:"type"`
	Attributes ServerAttributes `json:"attributes"`
}

type ServerGetAttributes

type ServerGetAttributes struct {
	Hostname        string                `json:"hostname"`
	Label           string                `json:"label"`
	Price           float64               `json:"price"`
	Role            string                `json:"role"`
	PrimaryIPv4     string                `json:"primary_ipv4"`
	Status          string                `json:"status"`
	IMPIStatus      string                `json:"impi_status"`
	Site            string                `json:"site"`
	InstanceType    string                `json:"instance_type"`
	CreatedAt       string                `json:"created_at"`
	Specs           ServerSpecs           `json:"specs"`
	Project         ServerProject         `json:"project"`
	OperatingSystem ServerOperatingSystem `json:"operating_system"`
	Plan            ServerPlan            `json:"plan"`
	Region          ServerRegion          `json:"region"`
	Team            ServerTeam            `json:"team"`
	Tags            []EmbedTag            `json:"tags"`
}

type ServerGetData

type ServerGetData struct {
	ID         string              `json:"id"`
	Type       string              `json:"type"`
	Attributes ServerGetAttributes `json:"attributes"`
}

type ServerGetResponse

type ServerGetResponse struct {
	Data ServerGetData `json:"data"`
	Meta meta          `json:"meta"`
}

type ServerListResponse

type ServerListResponse struct {
	Data []ServerGetData `json:"data"`
	Meta meta            `json:"meta"`
}

type ServerOperatingSystem added in v0.1.8

type ServerOperatingSystem struct {
	Name     string                  `json:"name"`
	Slug     string                  `json:"slug"`
	Version  string                  `json:"version"`
	Features OperatingSystemFeatures `json:"features"`
	Distro   OperatingSystemDistro   `json:"distro"`
}

type ServerPlan added in v0.1.8

type ServerPlan struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type ServerProject added in v0.1.8

type ServerProject struct {
	ID   interface{} `json:"id"`
	Name string      `json:"name"`
}

type ServerRegion added in v0.1.8

type ServerRegion struct {
	City    string     `json:"city"`
	Country string     `json:"country"`
	Site    ServerSite `json:"site"`
}

type ServerReinstallAttributes added in v0.2.5

type ServerReinstallAttributes struct {
	OperatingSystem string   `json:"operating_system,omitempty"`
	Hostname        string   `json:"hostname"`
	SSHKeys         []string `json:"ssh_keys,omitempty"`
	UserData        string   `json:"user_data,omitempty"`
	Raid            string   `json:"raid,omitempty"`
	IpxeUrl         string   `json:"ipxe_url,omitempty"`
}

type ServerReinstallData added in v0.2.5

type ServerReinstallData struct {
	Type       string                    `json:"type"`
	Attributes ServerReinstallAttributes `json:"attributes"`
}

type ServerReinstallRequest added in v0.2.5

type ServerReinstallRequest struct {
	Data ServerReinstallData `json:"data"`
}

type ServerRoot

type ServerRoot struct {
	Data ServerData `json:"data"`
	Meta meta       `json:"meta"`
}

type ServerService

type ServerService interface {
	List(ProjectID string, opts *ListOptions) ([]Server, *Response, error)
	Get(ServerID string, opts *GetOptions) (*Server, *Response, error)
	Create(*ServerCreateRequest) (*Server, *Response, error)
	Update(string, *ServerUpdateRequest) (*Server, *Response, error)
	Delete(serverID string) (*Response, error)
	Reinstall(serverID string, reinstallRequest *ServerReinstallRequest) (*Response, error)
}

type ServerServiceOp

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

ServerServiceOp implements ServerService

func (*ServerServiceOp) Create

func (s *ServerServiceOp) Create(createRequest *ServerCreateRequest) (*Server, *Response, error)

Create creates a new server

func (*ServerServiceOp) Delete

func (s *ServerServiceOp) Delete(serverID string) (*Response, error)

Delete deletes a server

func (*ServerServiceOp) Get

func (s *ServerServiceOp) Get(serverID string, opts *GetOptions) (*Server, *Response, error)

Get returns a server by id

func (*ServerServiceOp) List

func (s *ServerServiceOp) List(projectID string, opts *ListOptions) ([]Server, *Response, error)

List returns servers on a project

func (*ServerServiceOp) Reinstall added in v0.2.5

func (s *ServerServiceOp) Reinstall(serverID string, reinstallRequest *ServerReinstallRequest) (*Response, error)

Reinstall reinstalls an existing server

func (*ServerServiceOp) Update

func (s *ServerServiceOp) Update(serverID string, updateRequest *ServerUpdateRequest) (*Server, *Response, error)

Update updates a server

type ServerSite added in v0.1.8

type ServerSite struct {
	Name     string `json:"name"`
	Slug     string `json:"slug"`
	Facility string `json:"facility"`
}

type ServerSpecs

type ServerSpecs struct {
	CPU  string `json:"cpu"`
	Disk string `json:"disk"`
	RAM  string `json:"ram"`
	NIC  string `json:"nic"`
	GPU  string `json:"gpu"`
}

type ServerTeam added in v0.3.0

type ServerTeam struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Slug        string       `json:"slug"`
	Description string       `json:"description"`
	Address     string       `json:"address"`
	Status      string       `json:"status"`
	Currency    TeamCurrency `json:"currency"`
}

type ServerUpdateAttributes added in v0.2.5

type ServerUpdateAttributes struct {
	Hostname string   `json:"hostname"`
	Tags     []string `json:"tags,omitempty"`
}

type ServerUpdateData

type ServerUpdateData struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes ServerUpdateAttributes `json:"attributes"`
}

type ServerUpdateRequest

type ServerUpdateRequest struct {
	Data ServerUpdateData `json:"data"`
}

ServerUpdateRequest type used to update a Latitude server

type Site

type Site struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	InStock    bool   `json:"in_stock"`
	StockLevel string `json:"stock_level"`
}

type Tag added in v0.3.2

type Tag struct {
	ID          string
	Name        string
	Slug        string
	Description string
	Color       string
	TeamID      string
	TeamName    string
	TeamSlug    string
}

func NewFlatTag added in v0.3.2

func NewFlatTag(td TagData) Tag

func NewFlatTagList added in v0.3.2

func NewFlatTagList(td []TagData) []Tag

type TagAttributes added in v0.3.2

type TagAttributes struct {
	Name        string  `json:"name"`
	Slug        string  `json:"slug"`
	Description string  `json:"description"`
	Color       string  `json:"color"`
	Team        TagTeam `json:"team"`
}

type TagCreateAttributes added in v0.3.2

type TagCreateAttributes struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Color       string `json:"color,omitempty"`
}

type TagCreateData added in v0.3.2

type TagCreateData struct {
	Type       string              `json:"type"`
	Attributes TagCreateAttributes `json:"attributes"`
}

type TagCreateRequest added in v0.3.2

type TagCreateRequest struct {
	Data TagCreateData `json:"data"`
}

type TagData added in v0.3.2

type TagData struct {
	ID         string        `json:"id"`
	Type       string        `json:"type"`
	Attributes TagAttributes `json:"attributes"`
}

type TagListResponse added in v0.3.2

type TagListResponse struct {
	Data []TagData `json:"data"`
	Meta meta      `json:"meta"`
}

type TagResponse added in v0.3.2

type TagResponse struct {
	Data TagData `json:"data"`
	Meta meta    `json:"meta"`
}

type TagServiceOp added in v0.3.2

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

func (*TagServiceOp) Create added in v0.3.2

func (t *TagServiceOp) Create(createRequest *TagCreateRequest) (*Tag, *Response, error)

func (*TagServiceOp) Delete added in v0.3.2

func (t *TagServiceOp) Delete(tagID string) (*Response, error)

func (*TagServiceOp) List added in v0.3.2

func (t *TagServiceOp) List(opts *ListOptions) ([]Tag, *Response, error)

func (*TagServiceOp) Update added in v0.3.2

func (t *TagServiceOp) Update(tagID string, updateRequest *TagUpdateRequest) (*Tag, *Response, error)

type TagTeam added in v0.3.2

type TagTeam struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Address     string `json:"address"`
	Status      string `json:"status"`
	Currency    string `json:"currency"`
}

type TagUpdateAttributes added in v0.3.2

type TagUpdateAttributes TagCreateAttributes

type TagUpdateData added in v0.3.2

type TagUpdateData struct {
	ID         string              `json:"id"`
	Type       string              `json:"type"`
	Attributes TagUpdateAttributes `json:"attributes"`
}

type TagUpdateRequest added in v0.3.2

type TagUpdateRequest struct {
	Data TagUpdateData `json:"data"`
}

type TagsService added in v0.3.2

type TagsService interface {
	List(*ListOptions) ([]Tag, *Response, error)
	Create(*TagCreateRequest) (*Tag, *Response, error)
	Update(string, *TagUpdateRequest) (*Tag, *Response, error)
	Delete(string) (*Response, error)
}

type Team added in v0.1.5

type Team struct {
	ID          string        `json:"id"`
	Description string        `json:"description"`
	Name        string        `json:"name"`
	Slug        string        `json:"slug"`
	Currency    string        `json:"currency"`
	Address     *string       `json:"address"`
	Status      *string       `json:"status"`
	Projects    []interface{} `json:"projects"`
	Users       []interface{} `json:"users"`
	Owner       interface{}   `json:"owner"`
	Billing     interface{}   `json:"billing"`
	CreatedAt   string        `json:"created_at"`
	UpdatedAt   string        `json:"updated_at"`
}

Team represents a Latitude Team record

func NewFlatTeam added in v0.1.5

func NewFlatTeam(t TeamData) Team

Flatten latitude API data structures

type TeamCreateAttributes added in v0.1.5

type TeamCreateAttributes struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name"`
	Currency    string `json:"currency"`
	Address     string `json:"address,omitempty"`
}

type TeamCreateData added in v0.1.5

type TeamCreateData struct {
	Type       string               `json:"type"`
	Attributes TeamCreateAttributes `json:"attributes"`
}

type TeamCreateRequest added in v0.1.5

type TeamCreateRequest struct {
	Data TeamCreateData `json:"data"`
}

TeamCreateRequest type used to create a Latitude Team record

type TeamCreateResponse added in v0.1.5

type TeamCreateResponse struct {
	Data TeamData `json:"data"`
	Meta meta     `json:"meta"`
}

type TeamCurrency added in v0.3.0

type TeamCurrency struct {
	ID   string `json:"id"`
	Code string `json:"code"`
	Name string `json:"name"`
}

type TeamData added in v0.1.5

type TeamData struct {
	ID         string            `json:"id"`
	Type       string            `json:"type"`
	Attributes TeamGetAttributes `json:"attributes"`
}

type TeamGetAttributes added in v0.1.5

type TeamGetAttributes struct {
	Description string        `json:"description"`
	Name        string        `json:"name"`
	Slug        string        `json:"slug"`
	Currency    string        `json:"currency"`
	Address     *string       `json:"address"`
	Status      *string       `json:"status"`
	Projects    []interface{} `json:"projects"`
	Users       []interface{} `json:"users"`
	Owner       interface{}   `json:"owner"`
	Billing     interface{}   `json:"billing"`
	CreatedAt   string        `json:"created_at"`
	UpdatedAt   string        `json:"updated_at"`
}

type TeamGetResponse added in v0.1.5

type TeamGetResponse struct {
	Data []TeamData `json:"data"`
	Meta meta       `json:"meta"`
}

type TeamService added in v0.1.5

type TeamService interface {
	Get() (*Team, *Response, error)
	Create(request *TeamCreateRequest) (*Team, *Response, error)
	Update(TeamID string, request *TeamUpdateRequest) (*Team, *Response, error)
}

type TeamServiceOp added in v0.1.5

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

TeamServiceOp implements TeamService

func (*TeamServiceOp) Create added in v0.1.5

func (s *TeamServiceOp) Create(createRequest *TeamCreateRequest) (*Team, *Response, error)

Create creates a new Team record

func (*TeamServiceOp) Get added in v0.1.5

func (u *TeamServiceOp) Get() (*Team, *Response, error)

Get returns a Team by id

func (*TeamServiceOp) Update added in v0.1.5

func (s *TeamServiceOp) Update(TeamID string, updateRequest *TeamUpdateRequest) (*Team, *Response, error)

Update updates a Team record

type TeamUpdateAttributes added in v0.1.5

type TeamUpdateAttributes struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name,omitempty"`
	Address     string `json:"address,omitempty"`
}

type TeamUpdateData added in v0.1.5

type TeamUpdateData struct {
	ID         string               `json:"id"`
	Type       string               `json:"type"`
	Attributes TeamUpdateAttributes `json:"attributes"`
}

type TeamUpdateRequest added in v0.1.5

type TeamUpdateRequest struct {
	Data TeamUpdateData `json:"data"`
}

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 TrafficConsumption added in v0.1.5

type TrafficConsumption struct {
	FromDate                        int64           `json:"from_date"`
	ToDate                          int64           `json:"to_date"`
	TotalInboundGB                  int64           `json:"total_inbound_gb"`
	TotalOutboundGB                 int64           `json:"total_outbound_gb"`
	TotalInbound95thPercentileMbps  float64         `json:"total_inbound_95th_percentile_mbps"`
	TotalOutbound95thPercentileMbps float64         `json:"total_outbound_95th_percentile_mbps"`
	Regions                         []TrafficRegion `json:"regions"`
}

TrafficConsumption represents consumed traffic in regions

func NewFlatTrafficConsumption added in v0.1.5

func NewFlatTrafficConsumption(t TrafficConsumptionData) TrafficConsumption

Flatten latitude API data structures

type TrafficConsumptionData added in v0.1.5

type TrafficConsumptionData struct {
	ID         string             `json:"id"`
	Type       string             `json:"type"`
	Attributes TrafficConsumption `json:"attributes"`
}

type TrafficConsumptionResponse added in v0.1.5

type TrafficConsumptionResponse struct {
	Data TrafficConsumptionData `json:"data"`
	Meta meta                   `json:"meta"`
}

type TrafficQuota added in v0.1.5

type TrafficQuota struct {
	QuotaPerProject []QuotaPerProject `json:"quota_per_project"`
}

func NewFlatTrafficQuota added in v0.1.5

func NewFlatTrafficQuota(t TrafficQuotaData) TrafficQuota

type TrafficQuotaData added in v0.1.5

type TrafficQuotaData struct {
	ID         string       `json:"id"`
	Type       string       `json:"type"`
	Attributes TrafficQuota `json:"attributes"`
}

type TrafficQuotaResponse added in v0.1.5

type TrafficQuotaResponse struct {
	Data TrafficQuotaData `json:"data"`
	Meta meta             `json:"meta"`
}

type TrafficRegion added in v0.1.5

type TrafficRegion struct {
	RegionSlug string              `json:"region_slug"`
	Data       []TrafficRegionData `json:"data"`
}

type TrafficRegionData added in v0.1.5

type TrafficRegionData struct {
	Date                 string  `json:"date"`
	InboundGB            int64   `json:"inbound_gb"`
	OutboundGB           int64   `json:"outbound_gb"`
	AvgOutboundSpeedMbps float64 `json:"avg_outbound_speed_mbps"`
	AvgInboundSpeedMbps  float64 `json:"avg_inbound_speed_mbps"`
	OutboundSpeedMbps    float64 `json:"outbound_speed_mbps"`
	InboundSpeedMbps     float64 `json:"inbound_speed_mbps"`
}

type UserData added in v0.1.3

type UserData struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Content     string `json:"content"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

UserData represents a Latitude User Data record

func NewFlatUserData added in v0.1.3

func NewFlatUserData(ud UserDataData) UserData

Flatten latitude API data structures

func NewFlatUserDataList added in v0.1.3

func NewFlatUserDataList(udList []UserDataData) []UserData

type UserDataCreateAttributes added in v0.1.3

type UserDataCreateAttributes struct {
	Description string `json:"description"`
	Content     string `json:"content"`
}

type UserDataCreateData added in v0.1.3

type UserDataCreateData struct {
	Type       string                   `json:"type"`
	Attributes UserDataCreateAttributes `json:"attributes"`
}

type UserDataCreateRequest added in v0.1.3

type UserDataCreateRequest struct {
	Data UserDataCreateData `json:"data"`
}

UserDataCreateRequest type used to create a Latitude User Data record

type UserDataData added in v0.1.3

type UserDataData struct {
	ID         string                `json:"id"`
	Type       string                `json:"type"`
	Attributes UserDataGetAttributes `json:"attributes"`
}

type UserDataGetAttributes added in v0.1.3

type UserDataGetAttributes struct {
	Description string `json:"description"`
	Content     string `json:"content"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

type UserDataGetResponse added in v0.1.3

type UserDataGetResponse struct {
	Data UserDataData `json:"data"`
	Meta meta         `json:"meta"`
}

type UserDataListResponse added in v0.1.3

type UserDataListResponse struct {
	Data []UserDataData `json:"data"`
	Meta meta           `json:"meta"`
}

type UserDataService added in v0.1.3

type UserDataService interface {
	List(projectID string, opts *ListOptions) ([]UserData, *Response, error)
	Get(userDataID, projectID string, opts *GetOptions) (*UserData, *Response, error)
	Create(projectID string, request *UserDataCreateRequest) (*UserData, *Response, error)
	Update(userDataID, projectID string, request *UserDataUpdateRequest) (*UserData, *Response, error)
	Delete(userDataID, projectID string) (*Response, error)
}

type UserDataServiceOp added in v0.1.3

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

UserDataServiceOp implements UserDataService

func (*UserDataServiceOp) Create added in v0.1.3

func (s *UserDataServiceOp) Create(projectID string, createRequest *UserDataCreateRequest) (*UserData, *Response, error)

Create creates a new User Data record

func (*UserDataServiceOp) Delete added in v0.1.3

func (s *UserDataServiceOp) Delete(userDataID, projectID string) (*Response, error)

Delete deletes a User Data record

func (*UserDataServiceOp) Get added in v0.1.3

func (u *UserDataServiceOp) Get(userDataID, projectID string, opts *ListOptions) (*UserData, *Response, error)

Get returns a User data by id

func (*UserDataServiceOp) List added in v0.1.3

func (u *UserDataServiceOp) List(projectID string, opts *ListOptions) ([]UserData, *Response, error)

List returns list of User data

func (*UserDataServiceOp) Update added in v0.1.3

func (s *UserDataServiceOp) Update(userDataID, projectID string, updateRequest *UserDataUpdateRequest) (*UserData, *Response, error)

Update updates a User Data record

type UserDataUpdateAttributes added in v0.1.3

type UserDataUpdateAttributes struct {
	Description string `json:"description,omitempty"`
	Content     string `json:"content,omitempty"`
}

type UserDataUpdateData added in v0.1.3

type UserDataUpdateData struct {
	ID         string                   `json:"id"`
	Type       string                   `json:"type"`
	Attributes UserDataUpdateAttributes `json:"attributes"`
}

type UserDataUpdateRequest added in v0.1.3

type UserDataUpdateRequest struct {
	Data UserDataUpdateData `json:"data"`
}

type VirtualNetwork added in v0.2.2

type VirtualNetwork struct {
	ID               string     `json:"id"`
	Type             string     `json:"type"`
	Vid              int        `json:"vid"`
	Description      string     `json:"description"`
	City             string     `json:"city"`
	Country          string     `json:"country"`
	SiteId           string     `json:"site_id"`
	SiteName         string     `json:"site_name"`
	SiteSlug         string     `json:"site_slug"`
	Facility         string     `json:"facility"`
	AssignmentsCount int        `json:"assignments_count"`
	Tags             []EmbedTag `json:"tags"`
}

func NewFlatVirtualNetwork added in v0.2.2

func NewFlatVirtualNetwork(vnd VirtualNetworkData) VirtualNetwork

func NewFlatVirtualNetworkList added in v0.2.2

func NewFlatVirtualNetworkList(vnd []VirtualNetworkData) []VirtualNetwork

type VirtualNetworkAttributes added in v0.2.2

type VirtualNetworkAttributes struct {
	Vid              int                  `json:"vid"`
	Description      string               `json:"description"`
	Region           VirtualNetworkRegion `json:"region"`
	AssignmentsCount int                  `json:"assignments_count"`
	Tags             []EmbedTag           `json:"tags"`
}

type VirtualNetworkCreateAttributes added in v0.2.2

type VirtualNetworkCreateAttributes struct {
	Description string `json:"description"`
	Site        string `json:"site"`
	Project     string `json:"project"`
}

type VirtualNetworkCreateData added in v0.2.2

type VirtualNetworkCreateData struct {
	Type       string                         `json:"type"`
	Attributes VirtualNetworkCreateAttributes `json:"attributes"`
}

type VirtualNetworkCreateRequest added in v0.2.2

type VirtualNetworkCreateRequest struct {
	Data VirtualNetworkCreateData `json:"data"`
}

type VirtualNetworkData added in v0.2.2

type VirtualNetworkData struct {
	ID         string                   `json:"id"`
	Type       string                   `json:"type"`
	Attributes VirtualNetworkAttributes `json:"attributes"`
}

type VirtualNetworkGetResponse added in v0.2.2

type VirtualNetworkGetResponse struct {
	Data VirtualNetworkData `json:"data"`
	Meta meta               `json:"meta"`
}

type VirtualNetworkListResponse added in v0.2.2

type VirtualNetworkListResponse struct {
	Data []VirtualNetworkData `json:"data"`
	Meta meta                 `json:"meta"`
}

type VirtualNetworkRegion added in v0.2.2

type VirtualNetworkRegion struct {
	City    string             `json:"city"`
	Country string             `json:"country"`
	Site    VirtualNetworkSite `json:"site"`
}

type VirtualNetworkService added in v0.2.2

type VirtualNetworkService interface {
	List(listOpt *ListOptions) ([]VirtualNetwork, *Response, error)
	Get(virtualNetworkID string, getOpt *GetOptions) (*VirtualNetwork, *Response, error)
	Create(createRequest *VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error)
	Update(virtualNetworkID string, updateRequest *VirtualNetworkUpdateRequest) (*VirtualNetwork, *Response, error)
	Delete(virtualNetworkID string) (*Response, error)
}

type VirtualNetworkServiceOp added in v0.2.2

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

func (*VirtualNetworkServiceOp) Create added in v0.2.2

Create creates a new virtual network

func (*VirtualNetworkServiceOp) Delete added in v0.2.2

func (s *VirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error)

Delete deletes a virtual network

func (*VirtualNetworkServiceOp) Get added in v0.2.2

func (s *VirtualNetworkServiceOp) Get(virtualNetworkID string, opts *GetOptions) (*VirtualNetwork, *Response, error)

Get returns a server by id

func (*VirtualNetworkServiceOp) List added in v0.2.2

func (vn *VirtualNetworkServiceOp) List(opts *ListOptions) (virtualNetworks []VirtualNetwork, resp *Response, err error)

func (*VirtualNetworkServiceOp) Update added in v0.2.2

func (s *VirtualNetworkServiceOp) Update(virtualNetworkID string, updateRequest *VirtualNetworkUpdateRequest) (*VirtualNetwork, *Response, error)

Update updates a virtual network

type VirtualNetworkSite added in v0.2.2

type VirtualNetworkSite struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Slug     string `json:"slug"`
	Facility string `json:"facility"`
}

type VirtualNetworkUpdateAttributes added in v0.2.2

type VirtualNetworkUpdateAttributes struct {
	Description string   `json:"description"`
	Tags        []string `json:"tags,omitempty"`
}

type VirtualNetworkUpdateData added in v0.2.2

type VirtualNetworkUpdateData struct {
	ID         string                         `json:"id"`
	Type       string                         `json:"type"`
	Attributes VirtualNetworkUpdateAttributes `json:"attributes"`
}

type VirtualNetworkUpdateRequest added in v0.2.2

type VirtualNetworkUpdateRequest struct {
	Data VirtualNetworkUpdateData `json:"data"`
}

type VlanAssignAttributes added in v0.2.2

type VlanAssignAttributes struct {
	ServerID         string `json:"server_id"`
	VirtualNetworkID string `json:"virtual_network_id"`
}

type VlanAssignData added in v0.2.2

type VlanAssignData struct {
	Type       string               `json:"type"`
	Attributes VlanAssignAttributes `json:"attributes"`
}

type VlanAssignRequest added in v0.2.2

type VlanAssignRequest struct {
	Data VlanAssignData `json:"data"`
}

type VlanAssignment added in v0.2.2

type VlanAssignment struct {
	ID               string `json:"id"`
	Type             string `json:"type"`
	VirtualNetworkID string `json:"virtual_network_id"`
	Vid              int    `json:"vid"`
	Description      string `json:"description"`
	Status           string `json:"status"`
	ServerID         string `json:"server_id"`
	ServerHostname   string `json:"server_hostname"`
	ServerStatus     string `json:"server_status"`
	ServerLabel      string `json:"server_label"`
}

func NewFlatVlanAssignment added in v0.2.2

func NewFlatVlanAssignment(vnd VlanAssignmentData) VlanAssignment

func NewFlatVlanAssignmentList added in v0.2.2

func NewFlatVlanAssignmentList(vnd []VlanAssignmentData) []VlanAssignment

type VlanAssignmentAttributes added in v0.2.2

type VlanAssignmentAttributes struct {
	VlanAssignmentId string     `json:"virtual_network_id"`
	Vid              int        `json:"vid"`
	Description      string     `json:"description"`
	Status           string     `json:"status"`
	Server           VlanServer `json:"server"`
}

type VlanAssignmentData added in v0.2.2

type VlanAssignmentData struct {
	ID         string                   `json:"id"`
	Type       string                   `json:"type"`
	Attributes VlanAssignmentAttributes `json:"attributes"`
}

type VlanAssignmentGetResponse added in v0.2.2

type VlanAssignmentGetResponse struct {
	Data VlanAssignmentData `json:"data"`
	Meta meta               `json:"meta"`
}

type VlanAssignmentListResponse added in v0.2.2

type VlanAssignmentListResponse struct {
	Data []VlanAssignmentData `json:"data"`
	Meta meta                 `json:"meta"`
}

type VlanAssignmentService added in v0.2.2

type VlanAssignmentService interface {
	List(listOpt *ListOptions) ([]VlanAssignment, *Response, error)
	Get(VlanAssignmentID string) (*VlanAssignment, *Response, error)
	Assign(assignRequest *VlanAssignRequest) (*VlanAssignment, *Response, error)
	Delete(VlanAssignmentID string) (*Response, error)
}

type VlanAssignmentServiceOp added in v0.2.2

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

func (*VlanAssignmentServiceOp) Assign added in v0.2.2

func (s *VlanAssignmentServiceOp) Assign(assignRequest *VlanAssignRequest) (*VlanAssignment, *Response, error)

func (*VlanAssignmentServiceOp) Delete added in v0.2.2

func (s *VlanAssignmentServiceOp) Delete(vlanAssignmentID string) (*Response, error)

func (*VlanAssignmentServiceOp) Get added in v0.2.3

func (s *VlanAssignmentServiceOp) Get(vlanAssignmentID string) (*VlanAssignment, *Response, error)

func (*VlanAssignmentServiceOp) List added in v0.2.2

func (vn *VlanAssignmentServiceOp) List(opts *ListOptions) (vlanAssignments []VlanAssignment, resp *Response, err error)

type VlanServer added in v0.2.2

type VlanServer struct {
	Id       string `json:"id"`
	Hostname string `json:"hostname"`
	Label    string `json:"label"`
	Status   string `json:"status"`
}

Jump to

Keyboard shortcuts

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