attack_kit_api

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 1 Imported by: 3

README

AttackKit Go API

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

The types are generated automatically from the AttackKit OpenAPI specification.

Installation

Add the following to your go.mod file:

go get github.com/steadybit/attack-kit/go/attack_kit_api@v0.1.0

Usage

import (
	"github.com/steadybit/attack-kit/go/attack_kit_api"
)

attackList := attack_kit_api.AttackList{
    Attacks: []attack_kit_api.DescribingEndpointReference{
        {
            "GET",
            "/attacks/rollout-restart",
        },
    },
}

Documentation

Overview

Package attack_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

func Ptr

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

Types

type AttackDescription

type AttackDescription struct {
	// Used for categorization of the attack within user interfaces.
	Category AttackDescriptionCategory `json:"category"`

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

	// An icon that is used to identify your attack 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 attack. You will typically want to use something like `org.example.attacks.my-fancy-attack`.
	Id string `json:"id"`

	// A human-readable label for the attack.
	Label      string            `json:"label"`
	Parameters []AttackParameter `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 attack should be offered for. Matches the `id` field within `DescribeTargetTypeResponse` within DiscoveryKit.
	TargetType string `json:"targetType"`

	// Attacks can either be an instantaneous event, e.g., the restart of a host, or an activity spanning over an unspecified duration. For those attacks 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 AttackDescriptionTimeControl `json:"timeControl"`

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

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

type AttackDescriptionCategory

type AttackDescriptionCategory string

Used for categorization of the attack within user interfaces.

const (
	Network  AttackDescriptionCategory = "network"
	Resource AttackDescriptionCategory = "resource"
	State    AttackDescriptionCategory = "state"
)

Defines values for AttackDescriptionCategory.

type AttackDescriptionTimeControl

type AttackDescriptionTimeControl string

Attacks can either be an instantaneous event, e.g., the restart of a host, or an activity spanning over an unspecified duration. For those attacks 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      AttackDescriptionTimeControl = "EXTERNAL"
	INSTANTANEOUS AttackDescriptionTimeControl = "INSTANTANEOUS"
	INTERNAL      AttackDescriptionTimeControl = "INTERNAL"
)

Defines values for AttackDescriptionTimeControl.

type AttackKitError

type AttackKitError 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 AttackList

type AttackList struct {
	Attacks []DescribingEndpointReference `json:"attacks"`
}

Lists all attacks that the platform/agent could execute.

type AttackListResponse

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

AttackListResponse defines model for AttackListResponse.

func (AttackListResponse) AsAttackKitError

func (t AttackListResponse) AsAttackKitError() (AttackKitError, error)

func (AttackListResponse) AsAttackList

func (t AttackListResponse) AsAttackList() (AttackList, error)

func (*AttackListResponse) FromAttackKitError

func (t *AttackListResponse) FromAttackKitError(v AttackKitError) error

func (*AttackListResponse) FromAttackList

func (t *AttackListResponse) FromAttackList(v AttackList) error

func (AttackListResponse) MarshalJSON

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

func (*AttackListResponse) UnmarshalJSON

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

type AttackParameter

type AttackParameter 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 attack parameter.
	Description *string `json:"description,omitempty"`

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

	// The key under which the attack 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 AttackParameterType `json:"type"`
}

AttackParameter defines model for AttackParameter.

type AttackParameterType

type AttackParameterType 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     AttackParameterType = "boolean"
	Duration    AttackParameterType = "duration"
	File        AttackParameterType = "file"
	Integer     AttackParameterType = "integer"
	KeyValue    AttackParameterType = "key_value"
	Password    AttackParameterType = "password"
	Percentage  AttackParameterType = "percentage"
	String      AttackParameterType = "string"
	String1     AttackParameterType = "string[]"
	StringArray AttackParameterType = "string_array"
)

Defines values for AttackParameterType.

type AttackState

type AttackState = map[string]interface{}

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

type AttackStateAndMessages

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

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

AttackStateAndMessages defines model for AttackStateAndMessages.

type AttackStatus

type AttackStatus struct {
	Completed bool `json:"completed"`

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

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

AttackStatus defines model for AttackStatus.

type AttackStatusRequestBody

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

AttackStatusRequestBody defines model for AttackStatusRequestBody.

type AttackStatusResponse

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

AttackStatusResponse defines model for AttackStatusResponse.

func (AttackStatusResponse) AsAttackKitError

func (t AttackStatusResponse) AsAttackKitError() (AttackKitError, error)

func (AttackStatusResponse) AsAttackStatus

func (t AttackStatusResponse) AsAttackStatus() (AttackStatus, error)

func (*AttackStatusResponse) FromAttackKitError

func (t *AttackStatusResponse) FromAttackKitError(v AttackKitError) error

func (*AttackStatusResponse) FromAttackStatus

func (t *AttackStatusResponse) FromAttackStatus(v AttackStatus) error

func (AttackStatusResponse) MarshalJSON

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

func (*AttackStatusResponse) UnmarshalJSON

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

type DescribeAttackResponse

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

DescribeAttackResponse defines model for DescribeAttackResponse.

func (DescribeAttackResponse) AsAttackDescription

func (t DescribeAttackResponse) AsAttackDescription() (AttackDescription, error)

func (DescribeAttackResponse) AsAttackKitError

func (t DescribeAttackResponse) AsAttackKitError() (AttackKitError, error)

func (*DescribeAttackResponse) FromAttackDescription

func (t *DescribeAttackResponse) FromAttackDescription(v AttackDescription) error

func (*DescribeAttackResponse) FromAttackKitError

func (t *DescribeAttackResponse) FromAttackKitError(v AttackKitError) error

func (DescribeAttackResponse) MarshalJSON

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

func (*DescribeAttackResponse) UnmarshalJSON

func (t *DescribeAttackResponse) 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 KeyedMessages

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

KeyedMessages defines model for KeyedMessages.

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"
)

Defines values for MessageLevel.

type Messages

type Messages = []Message

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

type MutatingEndpointReference

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

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

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

type MutatingEndpointReferenceMethod

type MutatingEndpointReferenceMethod string

HTTP method to use when calling the HTTP endpoint.

const (
	MutatingEndpointReferenceMethodDELETE MutatingEndpointReferenceMethod = "DELETE"
	MutatingEndpointReferenceMethodPOST   MutatingEndpointReferenceMethod = "POST"
	MutatingEndpointReferenceMethodPUT    MutatingEndpointReferenceMethod = "PUT"
)

Defines values for MutatingEndpointReferenceMethod.

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"`

	// HTTP method to use when calling the HTTP endpoint.
	Method MutatingEndpointReferenceWithCallIntervalMethod `json:"method"`

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

MutatingEndpointReferenceWithCallInterval defines model for MutatingEndpointReferenceWithCallInterval.

type MutatingEndpointReferenceWithCallIntervalMethod

type MutatingEndpointReferenceWithCallIntervalMethod string

HTTP method to use when calling the HTTP endpoint.

const (
	MutatingEndpointReferenceWithCallIntervalMethodDELETE MutatingEndpointReferenceWithCallIntervalMethod = "DELETE"
	MutatingEndpointReferenceWithCallIntervalMethodPOST   MutatingEndpointReferenceWithCallIntervalMethod = "POST"
	MutatingEndpointReferenceWithCallIntervalMethodPUT    MutatingEndpointReferenceWithCallIntervalMethod = "PUT"
)

Defines values for MutatingEndpointReferenceWithCallIntervalMethod.

type ParameterOption added in v0.3.0

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

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

ParameterOption defines model for ParameterOption.

type PrepareAttackRequestBody

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

	// The target to attack as identified by a discovery.
	Target Target `json:"target"`
}

