mcr

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: 13 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 mcr commands and adds them to the root command

func BuyMCR

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

func CreateMCRPrefixFilterList

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

func DeleteMCR

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

func DeleteMCRPrefixFilterList

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

func GetMCR

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

func GetMCRPrefixFilterList

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

func ListMCRPrefixFilterLists

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

func ListMCRs added in v0.3.9

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

ListMCRs retrieves and prints a list of MCRs based on the provided filters.

func RestoreMCR

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

func UpdateMCR

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

func UpdateMCRPrefixFilterList

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

Types

type MCROutput

type MCROutput 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"`
	ProvisioningStatus string `json:"provisioning_status" header:"Status"`
	ASN                int    `json:"asn" header:"ASN"`
	Speed              int    `json:"speed" header:"Speed"`
}

MCROutput represents the desired fields for JSON output of MCR details.

func ToMCROutput

func ToMCROutput(mcr *megaport.MCR) (MCROutput, error)

ToMCROutput converts a *megaport.MCR to our MCROutput struct.

type MockMCRService

type MockMCRService struct {
	BuyMCRResult                             *megaport.BuyMCRResponse
	BuyMCRErr                                error
	CapturedBuyMCRRequest                    *megaport.BuyMCRRequest
	ValidateMCROrderErr                      error
	GetMCRResult                             *megaport.MCR
	GetMCRErr                                error
	ListMCRsResult                           []*megaport.MCR
	ListMCRsErr                              error
	CapturedListMCRsRequest                  *megaport.ListMCRsRequest
	DeleteMCRResult                          *megaport.DeleteMCRResponse
	DeleteMCRErr                             error
	CapturedDeleteMCRUID                     string
	CapturedMCRUID                           string
	RestoreMCRResult                         *megaport.RestoreMCRResponse
	RestoreMCRErr                            error
	CapturedRestoreMCRUID                    string
	CreateMCRPrefixFilterListResult          *megaport.CreateMCRPrefixFilterListResponse
	CreateMCRPrefixFilterListErr             error
	CapturedCreateMCRPrefixFilterListRequest *megaport.CreateMCRPrefixFilterListRequest
	CapturedCreatePrefixFilterListRequest    *megaport.CreateMCRPrefixFilterListRequest

	CreateMCRPrefixFilterListResponse *megaport.CreateMCRPrefixFilterListResponse
	CreateMCRPrefixFilterListError    error
	CapturedCreatePrefixFilterList    *megaport.CreateMCRPrefixFilterListRequest

	ListMCRPrefixFilterListsResult           []*megaport.PrefixFilterList
	ListMCRPrefixFilterListsErr              error
	GetMCRPrefixFilterListResult             *megaport.MCRPrefixFilterList
	GetMCRPrefixFilterListErr                error
	ModifyMCRPrefixFilterListResult          *megaport.ModifyMCRPrefixFilterListResponse
	ModifyMCRPrefixFilterListErr             error
	CapturedModifyMCRPrefixFilterListRequest *megaport.MCRPrefixFilterList
	DeleteMCRPrefixFilterListResult          *megaport.DeleteMCRPrefixFilterListResponse
	DeleteMCRPrefixFilterListErr             error
	ModifyMCRResult                          *megaport.ModifyMCRResponse
	ModifyMCRErr                             error
	CapturedModifyMCRRequest                 *megaport.ModifyMCRRequest
	ListMCRResourceTagsResult                map[string]string
	ListMCRResourceTagsErr                   error
	UpdateMCRResourceTagsErr                 error
	CapturedUpdateMCRResourceTagsRequest     map[string]string
	GetMCRPrefixFilterListsResult            []*megaport.PrefixFilterList
	GetMCRPrefixFilterListsErr               error
	CapturedModifyPrefixFilterListMCRID      string
	CapturedModifyPrefixFilterListID         int
	CapturedModifyPrefixFilterList           *megaport.MCRPrefixFilterList
}

func (*MockMCRService) BuyMCR

func (*MockMCRService) CreatePrefixFilterList

CreatePrefixFilterList mocks the CreatePrefixFilterList method

func (*MockMCRService) DeleteMCR

func (*MockMCRService) DeleteMCRPrefixFilterList

func (m *MockMCRService) DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*megaport.DeleteMCRPrefixFilterListResponse, error)

func (*MockMCRService) GetMCR

func (m *MockMCRService) GetMCR(ctx context.Context, mcrUID string) (*megaport.MCR, error)

func (*MockMCRService) GetMCRPrefixFilterList

func (m *MockMCRService) GetMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*megaport.MCRPrefixFilterList, error)

func (*MockMCRService) GetMCRPrefixFilterLists

func (m *MockMCRService) GetMCRPrefixFilterLists(ctx context.Context, mcrID string) ([]*megaport.PrefixFilterList, error)

func (*MockMCRService) ListMCRPrefixFilterLists

func (m *MockMCRService) ListMCRPrefixFilterLists(ctx context.Context, mcrID string) ([]*megaport.PrefixFilterList, error)

func (*MockMCRService) ListMCRResourceTags

func (m *MockMCRService) ListMCRResourceTags(ctx context.Context, mcrID string) (map[string]string, error)

func (*MockMCRService) ListMCRs added in v0.3.8

func (m *MockMCRService) ListMCRs(ctx context.Context, req *megaport.ListMCRsRequest) ([]*megaport.MCR, error)

func (*MockMCRService) ModifyMCR

ModifyMCR mocks the ModifyMCR method of the MCR service

func (*MockMCRService) ModifyMCRPrefixFilterList

func (m *MockMCRService) ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int, prefixFilterList *megaport.MCRPrefixFilterList) (*megaport.ModifyMCRPrefixFilterListResponse, error)

ModifyMCRPrefixFilterList mocks the ModifyMCRPrefixFilterList method

func (*MockMCRService) RestoreMCR

func (m *MockMCRService) RestoreMCR(ctx context.Context, mcrUID string) (*megaport.RestoreMCRResponse, error)

func (*MockMCRService) UpdateMCRResourceTags

func (m *MockMCRService) UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error

func (*MockMCRService) ValidateMCROrder

func (m *MockMCRService) ValidateMCROrder(ctx context.Context, req *megaport.BuyMCRRequest) error

type Module added in v0.3.4

type Module struct{}

Module implements the cmdbuilder.Module interface for mcr

func NewModule added in v0.3.4

func NewModule() *Module

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

type PrefixFilterListEntryOutput

type PrefixFilterListEntryOutput struct {
	output.Output `json:"-" header:"-"`
	Action        string `json:"action"`
	Prefix        string `json:"prefix"`
	Ge            int    `json:"ge,omitempty"`
	Le            int    `json:"le,omitempty"`
}

type PrefixFilterListOutput

type PrefixFilterListOutput struct {
	output.Output `json:"-" header:"-"`
	ID            int                           `json:"id"`
	Description   string                        `json:"description"`
	AddressFamily string                        `json:"address_family"`
	Entries       []PrefixFilterListEntryOutput `json:"entries"`
}

PrefixFilterListOutput represents the desired fields for JSON output.

func ToPrefixFilterListOutput

func ToPrefixFilterListOutput(prefixFilterList *megaport.MCRPrefixFilterList) (PrefixFilterListOutput, error)

ToPrefixFilterListOutput converts a *megaport.MCRPrefixFilterList to our PrefixFilterListOutput struct.

Jump to

Keyboard shortcuts

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