header

package
v0.0.0-...-1957489 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	// Name is an object name
	Name string `json:"name" yaml:"name"`
	// Description is object description
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Labels is a set of labels
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	// Expires is a global expiry time header can be set on any resource in the system.
	Expires time.Time `json:"expires" yaml:"expires"`
	// Revision is an opaque identifier which tracks the versions of a resource
	// over time. Clients should ignore and not alter its value but must return
	// the revision in any updates of a resource.
	Revision string `json:"revision,omitempty" yaml:"revision,omitempty"`
}

Metadata is resource metadata

func (*Metadata) CheckAndSetDefaults

func (m *Metadata) CheckAndSetDefaults() error

CheckAndSetDefaults verifies that the metadata object is valid.

func (*Metadata) Expiry

func (m *Metadata) Expiry() time.Time

Expiry returns the object expiry setting.

func (*Metadata) GetAllLabels

func (m *Metadata) GetAllLabels() map[string]string

GetAllLabels returns all labels from the resource.

func (*Metadata) GetLabel

func (m *Metadata) GetLabel(key string) (string, bool)

GetLabel retrieves the label with the provided key. If not found value will be empty and ok will be false.

func (*Metadata) GetName

func (m *Metadata) GetName() string

GetName returns the name of the resource.

func (*Metadata) GetRevision

func (m *Metadata) GetRevision() string

GetRevision returns the revision

func (*Metadata) GetStaticLabels

func (m *Metadata) GetStaticLabels() map[string]string

GetStaticLabels returns the static labels for the metadata.

func (*Metadata) IsEqual

func (m *Metadata) IsEqual(i *Metadata) bool

IsEqual determines if two metadata resources are equivalent to one another.

func (*Metadata) Origin

func (m *Metadata) Origin() string

Origin returns the origin value of the resource.

func (*Metadata) SetExpiry

func (m *Metadata) SetExpiry(expires time.Time)

SetExpiry sets the expiry time for the object.

func (*Metadata) SetName

func (m *Metadata) SetName(name string)

SetName sets the name of the resource.

func (*Metadata) SetOrigin

func (m *Metadata) SetOrigin(origin string)

SetOrigin sets the origin value of the resource.

func (*Metadata) SetRevision

func (m *Metadata) SetRevision(rev string)

SetRevision sets the revision

func (*Metadata) SetStaticLabels

func (m *Metadata) SetStaticLabels(sl map[string]string)

SetStaticLabels sets the static labels for the metadata.

type ResourceHeader

type ResourceHeader struct {
	// Kind is a resource kind.
	Kind string `json:"kind,omitempty"`
	// SubKind is an optional resource sub kind, used in some resources.
	SubKind string `json:"sub_kind,omitempty"`
	// Version is the resource version.
	Version string `json:"version,omitempty"`
	// Metadata is metadata for the resource.
	Metadata Metadata `json:"metadata,omitempty"`
}

ResourceHeader is a common header for Teleport resources.

func ResourceHeaderFromMetadata

func ResourceHeaderFromMetadata(metadata Metadata) ResourceHeader

func (*ResourceHeader) CheckAndSetDefaults

func (h *ResourceHeader) CheckAndSetDefaults() error

CheckAndSetDefaults will verify that the resource header is valid. This will additionally verify that the metadata is valid.

func (*ResourceHeader) Expiry

func (h *ResourceHeader) Expiry() time.Time

Expiry returns the resource expiry setting.

func (*ResourceHeader) GetAllLabels

func (h *ResourceHeader) GetAllLabels() map[string]string

GetAllLabels returns all labels from the resource.

func (*ResourceHeader) GetKind

func (h *ResourceHeader) GetKind() string

GetKind returns the resource kind.

func (*ResourceHeader) GetLabel

func (h *ResourceHeader) GetLabel(key string) (string, bool)

GetLabel retrieves the label with the provided key. If not found value will be empty and ok will be false.

func (*ResourceHeader) GetMetadata

func (h *ResourceHeader) GetMetadata() Metadata

GetMetadata returns object metadata.

func (*ResourceHeader) GetName

func (h *ResourceHeader) GetName() string

GetName returns the name of the resource.

func (*ResourceHeader) GetRevision

func (h *ResourceHeader) GetRevision() string

GetRevision returns the revision.

func (*ResourceHeader) GetStaticLabels

func (h *ResourceHeader) GetStaticLabels() map[string]string

GetStaticLabels returns the static labels for the resource.

func (*ResourceHeader) GetSubKind

func (h *ResourceHeader) GetSubKind() string

GetSubKind returns the resource subkind.

func (*ResourceHeader) GetVersion

func (h *ResourceHeader) GetVersion() string

GetVersion returns the resource version.

func (*ResourceHeader) IsEqual

func (h *ResourceHeader) IsEqual(i *ResourceHeader) bool

IsEqual determines if two resource headers are equivalent to one another.

func (*ResourceHeader) Origin

func (h *ResourceHeader) Origin() string

Origin returns the origin value of the resource.

func (*ResourceHeader) SetExpiry

func (h *ResourceHeader) SetExpiry(t time.Time)

SetExpiry sets the resource expiry.

func (*ResourceHeader) SetKind

func (h *ResourceHeader) SetKind(kind string)

SetKind sets the resource kind.

func (*ResourceHeader) SetName

func (h *ResourceHeader) SetName(v string)

SetName sets the name of the resource.

func (*ResourceHeader) SetOrigin

func (h *ResourceHeader) SetOrigin(origin string)

SetOrigin sets the origin value of the resource.

func (*ResourceHeader) SetRevision

func (h *ResourceHeader) SetRevision(rev string)

SetRevision sets the revision.

func (*ResourceHeader) SetStaticLabels

func (h *ResourceHeader) SetStaticLabels(sl map[string]string)

SetStaticLabels sets the static labels for the resource.

func (*ResourceHeader) SetSubKind

func (h *ResourceHeader) SetSubKind(s string)

SetSubKind sets the resource subkind.

func (*ResourceHeader) SetVersion

func (h *ResourceHeader) SetVersion(version string)

SetVersion sets the resource version.

Directories

Path Synopsis
convert
v1

Jump to

Keyboard shortcuts

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