PrepareAttackRequestBody defines model for PrepareAttackRequestBody.

type PrepareAttackResponse

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

PrepareAttackResponse defines model for PrepareAttackResponse.

func (PrepareAttackResponse) AsAttackKitError

func (t PrepareAttackResponse) AsAttackKitError() (AttackKitError, error)

func (PrepareAttackResponse) AsAttackStateAndMessages

func (t PrepareAttackResponse) AsAttackStateAndMessages() (AttackStateAndMessages, error)

func (*PrepareAttackResponse) FromAttackKitError

func (t *PrepareAttackResponse) FromAttackKitError(v AttackKitError) error

func (*PrepareAttackResponse) FromAttackStateAndMessages

func (t *PrepareAttackResponse) FromAttackStateAndMessages(v AttackStateAndMessages) error

func (PrepareAttackResponse) MarshalJSON

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

func (*PrepareAttackResponse) UnmarshalJSON

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

type StartAttackRequestBody

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

StartAttackRequestBody defines model for StartAttackRequestBody.

type StartAttackResponse

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

StartAttackResponse defines model for StartAttackResponse.

func (StartAttackResponse) AsAttackKitError

func (t StartAttackResponse) AsAttackKitError() (AttackKitError, error)

func (StartAttackResponse) AsAttackStateAndMessages

func (t StartAttackResponse) AsAttackStateAndMessages() (AttackStateAndMessages, error)

func (*StartAttackResponse) FromAttackKitError

func (t *StartAttackResponse) FromAttackKitError(v AttackKitError) error

func (*StartAttackResponse) FromAttackStateAndMessages

func (t *StartAttackResponse) FromAttackStateAndMessages(v AttackStateAndMessages) error

func (StartAttackResponse) MarshalJSON

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

func (*StartAttackResponse) UnmarshalJSON

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

type StopAttackRequestBody

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

StopAttackRequestBody defines model for StopAttackRequestBody.

type StopAttackResponse

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

StopAttackResponse defines model for StopAttackResponse.

func (StopAttackResponse) AsAttackKitError

func (t StopAttackResponse) AsAttackKitError() (AttackKitError, error)

func (StopAttackResponse) AsKeyedMessages

func (t StopAttackResponse) AsKeyedMessages() (KeyedMessages, error)

func (*StopAttackResponse) FromAttackKitError

func (t *StopAttackResponse) FromAttackKitError(v AttackKitError) error

func (*StopAttackResponse) FromKeyedMessages

func (t *StopAttackResponse) FromKeyedMessages(v KeyedMessages) error

func (StopAttackResponse) MarshalJSON

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

func (*StopAttackResponse) UnmarshalJSON

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

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 attack implementation.
	Attributes map[string][]string `json:"attributes"`
	Name       string              `json:"name"`
}

The target to attack as identified by a discovery.

Jump to

Keyboard shortcuts

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