resources

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("resource not found")

ErrNotFound is returned by Get when no matching resource exists.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind identifies the Dapr resource type.

const (
	KindComponent     Kind = "component"
	KindConfiguration Kind = "configuration"
)

type Resource

type Resource struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Kind     Kind     `json:"kind"`
	Type     string   `json:"type,omitempty"`
	Version  string   `json:"version,omitempty"`
	Path     string   `json:"path"`
	Raw      string   `json:"raw,omitempty"`
	LoadedBy []string `json:"loadedBy,omitempty"`
}

Resource describes a single Dapr component or configuration YAML file.

func FromRaw added in v0.0.10

func FromRaw(displayPath string, content []byte) []Resource

FromRaw parses multi-document YAML content into fully-populated Resources carrying Raw. displayPath is the entry's Path verbatim (for container sources use "<containerName>:<inContainerPath>") and feeds the ID hash, so same-named components from different containers stay distinct. Unparseable documents and unknown kinds are skipped.

type Service

type Service interface {
	List(ctx context.Context, kind Kind) ([]Resource, error)
	// Get resolves idOrName as a resource ID first, then as a metadata name
	// (first match) so pre-ID deep links keep working.
	Get(ctx context.Context, kind Kind, idOrName string) (Resource, error)
}

Service is the interface for listing and fetching Dapr resources.

func New

func New(paths func() []string, extras func() []Resource) Service

New returns a Service that scans the paths returned by the provider for Dapr resource YAMLs, merged with the extras provider's entries (resources that exist outside the host filesystem, e.g. extracted from containers). Either provider may be nil. Both are called on every List/Get so callers can change sources at runtime.

Jump to

Keyboard shortcuts

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