Documentation
¶
Index ¶
- func AddCommandsTo(rootCmd *cobra.Command)
- func GetLocation(cmd *cobra.Command, args []string, noColor bool, outputFormat string) error
- func ListLocations(cmd *cobra.Command, args []string, noColor bool, outputFormat string) error
- type LocationOutput
- type LocationTableOutput
- type MockLocationsService
- func (m *MockLocationsService) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*megaport.Location) ([]*megaport.Location, error)
- func (m *MockLocationsService) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*megaport.Location) []*megaport.Location
- func (m *MockLocationsService) GetLocationByID(ctx context.Context, locationID int) (*megaport.Location, error)
- func (m *MockLocationsService) GetLocationByName(ctx context.Context, locationName string) (*megaport.Location, error)
- func (m *MockLocationsService) GetLocationByNameFuzzy(ctx context.Context, search string) ([]*megaport.Location, error)
- func (m *MockLocationsService) IsValidMarketCode(ctx context.Context, marketCode string) (bool, error)
- func (m *MockLocationsService) ListCountries(ctx context.Context) ([]*megaport.Country, error)
- func (m *MockLocationsService) ListLocations(ctx context.Context) ([]*megaport.Location, error)
- func (m *MockLocationsService) ListMarketCodes(ctx context.Context) ([]string, error)
- type Module
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommandsTo ¶
AddCommandsTo builds the locations commands and adds them to the root command
func GetLocation ¶
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
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
ListCountries mocks the ListCountries method.
func (*MockLocationsService) ListLocations ¶ added in v0.4.0
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 (*Module) RegisterCommands ¶ added in v0.3.4
RegisterCommands adds all location commands to the root command