advice_kit_api

package module
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 23

README

AdviceKit Go API

This module exposes Go types that you will find helpful when implementing an AdviceKit extension.

The types are generated automatically from the AdviceKit OpenAPI specification.

Installation

Add the following to your go.mod file:

go get github.com/steadybit/advice-kit/go/advice_kit_api@v0.1.0

Usage

import (
	"github.com/steadybit/advice-kit/go/advice_kit_api"
)

AdviceList := advice_kit_api.AdviceList{
    Advice: []advice_kit_api.DescribingEndpointReference{
        {
            "GET",
            "/advice/my-fancy-advice",
        },
    },
}

Documentation

Overview

Package advice_kit_api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func Ptr

func Ptr[T any](val T) *T

Types

type AdviceDefinition

type AdviceDefinition struct {
	// AssessmentQueryApplicable A Target Query that identifies targets that could have this advice.
	AssessmentQueryApplicable string `json:"assessmentQueryApplicable"`

	// AssessmentQueryExclude A Target Query that identifies targets that should be excluded by this advice.
	AssessmentQueryExclude *string `json:"assessmentQueryExclude,omitempty"`

	// Category An optional category for the advice, e.g. 'Reliability', 'Scalability', 'Redundancy'.
	Category *string `json:"category,omitempty"`

	// Icon An svg of an icon that represents the advice, e.g. `data:image/svg+xml,%3Csvg....svg%3E%0A`.
	Icon string `json:"icon"`

	// Id A technical ID that is used to uniquely identify this type of advice. You will typically want to use something like `org.example.extension.my-fancy-advice`.
	Id string `json:"id"`

	// Label A human-readable label for the advice.
	Label string `json:"label"`

	// Status Provides details about advice.
	Status AdviceDefinitionStatus `json:"status"`

	// Tags A list of tags that describe the advice.
	Tags *[]string `json:"tags,omitempty"`

	// Version The version of the advice. This is used to identify the version of the advice and is used for compatibility checks.
	Version string `json:"version"`
}

AdviceDefinition Provides details about advice.

type AdviceDefinitionResponse

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

AdviceDefinitionResponse defines model for AdviceDefinitionResponse.

func (AdviceDefinitionResponse) AsAdviceDefinition

func (t AdviceDefinitionResponse) AsAdviceDefinition() (AdviceDefinition, error)

AsAdviceDefinition returns the union data inside the AdviceDefinitionResponse as a AdviceDefinition

func (AdviceDefinitionResponse) AsAdviceKitError

func (t AdviceDefinitionResponse) AsAdviceKitError() (AdviceKitError, error)

AsAdviceKitError returns the union data inside the AdviceDefinitionResponse as a AdviceKitError

func (*AdviceDefinitionResponse) FromAdviceDefinition

func (t *AdviceDefinitionResponse) FromAdviceDefinition(v AdviceDefinition) error

FromAdviceDefinition overwrites any union data inside the AdviceDefinitionResponse as the provided AdviceDefinition

func (*AdviceDefinitionResponse) FromAdviceKitError

func (t *AdviceDefinitionResponse) FromAdviceKitError(v AdviceKitError) error

FromAdviceKitError overwrites any union data inside the AdviceDefinitionResponse as the provided AdviceKitError

func (AdviceDefinitionResponse) MarshalJSON

func (t AdviceDefinitionResponse) MarshalJSON() ([]byte, error)

func (*AdviceDefinitionResponse) MergeAdviceDefinition

func (t *AdviceDefinitionResponse) MergeAdviceDefinition(v AdviceDefinition) error

MergeAdviceDefinition performs a merge with any union data inside the AdviceDefinitionResponse, using the provided AdviceDefinition

func (*AdviceDefinitionResponse) MergeAdviceKitError

func (t *AdviceDefinitionResponse) MergeAdviceKitError(v AdviceKitError) error

MergeAdviceKitError performs a merge with any union data inside the AdviceDefinitionResponse, using the provided AdviceKitError

func (*AdviceDefinitionResponse) UnmarshalJSON

func (t *AdviceDefinitionResponse) UnmarshalJSON(b []byte) error

type AdviceDefinitionStatus

type AdviceDefinitionStatus struct {
	// ActionNeeded Provides details about an advice lifecycle status actions needed.
	ActionNeeded AdviceDefinitionStatusActionNeeded `json:"actionNeeded"`

	// Implemented Provides details about advice lifecycle status implemented.
	Implemented AdviceDefinitionStatusImplemented `json:"implemented"`

	// ValidationNeeded Provides details about advice lifecycle status validation needed.
	ValidationNeeded AdviceDefinitionStatusValidationNeeded `json:"validationNeeded"`
}

