sls

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: 13 Imported by: 0

Documentation

Overview

* * MIT License * * (C) Copyright 2022-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 2022-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 2022-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

This section is empty.

Variables

View Source
var ErrSubnetNotFound = fmt.Errorf("subnet not found")

Functions

func CopyNetworks

func CopyNetworks(in map[string]sls_client.Network) (map[string]sls_client.Network, error)

func CopyState

func CopyState(in sls_client.SlsState) (sls_client.SlsState, error)

func DecodeExtraProperties

func DecodeExtraProperties[T any](hardware sls_client.Hardware) (*T, error)

func DecodeNetworkExtraProperties

func DecodeNetworkExtraProperties(extraPropertiesRaw interface{}, extraProperties *sls_common.NetworkExtraProperties) error

func FilterHardware

func FilterHardware(allHardware map[string]sls_client.Hardware, filter func(sls_client.Hardware) (bool, error)) (map[string]sls_client.Hardware, error)

FilterHardware will apply the given filter to a map of generic hardware

func FilterHardwareByType

func FilterHardwareByType(allHardware map[string]sls_client.Hardware, types ...xnametypes.HMSType) map[string]sls_client.Hardware

func FindManagementNCNs

func FindManagementNCNs(allHardware map[string]sls_client.Hardware) (map[string]sls_client.Hardware, error)

func HardwareMap

func HardwareMap(allHardware []sls_client.Hardware) map[string]sls_client.Hardware

func HardwarePairMap

func HardwarePairMap(allHardware []HardwarePair) map[string]HardwarePair

func HardwarePairSort added in v0.3.0

func HardwarePairSort(hardware []HardwarePair)

func HardwareSlice

func HardwareSlice(allHardware map[string]sls_client.Hardware) []sls_client.Hardware

func HardwareSort added in v0.3.0

func HardwareSort(hardware []sls_client.Hardware)

func HardwareSubtract

func HardwareSubtract(a, b sls_client.SlsState) ([]sls_client.Hardware, error)

Hardware present in A that is missing from B Set subtract operation

func HardwareUpdate

func HardwareUpdate(slsClient *sls_client.APIClient, ctx context.Context, hardwareToUpdate map[string]sls_client.Hardware, workers int) error

func LookupSubnet

func LookupSubnet(network sls_client.Network, subnetName string) (sls_client.NetworkIpv4Subnet, int, error)

LookupSubnet returns a subnet by name Note the return index value is useful to put modifications back into the subnet slice of a network's extra properties

func LookupSubnetInEP

func LookupSubnetInEP(networkEP *sls_client.NetworkExtraProperties, subnetName string) (sls_client.NetworkIpv4Subnet, int, error)

LookupSubnet returns a subnet by name Note the return index value is useful to put modifications back into the subnet slice of a network's extra properties

func Networks

func Networks(state sls_common.SLSState) (networks sls_common.NetworkArray)

func NewHardware

func NewHardware(xname xnames.Xname, class sls_client.HardwareClass, extraProperties interface{}) sls_client.Hardware

func ReservationsByName

func ReservationsByName(subnet sls_client.NetworkIpv4Subnet) map[string]sls_client.NetworkIpReservation

ReservationsByName presents the IPReservations in a map by name

func SortHardware

func SortHardware(hardware []sls_client.Hardware)

func SortHardwareReverse

func SortHardwareReverse(hardware []sls_client.Hardware)

Types

type HardwarePair

type HardwarePair struct {
	Xname     string
	HardwareA sls_client.Hardware
	HardwareB sls_client.Hardware
}

func HardwarePairSlice

func HardwarePairSlice(allHardware map[string]HardwarePair) []HardwarePair

func HardwareUnion

func HardwareUnion(a, b sls_client.SlsState) (identicalHardware []sls_client.Hardware, differingContents []HardwarePair, err error)

Identify hardware Note when comparing hardware network information like IP address and subnets are not considered. TODO make striping of networking information toggable

Jump to

Keyboard shortcuts

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