Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSourceEmpty = fmt.Errorf("invalid source, must specify at least one type of source configuration")
Functions ¶
func ReplaceEnv ¶ added in v0.22.0
ReplaceEnv replaces all environment variable placeholders with the contents from the environment.
Types ¶
type Credential ¶ added in v0.22.0
type Credential string
Credential overrides JSON parsing to translate "$(ENV_VAR_NAME)" into the value of the environment variable.
func (*Credential) UnmarshalJSON ¶ added in v0.22.0
func (s *Credential) UnmarshalJSON(data []byte) error
type Entry ¶
Entry is a single sourced entry. It's just a basic map, but makes it much clearer when building lists of this type, as the type syntax can get a bit messy.
func Parse ¶ added in v0.9.0
Parse attempts to extract entries from content that is either Jsonnet, JSON or YAML.
It also supports multidoc YAML, and will either return the root object itself if that root is a map[string]any, or if the root is an array, will try returning the contents of said array that are map[string]any's.
type Source ¶
type Source struct { Local *SourceLocal `json:"local,omitempty"` Inline *SourceInline `json:"inline,omitempty"` Exec *SourceExec `json:"exec,omitempty"` Backstage *SourceBackstage `json:"backstage,omitempty"` GitHub *SourceGitHub `json:"github,omitempty"` GraphQL *SourceGraphQL `json:"graphql,omitempty"` }
Source is instantiated from configuration and represents a source of catalog files.
func (Source) Backend ¶ added in v0.15.0
func (s Source) Backend() (SourceBackend, error)
type SourceBackend ¶ added in v0.15.0
type SourceBackstage ¶ added in v0.22.0
type SourceBackstage struct { Endpoint string `json:"endpoint"` // https://backstage.company.io/api/catalog/entities Token Credential `json:"token"` SignJWT *bool `json:"sign_jwt"` }
func (SourceBackstage) Load ¶ added in v0.22.0
func (s SourceBackstage) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceBackstage) String ¶ added in v0.22.0
func (s SourceBackstage) String() string
func (SourceBackstage) Validate ¶ added in v0.22.0
func (s SourceBackstage) Validate() error
type SourceEntry ¶
type SourceEntry struct { Origin string // the source origin e.g. inline Filename string // the filename that it should be evaluated under e.g. app/main.jsonnet Content []byte // the content of the source }
SourceEntry is an entry that has been discovered in a source, with the contents of the source file and an Origin that explains where the entry came from, specific to the type of source that produced it.
func (SourceEntry) Parse ¶
func (e SourceEntry) Parse() ([]Entry, error)
type SourceExec ¶ added in v0.9.0
type SourceExec struct {
Command []string `json:"command"`
}
func (SourceExec) Load ¶ added in v0.9.0
func (s SourceExec) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceExec) String ¶ added in v0.15.0
func (s SourceExec) String() string
func (SourceExec) Validate ¶ added in v0.9.0
func (s SourceExec) Validate() error
type SourceGitHub ¶ added in v0.22.0
type SourceGitHub struct { Repos []string `json:"repos"` Files []string `json:"files"` Token Credential `json:"token"` }
func (SourceGitHub) Load ¶ added in v0.22.0
func (s SourceGitHub) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceGitHub) String ¶ added in v0.22.0
func (s SourceGitHub) String() string
func (SourceGitHub) Validate ¶ added in v0.22.0
func (s SourceGitHub) Validate() error
type SourceGraphQL ¶ added in v1.1.0
type SourceGraphQL struct { Endpoint Credential `json:"endpoint"` // https://api.github.com/graphql Headers map[string]Credential `json:"headers"` Query string `json:"query"` Result null.String `json:"result"` Paginate struct { NextCursor null.String `json:"next_cursor"` } `json:"paginate,omitempty"` }
func (SourceGraphQL) Load ¶ added in v1.1.0
func (s SourceGraphQL) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceGraphQL) String ¶ added in v1.1.0
func (s SourceGraphQL) String() string
func (SourceGraphQL) Validate ¶ added in v1.1.0
func (s SourceGraphQL) Validate() error
type SourceInline ¶
func (SourceInline) Load ¶
func (s SourceInline) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceInline) String ¶ added in v0.15.0
func (s SourceInline) String() string
func (SourceInline) Validate ¶ added in v0.12.0
func (s SourceInline) Validate() error
type SourceLocal ¶
type SourceLocal struct {
Files []string `json:"files"`
}
func (SourceLocal) Load ¶
func (s SourceLocal) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceLocal) String ¶ added in v0.15.0
func (s SourceLocal) String() string
func (SourceLocal) Validate ¶ added in v0.12.0
func (s SourceLocal) Validate() error