AdviceDefinitionStatus Provides details about advice.

type AdviceDefinitionStatusActionNeeded

type AdviceDefinitionStatusActionNeeded struct {
	// AssessmentQuery A Assessment Target Query Addon that is used to identify targets with this advice in the target list of the assessmentQueryApplicable
	AssessmentQuery string `json:"assessmentQuery"`

	// Description Provides details description about advice lifecycle status actions needed.
	Description AdviceDefinitionStatusActionNeededDescription `json:"description"`
}

AdviceDefinitionStatusActionNeeded Provides details about an advice lifecycle status actions needed.

type AdviceDefinitionStatusActionNeededDescription

type AdviceDefinitionStatusActionNeededDescription struct {
	// Instruction A human-readable instructions of the action needed in mark down format. (you can use placeholder like ${target.attr('k8s.pod.name')})
	Instruction string `json:"instruction"`

	// Motivation A human-readable motivation of the action needed in mark down format. (you can use placeholder like ${target.attr('k8s.pod.name')})
	Motivation string `json:"motivation"`

	// Summary A human-readable summary of the action needed in mark down format. (you can use placeholder like ${target.attr('k8s.pod.name')})
	Summary string `json:"summary"`
}

AdviceDefinitionStatusActionNeededDescription Provides details description about advice lifecycle status actions needed.

type AdviceDefinitionStatusImplemented

type AdviceDefinitionStatusImplemented struct {
	// Description Provides details description about a advice lifecycle status implemented.
	Description AdviceDefinitionStatusImplementedDescription `json:"description"`
}

AdviceDefinitionStatusImplemented Provides details about advice lifecycle status implemented.

type AdviceDefinitionStatusImplementedDescription

type AdviceDefinitionStatusImplementedDescription struct {
	// Summary A human-readable summary of the implemented in mark down format. (you can use placeholder like ${target.attr('k8s.pod.name')})
	Summary string `json:"summary"`
}

AdviceDefinitionStatusImplementedDescription Provides details description about a advice lifecycle status implemented.

type AdviceDefinitionStatusValidationNeeded

type AdviceDefinitionStatusValidationNeeded struct {
	// Description Provides details description about advice lifecycle status validation needed.
	Description AdviceDefinitionStatusValidationNeededDescription `json:"description"`

	// Validation A list of validations that are available for this advice.
	Validation *[]Validation `json:"validation,omitempty"`
}

AdviceDefinitionStatusValidationNeeded Provides details about advice lifecycle status validation needed.

type AdviceDefinitionStatusValidationNeededDescription

type AdviceDefinitionStatusValidationNeededDescription struct {
	// Summary A human-readable summary of the validation needed in mark down format. (you can use placeholder like ${target.attr('k8s.pod.name')})
	Summary string `json:"summary"`
}

AdviceDefinitionStatusValidationNeededDescription Provides details description about advice lifecycle status validation needed.

type AdviceKitError

type AdviceKitError struct {
	// Detail A human-readable explanation specific to this occurrence of the problem.
	Detail *string `json:"detail,omitempty"`

	// Instance A URI reference that identifies the specific occurrence of the problem.
	Instance *string `json:"instance,omitempty"`

	// Title A short, human-readable summary of the problem type.
	Title string `json:"title"`

	// Type A URI reference that identifies the problem type.
	Type *string `json:"type,omitempty"`
}

AdviceKitError RFC 7807 Problem Details for HTTP APIs compliant response body for error scenarios

type AdviceList

type AdviceList struct {
	Advice []DescribingEndpointReference `json:"advice"`
}

AdviceList Lists all advice that the platform/agent could consume.

type AdviceListResponse

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

AdviceListResponse defines model for AdviceListResponse.

func (AdviceListResponse) AsAdviceKitError

func (t AdviceListResponse) AsAdviceKitError() (AdviceKitError, error)

AsAdviceKitError returns the union data inside the AdviceListResponse as a AdviceKitError

func (AdviceListResponse) AsAdviceList

func (t AdviceListResponse) AsAdviceList() (AdviceList, error)

AsAdviceList returns the union data inside the AdviceListResponse as a AdviceList

func (*AdviceListResponse) FromAdviceKitError

