discovery_kit_api

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 10 Imported by: 56

README

DiscoveryKit Go API

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

The types are generated automatically from the DiscoveryKit OpenAPI specification.

Installation

Add the following to your go.mod file:

go get github.com/steadybit/discovery-kit/go/discovery_kit_api@v0.1.0

Usage

import (
	"github.com/steadybit/discovery-kit/go/discovery_kit_api"
)

DiscoveryList := discovery_kit_api.DiscoveryList{
    Discoverys: []discovery_kit_api.DescribingEndpointReference{
        {
            "GET",
            "/Discoverys/rollout-restart",
        },
    },
}

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger added in v1.4.2

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 added in v1.4.2

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 Attribute added in v1.2.0

type Attribute struct {
	Matcher AttributeMatcher `json:"matcher"`
	Name    string           `json:"name"`
}

Attribute defines model for Attribute.

type AttributeDescription

type AttributeDescription struct {
	// Attribute The attribute name, for example `cat.name`
	Attribute string      `json:"attribute"`
	Label     PluralLabel `json:"label"`
}

AttributeDescription defines model for AttributeDescription.

type AttributeDescriptions

type AttributeDescriptions struct {
	Attributes []AttributeDescription `json:"attributes"`
}

AttributeDescriptions defines model for AttributeDescriptions.

type AttributeMatcher added in v1.2.0

type AttributeMatcher string

AttributeMatcher defines model for Attribute.Matcher.

const (
	Contains   AttributeMatcher = "contains"
	Equals     AttributeMatcher = "equals"
	Regex      AttributeMatcher = "regex"
	StartsWith AttributeMatcher = "starts_with"
)

Defines values for AttributeMatcher.

type Column

type Column struct {
	// Attribute The attribute which should be displayed in the column.
	Attribute string `json:"attribute"`

	// FallbackAttributes If the given attribute is empty, the fallbackAttributes are used. The first non-empty attribute will be displayed.
	FallbackAttributes *[]string `json:"fallbackAttributes,omitempty"`
}

Column defines model for Column.

type DescribeAttributesResponse

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

DescribeAttributesResponse defines model for DescribeAttributesResponse.

func (DescribeAttributesResponse) AsAttributeDescriptions

func (t DescribeAttributesResponse) AsAttributeDescriptions() (AttributeDescriptions, error)

AsAttributeDescriptions returns the union data inside the DescribeAttributesResponse as a AttributeDescriptions

func (DescribeAttributesResponse) AsDiscoveryKitError

func (t DescribeAttributesResponse) AsDiscoveryKitError() (DiscoveryKitError, error)

AsDiscoveryKitError returns the union data inside the DescribeAttributesResponse as a DiscoveryKitError

func (*DescribeAttributesResponse) FromAttributeDescriptions

func (t *DescribeAttributesResponse) FromAttributeDescriptions(v AttributeDescriptions) error

FromAttributeDescriptions overwrites any union data inside the DescribeAttributesResponse as the provided AttributeDescriptions

func (*DescribeAttributesResponse) FromDiscoveryKitError

func (t *DescribeAttributesResponse) FromDiscoveryKitError(v DiscoveryKitError) error

FromDiscoveryKitError overwrites any union data inside the DescribeAttributesResponse as the provided DiscoveryKitError

func (DescribeAttributesResponse) MarshalJSON

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

func (*DescribeAttributesResponse) MergeAttributeDescriptions added in v1.4.2

func (t *DescribeAttributesResponse) MergeAttributeDescriptions(v AttributeDescriptions) error

MergeAttributeDescriptions performs a merge with any union data inside the DescribeAttributesResponse, using the provided AttributeDescriptions

