storagepb

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package storagepb provides storage protobuf client and server interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdRequired = errors.New("Id is required")
)
View Source
var (
	ErrProfileRequired = errors.New("Group requires a Profile")
)

Functions

This section is empty.

Types

type ByReqs

type ByReqs []*Group

ByReqs defines a collection of Group structs which have a deterministic sorted order by increasing number of Requirements, then by sorted key/value strings. For example, a Group with Requirements {a:b, c:d} should be ordered after one with {a:b} and before one with {a:d, c:d}.

func (ByReqs) Len

func (groups ByReqs) Len() int

func (ByReqs) Less

func (groups ByReqs) Less(i, j int) bool

func (ByReqs) Swap

func (groups ByReqs) Swap(i, j int)

type Group

type Group struct {
	// machine readable Id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// human readable name
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// Profile id
	Profile string `protobuf:"bytes,3,opt,name=profile,proto3" json:"profile,omitempty"`
	// Selectors to match machines
	Selector map[string]string `` /* 157-byte string literal not displayed */
	// JSON encoded metadata
	Metadata             []byte   `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Group selects one or more machines and matches them to a Profile.

func ParseGroup

func ParseGroup(data []byte) (*Group, error)

ParseGroup parses bytes into a Group.

func (*Group) AssertValid

func (g *Group) AssertValid() error

AssertValid validates a Group. Returns nil if there are no validation errors.

func (*Group) Copy

func (g *Group) Copy() *Group

func (*Group) Descriptor

func (*Group) Descriptor() ([]byte, []int)

func (*Group) GetId

func (m *Group) GetId() string

func (*Group) GetMetadata

func (m *Group) GetMetadata() []byte

func (*Group) GetName

func (m *Group) GetName() string

func (*Group) GetProfile

func (m *Group) GetProfile() string

func (*Group) GetSelector

func (m *Group) GetSelector() map[string]string

func (*Group) Matches

func (g *Group) Matches(labels map[string]string) bool

Matches returns true if the given labels satisfy all the selector requirements, false otherwise.

func (*Group) Normalize

func (g *Group) Normalize() error

Normalize normalizes Group selectors according to reserved selector rules which require "mac" addresses to be valid, normalized MAC addresses.

func (*Group) ProtoMessage

func (*Group) ProtoMessage()

func (*Group) Reset

func (m *Group) Reset()

func (*Group) String

func (m *Group) String() string

func (*Group) ToRichGroup

func (g *Group) ToRichGroup() (*RichGroup, error)

ToRichGroup converts a Group into a RichGroup suitable for writing and user manipulation.

func (*Group) XXX_DiscardUnknown added in v0.9.0

func (m *Group) XXX_DiscardUnknown()

func (*Group) XXX_Marshal added in v0.9.0

func (m *Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Group) XXX_Merge added in v0.9.0

func (m *Group) XXX_Merge(src proto.Message)

func (*Group) XXX_Size added in v0.9.0

func (m *Group) XXX_Size() int

func (*Group) XXX_Unmarshal added in v0.9.0

func (m *Group) XXX_Unmarshal(b []byte) error

type NetBoot

type NetBoot struct {
	// the URL of the kernel image
	Kernel string `protobuf:"bytes,1,opt,name=kernel,proto3" json:"kernel,omitempty"`
	// the init RAM filesystem URLs
	Initrd []string `protobuf:"bytes,2,rep,name=initrd,proto3" json:"initrd,omitempty"`
	// kernel args
	Args                 []string `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

NetBoot describes network or PXE boot settings for a machine.

func (*NetBoot) Copy

func (b *NetBoot) Copy() *NetBoot

func (*NetBoot) Descriptor

func (*NetBoot) Descriptor() ([]byte, []int)

func (*NetBoot) GetArgs

func (m *NetBoot) GetArgs() []string

func (*NetBoot) GetInitrd

func (m *NetBoot) GetInitrd() []string

func (*NetBoot) GetKernel

func (m *NetBoot) GetKernel() string

func (*NetBoot) ProtoMessage

func (*NetBoot) ProtoMessage()

func (*NetBoot) Reset

func (m *NetBoot) Reset()

func (*NetBoot) String

func (m *NetBoot) String() string

func (*NetBoot) XXX_DiscardUnknown added in v0.9.0

func (m *NetBoot) XXX_DiscardUnknown()

func (*NetBoot) XXX_Marshal added in v0.9.0

func (m *NetBoot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NetBoot) XXX_Merge added in v0.9.0

func (m *NetBoot) XXX_Merge(src proto.Message)

func (*NetBoot) XXX_Size added in v0.9.0

func (m *NetBoot) XXX_Size() int

func (*NetBoot) XXX_Unmarshal added in v0.9.0

func (m *NetBoot) XXX_Unmarshal(b []byte) error

type Profile

type Profile struct {
	// profile id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// human readable name
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// ignition id
	IgnitionId string `protobuf:"bytes,3,opt,name=ignition_id,json=ignitionId,proto3" json:"ignition_id,omitempty"`
	// cloud config id
	CloudId string `protobuf:"bytes,4,opt,name=cloud_id,json=cloudId,proto3" json:"cloud_id,omitempty"`
	// support network boot / PXE
	Boot *NetBoot `protobuf:"bytes,5,opt,name=boot,proto3" json:"boot,omitempty"`
	// generic config id
	GenericId            string   `protobuf:"bytes,6,opt,name=generic_id,json=genericId,proto3" json:"generic_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Profile defines the boot and provisioning behavior of a group of machines.

func ParseProfile

func ParseProfile(data []byte) (*Profile, error)

ParseProfile parses bytes into a Profile.

func (*Profile) AssertValid

func (p *Profile) AssertValid() error

AssertValid validates a Profile. Returns nil if there are no validation errors.

func (*Profile) Copy

func (p *Profile) Copy() *Profile

func (*Profile) Descriptor

func (*Profile) Descriptor() ([]byte, []int)

func (*Profile) GetBoot

func (m *Profile) GetBoot() *NetBoot

func (*Profile) GetCloudId

func (m *Profile) GetCloudId() string

func (*Profile) GetGenericId

func (m *Profile) GetGenericId() string

func (*Profile) GetId

func (m *Profile) GetId() string

func (*Profile) GetIgnitionId

func (m *Profile) GetIgnitionId() string

func (*Profile) GetName

func (m *Profile) GetName() string

func (*Profile) ProtoMessage

func (*Profile) ProtoMessage()

func (*Profile) Reset

func (m *Profile) Reset()

func (*Profile) String

func (m *Profile) String() string

func (*Profile) XXX_DiscardUnknown added in v0.9.0

func (m *Profile) XXX_DiscardUnknown()

func (*Profile) XXX_Marshal added in v0.9.0

func (m *Profile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Profile) XXX_Merge added in v0.9.0

func (m *Profile) XXX_Merge(src proto.Message)

func (*Profile) XXX_Size added in v0.9.0

func (m *Profile) XXX_Size() int

func (*Profile) XXX_Unmarshal added in v0.9.0

func (m *Profile) XXX_Unmarshal(b []byte) error

type RichGroup

type RichGroup struct {
	// machine readable Id
	Id string `json:"id,omitempty"`
	// Human readable name
	Name string `json:"name,omitempty"`
	// Profile id
	Profile string `json:"profile,omitempty"`
	// Selectors to match machines
	Selector map[string]string `json:"selector,omitempty"`
	// Metadata
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

RichGroup is a user provided Group definition.

func (*RichGroup) ToGroup

func (rg *RichGroup) ToGroup() (*Group, error)

ToGroup converts a user provided RichGroup into a Group which can be serialized as a protocol buffer.

Jump to

Keyboard shortcuts

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