Documentation ¶
Overview ¶
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddBIOSConfigFlag(cmd *cobra.Command, ptr *bool)
- func AddBMCAddressFlag(cmd *cobra.Command, ptr *string)
- func AddBMCPasswordFlag(cmd *cobra.Command, ptr *string)
- func AddBMCUsernameFlag(cmd *cobra.Command, ptr *string)
- func AddComponentTypeFlag(cmd *cobra.Command, ptr *string)
- func AddConfigFileFlag(cmd *cobra.Command, ptr *string)
- func AddDryRunFlag(cmd *cobra.Command, ptr *bool, usage string)
- func AddFacilityFlag(cmd *cobra.Command, ptr *string)
- func AddFirmwareAddIDsFlag(cmd *cobra.Command, ptr *[]string)
- func AddFirmwareIDFlag(cmd *cobra.Command, ptr *string)
- func AddFirmwareIDsFlag(cmd *cobra.Command, ptr *[]string)
- func AddFirmwareRemoveIDsFlag(cmd *cobra.Command, ptr *[]string)
- func AddFirmwareSetFlag(cmd *cobra.Command, ptr *string)
- func AddFirmwareVersionFlag(cmd *cobra.Command, ptr *string)
- func AddForceFlag(cmd *cobra.Command, ptr *bool, usage string)
- func AddFromFileFlag(cmd *cobra.Command, ptr *string, usage string)
- func AddLabelsFlag(cmd *cobra.Command, ptr *map[string]string, usage string)
- func AddListComponentsFlag(cmd *cobra.Command, ptr *bool)
- func AddMacAOCFlag(cmd *cobra.Command, ptr *string)
- func AddMacBMCFlag(cmd *cobra.Command, ptr *string)
- func AddModelFlag(cmd *cobra.Command, ptr *string)
- func AddNameFlag(cmd *cobra.Command, ptr *string, usage string)
- func AddOutputFlag(cmd *cobra.Command, ptr *string)
- func AddPageFlag(cmd *cobra.Command, ptr *int)
- func AddPageLimitFlag(cmd *cobra.Command, ptr *int)
- func AddPowerOffRequiredFlag(cmd *cobra.Command, ptr *bool, usage string)
- func AddPrintTableFlag(cmd *cobra.Command, ptr *bool)
- func AddReAuthFlag(cmd *cobra.Command, ptr *bool)
- func AddServerFlag(cmd *cobra.Command, ptr *string)
- func AddServerPowerActionFlag(cmd *cobra.Command, ptr *string, params []string)
- func AddServerPowerActionStatusFlag(cmd *cobra.Command, ptr *bool)
- func AddServerSerialFlag(cmd *cobra.Command, ptr *string)
- func AddSkipBiosConfigFlag(cmd *cobra.Command, ptr *bool)
- func AddSkipBmcResetFlag(cmd *cobra.Command, ptr *bool)
- func AddSkipFWStatusFlag(cmd *cobra.Command, ptr *bool)
- func AddSlugFlag(cmd *cobra.Command, ptr *string, usage string)
- func AddVendorFlag(cmd *cobra.Command, ptr *string)
- func AddWithBMCErrorsFlag(cmd *cobra.Command, ptr *bool)
- func AddWithCredsFlag(cmd *cobra.Command, ptr *bool)
- func AddWithRecordsFlag(cmd *cobra.Command, ptr *bool)
- func AttributeByNamespace(ns string, attributes []fleetdbapi.Attributes) *fleetdbapi.Attributes
- func AttributeFromLabels(ns string, labels map[string]string) (*fleetdbapi.Attributes, error)
- func ConditionFromResponse(response *coapiv1.ServerResponse) (rctypes.Condition, error)
- func Execute()
- func FirmwareSetByVendorModel(ctx context.Context, vendor, model string, client *fleetdbapi.Client) ([]fleetdbapi.ComponentFirmwareSet, error)
- func FirmwareSetIDByVendorModel(ctx context.Context, vendor, model string, client *fleetdbapi.Client) (uuid.UUID, error)
- func FormatConditionResponse(response *coapiv1.ServerResponse, kind rctypes.Kind) (string, error)
- func MustCreateApp(ctx context.Context) *app.App
- func MutuallyExclusiveFlags(cmd *cobra.Command, flags ...*flagDetails)
- func PrintResults(format string, data ...any)
- func RequireFlag(cmd *cobra.Command, flagDetail *flagDetails)
- func RequireOneFlag(cmd *cobra.Command, flags ...*flagDetails)
- func ServerBMCCredentials(ctx context.Context, client *fleetdbapi.Client, server *rt.Server) error
- func VendorModelFromAttrs(attrs []fleetdbapi.Attributes) (vendor, model string)
- type ErrUnexpectedResponse
- type FirmwareSetFlags
Constants ¶
const ( CmdTimeout = 20 * time.Second // TODO: merge constants along with the ones in Alloy into a separate library ServerVendorAttributeNS = "sh.hollow.alloy.server_vendor_attributes" FirmwareSetAttributeNS = "sh.hollow.firmware_set.labels" )
Variables ¶
var ( ErrAttributeFromLabel = errors.New("error creating Attribute from Label") ErrLabelFromAttribute = errors.New("error creating Label from Attribute") ErrFwSetByVendorModel = errors.New("error identifying firmware set by server vendor, model") )
var ( ConfigFileFlag = &flagDetails{name: "config", short: "c"} ReAuthFlag = &flagDetails{name: "reauth"} ServerFlag = &flagDetails{name: "server", short: "s"} SkipFWStatusFlag = &flagDetails{name: "skip-fw-status"} SkipBiosConfigFlag = &flagDetails{name: "skip-bios-config"} FromFileFlag = &flagDetails{name: "from-file", short: "F"} FirmwareIDsFlag = &flagDetails{name: "firmware-ids", short: "U"} NameFlag = &flagDetails{name: "name", short: "n"} LabelsFlag = &flagDetails{name: "labels", short: "l"} FacilityFlag = &flagDetails{name: "facility"} BMCAddressFlag = &flagDetails{name: "bmc-addr", short: "a"} BMCUsernameFlag = &flagDetails{name: "bmc-user", short: "u"} BMCPasswordFlag = &flagDetails{name: "bmc-pass", short: "p"} FirmwareIDFlag = &flagDetails{name: "firmware-id", short: "f"} FirmwareVersionFlag = &flagDetails{name: "firmware-version", short: "V"} FirmwareSetFlag = &flagDetails{name: "set-id"} FirmwareAddFlag = &flagDetails{name: "add-firmware-ids"} FirmwareRemoveFlag = &flagDetails{name: "remove-firmware-ids"} MacAOCFlag = &flagDetails{name: "aoc-mac"} MacBMCFlag = &flagDetails{name: "bmc-mac"} OutputFlag = &flagDetails{name: "output", short: "o"} ForceFlag = &flagDetails{name: "force"} DryRunFlag = &flagDetails{name: "dry-run"} SkipBmcResetFlag = &flagDetails{name: "skip-bmc-reset"} PowerOffRequiredFlag = &flagDetails{name: "power-off-required"} ModelFlag = &flagDetails{name: "model", short: "m"} VendorFlag = &flagDetails{name: "vendor", short: "v"} SlugFlag = &flagDetails{name: "slug"} WithRecordsFlag = &flagDetails{name: "with-records"} PageFlag = &flagDetails{name: "page"} LimitFlag = &flagDetails{name: "limit"} WithBMCErrorsFlag = &flagDetails{name: "with-bmc-errors"} WithCredsFlag = &flagDetails{name: "with-creds"} PrintTableFlag = &flagDetails{name: "table", short: "t"} BiosConfigFlag = &flagDetails{name: "bios-config"} ListComponentsFlag = &flagDetails{name: "list-components"} ServerSerialFlag = &flagDetails{name: "serial"} ServerActionPowerActionFlag = &flagDetails{name: "action"} ServerActionPowerActionStatusFlag = &flagDetails{name: "action-status"} ComponentTypeFlag = &flagDetails{name: "component"} OutputTypeJSON outputType = "json" OutputTypeText outputType = "text" )
var RootCmd = &cobra.Command{ Use: "mctl", Short: "mctl is a CLI utility to interact with metal toolbox services", DisableAutoGenTag: true, }
RootCmd represents the base command when called without any subcommands
Functions ¶
func AddBIOSConfigFlag ¶ added in v1.0.2
func AddBMCAddressFlag ¶ added in v1.0.2
func AddBMCPasswordFlag ¶ added in v1.0.2
func AddBMCUsernameFlag ¶ added in v1.0.2
func AddComponentTypeFlag ¶ added in v1.0.2
func AddConfigFileFlag ¶ added in v1.0.2
func AddDryRunFlag ¶ added in v1.0.2
func AddFacilityFlag ¶ added in v1.0.2
func AddFirmwareAddIDsFlag ¶ added in v1.0.2
func AddFirmwareIDFlag ¶ added in v1.0.2
func AddFirmwareIDsFlag ¶ added in v1.0.2
func AddFirmwareRemoveIDsFlag ¶ added in v1.0.2
func AddFirmwareSetFlag ¶ added in v1.0.2
func AddFirmwareVersionFlag ¶ added in v1.0.2
func AddFromFileFlag ¶ added in v1.0.2
func AddLabelsFlag ¶ added in v1.0.2
func AddListComponentsFlag ¶ added in v1.0.2
func AddMacAOCFlag ¶ added in v1.0.2
func AddMacBMCFlag ¶ added in v1.0.2
func AddModelFlag ¶ added in v1.0.2
func AddOutputFlag ¶ added in v1.0.2
func AddPageFlag ¶ added in v1.0.2
func AddPageLimitFlag ¶ added in v1.0.2
func AddPowerOffRequiredFlag ¶ added in v1.0.2
func AddPrintTableFlag ¶ added in v1.0.2
func AddReAuthFlag ¶ added in v1.0.2
func AddServerFlag ¶ added in v1.0.2
func AddServerPowerActionFlag ¶ added in v1.0.2
func AddServerPowerActionStatusFlag ¶ added in v1.0.2
func AddServerSerialFlag ¶ added in v1.0.2
func AddSkipBiosConfigFlag ¶ added in v1.0.2
func AddSkipBmcResetFlag ¶ added in v1.0.2
func AddSkipFWStatusFlag ¶ added in v1.0.2
func AddVendorFlag ¶ added in v1.0.2
func AddWithBMCErrorsFlag ¶ added in v1.0.2
func AddWithCredsFlag ¶ added in v1.0.2
func AddWithRecordsFlag ¶ added in v1.0.2
func AttributeByNamespace ¶
func AttributeByNamespace(ns string, attributes []fleetdbapi.Attributes) *fleetdbapi.Attributes
AttributeByNamespace returns the serverservice attribute in the slice that matches the namespace
TODO: move into common library and share with Alloy
func AttributeFromLabels ¶
func AttributeFromLabels(ns string, labels map[string]string) (*fleetdbapi.Attributes, error)
func ConditionFromResponse ¶ added in v0.1.3
func ConditionFromResponse(response *coapiv1.ServerResponse) (rctypes.Condition, error)
ConditionFromResponse returns a Condition object from the Condition API ServerResponse object
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the RootCmd.
func FirmwareSetByVendorModel ¶
func FirmwareSetByVendorModel(ctx context.Context, vendor, model string, client *fleetdbapi.Client) ([]fleetdbapi.ComponentFirmwareSet, error)
FirmwareSetByVendorModel returns the firmware set matched by the vendor, model attributes
TODO: move into common library
func FirmwareSetIDByVendorModel ¶
func FirmwareSetIDByVendorModel(ctx context.Context, vendor, model string, client *fleetdbapi.Client) (uuid.UUID, error)
FirmwareSetIDByVendorModel returns the firmware set ID matched by the vendor, model attributes
TODO: move into common library
func FormatConditionResponse ¶ added in v0.1.3
FormatConditionResponse returns a prettyish JSON formatted output that can be printed to stdout.
func MutuallyExclusiveFlags ¶ added in v1.0.2
func PrintResults ¶ added in v1.0.1
func RequireFlag ¶ added in v1.0.2
func RequireOneFlag ¶ added in v1.0.2
func ServerBMCCredentials ¶ added in v1.0.1
Query server BMC credentials and update the given server object
func VendorModelFromAttrs ¶
func VendorModelFromAttrs(attrs []fleetdbapi.Attributes) (vendor, model string)
VendorModelFromAttrs unpacks the attributes payload to return the vendor, model attributes for a server
TODO: move into common library and share with Alloy
Types ¶
type ErrUnexpectedResponse ¶ added in v0.1.3
type ErrUnexpectedResponse struct {
// contains filtered or unexported fields
}
func (*ErrUnexpectedResponse) Error ¶ added in v0.1.3
func (e *ErrUnexpectedResponse) Error() string
type FirmwareSetFlags ¶
type FirmwareSetFlags struct { // labels are key values Labels map[string]string // id is the firmware set id ID string // list of firmware UUIDs to be added to the set AddFirmwareUUIDs []string // list of firmware UUIDs to be removed from the set RemoveFirmwareUUIDs []string // name for the firmware set to be created/edited FirmwareSetName string // create firmware set from file CreateFromFile string // ignore any create errors IgnoreCreateErrors bool }
firmware set command flags