config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package config provides the configuration for Pastiche service definitions.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedFileFormat = errors.New("unsupported file format")

Functions

This section is empty.

Types

type Auth added in v0.4.0

type Auth struct {
	Basic *BasicAuth `json:"basic,omitempty"`
}

type BasicAuth added in v0.4.0

type BasicAuth struct {
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
}

type Client added in v0.4.0

type Client struct {
	HTTP *HTTPClient `json:"http,omitempty"`
	GRPC *GRPCClient `json:"grpc,omitempty"`
}

type DigOutput added in v0.4.0

type DigOutput struct {
	Query string `json:"query,omitempty"`
}

type Endpoint

type Endpoint struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name,omitempty"`
	Source string `json:"source,omitempty"`

	Metadata
	Headers Header         `json:"headers,omitempty"`
	Query   Header         `json:"query,omitempty"`
	Form    Form           `json:"form,omitempty"`
	Body    any            `json:"body,omitempty"`
	RawBody any            `json:"rawBody,omitempty"`
	Vars    map[string]any `json:"vars,omitempty"`
	Auth    *Auth          `json:"auth,omitempty"`
	Output  []Output       `json:"output,omitempty"`
}

type File added in v0.4.0

type File struct {
	Schema string `json:"$schema,omitempty"`

	*Service

	Services []Service `json:"services,omitempty"`
	VarSets  []VarSet  `json:"varSets,omitempty"`
	Flows    []Flow    `json:"flows,omitempty"`
	// contains filtered or unexported fields
}

func BuiltinFiles added in v0.5.0

func BuiltinFiles() []*File

func LoadFile added in v0.4.0

func LoadFile(f fs.FS, filename string) (*File, error)

LoadFile loads the given file from the file system and name

func (*File) Name added in v0.4.0

func (f *File) Name() string

func (*File) SetName added in v0.4.0

func (f *File) SetName(name string)

type Flow added in v0.5.0

type Flow struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`

	Metadata
	Steps []Step         `json:"steps,omitempty"`
	Vars  map[string]any `json:"vars,omitempty"`
}

type Form added in v0.4.0

type Form map[string][]string

Form represents the key-value pairs in an encoded form.

func (Form) MarshalJSON added in v0.4.0

func (f Form) MarshalJSON() ([]byte, error)

func (*Form) UnmarshalJSON added in v0.4.0

func (f *Form) UnmarshalJSON(d []byte) error

type GRPCClient added in v0.4.0

type GRPCClient struct {
	DisableReflection bool   `json:"disableReflection,omitzero"`
	ProtoSet          string `json:"protoset,omitempty"`
	Plaintext         bool   `json:"plaintext,omitzero"`
}

type HTTPClient added in v0.4.0

type HTTPClient struct {
}
type Header map[string][]string

Header represents the key-value pairs in an HTTP header.

func (Header) MarshalJSON added in v0.4.0

func (h Header) MarshalJSON() ([]byte, error)

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(d []byte) error

type JMESPathOutput added in v0.4.0

type JMESPathOutput struct {
	Query string `json:"query,omitempty"`
}

type JSONOutput added in v0.4.0

type JSONOutput struct {
	Pretty bool `json:"pretty,omitempty"`
}
type Link struct {
	HRef       string `json:"href,omitempty"`
	HRefLang   string `json:"hrefLang,omitempty"`
	Audience   string `json:"audience,omitempty"`
	Rel        string `json:"rel,omitempty"`
	Title      string `json:"title,omitempty"`
	Type       string `json:"type,omitempty"`
	IsTemplate bool   `json:"isTemplate,omitempty"`
}

type Metadata added in v0.5.0

type Metadata struct {
	Comment     string   `json:"comment,omitempty"`
	Title       string   `json:"title,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Links       []Link   `json:"links,omitempty"`
}

type Output added in v0.4.0

