Documentation
¶
Index ¶
- func GetReflectNextElem(v reflect.Value) reflect.Value
- func ValidateDescription(description string) error
- func ValidateID(name string) error
- type Display
- type Duration
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d *Duration) MarshalText() ([]byte, error)
- func (d Duration) MarshalYAML() (any, error)
- func (d *Duration) Set(s string) error
- func (d Duration) String() string
- func (d *Duration) Type() string
- func (d *Duration) UnmarshalJSON(bytes []byte) error
- func (d *Duration) UnmarshalText(text []byte) error
- func (d *Duration) UnmarshalYAML(unmarshal func(any) error) error
- type DurationString
- type JSONRef
- type Plugin
- type PluginMetadata
- type Regexp
- type URL
- func (u *URL) IsNilOrEmpty() bool
- func (u URL) MarshalJSON() ([]byte, error)
- func (u *URL) MarshalText() ([]byte, error)
- func (u URL) MarshalYAML() (any, error)
- func (u *URL) String() string
- func (u *URL) UnmarshalJSON(data []byte) error
- func (u *URL) UnmarshalText(text []byte) error
- func (u *URL) UnmarshalYAML(unmarshal func(any) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateDescription ¶ added in v0.52.0
ValidateDescription checks for forbidden items in substring used inside description DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.ValidateDescription
func ValidateID ¶ added in v0.12.0
ValidateID checks for forbidden items in substring used inside id DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.ValidateID
Types ¶
type Display ¶ added in v0.11.0
type Display struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
Display DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.Display
type Duration ¶ added in v0.50.0
Duration wraps time.Duration. It is used to parse the custom duration format from YAML. This type should not propagate beyond the scope of input/output processing. +kubebuilder:validation:Type=string +kubebuilder:validation:Format=duration +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$`
DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.Duration
func ParseDuration ¶ added in v0.50.0
ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h. DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.ParseDuration
func (Duration) MarshalJSON ¶ added in v0.50.0
MarshalJSON implements the json.Marshaler interface.
func (*Duration) MarshalText ¶ added in v0.50.0
MarshalText implements the encoding.TextMarshaler interface.
func (Duration) MarshalYAML ¶ added in v0.50.0
MarshalYAML implements the yaml.Marshaler interface.
func (*Duration) UnmarshalJSON ¶ added in v0.50.0
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Duration) UnmarshalText ¶ added in v0.50.0
UnmarshalText implements the encoding.TextUnmarshaler interface.
type DurationString ¶ added in v0.53.0
type DurationString string
DurationString is a string that represents a duration, such as "1h", "30m", "15s", etc. It is used to unmarshal a duration string from JSON or YAML, and validate that it is a valid duration string.
Not converting the duration string into a time.Duration type allows us to avoid the issue of changing the initial input with an alias. This is something that happens when we use Duration type, because when the duration is unmarshalled then marshaled again, the input can be changed with an equivalent duration. For example "14d" will be changed to "2w".
So, use DurationString instead of Duration when you want to preserve the original input string. If, for any reason, you need to convert the DurationString to a time.Duration, you can use the ParseDuration function.
+kubebuilder:validation:Type=string +kubebuilder:validation:Format=duration +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$`
DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.DurationString
func (*DurationString) UnmarshalJSON ¶ added in v0.53.0
func (d *DurationString) UnmarshalJSON(bytes []byte) error
func (*DurationString) UnmarshalYAML ¶ added in v0.53.0
func (d *DurationString) UnmarshalYAML(unmarshal func(any) error) error
type JSONRef ¶
type JSONRef struct {
// Ref is the JSON reference.
// That's the only thing used during the marshalling / unmarshalling process.
// Other attributes are ignored during these processes.
Ref string `json:"$ref" yaml:"$ref"`
// Path is a list of string that will be used to find from the root of the struct the object pointed.
Path []string `json:"-" yaml:"-"`
// Object will contain the pointer to the actual object referenced by Ref
Object any `json:"-" yaml:"-"`
}
JSONRef DEPRECATED: this is replaced by the struct github.com/perses/spec/go/common.JSONRef
func (*JSONRef) UnmarshalJSON ¶
type Plugin ¶ added in v0.11.0
type Plugin struct {
// Kind is the type of the plugin (e.g., Panel, Variable, Datasource, etc.).
Kind string `json:"kind" yaml:"kind"`
// Metadata is an optional field that contains additional information such as version and registry of the plugin.
Metadata *PluginMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Spec any `json:"spec" yaml:"spec"`
}
Plugin DEPRECATED: this is replaced by the struct github.com/perses/spec/go/plugin/plugin.Plugin
func (Plugin) JSONMarshal ¶ added in v0.11.0
func (*Plugin) UnmarshalJSON ¶ added in v0.11.0
type PluginMetadata ¶ added in v0.53.0
type PluginMetadata struct {
// Version is optional. If not provided, it means the latest version available in the Perses instance.
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// Registry is optional. If not provided, it means the default registry: "perses.dev".
Registry string `json:"registry,omitempty" yaml:"registry,omitempty"`
}
PluginMetadata DEPRECATED: this is replaced by the struct github.com/perses/spec/go/plugin/plugin.Metadata
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it JSON/YAML marshalable. DEPRECATED Use github.com/perses/spec/go/common.Regexp instead
func MustNewRegexp ¶
MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile. DEPRECATED Use github.com/perses/spec/go/common.Regexp instead
func NewRegexp ¶
NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile. DEPRECATED Use github.com/perses/spec/go/common.Regexp instead
func (Regexp) MarshalJSON ¶
func (Regexp) MarshalYAML ¶
func (*Regexp) UnmarshalJSON ¶
type URL ¶ added in v0.43.0
DEPRECATED Use github.com/perses/spec/go/common.URL instead +kubebuilder:validation:Schemaless +kubebuilder:validation:Type=string +kubebuilder:validation:Format=uri
func MustParseURL ¶ added in v0.45.0
DEPRECATED Use github.com/perses/spec/go/common.MustParseURL instead
func (*URL) IsNilOrEmpty ¶ added in v0.43.0
func (URL) MarshalJSON ¶ added in v0.43.0
MarshalJSON implements the json.Marshaler interface for URL.
func (*URL) MarshalText ¶ added in v0.43.0
MarshalText implements the encoding.TextMarshaler interface.
func (URL) MarshalYAML ¶ added in v0.43.0
MarshalYAML implements the yaml.Marshaler interface for URLs.
func (*URL) UnmarshalJSON ¶ added in v0.43.0
UnmarshalJSON implements the json.Marshaler interface for URL.
func (*URL) UnmarshalText ¶ added in v0.43.0
UnmarshalText implements the encoding.TextUnmarshaler interface.