action_kit_api

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 1 Imported by: 0

README

ActionKit Go API

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

The types are generated automatically from the ActionKit OpenAPI specification.

Installation

Add the following to your go.mod file:

go get github.com/steadybit/action-kit/go/action_kit_api

Usage

import (
	"github.com/steadybit/action-kit/go/action_kit_api"
)

actionList := action_kit_api.ActionList{
    Actions: []action_kit_api.DescribingEndpointReference{
        {
            "GET",
            "/actions/rollout-restart",
        },
    },
}

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220629212257-2cf7fcf5b26d DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionDescription

type ActionDescription struct {
	// Used for categorization of the action within user interfaces.
	Category *string `json:"category,omitempty"`

	// Description for end-users to help them understand what the action is doing.
	Description string `json:"description"`

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

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

	// Describes what kind of action this is. This is used to help users understand and classify the various runnable actions that are part of an experiment.
	Kind ActionDescriptionKind `json:"kind"`

	// A human-readable label for the action.
	Label      string            `json:"label"`
	Parameters []ActionParameter `json:"parameters"`

	// HTTP endpoint which the Steadybit platform/agent could communicate with.
	Prepare MutatingEndpointReference `json:"prepare"`

	// HTTP endpoint which the Steadybit platform/agent could communicate with.
	Start MutatingEndpointReference `json:"start"`

	// HTTP endpoint which the Steadybit platform/agent could communicate with.
	Status *MutatingEndpointReferenceWithCallInterval `json:"status,omitempty"`

	// HTTP endpoint which the Steadybit platform/agent could communicate with.
	Stop *MutatingEndpointReference `json:"stop,omitempty"`

	// What target type this action should be offered for. Matches the `id` field within `DescribeTargetTypeResponse` within DiscoveryKit.
	TargetType *string `json:"targetType,omitempty"`

	// Actions can either be an instantaneous event, e.g., the restart of a host, or an activity spanning over an unspecified duration. For those actions having a duration, we differentiate between internally, e.g., waiting for a deployment to finish, and externally, e.g., waiting for a user-specified time to pass, controlled durations.
	TimeControl ActionDescriptionTimeControl `json:"timeControl"`

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

Provides details about a possible action, e.g., what configuration options it has, how to present it to end-users and how to trigger the action.

type ActionDescriptionKind

type ActionDescriptionKind string

Describes what kind of action this is. This is used to help users understand and classify the various runnable actions that are part of an experiment.

const (
	Attack   ActionDescriptionKind = "attack"
	Check    ActionDescriptionKind = "check"
	LoadTest ActionDescriptionKind = "load_test"
	Other    ActionDescriptionKind = "other"
)

Defines values for ActionDescriptionKind.

type ActionDescriptionTimeControl

type ActionDescriptionTimeControl string

Actions can either be an instantaneous event, e.g., the restart of a host, or an activity spanning over an unspecified duration. For those actions having a duration, we differentiate between internally, e.g., waiting for a deployment to finish, and externally, e.g., waiting for a user-specified time to pass, controlled durations.

const (
	External      ActionDescriptionTimeControl = "external"
	Instantaneous ActionDescriptionTimeControl = "instantaneous"
	Internal      ActionDescriptionTimeControl = "internal"
)

Defines values for ActionDescriptionTimeControl.

type ActionKitError

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

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

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

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

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

type ActionList

type ActionList struct {
	Actions []DescribingEndpointReference `json:"actions"`
}

Lists all actions that the platform/agent could execute.

type ActionListResponse

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

ActionListResponse defines model for ActionListResponse.

func (ActionListResponse) AsActionKitError

func (t ActionListResponse) AsActionKitError() (ActionKitError, error)

func (ActionListResponse) AsActionList

func (t ActionListResponse) AsActionList() (ActionList, error)

func (*ActionListResponse) FromActionKitError

func (t *ActionListResponse) FromActionKitError(v ActionKitError) error

func (*ActionListResponse) FromActionList

func (t *ActionListResponse) FromActionList(v ActionList) error

func (ActionListResponse) MarshalJSON

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

func (*ActionListResponse) UnmarshalJSON

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

type ActionParameter

type ActionParameter struct {
	// Unique file type specifiers describing what type of files are accepted for parameters of type 'file'.
	AcceptedFileTypes *[]string `json:"acceptedFileTypes,omitempty"`

	// Whether this parameter should be placed under the expandable advanced section within the user interface.
	Advanced *bool `json:"advanced,omitempty"`

	// A default value for this parameter. This value will be used if the user does not specify a value for this parameter.
	DefaultValue *string `json:"defaultValue,omitempty"`

	// Description for end-users to help them understand the action parameter.
	Description *string `json:"description,omitempty"`

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

	// The key under which the action parameter is stored. This key can then be found within the prepare request's config field.
	Name string `json:"name"`

	// Optional options for the `string`, `string[]` and `string_array` parameter types. Which result in suggestions for end-users.
	Options *[]ParameterOption `json:"options,omitempty"`

	// You can define this fields to order the parameters in the user interface. The lower the value, the higher the position.
	Order *int `json:"order,omitempty"`

	// Whether or not end-users need to specify a value for this parameter.
	Required *bool `json:"required,omitempty"`

	// What kind of value this parameter is capturing. The type selection influences the `config` passed as part of the `PrepareRequest`. It also results in improved user-interface elements.
	Type ActionParameterType `json:"type"`
}

ActionParameter defines model for ActionParameter.

type ActionParameterType

type ActionParameterType string

What kind of value this parameter is capturing. The type selection influences the `config` passed as part of the `PrepareRequest`. It also results in improved user-interface elements.

const (
	Boolean     ActionParameterType = "boolean"
	Duration    ActionParameterType = "duration"
	File        ActionParameterType = "file"
	Integer     ActionParameterType = "integer"
	KeyValue    ActionParameterType = "key_value"
	Password    ActionParameterType = "password"
	Percentage  ActionParameterType = "percentage"
	String      ActionParameterType = "string"
	String1     ActionParameterType = "string[]"
	StringArray ActionParameterType = "string_array"
)

Defines values for ActionParameterType.

type ActionState

type ActionState = map[string]interface{}

Any kind of action specific state that will be passed to the next endpoints.

type ActionStatusRequestBody

type ActionStatusRequestBody struct {
	// Any kind of action specific state that will be passed to the next endpoints.
	State ActionState `json:"state"`
}

ActionStatusRequestBody defines model for ActionStatusRequestBody.

type ActionStatusResponse

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

ActionStatusResponse defines model for ActionStatusResponse.

func (ActionStatusResponse) AsActionKitError

func (t ActionStatusResponse) AsActionKitError() (ActionKitError, error)

func (ActionStatusResponse) AsStatusResult

func (t ActionStatusResponse) AsStatusResult() (StatusResult, error)

func (*ActionStatusResponse) FromActionKitError

func (t *ActionStatusResponse) FromActionKitError(v ActionKitError) error

func (*ActionStatusResponse) FromStatusResult

func (t *ActionStatusResponse) FromStatusResult(v StatusResult) error

func (ActionStatusResponse) MarshalJSON

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

func (*ActionStatusResponse) UnmarshalJSON

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

type Artifact

type Artifact struct {
	// base64 encoded data
	Data string `json:"data"`

	// Human-readable label for the artifact. We recommend to include file extensions within the label for a better user-experience when downloading these artifacts, e.g., load_test_result.tar.gz.
	Label string `json:"label"`
}

Actions may choose to provide artifacts (arbitrary files) that are later accessible by users when inspecting experiment execution details. This comes in handy to expose load test reports and similar data.

type Artifacts

type Artifacts = []Artifact

Artifacts defines model for Artifacts.

type DescribeActionResponse

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

DescribeActionResponse defines model for DescribeActionResponse.

func (DescribeActionResponse) AsActionDescription

func (t DescribeActionResponse) AsActionDescription() (ActionDescription, error)

func (DescribeActionResponse) AsActionKitError

func (t DescribeActionResponse) AsActionKitError() (ActionKitError, error)

func (*DescribeActionResponse) FromActionDescription

func (t *DescribeActionResponse) FromActionDescription(v ActionDescription) error

func (*DescribeActionResponse) FromActionKitError

func (t *DescribeActionResponse) FromActionKitError(v ActionKitError) error

func (DescribeActionResponse) MarshalJSON

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

func (*DescribeActionResponse) UnmarshalJSON

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

type DescribingEndpointReference

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

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

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

type DescribingEndpointReferenceMethod

type DescribingEndpointReferenceMethod string

HTTP method to use when calling the HTTP endpoint.

const (
	Get DescribingEndpointReferenceMethod = "get"
)

Defines values for DescribingEndpointReferenceMethod.

type Message

type Message struct {
	Level   *MessageLevel `json:"level,omitempty"`
	Message string        `json:"message"`
}

Log-message that will be passed to the agent log.

type MessageLevel

type MessageLevel string

MessageLevel defines model for Message.Level.

const (
	Debug MessageLevel = "debug"
	Error MessageLevel = "error"
	Info  MessageLevel = "info"
	Warn  MessageLevel = "warn"
)

Defines values for MessageLevel.

type Messages

type Messages = []Message

Log-messages that will be passed to the agent log.

type MutatingEndpointReference

type MutatingEndpointReference struct {
	Method MutatingHttpMethod `json:"method"`

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

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

type MutatingEndpointReferenceWithCallInterval

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

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

MutatingEndpointReferenceWithCallInterval defines model for MutatingEndpointReferenceWithCallInterval.

type MutatingHttpMethod

type MutatingHttpMethod string

MutatingHttpMethod defines model for MutatingHttpMethod.

const (
	Delete MutatingHttpMethod = "delete"
	Post   MutatingHttpMethod = "post"
	Put    MutatingHttpMethod = "put"
)

Defines values for MutatingHttpMethod.

type ParameterOption

type ParameterOption struct {
	// A human-readable label describing this option.
	Label string `json:"label"`

	// The technical value which will be passed to the action as part of the `config` object.
	Value string `json:"value"`
}

ParameterOption defines model for ParameterOption.

type PrepareActionRequestBody

type PrepareActionRequestBody struct {
	// The action configuration. This contains the end-user configuration done for the action. Possible configuration parameters are defined through the action description.
	Config map[string]interface{} `json:"config"`

	// The target on which to act on as identified by a discovery.
	Target *Target `json:"target,omitempty"`
}

PrepareActionRequestBody defines model for PrepareActionRequestBody.

type PrepareActionResponse

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

PrepareActionResponse defines model for PrepareActionResponse.

func (PrepareActionResponse) AsActionKitError

func (t PrepareActionResponse) AsActionKitError() (ActionKitError, error)

func (PrepareActionResponse) AsPrepareResult

func (t PrepareActionResponse) AsPrepareResult() (PrepareResult, error)

func (*PrepareActionResponse) FromActionKitError

func (t *PrepareActionResponse) FromActionKitError(v ActionKitError) error

func (*PrepareActionResponse) FromPrepareResult

func (t *PrepareActionResponse) FromPrepareResult(v PrepareResult) error

func (PrepareActionResponse) MarshalJSON

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

func (*PrepareActionResponse) UnmarshalJSON

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

type PrepareResult

type PrepareResult struct {
	Artifacts *Artifacts `json:"artifacts,omitempty"`

	// Log-messages that will be passed to the agent log.
	Messages *Messages `json:"messages,omitempty"`

	// Any kind of action specific state that will be passed to the next endpoints.
	State ActionState `json:"state"`
}

PrepareResult defines model for PrepareResult.

type StartActionRequestBody

type StartActionRequestBody struct {
	// Any kind of action specific state that will be passed to the next endpoints.
	State ActionState `json:"state"`
}

StartActionRequestBody defines model for StartActionRequestBody.

type StartActionResponse

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

StartActionResponse defines model for StartActionResponse.

func (StartActionResponse) AsActionKitError

func (t StartActionResponse) AsActionKitError() (ActionKitError, error)

func (StartActionResponse) AsStartResult

func (t StartActionResponse) AsStartResult() (StartResult, error)

func (*StartActionResponse) FromActionKitError

func (t *StartActionResponse) FromActionKitError(v ActionKitError) error

func (*StartActionResponse) FromStartResult

func (t *StartActionResponse) FromStartResult(v StartResult) error

func (StartActionResponse) MarshalJSON

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

func (*StartActionResponse) UnmarshalJSON

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

type StartResult

type StartResult struct {
	Artifacts *Artifacts `json:"artifacts,omitempty"`

	// Log-messages that will be passed to the agent log.
	Messages *Messages `json:"messages,omitempty"`

	// Any kind of action specific state that will be passed to the next endpoints.
	State *ActionState `json:"state,omitempty"`
}

StartResult defines model for StartResult.

type StatusResult

type StatusResult struct {
	Artifacts *Artifacts `json:"artifacts,omitempty"`
	Completed bool       `json:"completed"`

	// Log-messages that will be passed to the agent log.
	Messages *Messages `json:"messages,omitempty"`

	// Any kind of action specific state that will be passed to the next endpoints.
	State *ActionState `json:"state,omitempty"`
}

StatusResult defines model for StatusResult.

type StopActionRequestBody

type StopActionRequestBody struct {
	// Any kind of action specific state that will be passed to the next endpoints.
	State ActionState `json:"state"`
}

StopActionRequestBody defines model for StopActionRequestBody.

type StopActionResponse

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

StopActionResponse defines model for StopActionResponse.

func (StopActionResponse) AsActionKitError

func (t StopActionResponse) AsActionKitError() (ActionKitError, error)

func (StopActionResponse) AsStopResult

func (t StopActionResponse) AsStopResult() (StopResult, error)

func (*StopActionResponse) FromActionKitError

func (t *StopActionResponse) FromActionKitError(v ActionKitError) error

func (*StopActionResponse) FromStopResult

func (t *StopActionResponse) FromStopResult(v StopResult) error

func (StopActionResponse) MarshalJSON

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

func (*StopActionResponse) UnmarshalJSON

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

type StopResult

type StopResult struct {
	Artifacts *Artifacts `json:"artifacts,omitempty"`

	// Log-messages that will be passed to the agent log.
	Messages *Messages `json:"messages,omitempty"`
}

StopResult defines model for StopResult.

type Target

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

The target on which to act on as identified by a discovery.

Jump to

Keyboard shortcuts

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