client

package module
v0.0.0-...-2dc964c Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

eats-cf-client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv() environment

LoadEnv instantiates an Environment via envstruct

func NewTokenCache

func NewTokenCache(cfg OauthConfig) *internal.TokenCache

Types

type AppGuidCache

type AppGuidCache interface {
	TryWithRefresh(appName string, f func(appGuid string) error) error
}

type Capi

type Capi interface {
	Apps(query map[string]string) ([]models.App, error)
	Process(appGuid, processType string) (models.Process, error)
	Scale(appGuid, processType string, instanceCount uint) error
	CreateTask(appGuid, command string, cfg models.TaskConfig, opts ...models.HeaderOption) (models.Task, error)
	Stop(appGuid string) error
}

type Client

type Client struct {
	CloudControllerUrl string
	SpaceGuid          string

	Oauth        Oauth
	Capi         Capi
	AppGuidCache AppGuidCache
}

func Build

func Build() *Client

func New

func New(cfg Config) *Client

func (*Client) CreateTask

func (c *Client) CreateTask(appName, command string, cfg models.TaskConfig, opts ...models.HeaderOption) (models.Task, error)

func (*Client) Process

func (c *Client) Process(appName, processType string) (models.Process, error)

func (*Client) Scale

func (c *Client) Scale(appName string, instanceTarget uint) error

func (*Client) Stop

func (c *Client) Stop(appName string) error

type Config

type Config struct {
	CloudControllerUrl string
	SpaceGuid          string
	HttpClient         *http.Client
	Username           string
	Password           string
	TokenGetter        func() (string, error)
}

type Oauth

type Oauth interface {
	Token() (string, error) //TODO just a func?
}

type OauthConfig

type OauthConfig struct {
	HttpClient httpClient
	OauthUrl   string

	Username string
	Password string

	Client       string
	ClientSecret string
}

type VcapApplication

type VcapApplication struct {
	SpaceID string `json:"space_id"`
	CfApi   string `json:"cf_api"`
}

VcapApplication is information provided by the Cloud Foundry runtime

func (*VcapApplication) UnmarshalEnv

func (v *VcapApplication) UnmarshalEnv(data string) error

UnmarshalEnv decodes a VcapApplication for envstruct.Load

type VcapServices

type VcapServices struct {
	Credhub []struct {
		Credentials map[string]string `json:"credentials"`
	} `json:"credhub"`
	UserProvided []userProvided `json:"user-provided"`
}

VcapServices is information provided by the Cloud Foundry runtime

func (*VcapServices) UnmarshalEnv

func (v *VcapServices) UnmarshalEnv(data string) error

UnmarshalEnv decodes a VcapServices for envstruct.Load

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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