resources

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const StatusNotChecked = "not-checked"

StatusNotChecked marks a reference whose value daprd reads from its own process environment (a local.env store or an envRef). The dashboard only sees its own environment, so any resolved/unset/empty verdict would describe the wrong process; the UI shows the reference without a status instead.

Variables

View Source
var ErrNoSecretValue = errors.New("no resolved secret value for field")

ErrNoSecretValue is returned by RevealSecret when the field has no secret reference, or the reference does not resolve to a value.

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"
	KindResiliency    Kind = "resiliency"
)

type Option added in v0.0.19

type Option func(*service)

Option configures the resources Service.

func WithSecrets added in v0.0.19

func WithSecrets(svc secrets.Service) Option

WithSecrets attaches a secret resolver so component resources carry secret reference status. Without it, SecretRefs and SecretStore stay empty.

type ResiliencyComponentTarget added in v0.0.24

type ResiliencyComponentTarget struct {
	Outbound *ResiliencyPolicyRefs `json:"outbound,omitempty"`
	Inbound  *ResiliencyPolicyRefs `json:"inbound,omitempty"`
}

ResiliencyComponentTarget holds a component's per-direction policies.

type ResiliencyPolicies added in v0.0.24

type ResiliencyPolicies struct {
	Timeouts        map[string]string         `json:"timeouts,omitempty"`
	Retries         map[string]map[string]any `json:"retries,omitempty"`
	CircuitBreakers map[string]map[string]any `json:"circuitBreakers,omitempty"`
}

ResiliencyPolicies maps policy names to their definitions.

type ResiliencyPolicyRefs added in v0.0.24

type ResiliencyPolicyRefs struct {
	Timeout                 string `json:"timeout,omitempty"`
	Retry                   string `json:"retry,omitempty"`
	CircuitBreaker          string `json:"circuitBreaker,omitempty"`
	CircuitBreakerScope     string `json:"circuitBreakerScope,omitempty"`
	CircuitBreakerCacheSize int    `json:"circuitBreakerCacheSize,omitempty"`
}

ResiliencyPolicyRefs names the policies applied to one target.

type ResiliencySpec added in v0.0.24

type ResiliencySpec struct {
	Policies ResiliencyPolicies `json:"policies"`
	Targets  ResiliencyTargets  `json:"targets"`
}

ResiliencySpec is the policies and targets of a Dapr Resiliency resource. Retry and circuit-breaker policies are passed through as-is so new Dapr fields reach the UI without a change here.

type ResiliencyTargets added in v0.0.24

type ResiliencyTargets struct {
	Apps       map[string]ResiliencyPolicyRefs      `json:"apps,omitempty"`
	Actors     map[string]ResiliencyPolicyRefs      `json:"actors,omitempty"`
	Components map[string]ResiliencyComponentTarget `json:"components,omitempty"`
}

ResiliencyTargets maps app ids, actor types and component names to the policies applied to them.

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"`
	Scopes   []string `json:"scopes,omitempty"`

	// Resiliency is the parsed spec of a Resiliency resource; nil for other kinds.
	Resiliency *ResiliencySpec `json:"resiliency,omitempty"`

	SecretRefs  []SecretRefStatus `json:"secretRefs,omitempty"`
	SecretStore *SecretStoreInfo  `json:"secretStore,omitempty"`
	// contains filtered or unexported fields
}

Resource describes a single Dapr component, configuration or resiliency resource parsed from a 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 SecretRefStatus added in v0.0.19

type SecretRefStatus struct {
	Field  string `json:"field"`
	Kind   string `json:"kind"`
	Store  string `json:"store,omitempty"`
	Name   string `json:"name,omitempty"`
	Key    string `json:"key,omitempty"`
	Status string `json:"status"`
	Detail string `json:"detail,omitempty"`
}

SecretRefStatus is one component metadata field that draws its value from a secret reference, with the outcome of resolving it. It never carries the value itself — see the reveal endpoint in pkg/server.

type SecretStoreInfo added in v0.0.19

type SecretStoreInfo struct {
	Name            string   `json:"name"`
	Type            string   `json:"type"`
	File            string   `json:"file,omitempty"`
	Prefix          string   `json:"prefix,omitempty"`
	NestedSeparator string   `json:"nestedSeparator,omitempty"`
	MultiValued     bool     `json:"multiValued,omitempty"`
	Keys            []string `json:"keys,omitempty"`
	KeysCapped      bool     `json:"keysCapped,omitempty"`
	InitErr         string   `json:"initErr,omitempty"`
	UsedBy          []string `json:"usedBy,omitempty"`
}

SecretStoreInfo describes a local secret-store component for its detail pane. Keys are names only.

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)
	// RevealSecret returns the resolved value of a single secret reference on
	// a component. It is the only path by which secret material leaves this
	// package.
	RevealSecret(ctx context.Context, idOrName, field string) (string, error)
}

Service is the interface for listing and fetching Dapr resources.

func New

func New(paths func() []string, extras func() []Resource, opts ...Option) 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