event_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: May 9, 2025 License: MIT Imports: 4 Imported by: 19

README

EventKit Go API

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

The types are generated automatically from the EventKit OpenAPI specification.

Installation

Add the following to your go.mod file:

go get github.com/steadybit/event-kit/go/event_kit_api

Usage

import (
	"github.com/steadybit/event-kit/go/event_kit_api"
    "github.com/steadybit/extension-kit/extutil"
)

eventList := event_kit_api.EventListenerList{
    EventListeners: []event_kit_api.EventListener{
        {
            Method:     "POST",
            Path:       "/events/experiment-started",
            ListenTo:   []string{"experiment.execution.created"},
        },
        {
            Method:     "POST",
            Path:       "/events/experiment-completed",
            ListenTo:   []string{"experiment.execution.completed"},
        },
    },
}

Documentation

Overview

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

This section is empty.

Types

type AccessTokenPrincipal

type AccessTokenPrincipal struct {
	Id string `json:"id"`

	// Name A human-readable name for the user.
	Name          string          `json:"name"`
	PrincipalType string          `json:"principalType"`
	TokenType     AccessTokenType `json:"tokenType"`
}

AccessTokenPrincipal defines model for AccessTokenPrincipal.

type AccessTokenType

type AccessTokenType string

AccessTokenType defines model for AccessTokenType.

const (
	AccessTokenTypeAdmin AccessTokenType = "admin"
	AccessTokenTypeTeam  AccessTokenType = "team"
)

Defines values for AccessTokenType.

type BatchPrincipal

type BatchPrincipal struct {
	PrincipalType string `json:"principalType"`

	// Username This is a unique identifier for the user.
	Username string `json:"username"`
}

BatchPrincipal defines model for BatchPrincipal.

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 Environment

type Environment struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Environment defines model for Environment.

type EventListener

