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 ¶
ReplaceEnv replaces all environment variable placeholders with the contents from the environment.
Types ¶
type Credential ¶
type Credential string
Credential overrides JSON parsing to translate "$(ENV_VAR_NAME)" into the value of the environment variable.
func (*Credential) UnmarshalJSON ¶
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 ¶
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 ¶
func (s Source) Backend() (SourceBackend, error)
type SourceBackend ¶
type SourceBackstage ¶
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 ¶
func (s SourceBackstage) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceBackstage) String ¶
func (s SourceBackstage) String() string
func (SourceBackstage) Validate ¶
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 ¶
type SourceExec struct {
Command []string `json:"command"`
}
func (SourceExec) Load ¶
func (s SourceExec) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceExec) String ¶
func (s SourceExec) String() string
func (SourceExec) Validate ¶
func (s SourceExec) Validate() error
type SourceGitHub ¶
type SourceGitHub struct { Repos []string `json:"repos"` Files []string `json:"files"` Token Credential `json:"token"` }
func (SourceGitHub) Load ¶
func (s SourceGitHub) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceGitHub) String ¶
func (s SourceGitHub) String() string
func (SourceGitHub) Validate ¶
func (s SourceGitHub) Validate() error
type SourceGraphQL ¶
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 ¶
func (s SourceGraphQL) Load(ctx context.Context, logger kitlog.Logger) ([]*SourceEntry, error)
func (SourceGraphQL) String ¶
func (s SourceGraphQL) String() string
func (SourceGraphQL) Validate ¶
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 ¶
func (s SourceInline) String() string
func (SourceInline) Validate ¶
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 ¶
func (s SourceLocal) String() string
func (SourceLocal) Validate ¶
func (s SourceLocal) Validate() error