location

package
v1.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DescribeCmd = base.DescribeCmd{
	ResourceNameSingular: "location",
	ShortDescription:     "Describe a location",
	JSONKeyGetByID:       "location",
	JSONKeyGetByName:     "locations",
	NameSuggestions:      func(c hcapi2.Client) func() []string { return c.Location().Names },
	Fetch: func(ctx context.Context, client hcapi2.Client, cmd *cobra.Command, idOrName string) (interface{}, *hcloud.Response, error) {
		return client.Location().Get(ctx, idOrName)
	},
	PrintText: func(ctx context.Context, client hcapi2.Client, cmd *cobra.Command, resource interface{}) error {
		location := resource.(*hcloud.Location)

		fmt.Printf("ID:\t\t%d\n", location.ID)
		fmt.Printf("Name:\t\t%s\n", location.Name)
		fmt.Printf("Description:\t%s\n", location.Description)
		fmt.Printf("Network Zone:\t%s\n", location.NetworkZone)
		fmt.Printf("Country:\t%s\n", location.Country)
		fmt.Printf("City:\t\t%s\n", location.City)
		fmt.Printf("Latitude:\t%f\n", location.Latitude)
		fmt.Printf("Longitude:\t%f\n", location.Longitude)
		return nil
	},
}

DescribeCmd defines a command for describing a location.

Functions

func NewCommand

func NewCommand(cli *state.State, client hcapi2.Client) *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL