locations

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandsTo

func AddCommandsTo(rootCmd *cobra.Command)

AddCommandsTo builds the locations commands and adds them to the root command

func GetLocation

func GetLocation(cmd *cobra.Command, args []string, noColor bool, outputFormat string) error

func ListLocations

func ListLocations(cmd *cobra.Command, args []string, noColor bool, outputFormat string) error

Types

type LocationOutput

type LocationOutput struct {
	output.Output `json:"-" header:"-"`
	ID            int     `json:"id" header:"ID"`
	Name          string  `json:"name" header:"Name"`
	Country       string  `json:"country" header:"Country"`
	Metro         string  `json:"metro" header:"Metro"`
	SiteCode      string  `json:"site_code" header:"Site Code"`
	Market        string  `json:"market" header:"Market"`
	Latitude      float64 `json:"latitude" header:"-"`  // Exclude from table output
	Longitude     float64 `json:"longitude" header:"-"` // Exclude from table output
	Status        string  `json:"status" header:"Status"`
}

LocationOutput represents the complete fields for JSON and CSV output.

func ToLocationOutput

func ToLocationOutput(l *megaport.Location) LocationOutput

ToLocationOutput converts a Location to a LocationOutput.

type LocationTableOutput

type LocationTableOutput struct {
	ID       int    `header:"ID"`
	Name     string `header:"Name"`
	Country  string `header:"Country"`
	Metro    string `header:"Metro"`
	SiteCode string `header:"Site Code"`
	Status   string `header:"Status"`
}

LocationTableOutput is a compact version for table display

func ToLocationTableOutput

func ToLocationTableOutput(l *megaport.Location) LocationTableOutput

ToLocationTableOutput converts a Location to a LocationTableOutput.

type MockLocationsService added in v0.4.0

type MockLocationsService struct {
	mock.Mock
}

func (*MockLocationsService) FilterLocationsByMarketCode added in v0.4.0

func (m *MockLocationsService) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*megaport.Location) ([]*megaport.Location, error)

FilterLocationsByMarketCode mocks the FilterLocationsByMarketCode method.

func (*MockLocationsService) FilterLocationsByMcrAvailability added in v0.4.0

func (m *MockLocationsService) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*megaport.Location) []*megaport.Location

FilterLocationsByMcrAvailability mocks the FilterLocationsByMcrAvailability method.

func (*MockLocationsService) GetLocationByID added in v0.4.0

func (m *MockLocationsService) GetLocationByID(ctx context.Context, locationID int) (*megaport.Location, error)

GetLocationByID mocks the GetLocationByID method.

func (*MockLocationsService) GetLocationByName added in v0.4.0

func (m *MockLocationsService) GetLocationByName(ctx context.Context, locationName string) (*megaport.Location, error)

GetLocationByName mocks the GetLocationByName method.

func (*MockLocationsService) GetLocationByNameFuzzy added in v0.4.0

func (m *MockLocationsService) GetLocationByNameFuzzy(ctx context.Context, search string) ([]*megaport.Location, error)

GetLocationByNameFuzzy mocks the GetLocationByNameFuzzy method.

func (*MockLocationsService) IsValidMarketCode added in v0.4.0

func (m *MockLocationsService) IsValidMarketCode(ctx context.Context, marketCode string) (bool, error)

IsValidMarketCode mocks the IsValidMarketCode method.

func (*MockLocationsService) ListCountries added in v0.4.0

func (m *MockLocationsService) ListCountries(ctx context.Context) ([]*megaport.Country, error)

ListCountries mocks the ListCountries method.

func (*MockLocationsService) ListLocations added in v0.4.0

func (m *MockLocationsService) ListLocations(ctx context.Context) ([]*megaport.Location, error)

ListLocations mocks the ListLocations method.

func (*MockLocationsService) ListMarketCodes added in v0.4.0

func (m *MockLocationsService) ListMarketCodes(ctx context.Context) ([]string, error)

ListMarketCodes mocks the ListMarketCodes method.

type Module added in v0.3.4

type Module struct{}

Module implements the cmdbuilder.Module interface for locations

func NewModule added in v0.3.4

func NewModule() *Module

NewModule creates a new locations module

func (*Module) Name added in v0.3.4

func (m *Module) Name() string

Name returns the module name

func (*Module) RegisterCommands added in v0.3.4

func (m *Module) RegisterCommands(rootCmd *cobra.Command)

RegisterCommands adds all location commands to the root command

Jump to

Keyboard shortcuts

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