inventory

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

Index

Constants

View Source
const (
	// Define constants for lifecyle states
	HardwareStatusEmpty          = HardwareStatus("empty")
	HardwareStatusStaged         = HardwareStatus("staged")
	HardwareStatusProvisioned    = HardwareStatus("provisioned")
	HardwareStatusDecommissioned = HardwareStatus("decommissioned")
	// Schema and proivider names are constant
	SchemaVersionV1Alpha1 = SchemaVersion("v1alpha1")
	CSMProvider           = Provider("csm")
)

Variables

View Source
var ErrDatastoreValidationFailure = errors.New("datastore validation failure")
View Source
var ErrEmptyLocationPath = errors.New("empty location path provided")
View Source
var ErrHardwareMissingLocationOrdinal = errors.New("hardware missing location ordinal")
View Source
var ErrHardwareNotFound = errors.New("hardware not found")
View Source
var ErrHardwareParentNotFound = errors.New("hardware parent not found")
View Source
var ErrHardwareUUIDConflict = errors.New("hardware uuid already exists")

Functions

func CompareHardwareByTypeThenLocation

func CompareHardwareByTypeThenLocation(hw1 *Hardware, hw2 *Hardware) bool

CompareHardwareByTypeThenLocation returns true if hw1 should sort before h2 otherwise it returns false

func CompareLocationPath

func CompareLocationPath(location1 LocationPath, location2 LocationPath) bool

CompareLocationPath returns true if location1 should sort before location2 otherwise it returns false

Types

type Datastore

type Datastore interface {
	GetSchemaVersion() (SchemaVersion, error)
	SetInventoryProvider(provider Provider) error
	InventoryProvider() (Provider, error)
	Flush() error
	Validate() (map[uuid.UUID]ValidateResult, error)

	// Crud operations
	Add(hardware *Hardware) error
	Get(uuid.UUID) (Hardware, error)
	Update(hardware *Hardware) error
	Remove(uuid uuid.UUID, recursion bool) error
	List() (Inventory, error)

	// Graph functions
	GetLocation(hardware Hardware) (LocationPath, error)
	GetAtLocation(path LocationPath) (Hardware, error)
	GetChildren(id uuid.UUID) ([]Hardware, error)
	GetDescendants(id uuid.UUID) ([]Hardware, error)
	GetSystemZero() (Hardware, error)              // TODO replace this when multiple systems are supported
	GetSystem(hardware Hardware) (Hardware, error) // Not yet implemented until multiple systems are supported

	// TODO for search properties
	Search(filter SearchFilter) (map[uuid.UUID]Hardware, error)

	// Clone creates a in-memory version of the datastore to perform location operations
	Clone() (Datastore, error)

	// Merge the contents of the remote datastore (most likely a in-memory one with changes)
	Merge(Datastore) error
}

func NewDatastoreJSON

func NewDatastoreJSON(dataFilePath string, logfilepath string, provider Provider) (Datastore, error)

func NewDatastoreJSONCSM added in v0.4.0

func NewDatastoreJSONCSM(dataFilePath string, logfilepath string, provider Provider) (Datastore, error)

type DatastoreJSON

type DatastoreJSON struct {
	// contains filtered or unexported fields
}

func NewDatastoreJSONInMemory added in v0.4.0

func NewDatastoreJSONInMemory(provider Provider) (*DatastoreJSON, error)

func (*DatastoreJSON) Add

func (ds *DatastoreJSON) Add(hardware *Hardware) error

Add adds a new hardware object to the inventory

func (*DatastoreJSON) Clone

func (ds *DatastoreJSON) Clone() (Datastore, error)

func (*DatastoreJSON) Flush

func (ds *DatastoreJSON) Flush() error

Flush writes the current inventory to the datastore

func (*DatastoreJSON) Get

func (ds *DatastoreJSON) Get(id uuid.UUID) (Hardware, error)

Get returns a hardware object from the inventory

func (*DatastoreJSON) GetAtLocation

func (ds *DatastoreJSON) GetAtLocation(path LocationPath) (Hardware, error)

GetAtLocation returns the hardware at the given location TODO THIS NEEDS UNIT TESTS

func (*DatastoreJSON) GetChildren

func (ds *DatastoreJSON) GetChildren(id uuid.UUID) ([]Hardware, error)

GetChildren returns the children of a given hardware object

func (*DatastoreJSON) GetDescendants added in v0.2.0

func (ds *DatastoreJSON) GetDescendants(id uuid.UUID) ([]Hardware, error)

func (*DatastoreJSON) GetLocation

func (ds *DatastoreJSON) GetLocation(hardware Hardware) (LocationPath, error)

GetLocation will follow the parent links up to the root node, which is signaled when a NIL parent UUID is found This will either return a partial location path, or a full path up to a cabinet or CDU TODO THIS NEEDS UNIT TESTS

func (*DatastoreJSON) GetSchemaVersion

func (ds *DatastoreJSON) GetSchemaVersion() (SchemaVersion, error)

func (*DatastoreJSON) GetSystem

func (ds *DatastoreJSON) GetSystem(hardware Hardware) (Hardware, error)

GetSystem returns the system that the given hardware object is a part of

func (*DatastoreJSON) GetSystemZero

func (ds *DatastoreJSON) GetSystemZero() (Hardware, error)

GetSystemZero assumes one system exists and returns it

func (*DatastoreJSON) InventoryProvider

func (ds *DatastoreJSON) InventoryProvider() (Provider, error)

GetExternalInventoryProvider gets the external inventory provider

func (*DatastoreJSON) List

func (ds *DatastoreJSON) List() (Inventory, error)

List returns the entire inventory

func (*DatastoreJSON) Merge

func (ds *DatastoreJSON) Merge(other Datastore) error

func (*DatastoreJSON) Remove

func (ds *DatastoreJSON) Remove(id uuid.UUID, recursion bool) error

Remove removes a hardware object from the inventory

func (*DatastoreJSON) Search added in v0.3.0

func (ds *DatastoreJSON) Search(filter SearchFilter) (map[uuid.UUID]Hardware, error)

func (*DatastoreJSON) SetInventoryProvider

func (ds *DatastoreJSON) SetInventoryProvider(provider Provider) error

SetExternalInventoryProvider sets the external inventory provider

func (*DatastoreJSON) Update

func (ds *DatastoreJSON) Update(hardware *Hardware) error

Update updates a hardware object in the inventory

func (*DatastoreJSON) Validate

func (ds *DatastoreJSON) Validate() (map[uuid.UUID]ValidateResult, error)

Validate validates the current inventory

type DatastoreJSONCSM added in v0.4.0

type DatastoreJSONCSM struct {
	// contains filtered or unexported fields
}

func NewDatastoreInMemoryCSM added in v0.4.0

func NewDatastoreInMemoryCSM(provider Provider) (*DatastoreJSONCSM, error)

func (*DatastoreJSONCSM) Add added in v0.4.0

func (dj *DatastoreJSONCSM) Add(hardware *Hardware) error

Add adds a new hardware object to the inventory

func (*DatastoreJSONCSM) Clone added in v0.4.0

func (dj *DatastoreJSONCSM) Clone() (Datastore, error)

func (*DatastoreJSONCSM) Flush added in v0.4.0

func (dj *DatastoreJSONCSM) Flush() error

Flush writes the current inventory to the datastore

func (*DatastoreJSONCSM) Get added in v0.4.0

func (dj *DatastoreJSONCSM) Get(id uuid.UUID) (Hardware, error)

Get returns a hardware object from the inventory

func (*DatastoreJSONCSM) GetAtLocation added in v0.4.0

func (dj *DatastoreJSONCSM) GetAtLocation(path LocationPath) (Hardware, error)

GetAtLocation returns the hardware at the given location TODO THIS NEEDS UNIT TESTS

func (*DatastoreJSONCSM) GetChildren added in v0.4.0

func (dj *DatastoreJSONCSM) GetChildren(id uuid.UUID) ([]Hardware, error)

GetChildren returns the children of a given hardware object

func (*DatastoreJSONCSM) GetDescendants added in v0.4.0

func (dj *DatastoreJSONCSM) GetDescendants(id uuid.UUID) ([]Hardware, error)

func (*DatastoreJSONCSM) GetLocation added in v0.4.0

func (dj *DatastoreJSONCSM) GetLocation(hardware Hardware) (LocationPath, error)

GetLocation will follow the parent links up to the root node, which is signaled when a NIL parent UUID is found This will either return a partial location path, or a full path up to a cabinet or CDU TODO THIS NEEDS UNIT TESTS

func (*DatastoreJSONCSM) GetSchemaVersion added in v0.4.0

func (dj *DatastoreJSONCSM) GetSchemaVersion() (SchemaVersion, error)

func (*DatastoreJSONCSM) GetSystem added in v0.4.0

func (dj *DatastoreJSONCSM) GetSystem(hardware Hardware) (Hardware, error)

GetSystem returns the system that the given hardware object is a part of

