api

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthPath           = "/health"
	PolicyPath           = "/v1/apps/{appId}/policy"
	CredentialPath       = "/v1/apps/{appId}/credential"
	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) CreateCredential

func (helper *APIHelper) CreateCredential(data interface{}) ([]byte, error)

func (*APIHelper) CreatePolicy

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

func (*APIHelper) DeleteCredential

func (helper *APIHelper) DeleteCredential() 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, asc bool, page uint64) (bool, [][]string, error)

func (*APIHelper) GetHistory

func (helper *APIHelper) GetHistory(startTime, endTime int64, asc 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