models

package
v0.0.0-...-52fabeb Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppStatusStopped = "STOPPED"
	AppStatusStarted = "STARTED"
)
View Source
const (
	UnitPercentage   = "%"
	UnitMegaBytes    = "MB"
	UnitNum          = ""
	UnitMilliseconds = "ms"
	UnitRPS          = "rps"

	MetricNameMemoryUtil   = "memoryutil"
	MetricNameMemoryUsed   = "memoryused"
	MetricNameCPUUtil      = "cpu"
	MetricNameThroughput   = "throughput"
	MetricNameResponseTime = "responsetime"

	MetricLabelAppID         = "app_id"
	MetricLabelInstanceIndex = "instance_index"
	MetricLabelName          = "name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveSchedule

type ActiveSchedule struct {
	ScheduleId         string
	InstanceMin        int `json:"instance_min_count"`
	InstanceMax        int `json:"instance_max_count"`
	InstanceMinInitial int `json:"initial_min_instance_count"`
}

type AppEntity

type AppEntity struct {
	Instances int     `json:"instances"`
	State     *string `json:"state,omitempty"`
}

type AppInstanceMetric

type AppInstanceMetric struct {
	AppId         string `json:"app_id"`
	InstanceIndex uint32 `json:"instance_index"`
	CollectedAt   int64  `json:"collected_at"`
	Name          string `json:"name"`
	Unit          string `json:"unit"`
	Value         string `json:"value"`
	Timestamp     int64  `json:"timestamp"`
}

func (*AppInstanceMetric) GetTimestamp

func (m *AppInstanceMetric) GetTimestamp() int64

func (*AppInstanceMetric) HasLabels

func (m *AppInstanceMetric) HasLabels(labels map[string]string) bool

type AppMetric

type AppMetric struct {
	AppId      string `json:"app_id"`
	MetricType string `json:"name"`
	Value      string `json:"value"`
	Unit       string `json:"unit"`
	Timestamp  int64  `json:"timestamp"`
}

func (*AppMetric) GetTimestamp

func (m *AppMetric) GetTimestamp() int64

func (*AppMetric) HasLabels

func (m *AppMetric) HasLabels(labels map[string]string) bool

type AppMetricResponse

type AppMetricResponse struct {
	PublicApiResponseBase
	Resources []AppMetric `json:"resources"`
}

type AppMonitor

type AppMonitor struct {
	AppId      string
	MetricType string
	StatWindow time.Duration
}

type AppNotFoundErr

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

func NewAppNotFoundErr

func NewAppNotFoundErr(message string) *AppNotFoundErr

func (*AppNotFoundErr) Error

func (e *AppNotFoundErr) Error() string

type AppPolicy

type AppPolicy struct {
	AppId         string
	ScalingPolicy *ScalingPolicy
}

type AppScalingHistory

type AppScalingHistory struct {
	AppId        string        `json:"app_id"`
	Timestamp    int64         `json:"timestamp"`
	ScalingType  ScalingType   `json:"scaling_type"`
	Status       ScalingStatus `json:"status"`
	OldInstances int           `json:"old_instances"`
	NewInstances int           `json:"new_instances"`
	Reason       string        `json:"reason"`
	Message      string        `json:"message"`
	Error        string        `json:"error"`
}

type AppScalingHistoryResponse

type AppScalingHistoryResponse struct {
	PublicApiResponseBase
	Resources []AppScalingHistory `json:"resources"`
}

type AppScalingResult

type AppScalingResult struct {
	AppId             string        `json:"app_id"`
	Status            ScalingStatus `json:"status"`
	Adjustment        int           `json:"adjustment"`
	CooldownExpiredAt int64         `json:"cool_down_expired_at"`
}

type BindingRequestBody

type BindingRequestBody struct {
	BrokerCommonRequestBody
	AppID  string          `json:"app_guid"`
	Policy json.RawMessage `json:"parameters,omitempty"`
}

type BrokerCommonRequestBody

type BrokerCommonRequestBody struct {
	ServiceID     string        `json:"service_id"`
	PlanID        string        `json:"plan_id"`
	BrokerContext BrokerContext `json:"context"`
}

type BrokerContext

type BrokerContext struct {
	OrgGUID   string `json:"organization_guid"`
	SpaceGUID string `json:"space_guid"`
}

type CFErrorResponse

type CFErrorResponse struct {
	Description string `json:"description"`
	ErrorCode   string `json:"error_code"`
	Code        int    `json:"code"`
}

type Credential

type Credential struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type CredentialResponse

type CredentialResponse struct {
	Credentials Credentials `json:"credentials"`
}

type Credentials

type Credentials struct {
	CustomMetrics CustomMetricsCredentials `json:"custom_metrics"`
}

type CredentialsOptions

type CredentialsOptions struct {
	InstanceId string `json:"instanceId"`
	BindingId  string `json:"bindingId"`
}

type CustomMetric

type CustomMetric struct {
	Name          string  `json:"name"`
	Value         float64 `json:"value"`
	Unit          string  `json:"unit"`
	AppGUID       string  `json:"app_guid"`
	InstanceIndex uint32  `json:"instance_index"`
}

type CustomMetricsCredentials

type CustomMetricsCredentials struct {
	*Credential
	URL     string `json:"url"`
	MtlsUrl string `json:"mtls_url"`
}

type ErrorResponse

type ErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type HealthConfig

type HealthConfig struct {
	Port                    int    `yaml:"port"`
	HealthCheckUsername     string `yaml:"username"`
	HealthCheckUsernameHash string `yaml:"username_hash"`
	HealthCheckPassword     string `yaml:"password"`
	HealthCheckPasswordHash string `yaml:"password_hash"`
}

func (*HealthConfig) Validate

func (c *HealthConfig) Validate(component string) error

type InstanceCreationRequestBody

type InstanceCreationRequestBody struct {
	BrokerCommonRequestBody
	OrgGUID    string             `json:"organization_guid"`
	SpaceGUID  string             `json:"space_guid"`
	Parameters InstanceParameters `json:"parameters,omitempty"`
}

type InstanceMetricResponse

type InstanceMetricResponse struct {
	PublicApiResponseBase
	Resources []AppInstanceMetric `json:"resources"`
}

type InstanceParameters

type InstanceParameters struct {
	DefaultPolicy *json.RawMessage `json:"default_policy,omitempty"`
}

type InstanceUpdateRequestBody

type InstanceUpdateRequestBody struct {
	BrokerCommonRequestBody
	Parameters *InstanceParameters `json:"parameters,omitempty"`
}

type Lock

type Lock struct {
	Owner                 string
	LastModifiedTimestamp time.Time
	Ttl                   time.Duration
}

type MetricsConsumer

type MetricsConsumer struct {
	InstanceIndex uint32          `json:"instance_index"`
	CustomMetrics []*CustomMetric `json:"metrics"`
}

type PolicyJson

type PolicyJson struct {
	AppId     string
	PolicyStr string
}

func (*PolicyJson) Equals

func (p *PolicyJson) Equals(p2 *PolicyJson) bool

func (*PolicyJson) GetAppPolicy

func (p *PolicyJson) GetAppPolicy() (*AppPolicy, error)

type PublicApiResponseBase

type PublicApiResponseBase struct {
	TotalResults int           `json:"total_results"`
	TotalPages   int           `json:"total_pages"`
	Page         int           `json:"page"`
	PrevUrl      string        `json:"prev_url"`
	NextUrl      string        `json:"next_url"`
	Resources    []interface{} `json:"resources"`
}

type RateLimitConfig

type RateLimitConfig struct {
	MaxAmount     int           `yaml:"max_amount"`
	ValidDuration time.Duration `yaml:"valid_duration"`
}

type RecurringSchedule

type RecurringSchedule struct {
	StartTime             string `json:"start_time"`
	EndTime               string `json:"end_time"`
	DaysOfWeek            []int  `json:"days_of_week,omitempty"`
	DaysOfMonth           []int  `json:"days_of_month,omitempty"`
	StartDate             string `json:"start_date,omitempty"`
	EndDate               string `json:"end_date,omitempty"`
	ScheduledInstanceMin  int    `json:"instance_min_count"`
	ScheduledInstanceMax  int    `json:"instance_max_count"`
	ScheduledInstanceInit int    `json:"initial_min_instance_count,omitempty"`
}

type ScalingPolicy

type ScalingPolicy struct {
	InstanceMin  int               `json:"instance_min_count"`
	InstanceMax  int               `json:"instance_max_count"`
	ScalingRules []*ScalingRule    `json:"scaling_rules,omitempty"`
	Schedules    *ScalingSchedules `json:"schedules,omitempty"`
}

type ScalingRule

type ScalingRule struct {
	MetricType            string `json:"metric_type"`
	BreachDurationSeconds int    `json:"breach_duration_secs,omitempty"`
	Threshold             int64  `json:"threshold"`
	Operator              string `json:"operator"`
	CoolDownSeconds       int    `json:"cool_down_secs,omitempty"`
	Adjustment            string `json:"adjustment"`
}

func (*ScalingRule) BreachDuration

func (r *ScalingRule) BreachDuration(defaultBreachDurationSecs int) time.Duration

func (*ScalingRule) CoolDown

func (r *ScalingRule) CoolDown(defaultCoolDownSecs int) time.Duration

type ScalingSchedules

type ScalingSchedules struct {
	Timezone              string                  `json:"timezone"`
	RecurringSchedules    []*RecurringSchedule    `json:"recurring_schedule,omitempty"`
	SpecificDateSchedules []*SpecificDateSchedule `json:"specific_date,omitempty"`
}

type ScalingStatus

type ScalingStatus int
const (
	ScalingStatusSucceeded ScalingStatus = iota
	ScalingStatusFailed
	ScalingStatusIgnored
)

type ScalingType

type ScalingType int
const (
	ScalingTypeDynamic ScalingType = iota
	ScalingTypeSchedule
)

type ServiceInstance

type ServiceInstance struct {
	ServiceInstanceId string
	OrgId             string
	SpaceId           string
	DefaultPolicy     string
	DefaultPolicyGuid string
}

type SpecificDateSchedule

type SpecificDateSchedule struct {
	StartDateTime         string `json:"start_date_time"`
	EndDateTime           string `json:"end_date_time"`
	ScheduledInstanceMin  int    `json:"instance_min_count"`
	ScheduledInstanceMax  int    `json:"instance_max_count"`
	ScheduledInstanceInit int    `json:"initial_min_instance_count,omitempty"`
}

type StoredProcedureConfig

type StoredProcedureConfig struct {
	SchemaName                             string `yaml:"schema_name"`
	CreateBindingCredentialProcedureName   string `yaml:"create_binding_credential_procedure_name"`
	DropBindingCredentialProcedureName     string `yaml:"drop_binding_credential_procedure_name"`
	DropAllBindingCredentialProcedureName  string `yaml:"drop_all_binding_credential_procedure_name"`
	ValidateBindingCredentialProcedureName string `yaml:"validate_binding_credential_procedure_name"`
}

type TLSCerts

type TLSCerts struct {
	KeyFile    string `yaml:"key_file" json:"keyFile"`
	CertFile   string `yaml:"cert_file" json:"certFile"`
	CACertFile string `yaml:"ca_file" json:"caCertFile"`
}

type Trigger

type Trigger struct {
	AppId                 string `json:"app_id"`
	MetricType            string `json:"metric_type"`
	MetricUnit            string `json:"metric_unit"`
	BreachDurationSeconds int    `json:"breach_duration_secs"`
	Threshold             int64  `json:"threshold"`
	Operator              string `json:"operator"`
	CoolDownSeconds       int    `json:"cool_down_secs"`
	Adjustment            string `json:"adjustment"`
}

func (Trigger) BreachDuration

func (t Trigger) BreachDuration() time.Duration

func (Trigger) CoolDown

func (t Trigger) CoolDown(defaultCoolDownSecs int) time.Duration

Jump to

Keyboard shortcuts

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