func (*DatastoreJSONCSM) GetSystemZero added in v0.4.0

func (dj *DatastoreJSONCSM) GetSystemZero() (Hardware, error)

GetSystemZero assumes one system exists and returns it

func (*DatastoreJSONCSM) InventoryProvider added in v0.4.0

func (dj *DatastoreJSONCSM) InventoryProvider() (Provider, error)

GetExternalInventoryProvider gets the external inventory provider

func (*DatastoreJSONCSM) List added in v0.4.0

func (dj *DatastoreJSONCSM) List() (Inventory, error)

List returns the entire inventory

func (*DatastoreJSONCSM) Merge added in v0.4.0

func (dj *DatastoreJSONCSM) Merge(otherDJ Datastore) error

func (*DatastoreJSONCSM) Remove added in v0.4.0

func (dj *DatastoreJSONCSM) Remove(id uuid.UUID, recursion bool) error

Remove removes a hardware object from the inventory

func (*DatastoreJSONCSM) Search added in v0.4.0

func (dj *DatastoreJSONCSM) Search(filter SearchFilter) (map[uuid.UUID]Hardware, error)

func (*DatastoreJSONCSM) SetInventoryProvider added in v0.4.0

func (dj *DatastoreJSONCSM) SetInventoryProvider(provider Provider) error

SetExternalInventoryProvider sets the external inventory provider

func (*DatastoreJSONCSM) Update added in v0.4.0

func (dj *DatastoreJSONCSM) Update(hardware *Hardware) error

Update updates a hardware object in the inventory

func (*DatastoreJSONCSM) Validate added in v0.4.0

func (dj *DatastoreJSONCSM) Validate() (map[uuid.UUID]ValidateResult, error)

Validate validates the current inventory

type GenerateHardwareBuildOutOpts added in v0.2.0

type GenerateHardwareBuildOutOpts struct {
	DeviceTypeSlug string
	DeviceOrdinal  int
	DeviceID       uuid.UUID // Optional: If specified use this for the top level hardware object created, otherwise if the UUID is uuid.Nil an UUID is generated if

	ParentHardware Hardware

	ExistingDescendantHardware []Hardware
}

type Hardware

type Hardware struct {
	ID               uuid.UUID                        `json:"ID" yaml:"ID" default:"" usage:"Unique Identifier"`
	Name             string                           `json:"Name,omitempty" yaml:"Name,omitempty" default:"" usage:"Friendly name"`
	Type             hardwaretypes.HardwareType       `json:"Type,omitempty" yaml:"Type,omitempty" default:"" usage:"Type"`
	DeviceTypeSlug   string                           `json:"DeviceTypeSlug,omitempty" yaml:"DeviceTypeSlug,omitempty" default:"" usage:"Hardware Type Library Device slug"`
	Vendor           string                           `json:"Vendor,omitempty" yaml:"Vendor,omitempty" default:"" usage:"Vendor"`
	Architecture     string                           `json:"Architecture,omitempty" yaml:"Architecture,omitempty" default:"" usage:"Architecture"`
	Model            string                           `json:"Model,omitempty" yaml:"Model,omitempty" default:"" usage:"Model"`
	Status           HardwareStatus                   `json:"Status,omitempty" yaml:"Status,omitempty" default:"Staged" usage:"Hardware can be [staged, provisioned, decomissioned]"`
	Properties       map[string]interface{}           `json:"Properties,omitempty" yaml:"Properties,omitempty" default:"" usage:"Properties"`
	ProviderMetadata map[Provider]ProviderMetadataRaw `json:"ProviderMetadata,omitempty" yaml:"ProviderMetadata,omitempty" default:"" usage:"ProviderMetadata"`
	Parent           uuid.UUID                        `json:"Parent,omitempty" yaml:"Parent,omitempty" default:"00000000-0000-0000-0000-000000000000" usage:"Parent hardware"`
	Children         []uuid.UUID                      `json:"Children,omitempty" yaml:"Children,omitempty"`         // derived from Parent
	LocationPath     LocationPath                     `json:"LocationPath,omitempty" yaml:"LocationPath,omitempty"` // derived from Parent
	LocationOrdinal  *int                             `json:"LocationOrdinal,omitempty" yaml:"LocationOrdinal,omitempty" default:"" usage:"LocationOrdinal"`
}

Hardware is the smallest unit of inventory It has all the potential fields that hardware can have

func NewHardwareFromBuildOut

func NewHardwareFromBuildOut(hardwareBuildOut HardwareBuildOut, status HardwareStatus) Hardware

