manifest

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 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

This section is empty.

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 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 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       string `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