Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(v interface{}) *bool
- func String(v interface{}) *string
- func Uint64(v interface{}) *uint64
- func Uint64FromInt(v interface{}) *uint64
- type Client
- func (c *Client) CreateCloudVxc(v *CloudVxcCreateInput) (*string, error)
- func (c *Client) CreateMcr(v McrCreateInput) (*string, error)
- func (c *Client) CreatePort(v *PortCreateInput) (*string, error)
- func (c *Client) CreatePrivateVxc(v *PrivateVxcCreateInput) (*string, error)
- func (c *Client) DeleteMcr(uid string) error
- func (c *Client) DeletePort(uid string) error
- func (c *Client) DeleteVxc(uid string) error
- func (c *Client) GetInternetExchanges(locationId uint64) ([]*InternetExchange, error)
- func (c *Client) GetIxPrice(ixType string, locationId, speed uint64) (*MegaportCharges, error)
- func (c *Client) GetLocations() ([]*Location, error)
- func (c *Client) GetMcr(uid string) (*Product, error)
- func (c *Client) GetMcr1Price(locationId, speed uint64, productUid string) (*MegaportCharges, error)
- func (c *Client) GetMcr2Price(locationId, speed uint64, productUid string) (*MegaportCharges, error)
- func (c *Client) GetMegaportPrice(locationId, speed, term uint64, productUid string, buyoutPort bool) (*MegaportCharges, error)
- func (c *Client) GetMegaports() ([]*Megaport, error)
- func (c *Client) GetMegaportsForGcpPairingKey(pairingKey string) ([]*MegaportCloud, []uint64, error)
- func (c *Client) GetPort(uid string) (*Product, error)
- func (c *Client) GetPortVlanIdAvailable(uid string, vlanId uint64) (bool, error)
- func (c *Client) GetVxc(uid string) (*ProductAssociatedVxc, error)
- func (c *Client) GetVxcPrice(aLocationId, bLocationId, speed uint64) (*MegaportCharges, error)
- func (c *Client) IsResourceDeleted(provisioningStatus string) bool
- func (c *Client) ListMcrs() ([]*Product, error)
- func (c *Client) ListPorts() ([]*Product, error)
- func (c *Client) Login(username, password, otp string) error
- func (c *Client) Logout() error
- func (c *Client) UpdateCloudVxc(v *CloudVxcUpdateInput) error
- func (c *Client) UpdateMcr(v McrUpdateInput) error
- func (c *Client) UpdatePort(v *PortUpdateInput) error
- func (c *Client) UpdatePrivateVxc(v *PrivateVxcUpdateInput) error
- type CloudVxcCreateInput
- type CloudVxcUpdateInput
- type CspConnection
- type InternetExchange
- type InternetExchangeIPAddress
- type Location
- type LocationAddress
- type LocationProducts
- type Mcr1UpdateInput
- type Mcr2CreateInput
- type Mcr2UpdateInput
- type McrCreateInput
- type McrUpdateInput
- type Megaport
- type MegaportCharges
- type MegaportCloud
- type PartnerConfig
- type PartnerConfigAws
- type PartnerConfigGcp
- type PortCreateInput
- type PortUpdateInput
- type PrivateVxcCreateInput
- type PrivateVxcUpdateInput
- type Product
- type ProductAssociatedVxc
- type ProductAssociatedVxcApproval
- type ProductAssociatedVxcEnd
- type ProductAssociatedVxcResources
- type ProductAssociatedVxcResourcesCspConnectionAws
- type ProductAssociatedVxcResourcesCspConnectionGcp
- type ProductAssociatedVxcResourcesCspConnectionGcpMegaports
- type ProductAssociatedVxcResourcesCspConnectionVRouter
- type ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces
- type ProductResources
- type ProductResourcesInterface
- type ProductResourcesVLL
- type ProductResourcesVirtualRouter
Constants ¶
View Source
const ( EndpointProduction = "https://api.megaport.com" EndpointStaging = "https://api-staging.megaport.com" Version = "0.1" UserAgent = "megaport-api-go-client/" + Version ProductStatusCancelled = "CANCELLED" ProductStatusCancelledParent = "CANCELLED_PARENT" ProductStatusConfigured = "CONFIGURED" ProductStatusDecommissioned = "DECOMMISSIONED" ProductStatusDeployable = "DEPLOYABLE" ProductStatusLive = "LIVE" )
View Source
const ( ProductTypePort = "MEGAPORT" // Virtual = false, ProductType = MEGAPORT ProductTypeMcr1 = "MEGAPORT" // Virtual = true, ProductType = MEGAPORT ProductTypeMcr2 = "MCR2" // Virtual = false, ProductType = MCR2 ProductTypeVxc = "VXC" )
View Source
const ( VxcTypePrivate = "private" VxcTypeAws = "aws" VxcTypeGcp = "gcp" VxcTypePartner = "partner" )
View Source
const ( VxcConnectTypeAws = "AWS" VxcConnectTypeGoogle = "GOOGLE" VxcConnectTypeVRouter = "VROUTER" )
Variables ¶
View Source
var (
ErrNotFound = fmt.Errorf("megaport-api: not found")
)
Functions ¶
func Uint64FromInt ¶
func Uint64FromInt(v interface{}) *uint64
Types ¶
type Client ¶
type Client struct { BaseURL string Token string UserAgent string // contains filtered or unexported fields }
func (*Client) CreateCloudVxc ¶
func (c *Client) CreateCloudVxc(v *CloudVxcCreateInput) (*string, error)
func (*Client) CreatePort ¶
func (c *Client) CreatePort(v *PortCreateInput) (*string, error)
func (*Client) CreatePrivateVxc ¶
func (c *Client) CreatePrivateVxc(v *PrivateVxcCreateInput) (*string, error)
func (*Client) DeletePort ¶
func (*Client) GetInternetExchanges ¶
func (c *Client) GetInternetExchanges(locationId uint64) ([]*InternetExchange, error)
func (*Client) GetIxPrice ¶
func (c *Client) GetIxPrice(ixType string, locationId, speed uint64) (*MegaportCharges, error)
func (*Client) GetLocations ¶
func (*Client) GetMcr1Price ¶
func (c *Client) GetMcr1Price(locationId, speed uint64, productUid string) (*MegaportCharges, error)
func (*Client) GetMcr2Price ¶
func (c *Client) GetMcr2Price(locationId, speed uint64, productUid string) (*MegaportCharges, error)
func (*Client) GetMegaportPrice ¶
func (*Client) GetMegaports ¶
func (*Client) GetMegaportsForGcpPairingKey ¶
func (c *Client) GetMegaportsForGcpPairingKey(pairingKey string) ([]*MegaportCloud, []uint64, error)
func (*Client) GetPortVlanIdAvailable ¶
func (*Client) GetVxcPrice ¶
func (c *Client) GetVxcPrice(aLocationId, bLocationId, speed uint64) (*MegaportCharges, error)
func (*Client) IsResourceDeleted ¶
func (*Client) UpdateCloudVxc ¶
func (c *Client) UpdateCloudVxc(v *CloudVxcUpdateInput) error
func (*Client) UpdateMcr ¶
func (c *Client) UpdateMcr(v McrUpdateInput) error
func (*Client) UpdatePort ¶
func (c *Client) UpdatePort(v *PortUpdateInput) error
func (*Client) UpdatePrivateVxc ¶
func (c *Client) UpdatePrivateVxc(v *PrivateVxcUpdateInput) error
type CloudVxcCreateInput ¶
type CloudVxcUpdateInput ¶
type CspConnection ¶
type CspConnection interface {
// contains filtered or unexported methods
}
type InternetExchange ¶
type InternetExchange struct { ASN uint64 Description string ECIX bool GroupMetro string `json:"group_metro"` Name string NetworkRegion string `json:"network_region"` PrimaryIPv4 InternetExchangeIPAddress PrimaryIPv6 InternetExchangeIPAddress SecondaryIPv4 InternetExchangeIPAddress SecondaryIPv6 InternetExchangeIPAddress State string }
type Location ¶
type Location struct { Address LocationAddress Campus string Country string Id uint64 Latitude float64 LiveDate uint64 Longitude float64 Market string Metro string Name string NetworkRegion string Products LocationProducts SiteCode string Status string VRouterAvailable bool }
Location data
type LocationAddress ¶
type LocationAddress struct { City string Country string Postcode string State string Street string Suburb string }
Address data
type LocationProducts ¶
type Mcr1UpdateInput ¶
type Mcr2CreateInput ¶
type Mcr2UpdateInput ¶
type McrCreateInput ¶
type McrCreateInput interface {
// contains filtered or unexported methods
}
type McrUpdateInput ¶
type McrUpdateInput interface {
// contains filtered or unexported methods
}
type MegaportCharges ¶
type MegaportCharges struct { Currency string DailyRate float64 DailySetup float64 Empty bool FixedRecurringCharge float64 // ForceProductChange // TODO: haven't seen a value other than null HourlyRate float64 HourlySetup float64 // Key string // TODO: haven't seen a value other than "no key" LongHaulMbpsRate float64 MbpsRate float64 MonthlyRate float64 MonthlySetup float64 // PostPaidBaseRate // TODO: haven't seen a value other than "no base rate" ProductType string }
type MegaportCloud ¶
type MegaportCloud struct { CompanyName string CompanyId uint64 CompanyUid string Country string Description string LocationId uint64 Name string NServiceId uint64 Port uint64 PortSpeed uint64 ProductId uint64 ProductUid string State string // This refers to the geographical location Type string // Potentially only used for Oracle ports Vxc interface{} // TODO: what is the appropriate type? }
type PartnerConfig ¶
type PartnerConfig interface {
// contains filtered or unexported methods
}
type PartnerConfigAws ¶
type PartnerConfigGcp ¶
type PartnerConfigGcp struct {
PairingKey *string
}
type PortCreateInput ¶
type PortUpdateInput ¶
type PrivateVxcCreateInput ¶
type PrivateVxcUpdateInput ¶
type Product ¶
type Product struct { AdminLocked bool // AggregationId // TODO: haven't seen a value other than null // AssociatedIxs []ProductsAssociatedIx // TODO: haven't seen a value other than an empty list AssociatedVxcs []ProductAssociatedVxc // AttributeTags // TODO: haven't seen a value other than an empty map BuyoutPort bool Cancelable bool CompanyName string CompanyUid string ContractStartDate uint64 ContractEndDate uint64 ContractTermMonths uint64 CostCentre string CreateDate uint64 CreatedBy string // LagId // TODO: haven't seen a value other than null LagPrimary bool LiveDate uint64 LocationId uint64 Locked bool Market string MarketplaceVisibility bool PortSpeed uint64 ProductName string ProductType string ProductUid string ProvisioningStatus string Resources ProductResources // SecondaryName // TODO: haven't seen a value other than null // TerminateDate // TODO: haven't seen a value other than null // UsageAlgorithm // TODO: haven't seen a value other than null Virtual bool VxcPermitted bool VxcAutoApproval bool }
type ProductAssociatedVxc ¶
type ProductAssociatedVxc struct { AdminLocked bool // AttributeTags // TODO: haven't seen a value other than an empty map AEnd ProductAssociatedVxcEnd BEnd ProductAssociatedVxcEnd Cancelable bool ContractEndDate uint64 // TODO: haven't seen a value other than null, despite the note in https://dev.megaport.com/#general-get-product-list ContractStartDate uint64 // TODO: haven't seen a value other than null, despite the note in https://dev.megaport.com/#general-get-product-list ContractTermMonths uint64 CostCentre string CreatedBy string // TODO: haven't seen a value other than null CreateDate uint64 DistanceBand string Locked bool // NServiceId // TODO: haven't seen a value other than null ProductName string ProductType string ProductUid string ProvisioningStatus string RateLimit uint64 Resources ProductAssociatedVxcResources // TODO: not documented - is the struct here the same as in Product? SecondaryName string UsageAlgorithm string VxcApproval ProductAssociatedVxcApproval }
func (*ProductAssociatedVxc) Type ¶
func (v *ProductAssociatedVxc) Type() string
type ProductAssociatedVxcApproval ¶
type ProductAssociatedVxcApproval struct { }
type ProductAssociatedVxcEnd ¶
type ProductAssociatedVxcResources ¶
type ProductAssociatedVxcResources struct {
CspConnection []CspConnection `json:"-"`
}
func (*ProductAssociatedVxcResources) GetCspConnection ¶
func (pr *ProductAssociatedVxcResources) GetCspConnection(connectType string) CspConnection
func (*ProductAssociatedVxcResources) UnmarshalJSON ¶
func (pr *ProductAssociatedVxcResources) UnmarshalJSON(b []byte) (err error)
type ProductAssociatedVxcResourcesCspConnectionAws ¶
type ProductAssociatedVxcResourcesCspConnectionAws struct { Account string AmazonAsn uint64 `json:"-"` AmazonAddress string `json:"amazon_address"` AmazonIpAddress string // Amazon_Asn uint64 `json:"amazon_asn"` Asn uint64 `json:"-"` AuthKey string // Auth_key string `json:"Auth_key"` ConnectType string CustomerAddress string `json:"customer_address"` CustomerIpAddress string Id uint64 `json:"-"` Name string OwnerAccount string PeerAsn uint64 `json:"-"` Prefixes string ResourceName string `json:"Resource_name"` ResourceType string `json:"Resource_type"` Type string VifId string `json:"Vif_id"` Vlan uint64 `json:"-"` }
func (*ProductAssociatedVxcResourcesCspConnectionAws) UnmarshalJSON ¶
func (pr *ProductAssociatedVxcResourcesCspConnectionAws) UnmarshalJSON(b []byte) (err error)
type ProductAssociatedVxcResourcesCspConnectionGcp ¶
type ProductAssociatedVxcResourcesCspConnectionGcp struct { Bandwidth uint64 Bandwidths []uint64 ConnectType string CspName string `json:"csp_name"` Megaports []ProductAssociatedVxcResourcesCspConnectionGcpMegaports PairingKey string ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` }
type ProductAssociatedVxcResourcesCspConnectionVRouter ¶
type ProductAssociatedVxcResourcesCspConnectionVRouter struct { ConnectType string BGPPeers []string `json:"bgp_peers"` BGPStatus map[string]uint64 `json:"bgp_status"` IpAddresses []string `json:"ip_addresses"` Interfaces []ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` VirtualRouterId uint64 VirtualRouterName string Vlan uint64 }
type ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces ¶
type ProductAssociatedVxcResourcesCspConnectionVRouterInterfaces struct{}
type ProductResources ¶
type ProductResources struct { // CrossConnect ProductResourcesCrossConnect `json:"cross_connect"` // TODO: only referenced in https://dev.megaport.com/#general-get-product-list Interface ProductResourcesInterface VirtualRouter ProductResourcesVirtualRouter `json:"virtual_router"` VLL ProductResourcesVLL }
type ProductResourcesInterface ¶
type ProductResourcesInterface struct { Demarcation string Description string Id uint64 `json:"-"` LoaTemplate string `json:"loa_template"` Media string Name string PortSpeed uint64 `json:"-"` ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` // SupportedSpeeds []uint64 `json:"supported_speeds"` // TODO: only referenced in https://dev.megaport.com/#general-get-product-list Up uint64 `json:"-"` }
func (*ProductResourcesInterface) UnmarshalJSON ¶
func (pr *ProductResourcesInterface) UnmarshalJSON(b []byte) (err error)
type ProductResourcesVLL ¶
type ProductResourcesVLL struct { AVLan uint64 `json:"-"` BVLan uint64 `json:"-"` Description string Id uint64 `json:"-"` Name string RateLimit uint64 `json:"-"` ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` Up uint64 `json:"-"` }
func (*ProductResourcesVLL) UnmarshalJSON ¶
func (pr *ProductResourcesVLL) UnmarshalJSON(b []byte) (err error)
type ProductResourcesVirtualRouter ¶
type ProductResourcesVirtualRouter struct { Id uint64 `json:"-"` McrASN uint64 `json:"-"` Name string ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` Speed uint64 `json:"-"` }
func (*ProductResourcesVirtualRouter) UnmarshalJSON ¶
func (pr *ProductResourcesVirtualRouter) UnmarshalJSON(b []byte) (err error)
Click to show internal directories.
Click to hide internal directories.