config

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

package config provides configuration types and functions for Substation.

Any non-backwards compatible changes to the configuration types should be accompanied by a version bump. Use the guidance below for choosing the appropriate fields for configurations:

For time-based configurations:

  • Use `Delay` for the amount of time to wait before executing.

  • Use `Timeout` for the amount of time to wait before interrupting an execution.

  • Use `Duration` for the total amount of time over many executions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidFactoryInput is returned when an unsupported input is referenced in any factory function.
	ErrInvalidFactoryInput = fmt.Errorf("invalid factory input")

	// ErrMissingRequiredOption is returned when a component does not have the required options to properly run.
	ErrMissingRequiredOption = fmt.Errorf("missing required option")

	// ErrInvalidOption is returned when an invalid option is received in a constructor.
	ErrInvalidOption = fmt.Errorf("invalid option")
)

Functions

func Decode

func Decode(input, output interface{}) error

Decode marshals and unmarshals an input interface into the output interface using the standard library's json package. This should be used when decoding JSON configurations (i.e., Config) in Substation interface factories.

func NewAWS

func NewAWS(ctx context.Context, cfg AWS) (aws.Config, error)

NewAWS returns a valid AWS SDK v2 configuration.

Types

type AWS

type AWS struct {
	// ARN is the AWS resource that the action will interact with.
	ARN string `json:"arn"`
	// AssumeRoleARN is the ARN of the role that the action will assume.
	AssumeRoleARN string `json:"assume_role_arn"`
}

type Batch

type Batch struct {
	// Count is the maximum number of records that can be batched.
	Count int `json:"count"`
	// Size is the maximum size of the batch in bytes.
	Size int `json:"size"`
	// Duration is the maximum amount of time that records can be batched for.
	Duration string `json:"duration"`
}

type Metric

type Metric struct {
	// Name is the name of the metric.
	Name string `json:"name"`
	// Attributes are key-value pairs that are associated with the metric.
	Attributes map[string]string `json:"attributes"`
	// Destination is the metrics destination that the metric will be sent to (internal/metrics).
	Destination config.Config `json:"destination"`
}

type Object

type Object struct {
	// SourceKey retrieves a value from a JSON object.
	SourceKey string `json:"source_key"`
	// TargetKey place a value into a JSON object.
	TargetKey string `json:"target_key"`
	// BatchKey retrieves a value from a JSON object that is used to organize
	// batched data (internal/aggregate).
	BatchKey string `json:"batch_key"`
}

type Request

type Request struct {
	// Timeout is the amount of time that the request will wait before timing out.
	Timeout string `json:"Timeout"`
}

type Retry

type Retry struct {
	// Count is the maximum number of times that the action will be retried. This
	// can be combined with the Delay field to create a backoff strategy.
	Count int `json:"count"`
	// Delay is the amount of time to wait before retrying the action. This can be
	// combined with the Count field to create a backoff strategy.
	Delay string `json:"delay"`
}

Jump to

Keyboard shortcuts

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