Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DescribeCmd = base.DescribeCmd[*hcloud.InferenceTokenType]{ ResourceNameSingular: "Inference Token Type", ShortDescription: "Describe an Inference Token Type", NameSuggestions: func(c hcapi2.Client) func() []string { return c.InferenceTokenType().Names }, Fetch: func(s state.State, _ *cobra.Command, idOrName string) (*hcloud.InferenceTokenType, any, error) { tt, _, err := s.Client().InferenceTokenType().Get(s, idOrName) if err != nil { return nil, nil, err } return tt, hcloud.SchemaFromInferenceTokenType(tt), nil }, PrintText: func(s state.State, _ *cobra.Command, out io.Writer, tokenType *hcloud.InferenceTokenType) error { pricing, _, err := s.Client().Pricing().Get(s) if err != nil { return err } fmt.Fprint(out, DescribeInferenceTokenType(s, tokenType, pricing.Currency)) return nil }, Configure: experimental.Inference, }
View Source
var ListCmd = base.ListCmd[*hcloud.InferenceTokenType, schema.InferenceTokenType]{ ResourceNamePlural: "Inference Token Types", JSONKeyGetByName: "inference_token_types", DefaultColumns: []string{"id", "name", "kind", "description", "available", "price_monthly_gross", "deprecated"}, SortOption: nil, Fetch: func(s state.State, _ *pflag.FlagSet, listOpts hcloud.ListOpts, _ []string) ([]*hcloud.InferenceTokenType, error) { opts := hcloud.InferenceTokenTypeListOpts{ListOpts: listOpts} return s.Client().InferenceTokenType().AllWithOpts(s, opts) }, OutputTable: func(t *output.Table[*hcloud.InferenceTokenType], client hcapi2.Client) { currency := sync.OnceValue(func() string { pricing, _, _ := client.Pricing().Get(context.Background()) return pricing.Currency }) t. AddAllowedFields(&hcloud.InferenceTokenType{}). AddFieldFn("price_hourly_gross", func(tokenType *hcloud.InferenceTokenType) string { if tokenType.Kind == hcloud.InferenceTokenKindUsageBased { return "-" } tokenType.Prices.Hourly.Currency = currency() return util.GrossPrice(tokenType.Prices.Hourly) }). AddFieldFn("price_hourly_net", func(tokenType *hcloud.InferenceTokenType) string { if tokenType.Kind == hcloud.InferenceTokenKindUsageBased { return "-" } tokenType.Prices.Hourly.Currency = currency() return util.NetPrice(tokenType.Prices.Hourly) }). AddFieldFn("price_monthly_gross", func(tokenType *hcloud.InferenceTokenType) string { if tokenType.Kind == hcloud.InferenceTokenKindUsageBased { return "-" } tokenType.Prices.Monthly.Currency = currency() return util.GrossPrice(tokenType.Prices.Monthly) }). AddFieldFn("price_monthly_net", func(tokenType *hcloud.InferenceTokenType) string { if tokenType.Kind == hcloud.InferenceTokenKindUsageBased { return "-" } tokenType.Prices.Monthly.Currency = currency() return util.NetPrice(tokenType.Prices.Monthly) }). AddFieldFn("deprecated", func(tokenType *hcloud.InferenceTokenType) string { if !tokenType.IsDeprecated() { return "-" } return util.Datetime(tokenType.UnavailableAfter()) }) }, Schema: hcloud.SchemaFromInferenceTokenType, Configure: experimental.Inference, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.