func (*Hardware) SetProviderMetadata

func (hardware *Hardware) SetProviderMetadata(provider Provider, metadata map[string]interface{})

type HardwareBuildOut added in v0.2.0

type HardwareBuildOut struct {
	ID               uuid.UUID
	ParentID         uuid.UUID
	DeviceTypeSlug   string
	DeviceType       hardwaretypes.DeviceType
	DeviceOrdinal    int
	OrdinalPath      []int
	LocationPath     LocationPath
	ExistingHardware *Hardware
}

func GenerateDefaultHardwareBuildOut added in v0.2.0

func GenerateDefaultHardwareBuildOut(l *hardwaretypes.Library, deviceTypeSlug string, deviceOrdinal int, parentHardware Hardware) (results []HardwareBuildOut, err error)

func GenerateHardwareBuildOut added in v0.2.0

func GenerateHardwareBuildOut(l *hardwaretypes.Library, opts GenerateHardwareBuildOutOpts) (results []HardwareBuildOut, err error)

TODO make this should work the inventory data structure

func (*HardwareBuildOut) GetOrdinal added in v0.2.0

func (hbo *HardwareBuildOut) GetOrdinal() int

type HardwareStatus

type HardwareStatus string

HardwareStatus is the current state of the hardware Using a status allows for the hardware to be tracked through its lifecycle and allows for historical tracking of the hardware even if it is replaced or removed

type Inventory

type Inventory struct {
	SchemaVersion SchemaVersion
	Provider      Provider
	Hardware      map[uuid.UUID]Hardware
}

Inventory is the top level object that represents the entire inventory This is what cani uses to represent the inventory

func (*Inventory) FilterHardware

func (i *Inventory) FilterHardware(filter func(Hardware) (bool, error)) (map[uuid.UUID]Hardware, error)

func (*Inventory) FilterHardwareByStatus added in v0.3.0

func (i *Inventory) FilterHardwareByStatus(wantedStatus ...HardwareStatus) map[uuid.UUID]Hardware

func (*Inventory) FilterHardwareByType

func (i *Inventory) FilterHardwareByType(types ...hardwaretypes.HardwareType) map[uuid.UUID]Hardware

func (*Inventory) FilterHardwareByTypeStatus

func (i *Inventory) FilterHardwareByTypeStatus(status HardwareStatus, types ...hardwaretypes.HardwareType) map[uuid.UUID]Hardware

type LocationPath

type LocationPath []LocationToken

func (LocationPath) Exists

func (lp LocationPath) Exists(ds Datastore) (bool, error)

Exists returns true if the hardware exists in the datastore

func (LocationPath) Get added in v0.2.0

func (lp LocationPath) Get(ds Datastore) (Hardware, error)

Get returns the Hardware at the location path

func (LocationPath) GetHardwareTypePath

func (lp LocationPath) GetHardwareTypePath() hardwaretypes.HardwareTypePath

GetHardwareTypePath returns the hardware type path of the location path

func (LocationPath) GetOrdinal added in v0.4.0

func (lp LocationPath) GetOrdinal(hardwareType hardwaretypes.HardwareType) (ordinal int, found bool)

func (LocationPath) GetOrdinalPath

func (lp LocationPath) GetOrdinalPath() []int

GetOrdinalPath returns the ordinal of the location path

func (LocationPath) GetUUID

func (lp LocationPath) GetUUID(ds Datastore) (uuid.UUID, error)

GetUUID returns the UUID of the location path

func (LocationPath) String

func (lp LocationPath) String() string

String returns a string representation of the location path

type LocationToken

type LocationToken struct {
	HardwareType hardwaretypes.HardwareType
	Ordinal      int
}

func (*LocationToken) String

func (lt *LocationToken) String() string

type Provider

type Provider string

Provider is the name of the external inventory provider

type ProviderMetadataRaw

type ProviderMetadataRaw map[string]interface{}

ProviderMetadataRaw stores the metadata from a provider in a generic map.

type SchemaVersion

type SchemaVersion string

SchemaVersion is the version of the inventory schema

type SearchFilter added in v0.3.0

type SearchFilter struct {
	Types  []hardwaretypes.HardwareType
	Status []HardwareStatus
}

SearchFilter works as follows - Each field is a different category to filter on - When is there a match?

  • A hardware object must match one element in a category
  • If a category is empty then all hardware objects will match
  • A must match across all categories

type ValidateResult added in v0.2.0

type ValidateResult struct {
	Hardware Hardware
	Errors   []string
}

Jump to

Keyboard shortcuts

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