Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DescribeCmd = base.DescribeCmd{ ResourceNameSingular: "Load Balancer Type", ShortDescription: "Describe a Load Balancer type", JSONKeyGetByID: "load_balancer_type", JSONKeyGetByName: "load_balancer_types", NameSuggestions: func(c hcapi2.Client) func() []string { return c.LoadBalancerType().Names }, Fetch: func(ctx context.Context, client hcapi2.Client, cmd *cobra.Command, idOrName string) (interface{}, *hcloud.Response, error) { return client.LoadBalancerType().Get(ctx, idOrName) }, PrintText: func(_ context.Context, _ hcapi2.Client, cmd *cobra.Command, resource interface{}) error { loadBalancerType := resource.(*hcloud.LoadBalancerType) cmd.Printf("ID:\t\t\t\t%d\n", loadBalancerType.ID) cmd.Printf("Name:\t\t\t\t%s\n", loadBalancerType.Name) cmd.Printf("Description:\t\t\t%s\n", loadBalancerType.Description) cmd.Printf("Max Services:\t\t\t%d\n", loadBalancerType.MaxServices) cmd.Printf("Max Connections:\t\t%d\n", loadBalancerType.MaxConnections) cmd.Printf("Max Targets:\t\t\t%d\n", loadBalancerType.MaxTargets) cmd.Printf("Max assigned Certificates:\t%d\n", loadBalancerType.MaxAssignedCertificates) cmd.Printf("Pricings per Location:\n") for _, price := range loadBalancerType.Pricings { cmd.Printf(" - Location:\t%s:\n", price.Location.Name) cmd.Printf(" Hourly:\t€ %s\n", price.Hourly.Gross) cmd.Printf(" Monthly:\t€ %s\n", price.Monthly.Gross) } return nil }, }
View Source
var ListCmd = base.ListCmd{ ResourceNamePlural: "Load Balancer Types", JSONKeyGetByName: "load_balancer_types", DefaultColumns: []string{"id", "name", "description", "max_services", "max_connections", "max_targets"}, Fetch: func(ctx context.Context, client hcapi2.Client, _ *pflag.FlagSet, listOpts hcloud.ListOpts, sorts []string) ([]interface{}, error) { opts := hcloud.LoadBalancerTypeListOpts{ListOpts: listOpts} if len(sorts) > 0 { opts.Sort = sorts } loadBalancerTypes, err := client.LoadBalancerType().AllWithOpts(ctx, opts) var resources []interface{} for _, r := range loadBalancerTypes { resources = append(resources, r) } return resources, err }, OutputTable: func(client hcapi2.Client) *output.Table { return output.NewTable(). AddAllowedFields(hcloud.LoadBalancerType{}) }, JSONSchema: func(resources []interface{}) interface{} { loadBalancerTypeSchemas := make([]schema.LoadBalancerType, 0, len(resources)) for _, resource := range resources { loadBalancerType := resource.(*hcloud.LoadBalancerType) loadBalancerTypeSchemas = append(loadBalancerTypeSchemas, util.LoadBalancerTypeToSchema(*loadBalancerType)) } return loadBalancerTypeSchemas }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.