model

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToConfig added in v0.4.0

func ToConfig(m *Model) *config.File

func Validate added in v0.4.0

func Validate(m *Model) error

Types

type Auth added in v0.4.0

type Auth interface {
	// contains filtered or unexported methods
}

type BasicAuth added in v0.4.0

type BasicAuth struct {
	User     string
	Password string
}

type Client added in v0.4.0

type Client interface {
	// contains filtered or unexported methods
}

type DigOutput added in v0.4.0

type DigOutput struct {
	Query string
}

type Endpoint

type Endpoint struct {
	Name        string
	Comment     string
	Title       string
	Description string
	Tags        []string
	Method      string
	Headers     map[string][]string
	Form        map[string][]string
	Links       []Link
	Body        any
	RawBody     any
	Vars        map[string]any
	Auth        Auth
	Output      []*OutputConfig
}

type Expander

type Expander = expander.Interface

type FetchCall added in v0.4.0

type FetchCall struct {
	URL     string
	Options FetchOptions
}

FetchCall represents the parsed fetch call

func ParseJSFetchCall added in v0.4.0

func ParseJSFetchCall(s string) (*FetchCall, error)

func (FetchCall) ToEndpoint added in v0.4.0

func (f FetchCall) ToEndpoint() *Endpoint

type FetchOptions added in v0.4.0

type FetchOptions struct {
	Method  string            `json:"method,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    string            `json:"body,omitempty"`
}

FetchOptions represents common fetch options

type GRPCClient added in v0.4.0

type GRPCClient struct {
	DisableReflection bool
	ProtoSet          string
	Plaintext         bool
}

type HTTPClient added in v0.4.0

type HTTPClient struct {
}

type JMESPathOutput added in v0.4.0

type JMESPathOutput struct {
	Query string
}

type JSONOutput added in v0.4.0

type JSONOutput struct {
	Pretty bool
}
type Link struct {
	HRef       string
	HRefLang   string
	Audience   string
	Rel        string
	Title      string
	Type       string
	IsTemplate bool
}

type Model

type Model struct {
	Services []*Service
	// contains filtered or unexported fields
}

func New

func New(c *config.Config) *Model

func (*Model) Resolve

func (m *Model) Resolve(spec ServiceSpec, server string, method string) (ResolvedResource, error)

func (*Model) Service

func (m *Model) Service(name string) (*Service, bool)

type OutputConfig added in v0.4.0

type OutputConfig struct {
	Name            string
	Comment         string
	Title           string
	Description     string
	Links           []Link
	Filter          OutputFilter
	IncludeMetadata bool
}

type OutputFilter added in v0.4.0

type OutputFilter interface {
	// contains filtered or unexported methods
}

type Request added in v0.4.0

type Request struct {
	URL      *url.URL
	Body     io.ReadCloser
	Headers  http.Header
	Vars     map[string]any
	Links    []Link
	Auth     Auth
	Expander e.Interface
}

func NewRequest added in v0.4.0

func NewRequest(r ResolvedResource, opts ...RequestOption) (*Request, error)

type RequestOption added in v0.4.0

type RequestOption interface {
	// contains filtered or unexported methods
}

func WithBaseURL added in v0.4.0

func WithBaseURL(baseURL *url.URL) RequestOption

func WithVars added in v0.4.0

func WithVars(vars map[string]any) RequestOption

type ResolvedResource

type ResolvedResource interface {
	Service() *Service
	Resource() *Resource
	Lineage() []*Resource
	Endpoint() *Endpoint
	Server() *Server
	Client() Client

	Auth() Auth
	Output() []*OutputConfig
	Headers() http.Header
	Vars() map[string]any
	Links() []Link

	EvalRequest(baseURL *url.URL, vars map[string]any) (*Request, error)
}

ResolvedResource represents the resource which was selected by its name

type Resource

type Resource struct {
	Name        string
	Comment     string
	Title       string
	Description string
	Tags        []string
	Resources   []*Resource
	Endpoints   []*Endpoint
	URITemplate *uritemplates.URITemplate
	Headers     map[string][]string
	Form        map[string][]string
	Links       []Link
	Command     []string
	Body        any
	RawBody     any
	Vars        map[string]any
	Auth        Auth
	Output      []*OutputConfig
}

func (*Resource) Endpoint

func (r *Resource) Endpoint(m string) (*Endpoint, bool)

func (*Resource) Resource

func (r *Resource) Resource(name string) (*Resource, bool)

type Server

type Server struct {
	Name        string
	Comment     string
	Description string
	Tags        []string
	Title       string
	BaseURL     string
	Headers     map[string][]string
	Form        map[string][]string
	Links       []Link
	Vars        map[string]any
	Auth        Auth
	Output      []*OutputConfig
}

type Service

type Service struct {
	Name        string
	Comment     string
	Title       string
	Description string
	Tags        []string
	Servers     []*Server
	Links       []Link
	Resource    *Resource
	Vars        map[string]any
	Client      Client
	Auth        Auth
	Output      []*OutputConfig
}

func (*Service) Server

func (s *Service) Server(name string) (*Server, bool)

type ServiceSpec

type ServiceSpec []string

func (ServiceSpec) NewCounter

func (s ServiceSpec) NewCounter() cli.ArgCounter

func (ServiceSpec) Path

func (s ServiceSpec) Path() string

func (ServiceSpec) ServiceName

func (s ServiceSpec) ServiceName() string

func (*ServiceSpec) Set

func (s *ServiceSpec) Set(arg string) error

func (ServiceSpec) String

func (s ServiceSpec) String() string

type TemplateOutput added in v0.4.0

type TemplateOutput struct {
	Text string
	File string
}

type XMLOutput added in v0.4.0

type XMLOutput struct {
	Pretty bool
}

type XPathOutput added in v0.4.0

type XPathOutput struct {
	Query string
}

type YAMLOutput added in v0.4.0

type YAMLOutput struct {
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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