v0.0.0-...-04a75a9 Latest Latest

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

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




Build Status GoDoc

cfclient is a package to assist you in writing apps that need information out of Cloud Foundry. It provides functions and structures to retrieve


go get

package main

import (

func main() {
  c := &Config{
    ApiAddress:   "",
    LoginAddress: "",
    Username:     "admin",
    Password:     "admin",
  client := NewClient(c)
  apps := client.ListApps()
Developing & Contributing

You can use Godep to restor the dependency

godep go build

Pull requests welcomed. Please ensure you make your changes in a branch off of the develop branch, not the master branch.




This section is empty.


This section is empty.


This section is empty.


type App

type App struct {
	Guid        string                 `json:"guid"`
	Name        string                 `json:"name"`
	Environment map[string]interface{} `json:"environment_json"`
	SpaceURL    string                 `json:"space_url"`
	SpaceData   SpaceResource          `json:"space"`
	// contains filtered or unexported fields

func (*App) Space

func (a *App) Space() Space

type AppResource

type AppResource struct {
	Meta   Meta `json:"metadata"`
	Entity App  `json:"entity"`

type AppResponse

type AppResponse struct {
	Count     int           `json:"total_results"`
	Pages     int           `json:"total_pages"`
	NextUrl   string        `json:"next_url"`
	Resources []AppResource `json:"resources"`

type Client

type Client struct {
	Endpoint Endpoint
	// contains filtered or unexported fields

Client used to communicate with Cloud Foundry

func NewClient

func NewClient(config *Config) *Client

NewClient returns a new client

func (*Client) AppByGuid

func (c *Client) AppByGuid(guid string) App

func (*Client) GetToken

func (c *Client) GetToken() string

func (*Client) ListApps

func (c *Client) ListApps() []App

func (*Client) ListOrgs

func (c *Client) ListOrgs() []Org

func (*Client) ListServices

func (c *Client) ListServices() []Service

func (*Client) ListSpaces

func (c *Client) ListSpaces() []Space

func (*Client) OrgSpaces

func (c *Client) OrgSpaces(guid string) []Space

type Config

type Config struct {
	ApiAddress        string
	LoginAddress      string
	Username          string
	Password          string
	SkipSslValidation bool
	HttpClient        *http.Client
	Token             string
	TokenSource       oauth2.TokenSource

Config is used to configure the creation of a client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig configuration for client Keep LoginAdress for backward compatibility Need to be remove in close future

type Endpoint

type Endpoint struct {
	DopplerEndpoint string `json:"doppler_logging_endpoint"`
	LoggingEndpoint string `json:"logging_endpoint"`
	AuthEndpoint    string `json:"authorization_endpoint"`
	TokenEndpoint   string `json:"token_endpoint"`

func DefaultEndpoint

func DefaultEndpoint() *Endpoint

type Meta

type Meta struct {
	Guid string `json:"guid"`

type Org

type Org struct {
	Guid string `json:"guid"`
	Name string `json:"name"`
	// contains filtered or unexported fields

type OrgResource

type OrgResource struct {
	Meta   Meta `json:"metadata"`
	Entity Org  `json:"entity"`

type OrgResponse

type OrgResponse struct {
	Count     int           `json:"total_results"`
	Pages     int           `json:"total_pages"`
	Resources []OrgResource `json:"resources"`

type Service

type Service struct {
	Guid  string `json:"guid"`
	Label string `json:"label"`
	// contains filtered or unexported fields

type ServiceResource

type ServiceResource struct {
	Meta   Meta    `json:"metadata"`
	Entity Service `json:"entity"`

type ServiceResponse

type ServiceResponse struct {
	Count     int               `json:"total_results"`
	Pages     int               `json:"total_pages"`
	Resources []ServiceResource `json:"resources"`

type Space

type Space struct {
	Guid    string      `json:"guid"`
	Name    string      `json:"name"`
	OrgURL  string      `json:"organization_url"`
	OrgData OrgResource `json:"organization"`
	// contains filtered or unexported fields

func (*Space) Org

func (s *Space) Org() Org

type SpaceResource

type SpaceResource struct {
	Meta   Meta  `json:"metadata"`
	Entity Space `json:"entity"`

type SpaceResponse

type SpaceResponse struct {
	Count     int             `json:"total_results"`
	Pages     int             `json:"total_pages"`
	Resources []SpaceResource `json:"resources"`

Jump to

Keyboard shortcuts

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