func (t *AdviceListResponse) FromAdviceKitError(v AdviceKitError) error

FromAdviceKitError overwrites any union data inside the AdviceListResponse as the provided AdviceKitError

func (*AdviceListResponse) FromAdviceList

func (t *AdviceListResponse) FromAdviceList(v AdviceList) error

FromAdviceList overwrites any union data inside the AdviceListResponse as the provided AdviceList

func (AdviceListResponse) MarshalJSON

func (t AdviceListResponse) MarshalJSON() ([]byte, error)

func (*AdviceListResponse) MergeAdviceKitError

func (t *AdviceListResponse) MergeAdviceKitError(v AdviceKitError) error

MergeAdviceKitError performs a merge with any union data inside the AdviceListResponse, using the provided AdviceKitError

func (*AdviceListResponse) MergeAdviceList

func (t *AdviceListResponse) MergeAdviceList(v AdviceList) error

MergeAdviceList performs a merge with any union data inside the AdviceListResponse, using the provided AdviceList

func (*AdviceListResponse) UnmarshalJSON

func (t *AdviceListResponse) UnmarshalJSON(b []byte) error

type DescribingEndpointReference

type DescribingEndpointReference struct {
	// Method HTTP method to use when calling the HTTP endpoint.
	Method DescribingEndpointReferenceMethod `json:"method"`

	// Path Absolute path of the HTTP endpoint.
	Path string `json:"path"`
}

DescribingEndpointReference HTTP endpoint which the Steadybit platform/agent could communicate with.

type DescribingEndpointReferenceMethod

type DescribingEndpointReferenceMethod string

DescribingEndpointReferenceMethod HTTP method to use when calling the HTTP endpoint.

const (
	GET DescribingEndpointReferenceMethod = "GET"
)

Defines values for DescribingEndpointReferenceMethod.

type Experiment

type Experiment = interface{}

Experiment Provides an experiment definition to automate the validation. It may contain advice placeholders, which will be substituted with target properties, but otherwise contains only fixed values. An experiment definition can be exported as JSON from the UI.

type ExperimentTemplate added in v1.1.0

type ExperimentTemplate = interface{}

ExperimentTemplate Provides an experiment template definition to automate the validation. It may contain advice placeholders, which will be substituted with target properties, and supports experiment template variables, which can be set dynamically during the experiment creation process through the UI. An experiment template definition can be exported as JSON from the UI. An experiment template definition has precedence over an experiment definition. For compatibility reasons both can be given.

type Validation

type Validation struct {
	// Description A human-readable description for the validation or for the experiment template. Markdown supported.
	Description *string `json:"description,omitempty"`

	// Experiment Provides an experiment definition to automate the validation.
	// It may contain advice placeholders, which will be substituted with target properties, but otherwise contains only fixed values.
	// An experiment definition can be exported as JSON from the UI.
	Experiment *Experiment `json:"experiment,omitempty"`

	// ExperimentTemplate Provides an experiment template definition to automate the validation.
	// It may contain advice placeholders, which will be substituted with target properties, and supports experiment template variables, which can be set dynamically during the experiment creation process through the UI.
	// An experiment template definition can be exported as JSON from the UI.
	// An experiment template definition has precedence over an experiment definition. For compatibility reasons both can be given.
	ExperimentTemplate *ExperimentTemplate `json:"experimentTemplate,omitempty"`

	// ForEachAttribute The attribute that is used to multiply the validation.
	ForEachAttribute *string `json:"forEachAttribute,omitempty"`

	// Id A technical ID that is used to uniquely identify this validation. You will typically want to use something like `org.example.extension.my-fancy-advice-validation.1`.
	Id string `json:"id"`

	// Name A human-readable name for the validation.
	Name string `json:"name"`

	// ShortDescription A human-readable short description for the validation or for the experiment template. Text Only.
	ShortDescription string `json:"shortDescription"`

	// Type The type of the validation. Distinguishes between a textual description of a manual validation and a dynamic validation by an experiment.
	Type ValidationType `json:"type"`
}

Validation Provides either a textual explanation, an experiment or an experiment template to validate the advice recommendations.

type ValidationType

type ValidationType string

ValidationType The type of the validation. Distinguishes between a textual description of a manual validation and a dynamic validation by an experiment.

const (
	EXPERIMENT ValidationType = "EXPERIMENT"
	TEXT       ValidationType = "TEXT"
)

Defines values for ValidationType.

Jump to

Keyboard shortcuts

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