goblueboxapi

package module
v0.0.0-...-4f22069 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2015 License: MIT Imports: 8 Imported by: 0

README

Go Blue Box API Library

goblueboxapi is a library for interacting with the Blue Box API.

Installation

Standard go get:

$ go get github.com/henrikhodne/goblueboxapi

Usage & Example

For usage and examples, see the Godoc.

Documentation

Overview

Package goblueboxapi exposes functionality to interact with the Blue Box API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	ID       string
	Hostname string
	IPs      []BlockIP
	Status   string
	VSHID    string `json:"vsh_id"`
}

A Block is an on demand virtual computing resource.

type BlockIP

type BlockIP struct {
	Address string
}

A BlockIP holds an IPv4 or IPv6 address for a block.

type BlockParams

type BlockParams struct {
	Product      string
	Template     string
	Password     string
	SshPublicKey string
	Hostname     string
	Username     string
	Location     string
	IPv6Only     bool
}

BlockParams holds the information needed to boot a block. Product and Template as well as either SshPublicKey or Password (but not both) must be specified.

type BlocksService

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

BlocksService exposes the API endpoints to interact with blocks.

func (*BlocksService) Create

func (s *BlocksService) Create(p BlockParams) (*Block, error)

Create boots a new block with the given parameters, and returns the block.

func (*BlocksService) Destroy

func (s *BlocksService) Destroy(uuid string) error

Destroy shuts down a block.

func (*BlocksService) Get

func (s *BlocksService) Get(uuid string) (*Block, error)

Get returns a block given its Id, or an error if there was a problem fetching the information from the API.

func (*BlocksService) List

func (s *BlocksService) List() ([]Block, error)

List returns the currently running blocks, or an error if there was a problem fetching the information from the API.

type Client

type Client struct {
	BaseURL *url.URL

	// Credentials which is used for authentication during API requests
	CustomerID string
	APIKey     string

	Blocks    *BlocksService
	Templates *TemplatesService
	// contains filtered or unexported fields
}

A Client manages communication with the Blue Box API

func NewClient

func NewClient(customerID, apiKey string) *Client

NewClient creates a Client with the given customer ID and API key and the default API endpoint.

type Template

type Template struct {
	ID          string
	Description string
	Public      bool
	Created     time.Time
}

A Teamplate is a bootable OS image.

type TemplateCreationStatus

type TemplateCreationStatus struct {
	Status string
	Text   string
	Error  int
}

A rich description of the output when creating a new Template.

type TemplatesService

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

TemplatesService exposes the API endpoints to interact with templates.

func (*TemplatesService) Create

func (s *TemplatesService) Create(uuid string, description string) (*TemplateCreationStatus, error)

Create queues a new template for creation from a block uuid.

func (*TemplatesService) Destroy

func (s *TemplatesService) Destroy(uuid string) error

Destroy destroys the template/image.

func (*TemplatesService) Get

func (s *TemplatesService) Get(uuid string) (*Template, error)

Get returns a template given its Id, or an error if there was a problem fetching the information from the API.

func (*TemplatesService) List

func (s *TemplatesService) List() ([]Template, error)

List returns the currently known templates, or an error if there was a problem fetching the information from the API.

Jump to

Keyboard shortcuts

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