manifest

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MPL-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package manifest provides

Index

Constants

View Source
const StringInterpolationPlaceholder = "{}"

StringInterpolationPlaceholder common symbol to use in strings for interpolation e.g. "My amazing {} Service"

Variables

View Source
var ErrInvalidKind = fmt.Errorf("not a valid Kind, try [%s]", strings.Join(_KindNames, ", "))

Functions

func EnhanceError

func EnhanceError(o ObjectGeneric, err error) error

EnhanceError annotates error with path of manifest source, if it exists if not returns the same error as passed as argument

func KindNames added in v0.20.0

func KindNames() []string

KindNames returns a list of possible string values of Kind.

func StringInterpolation

func StringInterpolation(withPlaceholder, replacer string) string

StringInterpolation for arguments ("{}-my-{}-string-{}", "xd") returns string xd-my-xd-string-xd

func UnsupportedAPIVersionErr

func UnsupportedAPIVersionErr(o ObjectGeneric) error

UnsupportedAPIVersionErr returns appropriate error for missing value in field apiVersion for not empty field apiVersion returns always that this version is not supported so have to be validated before

func UnsupportedKindErr

func UnsupportedKindErr(o ObjectGeneric) error

UnsupportedKindErr returns appropriate error for missing value in field kind for not empty field kind returns always that is not supported for this apiVersion so have to be validated before

Types

type AlertSilenceMetadata

type AlertSilenceMetadata struct {
	Name    string `json:"name" validate:"required,objectName" example:"name"`
	Project string `json:"project,omitempty" validate:"objectName" example:"default"`
}

AlertSilenceMetadata defines only basic metadata fields - name and project which uniquely identifies object on project level.

type Kind added in v0.20.0

type Kind int

Kind represents all the object kinds available in the API to perform operations on.

ENUM(

SLO = 1 Service Agent AlertPolicy AlertSilence Alert Project AlertMethod Direct DataExport RoleBinding Annotation UserGroup )

const (
	// KindSLO is a Kind of type SLO.
	KindSLO Kind = iota + 1
	// KindService is a Kind of type Service.
	KindService
	// KindAgent is a Kind of type Agent.
	KindAgent
	// KindAlertPolicy is a Kind of type AlertPolicy.
	KindAlertPolicy
	// KindAlertSilence is a Kind of type AlertSilence.
	KindAlertSilence
	// KindAlert is a Kind of type Alert.
	KindAlert
	// KindProject is a Kind of type Project.
	KindProject
	// KindAlertMethod is a Kind of type AlertMethod.
	KindAlertMethod
	// KindDirect is a Kind of type Direct.
	KindDirect
	// KindDataExport is a Kind of type DataExport.
	KindDataExport
	// KindRoleBinding is a Kind of type RoleBinding.
	KindRoleBinding
	// KindAnnotation is a Kind of type Annotation.
	KindAnnotation
	// KindUserGroup is a Kind of type UserGroup.
	KindUserGroup
)

func ApplicableKinds added in v0.20.0

func ApplicableKinds() []Kind

ApplicableKinds returns all the Kind instances which can be applied or deleted by the user.

func KindValues added in v0.20.0

func KindValues() []Kind

KindValues returns a list of the values for Kind

func ParseKind added in v0.20.0

func ParseKind(name string) (Kind, error)

ParseKind attempts to convert a string to a Kind.

func (Kind) Applicable added in v0.20.0

func (k Kind) Applicable() bool

Applicable returns true if the Kind can be applied or deleted by the user. In other words, it informs whether the Kind's lifecycle is managed by the user.

func (Kind) Equals added in v0.20.0

func (k Kind) Equals(s string) bool

Equals returns true if the Kind is equal to the given string. The comparison is case-insensitive.

func (Kind) IsValid added in v0.20.0

func (x Kind) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Kind) MarshalText added in v0.20.0

func (k Kind) MarshalText() ([]byte, error)

MarshalText implements the text encoding.TextMarshaler interface.

func (Kind) String added in v0.20.0

func (x Kind) String() string

String implements the Stringer interface.

func (Kind) ToLower added in v0.20.0

func (k Kind) ToLower() string

ToLower converts the Kind to a lower case string.

func (*Kind) UnmarshalText added in v0.20.0

func (k *Kind) UnmarshalText(text []byte) error

UnmarshalText implements the text encoding.TextUnmarshaler interface.

type LabelKey

type LabelKey = string

type LabelValue

type LabelValue = string

type Labels

type Labels map[LabelKey][]LabelValue

type Metadata

type Metadata struct {
	Name        string `json:"name" validate:"required,objectName" example:"name"`
	DisplayName string `json:"displayName,omitempty" validate:"omitempty,min=0,max=63" example:"Prometheus Source"`
	Project     string `json:"project,omitempty" validate:"objectName" example:"default"`
	Labels      Labels `json:"labels,omitempty" validate:"omitempty,labels"`
}

Metadata represents part of object which is common for all available Objects, for internal usage

func (Metadata) FullName

func (m Metadata) FullName() string

FullName returns full name of an object as `{name}.{project}`

type MetadataHolder

type MetadataHolder struct {
	Metadata Metadata `json:"metadata"`
}

MetadataHolder is an intermediate structure that can provides metadata related field to other structures

type ObjectGeneric

type ObjectGeneric struct {
	ObjectHeader
	Spec json.RawMessage `json:"spec"`
}

ObjectGeneric represents struct to which every Object is parsable Specific types of Object have different structures as Spec

func JSONToGenericObjects

func JSONToGenericObjects(jsonPayload []byte) ([]ObjectGeneric, error)

JSONToGenericObjects parse JSON Array of Objects into generic objects

type ObjectHeader

type ObjectHeader struct {
	APIVersion string `json:"apiVersion" validate:"required" example:"n9/v1alpha"`
	Kind       Kind   `json:"kind" validate:"required" example:"kind"`
	MetadataHolder
	ObjectInternal
}

ObjectHeader represents Header which is common for all available Objects

type ObjectInternal

type ObjectInternal struct {
	Organization string `json:"organization,omitempty" example:"nobl9-dev"`
	ManifestSrc  string `json:",omitempty" example:"x.yml"`
	OktaClientID string `json:"-"` // used only by kind Agent
}

ObjectInternal represents part of object which is only for internal usage, not exposed to the client, for internal usage

type ProjectMetadata

type ProjectMetadata struct {
	Name        string `json:"name" validate:"required,objectName" example:"name"`
	DisplayName string `json:"displayName,omitempty" validate:"omitempty,min=0,max=63" example:"Shopping App"`
	Labels      Labels `json:"labels,omitempty" validate:"omitempty,labels"`
}

type RoleBindingMetadata

type RoleBindingMetadata struct {
	Name string `json:"name" validate:"required,objectName" example:"name"`
}

Directories

Path Synopsis
Package v1alpha represents objects available in API n9/v1alpha
Package v1alpha represents objects available in API n9/v1alpha
twindow
Package twindow provides enums and functions to operate with resources related to Time Windows
Package twindow provides enums and functions to operate with resources related to Time Windows

Jump to

Keyboard shortcuts

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