type Output struct {
	Name string `json:"name,omitempty"`

	Metadata
	IncludeMetadata bool            `json:"includeMetadata,omitzero"`
	Template        *TemplateOutput `json:"template,omitempty"`
	JMESPath        *JMESPathOutput `json:"jmespath,omitempty"`
	XPath           *XPathOutput    `json:"xpath,omitempty"`
	Dig             *DigOutput      `json:"dig,omitempty"`
	JSON            *JSONOutput     `json:"json,omitempty"`
	XML             *XMLOutput      `json:"xml,omitempty"`
	YAML            *YAMLOutput     `json:"yaml,omitempty"`
}

type Resource

type Resource struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name,omitempty"`
	Source string `json:"source,omitempty"`

	Metadata
	Resources []Resource     `json:"resources,omitempty"`
	URI       string         `json:"uri,omitempty"`
	Headers   Header         `json:"headers,omitempty"`
	Query     Header         `json:"query,omitempty"`
	Form      Form           `json:"form,omitempty"`
	Get       *Endpoint      `json:"get,omitempty"`
	Put       *Endpoint      `json:"put,omitempty"`
	Post      *Endpoint      `json:"post,omitempty"`
	Delete    *Endpoint      `json:"delete,omitempty"`
	Options   *Endpoint      `json:"options,omitempty"`
	Head      *Endpoint      `json:"head,omitempty"`
	Trace     *Endpoint      `json:"trace,omitempty"`
	Patch     *Endpoint      `json:"patch,omitempty"`
	Body      any            `json:"body,omitempty"`
	RawBody   any            `json:"rawBody,omitempty"`
	Vars      map[string]any `json:"vars,omitempty"`
	Auth      *Auth          `json:"auth,omitempty"`
	Output    []Output       `json:"output,omitempty"`
}

type Server

type Server struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`

	Metadata
	BaseURL string         `json:"baseUrl"`
	Headers Header         `json:"headers,omitempty"`
	Query   Header         `json:"query,omitempty"`
	Vars    map[string]any `json:"vars,omitempty"`
	Auth    *Auth          `json:"auth,omitempty"`
	Output  []Output       `json:"output,omitempty"`
}

type Service

type Service struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`

	Metadata
	Servers   []Server       `json:"servers,omitempty"`
	Resources []Resource     `json:"resources,omitempty"`
	Vars      map[string]any `json:"vars,omitempty"`
	Client    *Client        `json:"client,omitempty"`
	Auth      *Auth          `json:"auth,omitempty"`
	Output    []Output       `json:"output,omitempty"`
}

func Builtin added in v0.4.0

func Builtin(name string) Service

func Builtins added in v0.4.0

func Builtins() []Service

func ExampleHTTPBinorg

func ExampleHTTPBinorg() Service

type Step added in v0.5.0

type Step struct {
	Name string `json:"name,omitempty"`

	Metadata
	Method  string         `json:"method,omitempty"`
	Headers Header         `json:"headers,omitempty"`
	Form    Form           `json:"form,omitempty"`
	Body    any            `json:"body,omitempty"`
	RawBody any            `json:"rawBody,omitempty"`
	Vars    map[string]any `json:"vars,omitempty"`
	Spec    string         `json:"spec,omitempty"`
	URL     string         `json:"url,omitempty"`
}

type TemplateOutput added in v0.4.0

type TemplateOutput struct {
	Text string `json:"text,omitempty"`
	File string `json:"file,omitempty"`
}

type VarSet added in v0.5.0

type VarSet struct {
	Schema string `json:"$schema,omitempty"`
	Name   string `json:"name,omitempty"`
	Source string `json:"source,omitempty"`

	Metadata
	Vars map[string]map[string]any `json:"vars,omitempty"`
}

type XMLOutput added in v0.4.0

type XMLOutput struct {
	Pretty bool `json:"pretty,omitempty"`
}

type XPathOutput added in v0.4.0

type XPathOutput struct {
	Query string `json:"query,omitempty"`
}

type YAMLOutput added in v0.4.0

type YAMLOutput struct {
}

Jump to

Keyboard shortcuts

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