mve

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MPL-2.0 Imports: 15 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 mve commands and adds them to the root command

func BuyMVE

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

func DeleteMVE

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

func GetMVE

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

func GetMVEStatus added in v0.4.4

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

GetMVEStatus retrieves only the provisioning status of an MVE without all details

func ListAvailableMVESizes

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

func ListMVEImages

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

func ListMVEResourceTags added in v0.4.3

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

func ListMVEs added in v0.3.9

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

func UpdateMVE

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

func UpdateMVEResourceTags added in v0.4.3

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

Types

type MVEOutput

type MVEOutput struct {
	output.Output `json:"-" header:"-"`
	UID           string `json:"uid" header:"UID"`
	Name          string `json:"name" header:"Name"`
	LocationID    int    `json:"location_id" header:"Location ID"`
	Status        string `json:"status" header:"Status"`
	Vendor        string `json:"vendor" header:"Vendor"`
	Size          string `json:"size" header:"Size"`
}

MVEOutput represents the desired fields for JSON output.

func ToMVEOutput

func ToMVEOutput(m *megaport.MVE) (MVEOutput, error)

ToMVEOutput converts an MVE to an MVEOutput.

type MVEStatus added in v0.4.4

type MVEStatus struct {
	UID    string `json:"uid" header:"UID"`
	Name   string `json:"name" header:"NAME"`
	Status string `json:"status" header:"STATUS"`
	Vendor string `json:"vendor" header:"VENDOR"`
	Size   string `json:"size" header:"SIZE"`
}

type MockMVEService

type MockMVEService struct {
	// Optional fields to customize behavior
	GetMVEErr           error
	GetMVEResult        *megaport.MVE
	ListMVEsErr         error
	ListMVEsResult      []*megaport.MVE
	BuyMVEErr           error
	BuyMVEResult        *megaport.BuyMVEResponse
	DeleteMVEErr        error
	DeleteMVEResult     *megaport.DeleteMVEResponse
	ModifyMVEErr        error
	ModifyMVEResult     *megaport.ModifyMVEResponse
	ValidateMVEOrderErr error

	// Resource tags related fields
	ListMVEResourceTagsErr    error
	ListMVEResourceTagsResult map[string]string
	UpdateMVEResourceTagsErr  error

	// Images and sizes
	ListMVEImagesErr            error
	ListMVEImagesResult         []*megaport.MVEImage
	ListAvailableMVESizesErr    error
	ListAvailableMVESizesResult []*megaport.MVESize

	// For tracking request parameters in tests
	CapturedBuyMVERequest                *megaport.BuyMVERequest
	CapturedModifyMVERequest             *megaport.ModifyMVERequest
	CapturedListMVEsRequest              *megaport.ListMVEsRequest
	CapturedUpdateMVEResourceTagsRequest map[string]string
}

MockMVEService implements the required MVE service methods for testing

func (*MockMVEService) BuyMVE

func (*MockMVEService) DeleteMVE

func (*MockMVEService) GetMVE

func (m *MockMVEService) GetMVE(ctx context.Context, mveID string) (*megaport.MVE, error)

func (*MockMVEService) ListAvailableMVESizes

func (m *MockMVEService) ListAvailableMVESizes(ctx context.Context) ([]*megaport.MVESize, error)

func (*MockMVEService) ListMVEImages

func (m *MockMVEService) ListMVEImages(ctx context.Context) ([]*megaport.MVEImage, error)

func (*MockMVEService) ListMVEResourceTags

func (m *MockMVEService) ListMVEResourceTags(ctx context.Context, mveID string) (map[string]string, error)

func (*MockMVEService) ListMVEs added in v0.3.8

func (m *MockMVEService) ListMVEs(ctx context.Context, req *megaport.ListMVEsRequest) ([]*megaport.MVE, error)

func (*MockMVEService) ModifyMVE

func (*MockMVEService) Reset

func (m *MockMVEService) Reset()

Reset clears all captured values and resets errors to nil

func (*MockMVEService) UpdateMVEResourceTags

func (m *MockMVEService) UpdateMVEResourceTags(ctx context.Context, mveID string, tags map[string]string) error

func (*MockMVEService) ValidateMVEOrder

func (m *MockMVEService) ValidateMVEOrder(ctx context.Context, req *megaport.BuyMVERequest) error

type Module added in v0.3.4

type Module struct{}

Module implements the cmdbuilder.Module interface for mve

func NewModule added in v0.3.4

func NewModule() *Module

NewModule creates a new mve 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 the mve command to the root command

Jump to

Keyboard shortcuts

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