rest

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Shared client to maximize connection re-use.
	// TODO: make this private to the package once kgx package is removed.
	HTTPClient *retryablehttp.Client
)

Functions

func GetUserAgent

func GetUserAgent() string

func NewFrontClient

func NewFrontClient(host string, cli akid.ClientID) *frontClientImpl

func NewLearnClient

func NewLearnClient(host string, cli akid.ClientID, svc akid.ServiceID) *learnClientImpl

Types

type CreateSpecOptions

type CreateSpecOptions struct {
	Tags           map[string]string
	PathPatterns   []pp.Pattern
	PathExclusions []*regexp.Regexp
	GitHubPR       *github.PRInfo
	GitLabMR       *gitlab.MRInfo
}

type FrontClient

type FrontClient interface {
	GetServices(context.Context) ([]Service, error)
}

type GetSpecOptions

type GetSpecOptions struct {
	EnableRelatedTypes bool
}

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       []byte
}

Error type for non-2xx HTTP errors.

func (HTTPError) Error

func (he HTTPError) Error() string

type LearnClient

type LearnClient interface {
	ListLearnSessions(context.Context, akid.ServiceID, map[string]string) ([]*kgxapi.LearnSession, error)
	GetLearnSession(context.Context, akid.ServiceID, akid.LearnSessionID) (*kgxapi.LearnSession, error)
	CreateLearnSession(context.Context, *kgxapi.APISpecReference, string, map[string]string) (akid.LearnSessionID, error)
	ReportWitnesses(context.Context, akid.LearnSessionID, []*kgxapi.WitnessReport) error

	// Deprecated: old way of creating a spec from a single learn session.
	// Use CreateSpec instead.
	CheckpointLearnSession(context.Context, akid.LearnSessionID) (akid.APISpecID, error)

	// Creates a spec from a set of learn sessions.
	CreateSpec(context.Context, string, []akid.LearnSessionID, CreateSpecOptions) (akid.APISpecID, error)
	GetSpec(context.Context, akid.APISpecID, GetSpecOptions) (kgxapi.GetSpecResponse, error)
	GetSpecVersion(context.Context, string) (kgxapi.APISpecVersion, error)
	UploadSpec(context.Context, kgxapi.UploadSpecRequest) (*kgxapi.UploadSpecResponse, error)

	// Resolve names.
	GetAPISpecIDByName(context.Context, string) (akid.APISpecID, error)
	GetLearnSessionIDByName(context.Context, string) (akid.LearnSessionID, error)

	// Spec diff
	GetSpecDiffTrie(context.Context, akid.APISpecID, akid.APISpecID) (*path_trie.PathTrie, error)
}

type Service

type Service struct {
	ID   akid.ServiceID `json:"id"`
	Name string         `json:"name"`
}

Jump to

Keyboard shortcuts

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