cf

package module
v0.0.0-...-f365751 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2013 License: MIT Imports: 15 Imported by: 0

README

Cloud Founry Interaction Library Build Status

CF Go package makes it easier to interact with Cloud Foundry v2 instances. It provides higher level API to perform basic actions over REST API.

The REST API of Cloud Foundry is not documented yet, so all the functionality is implemented by reverse engineering official CF client written in Ruby (http://github.com/cloudfoundry/cf).

Usage

The usage of this library is demonstrated in cf90 CLI tool (http://github.com/igm/cf90)

This project is work in progress.

Documentation

Overview

Cloud Foundy/PivotalCF client library

This library is able to connect to any Cloud Fondry instance and perform various operations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Enables Logging
	Trace bool = false
	// Writer used for tracing (osdefault .Stderr)
	Out io.Writer = os.Stderr
)
View Source
var HttpClient = http.DefaultClient

HttpClient used for HTTP Requests. Replace with different http client if needed.

Functions

This section is empty.

Types

type App

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

func (App) String

func (a App) String() string

type AppUpdate

type AppUpdate struct {
	Guid      string `json:"-"`
	Instances int    `json:"instances"`
	Memory    int    `json:"memory"`
}

type Archetype

type Archetype struct {
	Name   string
	Reader interface {
		io.ReadCloser
		io.Seeker
	}
}

type Domain

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

func (Domain) String

func (d Domain) String() string

type Error

type Error struct {
	CfCode         int `json:"code"`
	HttpStatusCode int
	Description    string `json:"description"`
	ErrorMsg       string `json:"error"`
}

func (*Error) Error

func (c *Error) Error() string

type FileInfo

type FileInfo struct {
	Name string
	Dir  bool
	Size string
}

type Info

type Info struct {
	Name                  string `json:"name"`
	Build                 string `json:"build"`
	Support               string `json:"support"`
	Version               int    `json:"version"`
	Description           string `json:"description"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	ApiVersion            string `json:"api_version"`
}

type Instance

type Instance struct {
	State       string  `json:"state"`
	Since       float64 `json:"since"`
	DebugIP     string  `json:"debug_ip"`
	DebugPort   string  `json:"debug_port"`
	ConsoleIP   string  `json:"console_ip"`
	ConsolePort string  `json:"console_port"`
}

type NewApp

type NewApp struct {
	SpaceGUID string `json:"space_guid"`
	Name      string `json:"name"`
	Instances int    `json:"instances"`
	Memory    int    `json:"memory"`

	Buildpack *string `json:"buildpack"`
	Command   *string `json:"command"`
	StackGUID *string `json:"stack_guid"`
}

Structure used to create a new application.

type Organization

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

type Route

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

func (Route) String

func (r Route) String() string

type Service

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

type Space

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

func (Space) String

func (s Space) String() string

type Summary

type Summary struct {
	Space
	Apps     []App     `json:"apps"`
	Services []Service `json:"services"`
}

type Target

type Target struct {
	TargetUrl     string
	Username      string
	TokenEndpoint string
	AccessToken   string
	RefreshToken  string
}

Target is the centra structure of this library. All the API remote operatins are performed on Target

func NewTarget

func NewTarget(url string) *Target

func (*Target) AppAddRoute

func (target *Target) AppAddRoute(appGUID, routeGUID string) (err error)

func (*Target) AppCreate

func (target *Target) AppCreate(app *NewApp) (ret *App, err error)

func (*Target) AppDelete

func (target *Target) AppDelete(appGUID string) (err error)

func (*Target) AppDeleteRoute

func (target *Target) AppDeleteRoute(appGUID, routeGUID string) (err error)

func (*Target) AppGet

func (target *Target) AppGet(appGUID, instance, file string) (reader io.Reader, err error)

func (*Target) AppInstances

func (target *Target) AppInstances(appGUID string) (instances map[string]Instance, err error)

func (*Target) AppLs

func (target *Target) AppLs(appGUID, instance, dir string) (files []FileInfo, err error)

func (*Target) AppPush

func (target *Target) AppPush(appGUID string, archetypes []*Archetype) (err error)

AppPush creates a zip archive from all the provided atchetypes and upload the archive to the server with relevant application uuid TODO: implement resources diff

func (*Target) AppPushArchive

func (target *Target) AppPushArchive(appGUID string, reader io.Reader) (err error)

func (*Target) AppRoutesGet

func (target *Target) AppRoutesGet(appGUID string) (routes []Route, err error)

func (*Target) AppStart

func (target *Target) AppStart(appGUID string) (resp *http.Response, err error)

func (*Target) AppStop

func (target *Target) AppStop(appGUID string) (resp *http.Response, err error)

func (*Target) AppUpdate

func (target *Target) AppUpdate(app *AppUpdate) (ret *App, err error)

func (*Target) AppsGet

func (target *Target) AppsGet() (apps []App, err error)

func (*Target) DomainsGet

func (target *Target) DomainsGet() (domains []Domain, err error)

GetDomains returns a slice of registered domains for given space

func (*Target) GetServices

func (target *Target) GetServices() (services []Service, err error)

func (*Target) Info

func (target *Target) Info() (info Info, err error)

func (*Target) Login

func (target *Target) Login(username, pass string) error

func (*Target) Logout

func (target *Target) Logout()

func (*Target) OrganizationsGet

func (target *Target) OrganizationsGet() (orgs []Organization, err error)

GetOrtanizations returns a slice of all organizations

func (*Target) RouteCreate

func (target *Target) RouteCreate(host, domainGUID, spaceGUID string) (err error)

func (*Target) RouteDelete

func (target *Target) RouteDelete(routeGUID string) (err error)

func (*Target) RoutesGet

func (target *Target) RoutesGet() (routes []Route, err error)

func (*Target) SpacesGet

func (target *Target) SpacesGet() (spaces []Space, err error)

func (*Target) Summary

func (target *Target) Summary(spaceGUID string) (summary *Summary, err error)

Summary returns a Space summary, not really sure if its usefull

Jump to

Keyboard shortcuts

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