func (*DescribeAttributesResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DescribeAttributesResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DescribeAttributesResponse, using the provided DiscoveryKitError

func (*DescribeAttributesResponse) UnmarshalJSON

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

type DescribeTargetEnrichmentRulesResponse added in v1.4.0

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

DescribeTargetEnrichmentRulesResponse defines model for DescribeTargetEnrichmentRulesResponse.

func (DescribeTargetEnrichmentRulesResponse) AsDiscoveryKitError added in v1.4.0

AsDiscoveryKitError returns the union data inside the DescribeTargetEnrichmentRulesResponse as a DiscoveryKitError

func (DescribeTargetEnrichmentRulesResponse) AsTargetEnrichmentRule added in v1.4.0

AsTargetEnrichmentRule returns the union data inside the DescribeTargetEnrichmentRulesResponse as a TargetEnrichmentRule

func (*DescribeTargetEnrichmentRulesResponse) FromDiscoveryKitError added in v1.4.0

FromDiscoveryKitError overwrites any union data inside the DescribeTargetEnrichmentRulesResponse as the provided DiscoveryKitError

func (*DescribeTargetEnrichmentRulesResponse) FromTargetEnrichmentRule added in v1.4.0

func (t *DescribeTargetEnrichmentRulesResponse) FromTargetEnrichmentRule(v TargetEnrichmentRule) error

FromTargetEnrichmentRule overwrites any union data inside the DescribeTargetEnrichmentRulesResponse as the provided TargetEnrichmentRule

func (DescribeTargetEnrichmentRulesResponse) MarshalJSON added in v1.4.0

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

func (*DescribeTargetEnrichmentRulesResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DescribeTargetEnrichmentRulesResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DescribeTargetEnrichmentRulesResponse, using the provided DiscoveryKitError

func (*DescribeTargetEnrichmentRulesResponse) MergeTargetEnrichmentRule added in v1.4.2

func (t *DescribeTargetEnrichmentRulesResponse) MergeTargetEnrichmentRule(v TargetEnrichmentRule) error

MergeTargetEnrichmentRule performs a merge with any union data inside the DescribeTargetEnrichmentRulesResponse, using the provided TargetEnrichmentRule

func (*DescribeTargetEnrichmentRulesResponse) UnmarshalJSON added in v1.4.0

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

type DescribeTargetResponse

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

DescribeTargetResponse defines model for DescribeTargetResponse.

func (DescribeTargetResponse) AsDiscoveryKitError

func (t DescribeTargetResponse) AsDiscoveryKitError() (DiscoveryKitError, error)

AsDiscoveryKitError returns the union data inside the DescribeTargetResponse as a DiscoveryKitError

func (DescribeTargetResponse) AsTargetDescription

func (t DescribeTargetResponse) AsTargetDescription() (TargetDescription, error)

AsTargetDescription returns the union data inside the DescribeTargetResponse as a TargetDescription

func (*DescribeTargetResponse) FromDiscoveryKitError

func (t *DescribeTargetResponse) FromDiscoveryKitError(v DiscoveryKitError) error

FromDiscoveryKitError overwrites any union data inside the DescribeTargetResponse as the provided DiscoveryKitError

func (*DescribeTargetResponse) FromTargetDescription

func (t *DescribeTargetResponse) FromTargetDescription(v TargetDescription) error

FromTargetDescription overwrites any union data inside the DescribeTargetResponse as the provided TargetDescription

func (DescribeTargetResponse) MarshalJSON

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

func (*DescribeTargetResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DescribeTargetResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DescribeTargetResponse, using the provided DiscoveryKitError

func (*DescribeTargetResponse) MergeTargetDescription added in v1.4.2

func (t *DescribeTargetResponse) MergeTargetDescription(v TargetDescription) error

MergeTargetDescription performs a merge with any union data inside the DescribeTargetResponse, using the provided TargetDescription

func (*DescribeTargetResponse) UnmarshalJSON

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

type DescribingEndpointReference

type DescribingEndpointReference struct {
	Method ReadHttpMethod `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 DescribingEndpointReferenceWithCallInterval

type DescribingEndpointReferenceWithCallInterval struct {
	// CallInterval At what frequency should the state endpoint be called? Takes durations in the format of `100ms` or `10s`.
	CallInterval *string        `json:"callInterval,omitempty"`
	Method       ReadHttpMethod `json:"method"`

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

DescribingEndpointReferenceWithCallInterval defines model for DescribingEndpointReferenceWithCallInterval.

type DiscoveredTargets

type DiscoveredTargets struct {
	Targets []Target `json:"targets"`
}

DiscoveredTargets Deprecated: use `DiscoveryData` instead. The results of a discovery call.

type DiscoveryData added in v1.4.0

type DiscoveryData struct {
	EnrichmentData *[]EnrichmentData `json:"enrichmentData,omitempty"`
	Targets        *[]Target         `json:"targets,omitempty"`
}

DiscoveryData The results of a discovery call

type DiscoveryDescription

type DiscoveryDescription struct {
	// Discover HTTP endpoint which the Steadybit platform/agent could communicate with.
	Discover DescribingEndpointReferenceWithCallInterval `json:"discover"`

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

DiscoveryDescription Provides details about a discovery, e.g., what endpoint needs to be called to discover targets.

type DiscoveryDescriptionResponse

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

DiscoveryDescriptionResponse defines model for DiscoveryDescriptionResponse.

func (DiscoveryDescriptionResponse) AsDiscoveryDescription

func (t DiscoveryDescriptionResponse) AsDiscoveryDescription() (DiscoveryDescription, error)

AsDiscoveryDescription returns the union data inside the DiscoveryDescriptionResponse as a DiscoveryDescription

func (DiscoveryDescriptionResponse) AsDiscoveryKitError

func (t DiscoveryDescriptionResponse) AsDiscoveryKitError() (DiscoveryKitError, error)

AsDiscoveryKitError returns the union data inside the DiscoveryDescriptionResponse as a DiscoveryKitError

func (*DiscoveryDescriptionResponse) FromDiscoveryDescription

func (t *DiscoveryDescriptionResponse) FromDiscoveryDescription(v DiscoveryDescription) error

FromDiscoveryDescription overwrites any union data inside the DiscoveryDescriptionResponse as the provided DiscoveryDescription

func (*DiscoveryDescriptionResponse) FromDiscoveryKitError

func (t *DiscoveryDescriptionResponse) FromDiscoveryKitError(v DiscoveryKitError) error

FromDiscoveryKitError overwrites any union data inside the DiscoveryDescriptionResponse as the provided DiscoveryKitError

func (DiscoveryDescriptionResponse) MarshalJSON

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

func (*DiscoveryDescriptionResponse) MergeDiscoveryDescription added in v1.4.2

func (t *DiscoveryDescriptionResponse) MergeDiscoveryDescription(v DiscoveryDescription) error

MergeDiscoveryDescription performs a merge with any union data inside the DiscoveryDescriptionResponse, using the provided DiscoveryDescription

func (*DiscoveryDescriptionResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DiscoveryDescriptionResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DiscoveryDescriptionResponse, using the provided DiscoveryKitError

func (*DiscoveryDescriptionResponse) UnmarshalJSON

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

type DiscoveryKitError

type DiscoveryKitError 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"`
}

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

type DiscoveryList

type DiscoveryList struct {
	Discoveries           []DescribingEndpointReference `json:"discoveries"`
	TargetAttributes      []DescribingEndpointReference `json:"targetAttributes"`
	TargetEnrichmentRules []DescribingEndpointReference `json:"targetEnrichmentRules"`
	TargetTypes           []DescribingEndpointReference `json:"targetTypes"`
}

DiscoveryList Lists all discoveries that the platform/agent could execute.

type DiscoveryListResponse

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

DiscoveryListResponse defines model for DiscoveryListResponse.

func (DiscoveryListResponse) AsDiscoveryKitError

func (t DiscoveryListResponse) AsDiscoveryKitError() (DiscoveryKitError, error)

AsDiscoveryKitError returns the union data inside the DiscoveryListResponse as a DiscoveryKitError

func (DiscoveryListResponse) AsDiscoveryList

func (t DiscoveryListResponse) AsDiscoveryList() (DiscoveryList, error)

AsDiscoveryList returns the union data inside the DiscoveryListResponse as a DiscoveryList

func (*DiscoveryListResponse) FromDiscoveryKitError

func (t *DiscoveryListResponse) FromDiscoveryKitError(v DiscoveryKitError) error

FromDiscoveryKitError overwrites any union data inside the DiscoveryListResponse as the provided DiscoveryKitError

func (*DiscoveryListResponse) FromDiscoveryList

func (t *DiscoveryListResponse) FromDiscoveryList(v DiscoveryList) error

FromDiscoveryList overwrites any union data inside the DiscoveryListResponse as the provided DiscoveryList

func (DiscoveryListResponse) MarshalJSON

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

func (*DiscoveryListResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DiscoveryListResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DiscoveryListResponse, using the provided DiscoveryKitError

func (*DiscoveryListResponse) MergeDiscoveryList added in v1.4.2

func (t *DiscoveryListResponse) MergeDiscoveryList(v DiscoveryList) error

MergeDiscoveryList performs a merge with any union data inside the DiscoveryListResponse, using the provided DiscoveryList

func (*DiscoveryListResponse) UnmarshalJSON

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

type DiscoveryResponse added in v1.4.0

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

DiscoveryResponse defines model for DiscoveryResponse.

func (DiscoveryResponse) AsDiscoveryData added in v1.4.0

func (t DiscoveryResponse) AsDiscoveryData() (DiscoveryData, error)

AsDiscoveryData returns the union data inside the DiscoveryResponse as a DiscoveryData

func (DiscoveryResponse) AsDiscoveryKitError added in v1.4.0

func (t DiscoveryResponse) AsDiscoveryKitError() (DiscoveryKitError, error)

AsDiscoveryKitError returns the union data inside the DiscoveryResponse as a DiscoveryKitError

func (*DiscoveryResponse) FromDiscoveryData added in v1.4.0

func (t *DiscoveryResponse) FromDiscoveryData(v DiscoveryData) error

FromDiscoveryData overwrites any union data inside the DiscoveryResponse as the provided DiscoveryData

func (*DiscoveryResponse) FromDiscoveryKitError added in v1.4.0

func (t *DiscoveryResponse) FromDiscoveryKitError(v DiscoveryKitError) error

FromDiscoveryKitError overwrites any union data inside the DiscoveryResponse as the provided DiscoveryKitError

func (DiscoveryResponse) MarshalJSON added in v1.4.0

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

func (*DiscoveryResponse) MergeDiscoveryData added in v1.4.2

func (t *DiscoveryResponse) MergeDiscoveryData(v DiscoveryData) error

MergeDiscoveryData performs a merge with any union data inside the DiscoveryResponse, using the provided DiscoveryData

func (*DiscoveryResponse) MergeDiscoveryKitError added in v1.4.2

func (t *DiscoveryResponse) MergeDiscoveryKitError(v DiscoveryKitError) error

MergeDiscoveryKitError performs a merge with any union data inside the DiscoveryResponse, using the provided DiscoveryKitError

func (*DiscoveryResponse) UnmarshalJSON added in v1.4.0

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

type EnrichmentData added in v1.4.0

type EnrichmentData struct {
	// Attributes These attributes contains the actual data provided through the discovery.  These attributes are used to find matching targets and can be copied to a target.
	Attributes map[string][]string `json:"attributes"`

	// EnrichmentDataType The type of the enrichment data. Will be used to find matching targets to enrich data.
	EnrichmentDataType string `json:"enrichmentDataType"`

	// Id The id of the enrichment data, needs to be unique per enrichment data type.
	Id string `json:"id"`
}

EnrichmentData A single discovered enrichment data

type OrderBy

type OrderBy struct {
	Attribute string           `json:"attribute"`
	Direction OrderByDirection `json:"direction"`
}

OrderBy defines model for OrderBy.

type OrderByDirection

type OrderByDirection string

OrderByDirection defines model for OrderBy.Direction.

const (
	ASC  OrderByDirection = "ASC"
	DESC OrderByDirection = "DESC"
)

Defines values for OrderByDirection.

type PluralLabel

type PluralLabel struct {
	One   string `json:"one"`
	Other string `json:"other"`
}

PluralLabel defines model for PluralLabel.

type ReadHttpMethod added in v1.5.0

type ReadHttpMethod string

ReadHttpMethod defines model for ReadHttpMethod.

const (
	GET ReadHttpMethod = "GET"
)

Defines values for ReadHttpMethod.

type SourceOrDestination added in v1.2.0

type SourceOrDestination struct {
	// Selector To identify a source or a destination, we employ a mechanism similar to Kubernetes label selectors. When this instance represents a source, you can use the placeholder `${src.attribute}` to refer to target attributes of the destination. Note that you can use the placeholders `${src.attribute}` and `${dest.attribute}` respectively.
	Selector map[string]string `json:"selector"`

	// Type The source or destination target type.
	Type string `json:"type"`
}

SourceOrDestination defines model for SourceOrDestination.

type Table

type Table struct {
	Columns []Column  `json:"columns"`
	OrderBy []OrderBy `json:"orderBy"`
}

Table defines model for Table.

type Target

type Target struct {
	// Attributes These attributes include detailed information about the target provided through the discovery. These attributes are typically used as additional parameters within the attack implementation.
	Attributes map[string][]string `json:"attributes"`

	// Id The id of the target, needs to be unique per target type.
	Id string `json:"id"`

	// Label A label, which will be used by the platform to display the target
	Label string `json:"label"`

	// TargetType The type of the target. Will be used to find matching attacks and find the right ui configuration to show and select the targets.
	TargetType string `json:"targetType"`
}

Target A single discovered target

type TargetDescription

type TargetDescription struct {
	// Category A human readable label categorizing the target type, e.g., 'cloud' or 'Kubernetes'.
	Category *string `json:"category,omitempty"`

	// Icon An icon that is used to identify the targets in the ui. Needs to be a data-uri containing an image.
	Icon *string `json:"icon,omitempty"`

	// Id a global unique name of the target type
	Id    string      `json:"id"`
	Label PluralLabel `json:"label"`
	Table Table       `json:"table"`

	// Version The version of the target type. Remember to increase the value everytime you update the definitions. The platform will ignore any definition changes with the same version. We do recommend usage of semver strings.
	Version string `json:"version"`
}

TargetDescription A definition of a target type and how it will be handled by the ui

type TargetEnrichmentRule added in v1.2.0

type TargetEnrichmentRule struct {
	Attributes []Attribute         `json:"attributes"`
	Dest       SourceOrDestination `json:"dest"`

	// Id a global unique name of the enrichment rule
	Id  string              `json:"id"`
	Src SourceOrDestination `json:"src"`

	// Version The version of the enrichment rule. Remember to increase the value everytime you update the definitions. The platform will ignore any definition changes with the same version. We do recommend usage of semver strings.
	Version string `json:"version"`
}

TargetEnrichmentRule A rule describing how to enrich a target with data from another target or from enrichment data

Jump to

Keyboard shortcuts

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