api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HealthPath           = "/health"
	PolicyPath           = "/v1/apps/{appId}/policy"
	AggregatedMetricPath = "/v1/apps/{appId}/aggregated_metric_histories/{metric_type}"
	HistoryPath          = "/v1/apps/{appId}/scaling_histories"
)

Variables

View Source
var ConfigFile = func() string {
	defaultCFConfigPath, _ := confighelpers.DefaultFilePath()
	targetsPath := filepath.Join(filepath.Dir(defaultCFConfigPath), "plugins", "autoscaler_config")
	os.MkdirAll(targetsPath, 0700)

	defaultConfigFileName := "config.json"
	if os.Getenv("AUTOSCALER_CONFIG_FILE") != "" {
		defaultConfigFileName = os.Getenv("AUTOSCALER_CONFIG_FILE")
	}
	return filepath.Join(targetsPath, defaultConfigFileName)
}

Functions

func SetEndpoint

func SetEndpoint(cfclient *CFClient, url string, skipSSLValidation bool) error

func UnsetEndpoint

func UnsetEndpoint() error

Types

type APIEndpoint

type APIEndpoint struct {
	URL               string
	SkipSSLValidation bool
}

func GetEndpoint

func GetEndpoint(cfclient *CFClient) (*APIEndpoint, error)

type APIHelper

type APIHelper struct {
	Endpoint *APIEndpoint
	Client   *CFClient
	Logger   trace.Printer
}

func NewAPIHelper

func NewAPIHelper(endpoint *APIEndpoint, cfclient *CFClient, traceEnabled string) *APIHelper

func (*APIHelper) CheckHealth

func (helper *APIHelper) CheckHealth() error

func (*APIHelper) CreatePolicy

func (helper *APIHelper) CreatePolicy(data interface{}) error

func (*APIHelper) DeletePolicy

func (helper *APIHelper) DeletePolicy() error

func (*APIHelper) DoRequest

func (helper *APIHelper) DoRequest(req *http.Request) (*http.Response, error)

func (*APIHelper) GetAggregatedMetrics added in v1.1.0

func (helper *APIHelper) GetAggregatedMetrics(metricName string, startTime, endTime int64, desc bool, page uint64) (bool, [][]string, error)

func (*APIHelper) GetHistory

func (helper *APIHelper) GetHistory(startTime, endTime int64, desc bool, page uint64) (bool, [][]string, error)

func (*APIHelper) GetPolicy

func (helper *APIHelper) GetPolicy() ([]byte, error)

type CFClient

type CFClient struct {
	CCAPIEndpoint string
	AuthToken     string
	AppId         string
	AppName       string
	IsSSLDisabled bool
	// contains filtered or unexported fields
}

func NewCFClient

func NewCFClient(connection Connection) (*CFClient, error)

func (*CFClient) Configure

func (client *CFClient) Configure(appName string) error

type Connection

type Connection interface {
	ApiEndpoint() (string, error)
	IsLoggedIn() (bool, error)
	AccessToken() (string, error)
	GetApp(string) (plugin_models.GetAppModel, error)
	IsSSLDisabled() (bool, error)
}

Jump to

Keyboard shortcuts

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