Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NetworkCmd = &cobra.Command{
Use: "network",
Short: "Manage networks in a zone",
Long: `Perform operations on networks such as create, list, show, and delete.`,
}
View Source
var NetworkServiceOfferingCmd = &cobra.Command{ Use: "service-offering", Aliases: []string{"serviceofferings", "service-offerings", "serviceoffering", "offering", "offerings", "service-offering list"}, Short: "List available network service offerings for a zone", Long: `List available network service offerings in a zone.`, PreRunE: func(cmd *cobra.Command, args []string) error { if err := cli.Preflight(true)(cmd, args); err != nil { return err } return nil }, RunE: func(cmd *cobra.Command, args []string) error { if err := cli.LoadFromCobraFlags(cmd, &listOpts); err != nil { return err } token := cli.TokenFromContext(cmd.Context()) zoneID := cli.ZoneIDFromContext(cmd.Context()) httpClient := http.NewClient(token) resp, err := httpClient.ListNetworkServiceOfferings(zoneID) if err != nil { slog.Error("failed to list network service offerings", "error", err) return fmt.Errorf("error: %w", err) } if len(resp.Data) == 0 { fmt.Println("No network service offerings found.") return nil } table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"ID", "Name", "Display Name", "Price", "Overprice", "Plan(GiB)", "Rate(Mbps)", "Type", "Protocol", "Desc", "DisplayNameFA"}) for _, offering := range resp.Data { row := []string{ offering.ID, offering.Name, offering.DisplayName, fmt.Sprintf("%.2f", offering.HourlyStartedPrice), fmt.Sprintf("%.2f", offering.TrafficTransferOverprice), fmt.Sprintf("%d", offering.TrafficTransferPlan), fmt.Sprintf("%d", offering.NetworkRate), offering.Type, offering.InternetProtocol, offering.Description, offering.DisplayNameFA, } table.Append(row) } table.Render() return nil }, }
NetworkServiceOfferingCmd is the command to list network service offerings.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.