ports

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandsTo

func AddCommandsTo(rootCmd *cobra.Command)

func BuyLAGPort

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

func BuyPort

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

func CheckPortVLANAvailability

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

func DeletePort

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

func GetPort

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

func GetPortHelp

func GetPortHelp(cmd *cobra.Command, args []string) error

GetPortHelp is a placeholder function for the ports help command

func ListPorts

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

func LockPort

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

func RestorePort

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

func UnlockPort

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

func UpdatePort

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

Types

type MockPortService

type MockPortService struct {
	// Optional fields to customize behavior
	GetPortErr                      error
	GetPortResult                   *megaport.Port
	ListPortsErr                    error
	ListPortsResult                 []*megaport.Port
	BuyPortErr                      error
	BuyPortResult                   *megaport.BuyPortResponse
	CapturedRequest                 *megaport.BuyPortRequest
	CheckPortVLANAvailabilityErr    error
	CheckPortVLANAvailabilityResult bool
	CapturedVLANRequest             struct {
		PortID string
		VLANID int
	}
	DeletePortErr         error
	DeletePortResult      *megaport.DeletePortResponse
	CapturedDeletePortUID string

	ListPortResourceTagsErr    error
	ListPortResourceTagsResult map[string]string
	CapturedResourceTagPortUID string

	ValidatePortOrderErr      error
	ModifyPortErr             error
	ModifyPortResult          *megaport.ModifyPortResponse
	CapturedModifyPortRequest *megaport.ModifyPortRequest
	RestorePortErr            error
	RestorePortResult         *megaport.RestorePortResponse
	CapturedRestorePortUID    string
	LockPortErr               error
	LockPortResult            *megaport.LockPortResponse
	CapturedLockPortUID       string
	UnlockPortErr             error
	UnlockPortResult          *megaport.UnlockPortResponse
	CapturedUnlockPortUID     string
	UpdatePortResourceTagsErr error
	CapturedUpdateTagsRequest struct {
		PortID string
		Tags   map[string]string
	}
	UpdatePortErr    error
	UpdatePortResult *megaport.ModifyPortResponse
}

MockPortService implements the required Port service methods for testing

func (*MockPortService) BuyPort

func (*MockPortService) CheckPortVLANAvailability

func (m *MockPortService) CheckPortVLANAvailability(ctx context.Context, portID string, vlanID int) (bool, error)

func (*MockPortService) DeletePort

func (*MockPortService) GetPort

func (m *MockPortService) GetPort(ctx context.Context, portID string) (*megaport.Port, error)

func (*MockPortService) ListPortResourceTags

func (m *MockPortService) ListPortResourceTags(ctx context.Context, portID string) (map[string]string, error)

func (*MockPortService) ListPorts

func (m *MockPortService) ListPorts(ctx context.Context) ([]*megaport.Port, error)

func (*MockPortService) LockPort

func (m *MockPortService) LockPort(ctx context.Context, portId string) (*megaport.LockPortResponse, error)

func (*MockPortService) ModifyPort

func (*MockPortService) RestorePort

func (m *MockPortService) RestorePort(ctx context.Context, portId string) (*megaport.RestorePortResponse, error)

func (*MockPortService) UnlockPort

func (m *MockPortService) UnlockPort(ctx context.Context, portId string) (*megaport.UnlockPortResponse, error)

func (*MockPortService) UpdatePortResourceTags

func (m *MockPortService) UpdatePortResourceTags(ctx context.Context, portID string, tags map[string]string) error

func (*MockPortService) ValidatePortOrder

func (m *MockPortService) ValidatePortOrder(ctx context.Context, req *megaport.BuyPortRequest) error

type PortOutput

type PortOutput struct {
	output.Output      `json:"-" header:"-"`
	UID                string `json:"uid"`
	Name               string `json:"name"`
	LocationID         int    `json:"location_id"`
	PortSpeed          int    `json:"port_speed"`
	ProvisioningStatus string `json:"provisioning_status"`
}

PortOutput represents the desired fields for JSON output.

func ToPortOutput

func ToPortOutput(port *megaport.Port) (PortOutput, error)

ToPortOutput converts a *megaport.Port to our PortOutput struct.

Jump to

Keyboard shortcuts

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