type EventListener struct {
	// ListenTo List of event names that the event listener want to listen to. You may optionally define the special `*` event name to listen to all events.
	ListenTo []string           `json:"listenTo"`
	Method   MutatingHttpMethod `json:"method"`

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

EventListener defines model for EventListener.

type EventListenerList

type EventListenerList struct {
	EventListeners []EventListener `json:"eventListeners"`
}

EventListenerList Lists all listeners that the platform/agent could call.

type EventListenerListResponse

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

EventListenerListResponse defines model for EventListenerListResponse.

func (EventListenerListResponse) AsEventListenerList

func (t EventListenerListResponse) AsEventListenerList() (EventListenerList, error)

AsEventListenerList returns the union data inside the EventListenerListResponse as a EventListenerList

func (*EventListenerListResponse) FromEventListenerList

func (t *EventListenerListResponse) FromEventListenerList(v EventListenerList) error

FromEventListenerList overwrites any union data inside the EventListenerListResponse as the provided EventListenerList

func (EventListenerListResponse) MarshalJSON

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

func (*EventListenerListResponse) MergeEventListenerList added in v1.4.0

func (t *EventListenerListResponse) MergeEventListenerList(v EventListenerList) error

MergeEventListenerList performs a merge with any union data inside the EventListenerListResponse, using the provided EventListenerList

func (*EventListenerListResponse) UnmarshalJSON

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

type EventRequestBody

type EventRequestBody struct {
	Environment                   *Environment                   `json:"environment,omitempty"`
	EventName                     string                         `json:"eventName"`
	EventTime                     time.Time                      `json:"eventTime"`
	ExperimentExecution           *ExperimentExecution           `json:"experimentExecution,omitempty"`
	ExperimentStepExecution       *ExperimentStepExecution       `json:"experimentStepExecution,omitempty"`
	ExperimentStepTargetExecution *ExperimentStepTargetExecution `json:"experimentStepTargetExecution,omitempty"`
	Id                            uuid.UUID                      `json:"id"`

	// Principal The principal describes through which activity the action was triggered.
	Principal Principal `json:"principal"`
	Team      *Team     `json:"team,omitempty"`
	Tenant    Tenant    `json:"tenant"`
}

EventRequestBody defines model for EventRequestBody.

type ExperimentExecution

type ExperimentExecution struct {
	EndedTime     *time.Time `json:"endedTime,omitempty"`
	ExecutionId   float32    `json:"executionId"`
	ExperimentKey string     `json:"experimentKey"`
	Hypothesis    string     `json:"hypothesis"`
	Name          string     `json:"name"`
	PreparedTime  time.Time  `json:"preparedTime"`

	// Reason Additional information about the reason for the state.
	Reason *string `json:"reason,omitempty"`

	// ReasonDetails Additional information about the reason for the state.
	ReasonDetails *string                  `json:"reasonDetails,omitempty"`
	StartedTime   time.Time                `json:"startedTime"`
	State         ExperimentExecutionState `json:"state"`
}

ExperimentExecution defines model for ExperimentExecution.

type ExperimentExecutionState

type ExperimentExecutionState string

ExperimentExecutionState defines model for ExperimentExecution.State.

const (
	ExperimentExecutionStateCanceled  ExperimentExecutionState = "canceled"
	ExperimentExecutionStateCompleted ExperimentExecutionState = "completed"
	ExperimentExecutionStateCreated   ExperimentExecutionState = "created"
	ExperimentExecutionStateErrored   ExperimentExecutionState = "errored"
	ExperimentExecutionStateFailed    ExperimentExecutionState = "failed"
	ExperimentExecutionStatePrepared  ExperimentExecutionState = "prepared"
	ExperimentExecutionStateRunning   ExperimentExecutionState = "running"
)

Defines values for ExperimentExecutionState.

type ExperimentStepExecution added in v1.2.0

type ExperimentStepExecution struct {
	ActionId      *string                            `json:"actionId,omitempty"`
	ActionKind    *ExperimentStepExecutionActionKind `json:"actionKind,omitempty"`
	ActionName    *string                            `json:"actionName,omitempty"`
	CustomLabel   *string                            `json:"customLabel,omitempty"`
	EndedTime     *time.Time                         `json:"endedTime,omitempty"`
	ExecutionId   float32                            `json:"executionId"`
	ExperimentKey string                             `json:"experimentKey"`
	Id            uuid.UUID                          `json:"id"`
	StartedTime   *time.Time                         `json:"startedTime,omitempty"`
	State         ExperimentStepExecutionState       `json:"state"`
	Type          ExperimentStepExecutionType        `json:"type"`
}

ExperimentStepExecution defines model for ExperimentStepExecution.

type ExperimentStepExecutionActionKind added in v1.2.1

type ExperimentStepExecutionActionKind string

ExperimentStepExecutionActionKind defines model for ExperimentStepExecution.ActionKind.

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

Defines values for ExperimentStepExecutionActionKind.

type ExperimentStepExecutionState added in v1.2.0

type ExperimentStepExecutionState string

ExperimentStepExecutionState defines model for ExperimentStepExecution.State.

const (
	ExperimentStepExecutionStateCanceled  ExperimentStepExecutionState = "canceled"
	ExperimentStepExecutionStateCompleted ExperimentStepExecutionState = "completed"
	ExperimentStepExecutionStateCreated   ExperimentStepExecutionState = "created"
	ExperimentStepExecutionStateErrored   ExperimentStepExecutionState = "errored"
	ExperimentStepExecutionStateFailed    ExperimentStepExecutionState = "failed"
	ExperimentStepExecutionStatePrepared  ExperimentStepExecutionState = "prepared"
	ExperimentStepExecutionStateRunning   ExperimentStepExecutionState = "running"
	ExperimentStepExecutionStateSkipped   ExperimentStepExecutionState = "skipped"
)

Defines values for ExperimentStepExecutionState.

type ExperimentStepExecutionType added in v1.2.0

type ExperimentStepExecutionType string

ExperimentStepExecutionType defines model for ExperimentStepExecution.Type.

const (
	Action ExperimentStepExecutionType = "action"
	Wait   ExperimentStepExecutionType = "wait"
)

Defines values for ExperimentStepExecutionType.

type ExperimentStepTargetExecution added in v1.3.0

type ExperimentStepTargetExecution struct {
	AgentHostname string     `json:"agentHostname"`
	EndedTime     *time.Time `json:"endedTime,omitempty"`
	ExecutionId   float32    `json:"executionId"`
	ExperimentKey string     `json:"experimentKey"`
	Id            uuid.UUID  `json:"id"`

	// Reason Additional information about the reason for the state.
	Reason *string `json:"reason,omitempty"`

	// ReasonDetails Additional information about the reason for the state.
	ReasonDetails    *string                            `json:"reasonDetails,omitempty"`
	StartedTime      *time.Time                         `json:"startedTime,omitempty"`
	State            ExperimentStepTargetExecutionState `json:"state"`
	StepExecutionId  uuid.UUID                          `json:"stepExecutionId"`
	TargetAttributes map[string][]string                `json:"targetAttributes"`
	TargetName       string                             `json:"targetName"`
	TargetType       string                             `json:"targetType"`
}

ExperimentStepTargetExecution defines model for ExperimentStepTargetExecution.

type ExperimentStepTargetExecutionState added in v1.3.0

type ExperimentStepTargetExecutionState string

ExperimentStepTargetExecutionState defines model for ExperimentStepTargetExecution.State.

const (
	Canceled  ExperimentStepTargetExecutionState = "canceled"
	Completed ExperimentStepTargetExecutionState = "completed"
	Created   ExperimentStepTargetExecutionState = "created"
	Errored   ExperimentStepTargetExecutionState = "errored"
	Failed    ExperimentStepTargetExecutionState = "failed"
	Prepared  ExperimentStepTargetExecutionState = "prepared"
	Running   ExperimentStepTargetExecutionState = "running"
	Skipped   ExperimentStepTargetExecutionState = "skipped"
)

Defines values for ExperimentStepTargetExecutionState.

type ListenResult

type ListenResult = map[string]interface{}

ListenResult defines model for ListenResult.

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 Principal

type Principal interface{}

type PrincipalType

type PrincipalType string

PrincipalType defines model for PrincipalType.

const (
	AccessToken PrincipalType = "access_token"
	BatchJob    PrincipalType = "batch_job"
	User        PrincipalType = "user"
)

Defines values for PrincipalType.

type Team

type Team struct {
	Id   string `json:"id"`
	Key  string `json:"key"`
	Name string `json:"name"`
}

Team defines model for Team.

type Tenant

type Tenant struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

Tenant defines model for Tenant.

type UserPrincipal

type UserPrincipal struct {
	Email *string `json:"email,omitempty"`

	// Name A human-readable name for the user.
	Name          string `json:"name"`
	PrincipalType string `json:"principalType"`

	// Username This is a unique identifier for the user.
	Username string `json:"username"`
}

UserPrincipal defines model for UserPrincipal.

Jump to

Keyboard shortcuts

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