Documentation
¶
Index ¶
- func AddCommandsTo(rootCmd *cobra.Command)
- func ApplyConfig(cmd *cobra.Command, _ []string, noColor bool, outputFormat string) error
- type ApplyResult
- type InfraConfig
- type MCRConfig
- type MVEConfig
- type MockMCRService
- func (m *MockMCRService) BuyMCR(ctx context.Context, req *megaport.BuyMCRRequest) (*megaport.BuyMCRResponse, error)
- func (m *MockMCRService) CreatePrefixFilterList(ctx context.Context, req *megaport.CreateMCRPrefixFilterListRequest) (*megaport.CreateMCRPrefixFilterListResponse, error)
- func (m *MockMCRService) DeleteMCR(ctx context.Context, req *megaport.DeleteMCRRequest) (*megaport.DeleteMCRResponse, error)
- func (m *MockMCRService) DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, id int) (*megaport.DeleteMCRPrefixFilterListResponse, error)
- func (m *MockMCRService) GetMCR(ctx context.Context, mcrId string) (*megaport.MCR, error)
- func (m *MockMCRService) GetMCRPrefixFilterList(ctx context.Context, mcrID string, id int) (*megaport.MCRPrefixFilterList, error)
- func (m *MockMCRService) GetMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*megaport.PrefixFilterList, error)
- func (m *MockMCRService) ListMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*megaport.PrefixFilterList, error)
- func (m *MockMCRService) ListMCRResourceTags(ctx context.Context, mcrID string) (map[string]string, error)
- func (m *MockMCRService) ListMCRs(ctx context.Context, req *megaport.ListMCRsRequest) ([]*megaport.MCR, error)
- func (m *MockMCRService) ModifyMCR(ctx context.Context, req *megaport.ModifyMCRRequest) (*megaport.ModifyMCRResponse, error)
- func (m *MockMCRService) ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, id int, list *megaport.MCRPrefixFilterList) (*megaport.ModifyMCRPrefixFilterListResponse, error)
- func (m *MockMCRService) RestoreMCR(ctx context.Context, mcrId string) (*megaport.RestoreMCRResponse, error)
- func (m *MockMCRService) UpdateMCRIPsecAddOn(ctx context.Context, mcrID string, addOnUID string, tunnelCount int) error
- func (m *MockMCRService) UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error
- func (m *MockMCRService) UpdateMCRWithAddOn(ctx context.Context, mcrID string, req megaport.MCRAddOnRequest) error
- func (m *MockMCRService) ValidateMCROrder(ctx context.Context, req *megaport.BuyMCRRequest) error
- func (m *MockMCRService) WaitForMCRReady(ctx context.Context, mcrID string, timeout time.Duration) error
- type MockMVEService
- func (m *MockMVEService) BuyMVE(ctx context.Context, req *megaport.BuyMVERequest) (*megaport.BuyMVEResponse, error)
- func (m *MockMVEService) DeleteMVE(ctx context.Context, req *megaport.DeleteMVERequest) (*megaport.DeleteMVEResponse, error)
- func (m *MockMVEService) GetMVE(ctx context.Context, mveId string) (*megaport.MVE, error)
- func (m *MockMVEService) ListAvailableMVESizes(ctx context.Context) ([]*megaport.MVESize, error)
- func (m *MockMVEService) ListMVEImages(ctx context.Context) ([]*megaport.MVEImage, error)
- func (m *MockMVEService) ListMVEResourceTags(ctx context.Context, mveID string) (map[string]string, error)
- func (m *MockMVEService) ListMVEs(ctx context.Context, req *megaport.ListMVEsRequest) ([]*megaport.MVE, error)
- func (m *MockMVEService) ModifyMVE(ctx context.Context, req *megaport.ModifyMVERequest) (*megaport.ModifyMVEResponse, error)
- func (m *MockMVEService) UpdateMVEResourceTags(ctx context.Context, mveID string, tags map[string]string) error
- func (m *MockMVEService) ValidateMVEOrder(ctx context.Context, req *megaport.BuyMVERequest) error
- type MockPortService
- func (m *MockPortService) BuyPort(ctx context.Context, req *megaport.BuyPortRequest) (*megaport.BuyPortResponse, error)
- func (m *MockPortService) CheckPortVLANAvailability(ctx context.Context, portId string, vlan int) (bool, error)
- func (m *MockPortService) DeletePort(ctx context.Context, req *megaport.DeletePortRequest) (*megaport.DeletePortResponse, error)
- func (m *MockPortService) GetPort(ctx context.Context, portId string) (*megaport.Port, error)
- func (m *MockPortService) ListPortResourceTags(ctx context.Context, portID string) (map[string]string, error)
- func (m *MockPortService) ListPorts(ctx context.Context) ([]*megaport.Port, error)
- func (m *MockPortService) LockPort(ctx context.Context, portId string) (*megaport.LockPortResponse, error)
- func (m *MockPortService) ModifyPort(ctx context.Context, req *megaport.ModifyPortRequest) (*megaport.ModifyPortResponse, error)
- func (m *MockPortService) RestorePort(ctx context.Context, portId string) (*megaport.RestorePortResponse, error)
- func (m *MockPortService) UnlockPort(ctx context.Context, portId string) (*megaport.UnlockPortResponse, error)
- func (m *MockPortService) UpdatePortResourceTags(ctx context.Context, portID string, tags map[string]string) error
- func (m *MockPortService) ValidatePortOrder(ctx context.Context, req *megaport.BuyPortRequest) error
- type MockVXCService
- func (m *MockVXCService) BuyVXC(ctx context.Context, req *megaport.BuyVXCRequest) (*megaport.BuyVXCResponse, error)
- func (m *MockVXCService) DeleteVXC(ctx context.Context, id string, req *megaport.DeleteVXCRequest) error
- func (m *MockVXCService) GetVXC(ctx context.Context, id string) (*megaport.VXC, error)
- func (m *MockVXCService) ListPartnerPorts(ctx context.Context, req *megaport.ListPartnerPortsRequest) (*megaport.ListPartnerPortsResponse, error)
- func (m *MockVXCService) ListVXCResourceTags(ctx context.Context, vxcID string) (map[string]string, error)
- func (m *MockVXCService) ListVXCs(ctx context.Context, req *megaport.ListVXCsRequest) ([]*megaport.VXC, error)
- func (m *MockVXCService) LookupPartnerPorts(ctx context.Context, req *megaport.LookupPartnerPortsRequest) (*megaport.LookupPartnerPortsResponse, error)
- func (m *MockVXCService) UpdateVXC(ctx context.Context, id string, req *megaport.UpdateVXCRequest) (*megaport.VXC, error)
- func (m *MockVXCService) UpdateVXCResourceTags(ctx context.Context, vxcID string, tags map[string]string) error
- func (m *MockVXCService) ValidateVXCOrder(ctx context.Context, req *megaport.BuyVXCRequest) error
- type Module
- type PortConfig
- type VXCConfig
- type VXCEndpointConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommandsTo ¶
AddCommandsTo builds the apply command and adds it to the root command.
Types ¶
type ApplyResult ¶
type ApplyResult struct {
output.Output `json:"-" header:"-"`
Type string `json:"type" header:"Type"`
Name string `json:"name" header:"Name"`
UID string `json:"uid" header:"UID"`
Status string `json:"status" header:"Status"`
}
ApplyResult records the outcome of provisioning a single resource.
type InfraConfig ¶
type InfraConfig struct {
Ports []PortConfig `yaml:"ports" json:"ports"`
MCRs []MCRConfig `yaml:"mcrs" json:"mcrs"`
MVEs []MVEConfig `yaml:"mves" json:"mves"`
VXCs []VXCConfig `yaml:"vxcs" json:"vxcs"`
}
InfraConfig is the top-level structure for a megaport apply config file.
type MCRConfig ¶
type MCRConfig struct {
Name string `yaml:"name" json:"name"`
LocationID int `yaml:"location_id" json:"location_id"`
Speed int `yaml:"speed" json:"speed"`
Term int `yaml:"term" json:"term"`
ASN int `yaml:"asn" json:"asn"`
DiversityZone string `yaml:"diversity_zone" json:"diversity_zone"`
CostCentre string `yaml:"cost_centre" json:"cost_centre"`
ResourceTags map[string]string `yaml:"resource_tags" json:"resource_tags"`
}
MCRConfig describes an MCR to provision.
type MVEConfig ¶
type MVEConfig struct {
Name string `yaml:"name" json:"name"`
LocationID int `yaml:"location_id" json:"location_id"`
Term int `yaml:"term" json:"term"`
VendorConfig map[string]interface{} `yaml:"vendor_config" json:"vendor_config"`
DiversityZone string `yaml:"diversity_zone" json:"diversity_zone"`
CostCentre string `yaml:"cost_centre" json:"cost_centre"`
ResourceTags map[string]string `yaml:"resource_tags" json:"resource_tags"`
}
MVEConfig describes an MVE to provision. VendorConfig holds vendor-specific fields (e.g. vendor, imageId, productSize).
type MockMCRService ¶
type MockMCRService struct {
BuyMCRResult *megaport.BuyMCRResponse
BuyMCRErr error
BuyMCRNilResp bool
ValidateMCROrderErr error
CapturedMCRRequest *megaport.BuyMCRRequest
WaitForMCRReadyDelay time.Duration
WaitForMCRReadyErr error
DeleteMCRErr error
DeleteMCRCalledWith []string
GetMCRStatus string // provisioning status returned by GetMCR (default ready)
GetMCRErr error // error returned by GetMCR (simulates a provision-wait failure)
}
MockMCRService implements megaport.MCRService for testing.
func (*MockMCRService) BuyMCR ¶
func (m *MockMCRService) BuyMCR(ctx context.Context, req *megaport.BuyMCRRequest) (*megaport.BuyMCRResponse, error)
func (*MockMCRService) CreatePrefixFilterList ¶
func (m *MockMCRService) CreatePrefixFilterList(ctx context.Context, req *megaport.CreateMCRPrefixFilterListRequest) (*megaport.CreateMCRPrefixFilterListResponse, error)
func (*MockMCRService) DeleteMCR ¶
func (m *MockMCRService) DeleteMCR(ctx context.Context, req *megaport.DeleteMCRRequest) (*megaport.DeleteMCRResponse, error)
func (*MockMCRService) DeleteMCRPrefixFilterList ¶
func (m *MockMCRService) DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, id int) (*megaport.DeleteMCRPrefixFilterListResponse, error)
func (*MockMCRService) GetMCRPrefixFilterList ¶
func (m *MockMCRService) GetMCRPrefixFilterList(ctx context.Context, mcrID string, id 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 (*MockMCRService) ListMCRs ¶
func (m *MockMCRService) ListMCRs(ctx context.Context, req *megaport.ListMCRsRequest) ([]*megaport.MCR, error)
func (*MockMCRService) ModifyMCR ¶
func (m *MockMCRService) ModifyMCR(ctx context.Context, req *megaport.ModifyMCRRequest) (*megaport.ModifyMCRResponse, error)
func (*MockMCRService) ModifyMCRPrefixFilterList ¶
func (m *MockMCRService) ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, id int, list *megaport.MCRPrefixFilterList) (*megaport.ModifyMCRPrefixFilterListResponse, error)
func (*MockMCRService) RestoreMCR ¶
func (m *MockMCRService) RestoreMCR(ctx context.Context, mcrId string) (*megaport.RestoreMCRResponse, error)
func (*MockMCRService) UpdateMCRIPsecAddOn ¶ added in v0.7.1
func (*MockMCRService) UpdateMCRResourceTags ¶
func (*MockMCRService) UpdateMCRWithAddOn ¶ added in v0.7.1
func (m *MockMCRService) UpdateMCRWithAddOn(ctx context.Context, mcrID string, req megaport.MCRAddOnRequest) error
func (*MockMCRService) ValidateMCROrder ¶
func (m *MockMCRService) ValidateMCROrder(ctx context.Context, req *megaport.BuyMCRRequest) error
func (*MockMCRService) WaitForMCRReady ¶ added in v0.9.2
type MockMVEService ¶
type MockMVEService struct {
BuyMVEResult *megaport.BuyMVEResponse
BuyMVEErr error
BuyMVENilResp bool
ValidateMVEOrderErr error
DeleteMVEErr error
DeleteMVECalledWith []string
GetMVEStatus string // provisioning status returned by GetMVE (default ready)
GetMVEErr error // error returned by GetMVE (simulates a provision-wait failure)
}
MockMVEService implements megaport.MVEService for testing.
func (*MockMVEService) BuyMVE ¶
func (m *MockMVEService) BuyMVE(ctx context.Context, req *megaport.BuyMVERequest) (*megaport.BuyMVEResponse, error)
func (*MockMVEService) DeleteMVE ¶
func (m *MockMVEService) DeleteMVE(ctx context.Context, req *megaport.DeleteMVERequest) (*megaport.DeleteMVEResponse, error)
func (*MockMVEService) ListAvailableMVESizes ¶
func (*MockMVEService) ListMVEImages ¶
func (*MockMVEService) ListMVEResourceTags ¶
func (*MockMVEService) ListMVEs ¶
func (m *MockMVEService) ListMVEs(ctx context.Context, req *megaport.ListMVEsRequest) ([]*megaport.MVE, error)
func (*MockMVEService) ModifyMVE ¶
func (m *MockMVEService) ModifyMVE(ctx context.Context, req *megaport.ModifyMVERequest) (*megaport.ModifyMVEResponse, error)
func (*MockMVEService) UpdateMVEResourceTags ¶
func (*MockMVEService) ValidateMVEOrder ¶
func (m *MockMVEService) ValidateMVEOrder(ctx context.Context, req *megaport.BuyMVERequest) error
type MockPortService ¶
type MockPortService struct {
BuyPortResult *megaport.BuyPortResponse
BuyPortErr error
BuyPortNilResp bool
ValidatePortOrderErr error
CapturedPortRequest *megaport.BuyPortRequest
DeletePortErr error
DeletePortCalledWith []string
GetPortStatus string // provisioning status returned by GetPort (default ready)
GetPortErr error // error returned by GetPort (simulates a provision-wait failure)
}
MockPortService implements megaport.PortService for testing.
func (*MockPortService) BuyPort ¶
func (m *MockPortService) BuyPort(ctx context.Context, req *megaport.BuyPortRequest) (*megaport.BuyPortResponse, error)
func (*MockPortService) CheckPortVLANAvailability ¶
func (*MockPortService) DeletePort ¶
func (m *MockPortService) DeletePort(ctx context.Context, req *megaport.DeletePortRequest) (*megaport.DeletePortResponse, error)
func (*MockPortService) ListPortResourceTags ¶
func (*MockPortService) LockPort ¶
func (m *MockPortService) LockPort(ctx context.Context, portId string) (*megaport.LockPortResponse, error)
func (*MockPortService) ModifyPort ¶
func (m *MockPortService) ModifyPort(ctx context.Context, req *megaport.ModifyPortRequest) (*megaport.ModifyPortResponse, error)
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 (*MockPortService) ValidatePortOrder ¶
func (m *MockPortService) ValidatePortOrder(ctx context.Context, req *megaport.BuyPortRequest) error
type MockVXCService ¶
type MockVXCService struct {
BuyVXCResult *megaport.BuyVXCResponse
BuyVXCErr error
BuyVXCErrOnCall int // if > 0, return BuyVXCErr only on this call number (1-based)
BuyVXCNilResp bool
ValidateVXCOrderErr error
CapturedVXCRequest *megaport.BuyVXCRequest
DeleteVXCErr error
DeleteVXCCalledWith []string
GetVXCStatus string // provisioning status returned by GetVXC (default ready)
GetVXCErr error // error returned by GetVXC (simulates a provision-wait failure)
// contains filtered or unexported fields
}
MockVXCService implements megaport.VXCService for testing.
func (*MockVXCService) BuyVXC ¶
func (m *MockVXCService) BuyVXC(ctx context.Context, req *megaport.BuyVXCRequest) (*megaport.BuyVXCResponse, error)
func (*MockVXCService) DeleteVXC ¶
func (m *MockVXCService) DeleteVXC(ctx context.Context, id string, req *megaport.DeleteVXCRequest) error
func (*MockVXCService) ListPartnerPorts ¶
func (m *MockVXCService) ListPartnerPorts(ctx context.Context, req *megaport.ListPartnerPortsRequest) (*megaport.ListPartnerPortsResponse, error)
func (*MockVXCService) ListVXCResourceTags ¶
func (*MockVXCService) ListVXCs ¶
func (m *MockVXCService) ListVXCs(ctx context.Context, req *megaport.ListVXCsRequest) ([]*megaport.VXC, error)
func (*MockVXCService) LookupPartnerPorts ¶
func (m *MockVXCService) LookupPartnerPorts(ctx context.Context, req *megaport.LookupPartnerPortsRequest) (*megaport.LookupPartnerPortsResponse, error)
func (*MockVXCService) UpdateVXC ¶
func (m *MockVXCService) UpdateVXC(ctx context.Context, id string, req *megaport.UpdateVXCRequest) (*megaport.VXC, error)
func (*MockVXCService) UpdateVXCResourceTags ¶
func (*MockVXCService) ValidateVXCOrder ¶
func (m *MockVXCService) ValidateVXCOrder(ctx context.Context, req *megaport.BuyVXCRequest) error
type Module ¶
type Module struct{}
Module implements registry.Module for the apply command.
func (*Module) RegisterCommands ¶
type PortConfig ¶
type PortConfig struct {
Name string `yaml:"name" json:"name"`
LocationID int `yaml:"location_id" json:"location_id"`
Speed int `yaml:"speed" json:"speed"`
Term int `yaml:"term" json:"term"`
MarketplaceVisibility bool `yaml:"marketplace_visibility" json:"marketplace_visibility"`
DiversityZone string `yaml:"diversity_zone" json:"diversity_zone"`
CostCentre string `yaml:"cost_centre" json:"cost_centre"`
ResourceTags map[string]string `yaml:"resource_tags" json:"resource_tags"`
}
PortConfig describes a port to provision.
type VXCConfig ¶
type VXCConfig struct {
Name string `yaml:"name" json:"name"`
RateLimit int `yaml:"rate_limit" json:"rate_limit"`
Term int `yaml:"term" json:"term"`
AEnd VXCEndpointConfig `yaml:"a_end" json:"a_end"`
BEnd VXCEndpointConfig `yaml:"b_end" json:"b_end"`
CostCentre string `yaml:"cost_centre" json:"cost_centre"`
ResourceTags map[string]string `yaml:"resource_tags" json:"resource_tags"`
}
VXCConfig describes a VXC to provision.
type VXCEndpointConfig ¶
type VXCEndpointConfig struct {
ProductUID string `yaml:"product_uid" json:"product_uid"`
VLAN int `yaml:"vlan" json:"vlan"`
}
VXCEndpointConfig describes one end of a VXC connection.