Documentation ¶
Index ¶
- func StreamToString(stream io.Reader) string
- func Stringify(message interface{}) string
- type Address
- type AddressRequest
- type AddressStruct
- type AvailableRequest
- type AvailableResponse
- type BackToL3Request
- type BillingAddress
- type BondRequest
- type Client
- type Cpus
- type Device
- type DeviceActionRequest
- type DeviceCreateRequest
- type DeviceIPService
- type DeviceIPServiceOp
- type DevicePortService
- type DevicePortServiceOp
- func (i *DevicePortServiceOp) Assign(par *PortAssignRequest) (*Port, *Response, error)
- func (i *DevicePortServiceOp) Bond(br *BondRequest) (*Port, *Response, error)
- func (i *DevicePortServiceOp) DeviceNetworkType(deviceID string) (NetworkType, error)
- func (i *DevicePortServiceOp) DeviceToLayerThree(deviceID string) (*Device, error)
- func (i *DevicePortServiceOp) DeviceToLayerTwo(deviceID string) (*Device, error)
- func (i *DevicePortServiceOp) Disbond(dr *DisbondRequest) (*Port, *Response, error)
- func (i *DevicePortServiceOp) GetBondPort(deviceID string) (*Port, error)
- func (i *DevicePortServiceOp) GetPortByName(deviceID, name string) (*Port, error)
- func (i *DevicePortServiceOp) PortToLayerThree(portID string) (*Port, *Response, error)
- func (i *DevicePortServiceOp) PortToLayerTwo(portID string) (*Port, *Response, error)
- func (i *DevicePortServiceOp) Unassign(par *PortAssignRequest) (*Port, *Response, error)
- type DeviceService
- type DeviceServiceOp
- func (s *DeviceServiceOp) Create(createRequest *DeviceCreateRequest) (*Device, *Response, error)
- func (s *DeviceServiceOp) Delete(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) Get(deviceID string) (*Device, *Response, error)
- func (s *DeviceServiceOp) GetExtra(deviceID string, includes, excludes []string) (*Device, *Response, error)
- func (s *DeviceServiceOp) List(projectID string, listOpt *ListOptions) (devices []Device, resp *Response, err error)
- func (s *DeviceServiceOp) Lock(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) PowerOff(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) PowerOn(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) Reboot(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) Unlock(deviceID string) (*Response, error)
- func (s *DeviceServiceOp) Update(deviceID string, updateRequest *DeviceUpdateRequest) (*Device, *Response, error)
- type DeviceUpdateRequest
- type DisbondRequest
- type Drives
- type Email
- type EmailService
- type EmailServiceOp
- type ErrorResponse
- type Facility
- type FacilityService
- type FacilityServiceOp
- type Features
- type Href
- type IPAddressAssignment
- type IPAddressReservation
- type IPReservationRequest
- type ListOptions
- type Memory
- type NetworkType
- type Nics
- type OS
- type OSService
- type OSServiceOp
- type Organization
- type OrganizationCreateRequest
- type OrganizationService
- type OrganizationServiceOp
- func (s *OrganizationServiceOp) Create(createRequest *OrganizationCreateRequest) (*Organization, *Response, error)
- func (s *OrganizationServiceOp) Delete(organizationID string) (*Response, error)
- func (s *OrganizationServiceOp) Get(organizationID string) (*Organization, *Response, error)
- func (s *OrganizationServiceOp) List() ([]Organization, *Response, error)
- func (s *OrganizationServiceOp) ListPaymentMethods(organizationID string) ([]PaymentMethod, *Response, error)
- func (s *OrganizationServiceOp) Update(id string, updateRequest *OrganizationUpdateRequest) (*Organization, *Response, error)
- type OrganizationUpdateRequest
- type PaymentMethod
- type PaymentMethodCreateRequest
- type PaymentMethodService
- type PaymentMethodServiceOp
- type PaymentMethodUpdateRequest
- type Plan
- type PlanService
- type PlanServiceOp
- type Port
- type PortAssignRequest
- type PortData
- type PriceMap
- type Pricing
- type Project
- type ProjectCreateRequest
- type ProjectIPService
- type ProjectIPServiceOp
- func (i *ProjectIPServiceOp) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error)
- func (i *ProjectIPServiceOp) Get(reservationID string) (*IPAddressReservation, *Response, error)
- func (i *ProjectIPServiceOp) List(projectID string) ([]IPAddressReservation, *Response, error)
- func (i *ProjectIPServiceOp) Remove(ipReservationID string) (*Response, error)
- func (i *ProjectIPServiceOp) Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error)
- type ProjectService
- type ProjectServiceOp
- func (s *ProjectServiceOp) Create(createRequest *ProjectCreateRequest) (*Project, *Response, error)
- func (s *ProjectServiceOp) Delete(projectID string) (*Response, error)
- func (s *ProjectServiceOp) Get(projectID string) (*Project, *Response, error)
- func (s *ProjectServiceOp) List() ([]Project, *Response, error)
- func (s *ProjectServiceOp) Update(id string, updateRequest *ProjectUpdateRequest) (*Project, *Response, error)
- type ProjectUpdateRequest
- type ProjectVirtualNetworkService
- type ProjectVirtualNetworkServiceOp
- func (i *ProjectVirtualNetworkServiceOp) Create(input *VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error)
- func (i *ProjectVirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error)
- func (i *ProjectVirtualNetworkServiceOp) List(projectID string) (*VirtualNetworkListResponse, *Response, error)
- type ProvisionEvent
- type Rate
- type Response
- type SSHKey
- type SSHKeyCreateRequest
- type SSHKeyService
- type SSHKeyServiceOp
- func (s *SSHKeyServiceOp) Create(createRequest *SSHKeyCreateRequest) (*SSHKey, *Response, error)
- func (s *SSHKeyServiceOp) Delete(sshKeyID string) (*Response, error)
- func (s *SSHKeyServiceOp) Get(sshKeyID string) (*SSHKey, *Response, error)
- func (s *SSHKeyServiceOp) List() ([]SSHKey, *Response, error)
- func (s *SSHKeyServiceOp) ProjectList(projectID string) ([]SSHKey, *Response, error)
- func (s *SSHKeyServiceOp) Update(id string, updateRequest *SSHKeyUpdateRequest) (*SSHKey, *Response, error)
- type SSHKeyUpdateRequest
- type SnapshotPolicy
- type Specs
- type SpotMarketService
- type SpotMarketServiceOp
- type Timestamp
- type User
- type UserService
- type UserServiceOp
- type VirtualNetwork
- type VirtualNetworkCreateRequest
- type VirtualNetworkCreateResponse
- type VirtualNetworkListResponse
- type Volume
- type VolumeAttachment
- type VolumeAttachmentService
- type VolumeAttachmentServiceOp
- type VolumeCreateRequest
- type VolumeService
- type VolumeServiceOp
- func (v *VolumeServiceOp) Create(createRequest *VolumeCreateRequest, projectID string) (*Volume, *Response, error)
- func (v *VolumeServiceOp) Delete(volumeID string) (*Response, error)
- func (v *VolumeServiceOp) Get(volumeID string) (*Volume, *Response, error)
- func (v *VolumeServiceOp) List(projectID string, listOpt *ListOptions) (volumes []Volume, resp *Response, err error)
- func (s *VolumeServiceOp) Lock(id string) (*Response, error)
- func (s *VolumeServiceOp) Unlock(id string) (*Response, error)
- func (v *VolumeServiceOp) Update(id string, updateRequest *VolumeUpdateRequest) (*Volume, *Response, error)
- type VolumeUpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamToString ¶
StreamToString converts a reader to a string
Types ¶
type Address ¶
type Address struct {
ID string `json:"id,omitempty"`
}
Address - the physical address of the facility
type AddressRequest ¶
type AddressStruct ¶
type AddressStruct struct {
Address string `json:"address"`
}
AddressStruct is a helper type for request/response with dict like {"address": ... }
type AvailableRequest ¶
type AvailableRequest struct {
CIDR int `json:"cidr"`
}
AvailableRequest is a type for listing available addresses from a reserved block.
type AvailableResponse ¶
type AvailableResponse struct {
Available []string `json:"available"`
}
AvailableResponse is a type for listing of available addresses from a reserved block.
type BackToL3Request ¶
type BackToL3Request struct {
RequestIPs []AddressRequest `json:"request_ips"`
}
type BillingAddress ¶
type BondRequest ¶
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string ConsumerToken string APIKey string RateLimit Rate // Packet Api Objects Plans PlanService Users UserService Emails EmailService SSHKeys SSHKeyService Devices DeviceService Projects ProjectService Facilities FacilityService OperatingSystems OSService DeviceIPs DeviceIPService DevicePorts DevicePortService ProjectIPs ProjectIPService ProjectVirtualNetworks ProjectVirtualNetworkService Volumes VolumeService VolumeAttachments VolumeAttachmentService SpotMarket SpotMarketService Organizations OrganizationService // contains filtered or unexported fields }
Client is the base API Client
func NewClientWithAuth ¶
NewClientWithAuth initializes and returns a Client, use this to get an API Client to operate on N.B.: Packet'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
type Device ¶
type Device struct { ID string `json:"id"` Href string `json:"href,omitempty"` Hostname string `json:"hostname,omitempty"` State string `json:"state,omitempty"` Created string `json:"created_at,omitempty"` Updated string `json:"updated_at,omitempty"` Locked bool `json:"locked,omitempty"` BillingCycle string `json:"billing_cycle,omitempty"` Storage map[string]interface{} `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"` Project *Project `json:"project,omitempty"` ProvisionEvents []*ProvisionEvent `json:"provisioning_events,omitempty"` ProvisionPer float32 `json:"provisioning_percentage,omitempty"` UserData string `json:"userdata,omitempty"` RootPassword string `json:"root_password,omitempty"` IPXEScriptURL string `json:"ipxe_script_url,omitempty"` AlwaysPXE bool `json:"always_pxe,omitempty"` HardwareReservation Href `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"` }
Device represents a Packet device
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"` Plan string `json:"plan"` Facility string `json:"facility"` OS string `json:"operating_system"` BillingCycle string `json:"billing_cycle"` ProjectID string `json:"project_id"` UserData string `json:"userdata"` Storage string `json:"storage,omitempty"` Tags []string `json:"tags"` 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"` }
DeviceCreateRequest type used to create a Packet device
func (DeviceCreateRequest) String ¶
func (d DeviceCreateRequest) String() string
type DeviceIPService ¶
type DeviceIPService interface { Assign(deviceID string, assignRequest *AddressStruct) (*IPAddressAssignment, *Response, error) Unassign(assignmentID string) (*Response, error) Get(assignmentID string) (*IPAddressAssignment, *Response, error) }
DeviceIPService handles assignment of addresses from reserved blocks to instances in a project.
type DeviceIPServiceOp ¶
type DeviceIPServiceOp struct {
// contains filtered or unexported fields
}
DeviceIPServiceOp is interface for IP-address assignment methods.
func (*DeviceIPServiceOp) Assign ¶
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 ¶
func (i *DeviceIPServiceOp) Get(assignmentID string) (*IPAddressAssignment, *Response, error)
Get returns assignment by ID.
func (*DeviceIPServiceOp) Unassign ¶
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 ¶
type DevicePortService interface { Assign(*PortAssignRequest) (*Port, *Response, error) Unassign(*PortAssignRequest) (*Port, *Response, error) Bond(*BondRequest) (*Port, *Response, error) Disbond(*DisbondRequest) (*Port, *Response, error) PortToLayerTwo(string) (*Port, *Response, error) PortToLayerThree(string) (*Port, *Response, error) DeviceToLayerTwo(string) (*Device, error) DeviceToLayerThree(string) (*Device, error) DeviceNetworkType(string) (NetworkType, error) GetBondPort(string) (*Port, error) GetPortByName(string, string) (*Port, error) }
DevicePortService handles operations on a port which belongs to a particular device
type DevicePortServiceOp ¶
type DevicePortServiceOp struct {
// contains filtered or unexported fields
}
func (*DevicePortServiceOp) Assign ¶
func (i *DevicePortServiceOp) Assign(par *PortAssignRequest) (*Port, *Response, error)
func (*DevicePortServiceOp) Bond ¶
func (i *DevicePortServiceOp) Bond(br *BondRequest) (*Port, *Response, error)
func (*DevicePortServiceOp) DeviceNetworkType ¶
func (i *DevicePortServiceOp) DeviceNetworkType(deviceID string) (NetworkType, error)
func (*DevicePortServiceOp) DeviceToLayerThree ¶
func (i *DevicePortServiceOp) DeviceToLayerThree(deviceID string) (*Device, error)
func (*DevicePortServiceOp) DeviceToLayerTwo ¶
func (i *DevicePortServiceOp) DeviceToLayerTwo(deviceID string) (*Device, error)
DeviceToLayerTwo converts device to L2 networking. Use bond0 to attach VLAN.
func (*DevicePortServiceOp) Disbond ¶
func (i *DevicePortServiceOp) Disbond(dr *DisbondRequest) (*Port, *Response, error)
func (*DevicePortServiceOp) GetBondPort ¶
func (i *DevicePortServiceOp) GetBondPort(deviceID string) (*Port, error)
func (*DevicePortServiceOp) GetPortByName ¶
func (i *DevicePortServiceOp) GetPortByName(deviceID, name string) (*Port, error)
func (*DevicePortServiceOp) PortToLayerThree ¶
func (i *DevicePortServiceOp) PortToLayerThree(portID string) (*Port, *Response, error)
func (*DevicePortServiceOp) PortToLayerTwo ¶
func (i *DevicePortServiceOp) PortToLayerTwo(portID string) (*Port, *Response, error)
func (*DevicePortServiceOp) Unassign ¶
func (i *DevicePortServiceOp) Unassign(par *PortAssignRequest) (*Port, *Response, error)
type DeviceService ¶
type DeviceService interface { List(ProjectID string, listOpt *ListOptions) ([]Device, *Response, error) Get(string) (*Device, *Response, error) GetExtra(deviceID string, includes, excludes []string) (*Device, *Response, error) Create(*DeviceCreateRequest) (*Device, *Response, error) Update(string, *DeviceUpdateRequest) (*Device, *Response, error) Delete(string) (*Response, error) Reboot(string) (*Response, error) PowerOff(string) (*Response, error) PowerOn(string) (*Response, error) Lock(string) (*Response, error) Unlock(string) (*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) (*Response, error)
Delete deletes a device
func (*DeviceServiceOp) Get ¶
func (s *DeviceServiceOp) Get(deviceID string) (*Device, *Response, error)
Get returns a device by id
func (*DeviceServiceOp) GetExtra ¶
func (s *DeviceServiceOp) GetExtra(deviceID string, includes, excludes []string) (*Device, *Response, error)
GetExtra returns a device by id. Specifying either includes/excludes provides more or less desired detailed information about resources which would otherwise be represented with an href link
func (*DeviceServiceOp) List ¶
func (s *DeviceServiceOp) List(projectID string, listOpt *ListOptions) (devices []Device, resp *Response, err error)
List returns devices on a project
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) 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 a Packet device
type DisbondRequest ¶
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
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
type EmailService ¶
EmailService interface defines available email methods
type EmailServiceOp ¶
type EmailServiceOp struct {
// contains filtered or unexported fields
}
EmailServiceOp implements EmailService
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 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"` URL string `json:"href,omitempty"` }
Facility represents a Packet facility
type FacilityService ¶
FacilityService interface defines available facility methods
type FacilityServiceOp ¶
type FacilityServiceOp struct {
// contains filtered or unexported fields
}
FacilityServiceOp implements FacilityService
type IPAddressAssignment ¶
type IPAddressAssignment struct { AssignedTo Href `json:"assigned_to"` // contains filtered or unexported fields }
IPAddressAssignment is created when an IP address from reservation block is assigned to a device.
func (IPAddressAssignment) String ¶
func (i IPAddressAssignment) String() string
type IPAddressReservation ¶
type IPAddressReservation struct { Assignments []Href `json:"assignments"` Facility Facility `json:"facility,omitempty"` Available string `json:"available"` Addon bool `json:"addon"` Bill bool `json:"bill"` // contains filtered or unexported fields }
IPAddressReservation is created when user sends IP reservation request for a project (considering it's within quota).
func (IPAddressReservation) String ¶
func (i IPAddressReservation) String() string
type IPReservationRequest ¶
type IPReservationRequest struct { Type string `json:"type"` Quantity int `json:"quantity"` Comments string `json:"comments"` Facility string `json:"facility"` }
IPReservationRequest represents the body of a reservation request.
type ListOptions ¶
type ListOptions struct { // for paginated result sets, page of results to retrieve Page int `url:"page,omitempty"` // for paginated result sets, the number of results to return per page PerPage int `url:"per_page,omitempty"` // specify which resources you want to return as collections instead of references Includes string }
ListOptions specifies optional global API parameters
type Memory ¶
type Memory struct {
Total string `json:"total,omitempty"`
}
Memory - the RAM config details for specs on a plan
type NetworkType ¶
type NetworkType int
const ( NetworkL3 NetworkType = iota NetworkHybrid NetworkL2Bonded NetworkL2Individual NetworkUnknown )
type OS ¶
type OS struct { Name string `json:"name"` Slug string `json:"slug"` Distro string `json:"distro"` Version string `json:"version"` }
OS represents a Packet operating system
type OSServiceOp ¶
type OSServiceOp struct {
// contains filtered or unexported fields
}
OSServiceOp implements OSService
type Organization ¶
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"` Logo string `json:"logo,omitempty"` LogoThumb string `json:"logo_thumb,omitempty"` Projects []Project `json:"projects,omitempty"` URL string `json:"href,omitempty"` Users []User `json:"members,omitempty"` Owners []User `json:"owners,omitempty"` }
Organization represents a Packet organization
func (Organization) String ¶
func (o Organization) String() string
type OrganizationCreateRequest ¶
type OrganizationCreateRequest struct { Name string `json:"name"` Description string `json:"description"` Website string `json:"website"` Twitter string `json:"twitter"` Logo string `json:"logo"` }
OrganizationCreateRequest type used to create a Packet organization
func (OrganizationCreateRequest) String ¶
func (o OrganizationCreateRequest) String() string
type OrganizationService ¶
type OrganizationService interface { List() ([]Organization, *Response, error) Get(string) (*Organization, *Response, error) Create(*OrganizationCreateRequest) (*Organization, *Response, error) Update(string, *OrganizationUpdateRequest) (*Organization, *Response, error) Delete(string) (*Response, error) ListPaymentMethods(string) ([]PaymentMethod, *Response, error) }
OrganizationService interface defines available organization methods
type OrganizationServiceOp ¶
type OrganizationServiceOp struct {
// contains filtered or unexported fields
}
OrganizationServiceOp implements OrganizationService
func (*OrganizationServiceOp) Create ¶
func (s *OrganizationServiceOp) Create(createRequest *OrganizationCreateRequest) (*Organization, *Response, error)
Create creates a new organization
func (*OrganizationServiceOp) Delete ¶
func (s *OrganizationServiceOp) Delete(organizationID string) (*Response, error)
Delete deletes an organizationID
func (*OrganizationServiceOp) Get ¶
func (s *OrganizationServiceOp) Get(organizationID string) (*Organization, *Response, error)
Get returns a organization by id
func (*OrganizationServiceOp) List ¶
func (s *OrganizationServiceOp) List() ([]Organization, *Response, error)
List returns the user's organizations
func (*OrganizationServiceOp) ListPaymentMethods ¶
func (s *OrganizationServiceOp) ListPaymentMethods(organizationID string) ([]PaymentMethod, *Response, error)
ListPaymentMethods returns PaymentMethods for an organization
func (*OrganizationServiceOp) Update ¶
func (s *OrganizationServiceOp) Update(id string, updateRequest *OrganizationUpdateRequest) (*Organization, *Response, error)
Update updates an organization
type OrganizationUpdateRequest ¶
type OrganizationUpdateRequest struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Website *string `json:"website,omitempty"` Twitter *string `json:"twitter,omitempty"` Logo *string `json:"logo,omitempty"` }
OrganizationUpdateRequest type used to update a Packet organization
func (OrganizationUpdateRequest) String ¶
func (o OrganizationUpdateRequest) String() string
type PaymentMethod ¶
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 a Packet payment method of an organization
func (PaymentMethod) String ¶
func (pm PaymentMethod) String() string
type PaymentMethodCreateRequest ¶
type PaymentMethodCreateRequest struct { Name string `json:"name"` Nonce string `json:"name"` 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 a Packet payment method of an organization
func (PaymentMethodCreateRequest) String ¶
func (pm PaymentMethodCreateRequest) String() string
type PaymentMethodService ¶
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 ¶
type PaymentMethodServiceOp struct {
// contains filtered or unexported fields
}
PaymentMethodServiceOp implements PaymentMethodService
type PaymentMethodUpdateRequest ¶
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 a Packet payment method of an organization
func (PaymentMethodUpdateRequest) String ¶
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"` Specs *Specs `json:"specs,omitempty"` Pricing *Pricing `json:"pricing,omitempty"` }
Plan represents a Packet service plan
type PlanService ¶
PlanService interface defines available plan methods
type PlanServiceOp ¶
type PlanServiceOp struct {
// contains filtered or unexported fields
}
PlanServiceOp implements PlanService
type Port ¶
type Port struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Data PortData `json:"data"` AttachedVirtualNetworks []VirtualNetwork `json:"virtual_networks"` }
type PortAssignRequest ¶
type Pricing ¶
type Pricing struct { Hourly float32 `json:"hourly,omitempty"` Monthly float32 `json:"monthly,omitempty"` }
Pricing - the pricing options on a plan
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"` }
Project represents a Packet project
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 a Packet project
func (ProjectCreateRequest) String ¶
func (p ProjectCreateRequest) String() string
type ProjectIPService ¶
type ProjectIPService interface { Get(reservationID string) (*IPAddressReservation, *Response, error) List(projectID string) ([]IPAddressReservation, *Response, error) Request(projectID string, ipReservationReq *IPReservationRequest) (*IPAddressReservation, *Response, error) Remove(ipReservationID string) (*Response, error) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error) }
ProjectIPService handles reservation of IP address blocks for a project.
type ProjectIPServiceOp ¶
type ProjectIPServiceOp struct {
// contains filtered or unexported fields
}
ProjectIPServiceOp is interface for IP assignment methods.
func (*ProjectIPServiceOp) AvailableAddresses ¶
func (i *ProjectIPServiceOp) AvailableAddresses(ipReservationID string, r *AvailableRequest) ([]string, *Response, error)
AvailableAddresses lists addresses available from a reserved block
func (*ProjectIPServiceOp) Get ¶
func (i *ProjectIPServiceOp) Get(reservationID string) (*IPAddressReservation, *Response, error)
Get returns reservation by ID.
func (*ProjectIPServiceOp) List ¶
func (i *ProjectIPServiceOp) List(projectID string) ([]IPAddressReservation, *Response, error)
List provides a list of IP resevations for a single project.
func (*ProjectIPServiceOp) Remove ¶
func (i *ProjectIPServiceOp) Remove(ipReservationID string) (*Response, error)
Remove removes an IP reservation from the project.
func (*ProjectIPServiceOp) Request ¶
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.
type ProjectService ¶
type ProjectService interface { List() ([]Project, *Response, error) Get(string) (*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) (*Project, *Response, error)
Get returns a project by id
func (*ProjectServiceOp) List ¶
func (s *ProjectServiceOp) List() ([]Project, *Response, error)
List returns the user's projects
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"` }
ProjectUpdateRequest type used to update a Packet project
func (ProjectUpdateRequest) String ¶
func (p ProjectUpdateRequest) String() string
type ProjectVirtualNetworkService ¶
type ProjectVirtualNetworkService interface { List(projectID string) (*VirtualNetworkListResponse, *Response, error) Create(*VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error) Delete(virtualNetworkID string) (*Response, error) }
DevicePortService handles operations on a port which belongs to a particular device
type ProjectVirtualNetworkServiceOp ¶
type ProjectVirtualNetworkServiceOp struct {
// contains filtered or unexported fields
}
func (*ProjectVirtualNetworkServiceOp) Create ¶
func (i *ProjectVirtualNetworkServiceOp) Create(input *VirtualNetworkCreateRequest) (*VirtualNetwork, *Response, error)
func (*ProjectVirtualNetworkServiceOp) Delete ¶
func (i *ProjectVirtualNetworkServiceOp) Delete(virtualNetworkID string) (*Response, error)
func (*ProjectVirtualNetworkServiceOp) List ¶
func (i *ProjectVirtualNetworkServiceOp) List(projectID string) (*VirtualNetworkListResponse, *Response, error)
type ProvisionEvent ¶
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
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"` User User `json:"user,omitempty"` URL string `json:"href,omitempty"` }
SSHKey represents a user's ssh key
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) (*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) (*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 ¶
func (s *SSHKeyServiceOp) ProjectList(projectID string) ([]SSHKey, *Response, error)
ProjectList lists ssh keys of a project
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 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 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
type SpotMarketService ¶
SpotMarketService expooses Spot Market methods
type SpotMarketServiceOp ¶
type SpotMarketServiceOp struct {
// contains filtered or unexported fields
}
SpotMarketServiceOp implements SpotMarketService
type Timestamp ¶
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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
type User ¶
type User struct { ID string `json:"id"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` FullName string `json:"full_name,omitempty"` Email string `json:"email,omitempty"` TwoFactor string `json:"two_factor_auth,omitempty"` DefaultOrganizationID string `json:"default_organization_id,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Facebook string `json:"twitter,omitempty"` Twitter string `json:"facebook,omitempty"` LinkedIn string `json:"linkedin,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"` }
User represents a Packet user
type UserService ¶
type UserService interface { Get(string) (*User, *Response, error) Current() (*User, *Response, error) }
UserService interface defines available user methods
type UserServiceOp ¶
type UserServiceOp struct {
// contains filtered or unexported fields
}
UserServiceOp implements UserService
type VirtualNetwork ¶
type VirtualNetworkCreateResponse ¶
type VirtualNetworkCreateResponse struct {
VirtualNetwork VirtualNetwork `json:"virtual_networks"`
}
type VirtualNetworkListResponse ¶
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
type VolumeAttachment ¶
type VolumeAttachment struct { Href string `json:"href"` ID string `json:"id"` Volume Volume `json:"volume"` Device Device `json:"device"` }
VolumeAttachment is a type from Packet API
type VolumeAttachmentService ¶
type VolumeAttachmentService interface { Get(string) (*VolumeAttachment, *Response, error) Create(string, string) (*VolumeAttachment, *Response, error) Delete(string) (*Response, error) }
VolumeAttachmentService defines attachment methdods
type VolumeAttachmentServiceOp ¶
type VolumeAttachmentServiceOp struct {
// contains filtered or unexported fields
}
VolumeAttachmentServiceOp implements VolumeService
func (*VolumeAttachmentServiceOp) Create ¶
func (v *VolumeAttachmentServiceOp) Create(volumeID, deviceID string) (*VolumeAttachment, *Response, error)
Create Attachment, i.e. attach volume to a device
func (*VolumeAttachmentServiceOp) Delete ¶
func (v *VolumeAttachmentServiceOp) Delete(attachmentID string) (*Response, error)
Delete deletes attachment by id
func (*VolumeAttachmentServiceOp) Get ¶
func (v *VolumeAttachmentServiceOp) Get(attachmentID string) (*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 a Packet volume
func (VolumeCreateRequest) String ¶
func (v VolumeCreateRequest) String() string
type VolumeService ¶
type VolumeService interface { List(string, *ListOptions) ([]Volume, *Response, error) Get(string) (*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) (*Volume, *Response, error)
Get returns a volume by id
func (*VolumeServiceOp) List ¶
func (v *VolumeServiceOp) List(projectID string, listOpt *ListOptions) (volumes []Volume, resp *Response, err error)
List returns the volumes for a project
func (*VolumeServiceOp) Lock ¶
func (s *VolumeServiceOp) Lock(id string) (*Response, error)
Lock sets a volume to "locked"
func (*VolumeServiceOp) Unlock ¶
func (s *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 a Packet volume
func (VolumeUpdateRequest) String ¶
func (v VolumeUpdateRequest) String() string