Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DescribeCmd = base.DescribeCmd[*hcloud.StorageBoxType]{ ResourceNameSingular: "Storage Box Type", ShortDescription: "Describe a Storage Box Type", NameSuggestions: func(c hcapi2.Client) func() []string { return c.StorageBoxType().Names }, Fetch: func(s state.State, _ *cobra.Command, idOrName string) (*hcloud.StorageBoxType, any, error) { st, _, err := s.Client().StorageBoxType().Get(s, idOrName) if err != nil { return nil, nil, err } return st, hcloud.SchemaFromStorageBoxType(st), nil }, PrintText: func(s state.State, _ *cobra.Command, out io.Writer, storageBoxType *hcloud.StorageBoxType) error { description, err := DescribeStorageBoxType(s, storageBoxType, false) if err != nil { return err } fmt.Fprint(out, description) return nil }, Experimental: experimental.StorageBoxes, }
View Source
var ListCmd = base.ListCmd[*hcloud.StorageBoxType, schema.StorageBoxType]{ ResourceNamePlural: "Storage Box Types", JSONKeyGetByName: "storage_box_types", DefaultColumns: []string{"id", "name", "description", "size", "snapshot_limit", "automatic_snapshot_limit", "subaccounts_limit"}, SortOption: nil, Fetch: func(s state.State, _ *pflag.FlagSet, listOpts hcloud.ListOpts, _ []string) ([]*hcloud.StorageBoxType, error) { opts := hcloud.StorageBoxTypeListOpts{ListOpts: listOpts} return s.Client().StorageBoxType().AllWithOpts(s, opts) }, OutputTable: func(t *output.Table[*hcloud.StorageBoxType], _ hcapi2.Client) { t. AddAllowedFields(&hcloud.StorageBoxType{}). AddFieldFn("size", func(storageBoxType *hcloud.StorageBoxType) string { return humanize.IBytes(uint64(storageBoxType.Size)) }). AddFieldFn("deprecated", func(storageBoxType *hcloud.StorageBoxType) string { if !storageBoxType.IsDeprecated() { return "-" } return util.Datetime(storageBoxType.UnavailableAfter()) }). AddFieldFn("snapshot_limit", func(storageBoxType *hcloud.StorageBoxType) string { if storageBoxType.SnapshotLimit == nil { return "-" } return strconv.Itoa(*storageBoxType.SnapshotLimit) }). AddFieldFn("automatic_snapshot_limit", func(storageBoxType *hcloud.StorageBoxType) string { if storageBoxType.AutomaticSnapshotLimit == nil { return "-" } return strconv.Itoa(*storageBoxType.AutomaticSnapshotLimit) }) }, Schema: hcloud.SchemaFromStorageBoxType, Experimental: experimental.StorageBoxes, }
Functions ¶
func DescribeStorageBoxType ¶ added in v1.56.0
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.