Documentation
¶
Overview ¶
Package megaport holds the Megaport Go Library. It allows users to orchestrate the creation of Megaport Services.
Before using this library, please ensure you read Megaport's Terms and Conditions.
The Megaport API Documentation is also available online.
Example ¶
Create a new client using your credentials and interact with the Megaport API
package main
import (
"context"
"fmt"
megaport "github.com/megaport/megaportgo"
)
func main() {
// Creates a new client using the default HTTP cleint with the specified credentials against the staging environment
client, err := megaport.New(nil,
megaport.WithCredentials("ACCESS_KEY", "SECRET_KEY"),
megaport.WithEnvironment(megaport.EnvironmentStaging),
)
if err != nil {
// ...
}
// Authorize the client using the client's credentials
authInfo, err := client.Authorize(context.TODO())
if err != nil {
// ...
}
fmt.Println(authInfo.AccessToken)
fmt.Println(authInfo.Expiration) // You can use the expiration here to reauthorize the client when your access token expires
// After you have authorized you can interact with the API
locations, err := client.LocationService.ListLocations(context.TODO())
if err != nil {
// ...
}
for _, location := range locations {
fmt.Println(location.Name)
}
}
Output:
Example (Logger) ¶
Example with a custom logger
package main
import (
"context"
"log/slog"
"os"
megaport "github.com/megaport/megaportgo"
)
func main() {
// A handler that logs JSON logs to stdout but only errors
handler := slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelError,
})
// Create a new client with your custom log handler
client, err := megaport.New(nil,
megaport.WithCredentials("ACCESS_KEY", "SECRET_KEY"),
megaport.WithEnvironment(megaport.EnvironmentStaging),
megaport.WithLogHandler(handler),
)
if err != nil {
// ...
}
client.Logger.ErrorContext(context.Background(), "testing") // will print
client.Logger.InfoContext(context.Background(), "testing") // won't print
}
Output:
Index ¶
- Constants
- Variables
- func CheckResponse(r *http.Response) error
- func DoRequest(ctx context.Context, req *http.Request) (*http.Response, error)
- func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func IsServiceNotFoundError(err error) bool
- func PtrTo[T any](v T) *T
- type APIMCRPrefixFilterList
- type APIMCRPrefixFilterListEntry
- type AWSVXCOrder
- type AWSVXCOrderConfiguration
- type ArubaConfig
- type AssociatedIXOrder
- type AsyncBGPNeighborRoutesData
- type AsyncIPRoutesData
- type AuthInfo
- type AviatrixConfig
- type BGPSessionStatus
- type BfdConfig
- type BgpConnectionConfig
- type BillingMarket
- type BillingMarketService
- type BillingMarketServiceOp
- type BuyIXRequest
- type BuyIXResponse
- type BuyMCRRequest
- type BuyMCRResponse
- type BuyMVERequest
- type BuyMVEResponse
- type BuyPortRequest
- type BuyPortResponse
- type BuyVXCRequest
- type BuyVXCResponse
- type CSPConnection
- type CSPConnectionAWS
- type CSPConnectionAWSHC
- type CSPConnectionAzure
- type CSPConnectionAzureMegaport
- type CSPConnectionAzurePeeringConfig
- type CSPConnectionAzurePort
- type CSPConnectionConfig
- type CSPConnectionGoogle
- type CSPConnectionGoogleMegaport
- type CSPConnectionGooglePort
- type CSPConnectionIBM
- type CSPConnectionOracle
- type CSPConnectionOracleMegaport
- type CSPConnectionOraclePort
- type CSPConnectionOther
- type CSPConnectionTransit
- type CSPConnectionVirtualRouter
- type CSPConnectionVirtualRouterInterface
- type CiscoConfig
- type Client
- func (c *Client) Authorize(ctx context.Context) (*AuthInfo, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*http.Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any) (*http.Request, error)
- func (c *Client) SetAccessToken(token string, expiry time.Time)
- func (c *Client) SetOnRequestCompleted(rc RequestCompletionCallback)
- func (c *Client) SetTokenProvider(tp TokenProvider)
- type ClientOpt
- func WithAccessToken(token string, expiry time.Time) ClientOpt
- func WithBaseURL(bu string) ClientOpt
- func WithCallContext(companyUID string) ClientOpt
- func WithCredentials(accessKey, secretKey string) ClientOpt
- func WithCustomHeaders(headers map[string]string) ClientOpt
- func WithEnvironment(e Environment) ClientOpt
- func WithLogHandler(h slog.Handler) ClientOpt
- func WithLogResponseBody() ClientOpt
- func WithTokenProvider(tp TokenProvider) ClientOpt
- func WithTokenURL(tokenURL string) ClientOpt
- func WithUserAgent(ua string) ClientOpt
- type CompanyEnablement
- type Country
- type CreateMCRPrefixFilterListRequest
- type CreateMCRPrefixFilterListResponse
- type CreateNATGatewayRequest
- type CreateServiceKeyAPIResponse
- type CreateServiceKeyAPIResponseData
- type CreateServiceKeyRequest
- type CreateServiceKeyResponse
- type CreateUserRequest
- type CreateUserResponse
- type DeleteIXRequest
- type DeleteMCRPrefixFilterListResponse
- type DeleteMCRRequest
- type DeleteMCRResponse
- type DeleteMVERequest
- type DeleteMVEResponse
- type DeleteNATGatewayResponse
- type DeletePortRequest
- type DeletePortResponse
- type DeleteProductRequest
- type DeleteProductResponse
- type DeleteVXCRequest
- type DeleteVXCResponse
- type DiscountDetails
- type DiscountReason
- type Environment
- type ErrorResponse
- type EventsService
- type EventsServiceOp
- type FortinetConfig
- type GetNATGatewayTelemetryRequest
- type GetPortRequest
- type GetProductPricingRequest
- type GetServiceKeyAPIResponse
- type GetUserActivityRequest
- type IPAddressPriceBookRequest
- type IPsecTunnelConfig
- type IX
- type IXBGPConnection
- type IXIPAddress
- type IXInterface
- type IXLocationDetail
- type IXOrder
- type IXP
- type IXPriceBookRequest
- type IXResources
- type IXService
- type IXServiceOp
- func (svc *IXServiceOp) BuyIX(ctx context.Context, req *BuyIXRequest) (*BuyIXResponse, error)
- func (svc *IXServiceOp) DeleteIX(ctx context.Context, id string, req *DeleteIXRequest) error
- func (svc *IXServiceOp) GetIX(ctx context.Context, id string) (*IX, error)
- func (svc *IXServiceOp) ListIXPs(ctx context.Context, req *ListIXPsRequest) ([]*IXP, error)
- func (svc *IXServiceOp) ListIXs(ctx context.Context, req *ListIXsRequest) ([]*IX, error)
- func (svc *IXServiceOp) UpdateIX(ctx context.Context, id string, req *UpdateIXRequest) (*IX, error)
- func (svc *IXServiceOp) ValidateIXOrder(ctx context.Context, req *BuyIXRequest) error
- type IXUpdate
- type IXVPLSInterface
- type IpRoute
- type LevelFilterHandler
- type ListBGPNeighborRoutesRequest
- type ListBGPRoutesRequest
- type ListBGPSessionsRequest
- type ListIPRoutesRequest
- type ListIXPsRequest
- type ListIXsRequest
- type ListLocationsV3Options
- type ListMCRsRequest
- type ListMVEsRequest
- type ListOrderApprovalsAPIResponse
- type ListOrderApprovalsRequest
- type ListOrderApprovalsResponse
- type ListPartnerPortsRequest
- type ListPartnerPortsResponse
- type ListServiceKeysAPIResponse
- type ListServiceKeysRequest
- type ListServiceKeysResponse
- type ListVXCsRequest
- type Locationdeprecated
- type LocationMVEdeprecated
- type LocationMVEDetailsdeprecated
- type LocationProductKind
- type LocationProductsdeprecated
- type LocationService
- type LocationServiceOp
- func (svc *LocationServiceOp) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error)deprecated
- func (svc *LocationServiceOp) FilterLocationsByMarketCodeV3(ctx context.Context, marketCode string, locations []*LocationV3) ([]*LocationV3, error)
- func (svc *LocationServiceOp) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*Location) []*Locationdeprecated
- func (svc *LocationServiceOp) FilterLocationsByMcrAvailabilityV3(ctx context.Context, mcrAvailable bool, locations []*LocationV3) []*LocationV3
- func (svc *LocationServiceOp) FilterLocationsByMetroV3(ctx context.Context, metro string, locations []*LocationV3) []*LocationV3
- func (svc *LocationServiceOp) FilterLocationsByNATGatewaySpeedV3(ctx context.Context, speedMbps int, locations []*LocationV3) []*LocationV3
- func (svc *LocationServiceOp) GetLocationByID(ctx context.Context, locationID int) (*Location, error)deprecated
- func (svc *LocationServiceOp) GetLocationByIDV3(ctx context.Context, locationID int) (*LocationV3, error)
- func (svc *LocationServiceOp) GetLocationByName(ctx context.Context, locationName string) (*Location, error)deprecated
- func (svc *LocationServiceOp) GetLocationByNameFuzzy(ctx context.Context, search string) ([]*Location, error)deprecated
- func (svc *LocationServiceOp) GetLocationByNameFuzzyV3(ctx context.Context, search string) ([]*LocationV3, error)
- func (svc *LocationServiceOp) GetLocationByNameV3(ctx context.Context, locationName string) (*LocationV3, error)
- func (svc *LocationServiceOp) GetRoundTripTimes(ctx context.Context, srcLocation, year, month int) ([]*RoundTripTime, error)
- func (svc *LocationServiceOp) IsValidMarketCode(ctx context.Context, marketCode string) (bool, error)
- func (svc *LocationServiceOp) ListCountries(ctx context.Context) ([]*Country, error)
- func (svc *LocationServiceOp) ListLocations(ctx context.Context) ([]*Location, error)deprecated
- func (svc *LocationServiceOp) ListLocationsV3(ctx context.Context) ([]*LocationV3, error)
- func (svc *LocationServiceOp) ListLocationsV3WithOptions(ctx context.Context, opts *ListLocationsV3Options) ([]*LocationV3, error)
- func (svc *LocationServiceOp) ListMarketCodes(ctx context.Context) ([]string, error)
- type LocationV3
- func (l *LocationV3) GetCountry() string
- func (l *LocationV3) GetCrossConnectType() string
- func (l *LocationV3) GetDataCenterID() int
- func (l *LocationV3) GetDataCenterName() string
- func (l *LocationV3) GetMCRSpeeds() []int
- func (l *LocationV3) GetMVEMaxCpuCores() *int
- func (l *LocationV3) GetMegaportSpeeds() []int
- func (l *LocationV3) GetNATGatewaySpeeds() []int
- func (l *LocationV3) HasCrossConnectSupport() bool
- func (l *LocationV3) HasMCRSupport() bool
- func (l *LocationV3) HasMVESupport() bool
- func (l *LocationV3) HasNATGatewaySupport() bool
- func (l *LocationV3) IsOrderable(product LocationProductKind) bool
- func (l *LocationV3) IsStatusOrderable() bool
- func (l *LocationV3) SupportsNATGatewaySpeed(speedMbps int) bool
- func (l *LocationV3) ToLegacyLocation() *Location
- type LocationV3Address
- type LocationV3CrossConnect
- type LocationV3DataCentre
- type LocationV3DiversityZone
- type LocationV3DiversityZones
- type LocationV3ProductAddOns
- type LockPortRequest
- type LockPortResponse
- type LookingGlassAsyncBGPNeighborRoutesResponse
- type LookingGlassAsyncIPRoutesResponse
- type LookingGlassAsyncJob
- type LookingGlassAsyncJobResponse
- type LookingGlassAsyncStatus
- type LookingGlassBGPNeighborRoute
- type LookingGlassBGPNeighborRoutesResponse
- type LookingGlassBGPRoute
- type LookingGlassBGPRoutesResponse
- type LookingGlassBGPSession
- type LookingGlassBGPSessionsResponse
- type LookingGlassIPRoute
- type LookingGlassIPRoutesResponse
- type LookingGlassPingResult
- type LookingGlassPingStatistics
- type LookingGlassRouteDirection
- type LookingGlassTracerouteHop
- type LookingGlassTracerouteProbe
- type LookingGlassTracerouteResult
- type LookupPartnerPortsRequest
- type LookupPartnerPortsResponse
- type MCR
- type MCRAddOn
- type MCRAddOnIPsecConfig
- type MCRAddOnRequest
- type MCRLookingGlassService
- type MCRLookingGlassServiceOp
- func (svc *MCRLookingGlassServiceOp) GetAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncBGPNeighborRoutesData, error)
- func (svc *MCRLookingGlassServiceOp) GetAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncIPRoutesData, error)
- func (svc *MCRLookingGlassServiceOp) GetMCRPingResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
- func (svc *MCRLookingGlassServiceOp) GetMCRTracerouteResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
- func (svc *MCRLookingGlassServiceOp) ListBGPNeighborRoutes(ctx context.Context, req *ListBGPNeighborRoutesRequest) ([]*LookingGlassBGPNeighborRoute, error)
- func (svc *MCRLookingGlassServiceOp) ListBGPNeighborRoutesAsync(ctx context.Context, req *ListBGPNeighborRoutesRequest) (*LookingGlassAsyncJob, error)
- func (svc *MCRLookingGlassServiceOp) ListBGPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassBGPRoute, error)
- func (svc *MCRLookingGlassServiceOp) ListBGPRoutesWithFilter(ctx context.Context, req *ListBGPRoutesRequest) ([]*LookingGlassBGPRoute, error)
- func (svc *MCRLookingGlassServiceOp) ListBGPSessions(ctx context.Context, mcrUID string) ([]*LookingGlassBGPSession, error)
- func (svc *MCRLookingGlassServiceOp) ListIPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassIPRoute, error)
- func (svc *MCRLookingGlassServiceOp) ListIPRoutesAsync(ctx context.Context, mcrUID string) (*LookingGlassAsyncJob, error)
- func (svc *MCRLookingGlassServiceOp) ListIPRoutesWithFilter(ctx context.Context, req *ListIPRoutesRequest) ([]*LookingGlassIPRoute, error)
- func (svc *MCRLookingGlassServiceOp) PingMCR(ctx context.Context, req *MCRPingRequest) (string, error)
- func (svc *MCRLookingGlassServiceOp) TracerouteMCR(ctx context.Context, req *MCRTracerouteRequest) (string, error)
- func (svc *MCRLookingGlassServiceOp) WaitForAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassBGPNeighborRoute, error)
- func (svc *MCRLookingGlassServiceOp) WaitForAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassIPRoute, error)
- func (svc *MCRLookingGlassServiceOp) WaitForMCRPing(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
- func (svc *MCRLookingGlassServiceOp) WaitForMCRTraceroute(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
- type MCROrder
- type MCROrderConfig
- type MCROrderConfirmation
- type MCRPingRequest
- type MCRPrefixFilterList
- type MCRPrefixListEntry
- type MCRPriceBookRequest
- type MCRResources
- type MCRService
- type MCRServiceOp
- func (svc *MCRServiceOp) BuyMCR(ctx context.Context, req *BuyMCRRequest) (*BuyMCRResponse, error)
- func (svc *MCRServiceOp) CreatePrefixFilterList(ctx context.Context, req *CreateMCRPrefixFilterListRequest) (*CreateMCRPrefixFilterListResponse, error)
- func (svc *MCRServiceOp) DeleteMCR(ctx context.Context, req *DeleteMCRRequest) (*DeleteMCRResponse, error)
- func (svc *MCRServiceOp) DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*DeleteMCRPrefixFilterListResponse, error)
- func (svc *MCRServiceOp) GetMCR(ctx context.Context, mcrId string) (*MCR, error)
- func (svc *MCRServiceOp) GetMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*MCRPrefixFilterList, error)
- func (svc *MCRServiceOp) GetMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)deprecated
- func (svc *MCRServiceOp) ListMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
- func (svc *MCRServiceOp) ListMCRResourceTags(ctx context.Context, mcrID string) (map[string]string, error)
- func (svc *MCRServiceOp) ListMCRs(ctx context.Context, req *ListMCRsRequest) ([]*MCR, error)
- func (svc *MCRServiceOp) ModifyMCR(ctx context.Context, req *ModifyMCRRequest) (*ModifyMCRResponse, error)
- func (svc *MCRServiceOp) ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int, ...) (*ModifyMCRPrefixFilterListResponse, error)
- func (svc *MCRServiceOp) RestoreMCR(ctx context.Context, mcrId string) (*RestoreMCRResponse, error)
- func (svc *MCRServiceOp) UpdateMCRIPsecAddOn(ctx context.Context, mcrID string, addOnUID string, tunnelCount int) error
- func (svc *MCRServiceOp) UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error
- func (svc *MCRServiceOp) UpdateMCRWithAddOn(ctx context.Context, mcrID string, req MCRAddOnRequest) error
- func (svc *MCRServiceOp) ValidateMCROrder(ctx context.Context, req *BuyMCRRequest) error
- func (svc *MCRServiceOp) WaitForMCRReady(ctx context.Context, mcrID string, timeout time.Duration) error
- type MCRTracerouteRequest
- type MCRVirtualRouter
- type MVE
- type MVEConfig
- type MVEImage
- type MVEImageAPIResponsedeprecated
- type MVEImageAPIResponseDatadeprecated
- type MVEImageAPIResponseDataV4
- type MVEImageAPIResponseV4
- type MVEImageProduct
- type MVEImageVersion
- type MVEInstanceSize
- type MVENetworkInterface
- type MVEOrderConfig
- type MVEOrderConfirmation
- type MVEPriceBookRequest
- type MVEResources
- type MVEService
- type MVEServiceOp
- func (svc *MVEServiceOp) BuyMVE(ctx context.Context, req *BuyMVERequest) (*BuyMVEResponse, error)
- func (svc *MVEServiceOp) DeleteMVE(ctx context.Context, req *DeleteMVERequest) (*DeleteMVEResponse, error)
- func (svc *MVEServiceOp) GetMVE(ctx context.Context, mveId string) (*MVE, error)
- func (svc *MVEServiceOp) ListAvailableMVESizes(ctx context.Context) ([]*MVESize, error)
- func (svc *MVEServiceOp) ListMVEImages(ctx context.Context) ([]*MVEImage, error)
- func (svc *MVEServiceOp) ListMVEResourceTags(ctx context.Context, mveID string) (map[string]string, error)
- func (svc *MVEServiceOp) ListMVEs(ctx context.Context, req *ListMVEsRequest) ([]*MVE, error)
- func (svc *MVEServiceOp) ModifyMVE(ctx context.Context, req *ModifyMVERequest) (*ModifyMVEResponse, error)
- func (svc *MVEServiceOp) UpdateMVEResourceTags(ctx context.Context, mveID string, tags map[string]string) error
- func (svc *MVEServiceOp) ValidateMVEOrder(ctx context.Context, req *BuyMVERequest) error
- type MVESize
- type MVEVirtualMachine
- type MVEVirtualMachineImage
- type MVEVnicUpdate
- type MaintenanceEvent
- type MaintenanceState
- type ManageProductLockRequest
- type ManageProductLockResponse
- type ManagedAccount
- type ManagedAccountRequest
- type ManagedAccountService
- type ManagedAccountServiceOp
- func (svc *ManagedAccountServiceOp) CreateManagedAccount(ctx context.Context, req *ManagedAccountRequest) (*ManagedAccount, error)
- func (svc *ManagedAccountServiceOp) GetManagedAccount(ctx context.Context, companyUID string, managedAccountName string) (*ManagedAccount, error)
- func (svc *ManagedAccountServiceOp) ListManagedAccounts(ctx context.Context) ([]*ManagedAccount, error)
- func (svc *ManagedAccountServiceOp) UpdateManagedAccount(ctx context.Context, companyUID string, req *ManagedAccountRequest) (*ManagedAccount, error)
- type Market
- type MegaportPriceBookRequest
- type MerakiConfig
- type ModifyMCRPrefixFilterListResponse
- type ModifyMCRRequest
- type ModifyMCRResponse
- type ModifyMVERequest
- type ModifyMVEResponse
- type ModifyPortRequest
- type ModifyPortResponse
- type ModifyProductRequest
- type ModifyProductResponse
- type NATGateway
- type NATGatewayBGPNeighborRoutesRequest
- type NATGatewayBGPRoute
- type NATGatewayBuyResult
- type NATGatewayIPRoute
- type NATGatewayListResponse
- type NATGatewayNetworkConfig
- type NATGatewayOrderPrice
- type NATGatewayPacketFilter
- type NATGatewayPacketFilterEntry
- type NATGatewayPacketFilterRequest
- type NATGatewayPacketFilterSummary
- type NATGatewayPrefixList
- type NATGatewayPrefixListEntry
- type NATGatewayPrefixListSummary
- type NATGatewayPriceBookRequest
- type NATGatewayResponse
- type NATGatewayRoute
- type NATGatewayRouteNextHop
- type NATGatewayRouteVXCRef
- type NATGatewayService
- type NATGatewayServiceOp
- func (svc *NATGatewayServiceOp) BuyNATGateway(ctx context.Context, productUID string) (*NATGatewayBuyResult, error)
- func (svc *NATGatewayServiceOp) CreateNATGateway(ctx context.Context, req *CreateNATGatewayRequest) (*NATGateway, error)
- func (svc *NATGatewayServiceOp) CreateNATGatewayPacketFilter(ctx context.Context, productUID string, req *NATGatewayPacketFilterRequest) (*NATGatewayPacketFilter, error)
- func (svc *NATGatewayServiceOp) CreateNATGatewayPrefixList(ctx context.Context, productUID string, req *NATGatewayPrefixList) (*NATGatewayPrefixList, error)
- func (svc *NATGatewayServiceOp) DeleteNATGateway(ctx context.Context, productUID string) error
- func (svc *NATGatewayServiceOp) DeleteNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) error
- func (svc *NATGatewayServiceOp) DeleteNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) error
- func (svc *NATGatewayServiceOp) GetNATGateway(ctx context.Context, productUID string) (*NATGateway, error)
- func (svc *NATGatewayServiceOp) GetNATGatewayDiagnosticsRoutes(ctx context.Context, productUID, operationID string) ([]*NATGatewayRoute, error)
- func (svc *NATGatewayServiceOp) GetNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) (*NATGatewayPacketFilter, error)
- func (svc *NATGatewayServiceOp) GetNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) (*NATGatewayPrefixList, error)
- func (svc *NATGatewayServiceOp) GetNATGatewayTelemetry(ctx context.Context, req *GetNATGatewayTelemetryRequest) (*ServiceTelemetryResponse, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutes(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) ([]*NATGatewayBGPRoute, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutesAsync(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) (string, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayBGPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayBGPRoute, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayBGPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayIPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayIPRoute, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayIPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayPacketFilters(ctx context.Context, productUID string) ([]*NATGatewayPacketFilterSummary, error)
- func (svc *NATGatewayServiceOp) ListNATGatewayPrefixLists(ctx context.Context, productUID string) ([]*NATGatewayPrefixListSummary, error)
- func (svc *NATGatewayServiceOp) ListNATGatewaySessions(ctx context.Context) ([]*NATGatewaySession, error)
- func (svc *NATGatewayServiceOp) ListNATGateways(ctx context.Context) ([]*NATGateway, error)
- func (svc *NATGatewayServiceOp) UpdateNATGateway(ctx context.Context, req *UpdateNATGatewayRequest) (*NATGateway, error)
- func (svc *NATGatewayServiceOp) UpdateNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int, ...) (*NATGatewayPacketFilter, error)
- func (svc *NATGatewayServiceOp) UpdateNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int, ...) (*NATGatewayPrefixList, error)
- func (svc *NATGatewayServiceOp) ValidateNATGatewayOrder(ctx context.Context, productUID string) (*NATGatewayValidateResult, error)
- type NATGatewaySession
- type NATGatewaySessionsResponse
- type NATGatewaySpeedSessionResult
- type NATGatewayValidateResult
- type OrderApproval
- type OrderApprovalActionRequest
- type OrderApprovalService
- type OrderApprovalServiceOp
- func (svc *OrderApprovalServiceOp) ApproveOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
- func (svc *OrderApprovalServiceOp) ListOrderApprovals(ctx context.Context, req *ListOrderApprovalsRequest) (*ListOrderApprovalsResponse, error)
- func (svc *OrderApprovalServiceOp) RejectOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
- func (svc *OrderApprovalServiceOp) WithdrawOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
- type OrderApprovalStatus
- type OrderApprovalType
- type OrderValidFor
- type OutageEvent
- type OutageState
- type PaloAltoConfig
- type PartnerConfigInterface
- type PartnerLookup
- type PartnerLookupItem
- type PartnerMegaport
- type PartnerOrder
- type PartnerOrderAzurePeeringConfig
- type PartnerOrderContents
- type PartnerService
- type PartnerServiceOp
- func (svc *PartnerServiceOp) FilterPartnerMegaportByCompanyName(ctx context.Context, partners []*PartnerMegaport, companyName string, ...) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) FilterPartnerMegaportByConnectType(ctx context.Context, partners []*PartnerMegaport, connectType string, ...) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) FilterPartnerMegaportByDiversityZone(ctx context.Context, partners []*PartnerMegaport, diversityZone string) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) FilterPartnerMegaportByLocationId(ctx context.Context, partners []*PartnerMegaport, locationId int) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) FilterPartnerMegaportByMetro(ctx context.Context, partners []*PartnerMegaport, metro string) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) FilterPartnerMegaportByProductName(ctx context.Context, partners []*PartnerMegaport, productName string, ...) ([]*PartnerMegaport, error)
- func (svc *PartnerServiceOp) ListPartnerMegaports(ctx context.Context) ([]*PartnerMegaport, error)
- type Peer
- type Port
- type PortAttributeTags
- type PortInterface
- type PortOrder
- type PortOrderConfig
- type PortOrderConfirmation
- type PortOrderResponse
- type PortResources
- type PortResourcesInterface
- type PortResponse
- type PortService
- type PortServiceOp
- func (svc *PortServiceOp) BuyPort(ctx context.Context, req *BuyPortRequest) (*BuyPortResponse, error)
- func (svc *PortServiceOp) CheckPortVLANAvailability(ctx context.Context, portId string, vlan int) (bool, error)
- func (svc *PortServiceOp) DeletePort(ctx context.Context, req *DeletePortRequest) (*DeletePortResponse, error)
- func (svc *PortServiceOp) GetPort(ctx context.Context, portId string) (*Port, error)
- func (svc *PortServiceOp) ListPortResourceTags(ctx context.Context, portID string) (map[string]string, error)
- func (svc *PortServiceOp) ListPorts(ctx context.Context) ([]*Port, error)
- func (svc *PortServiceOp) LockPort(ctx context.Context, portId string) (*LockPortResponse, error)
- func (svc *PortServiceOp) ModifyPort(ctx context.Context, req *ModifyPortRequest) (*ModifyPortResponse, error)
- func (svc *PortServiceOp) RestorePort(ctx context.Context, portId string) (*RestorePortResponse, error)
- func (svc *PortServiceOp) UnlockPort(ctx context.Context, portId string) (*UnlockPortResponse, error)
- func (svc *PortServiceOp) UpdatePortResourceTags(ctx context.Context, portID string, tags map[string]string) error
- func (svc *PortServiceOp) ValidatePortOrder(ctx context.Context, req *BuyPortRequest) error
- type PortTerminatedServiceDetails
- type PortTerminatedServiceDetailsInterface
- type PortTerminatedServiceDetailsLocation
- type PortVLANAvailabilityAPIResponse
- type PrefixFilterList
- type PriceBookChargeReason
- type PriceBookDTO
- type PriceBookDiscountElement
- type PriceBookPriceElement
- type PriceBookRequest
- type PricingFrequency
- type PrismaConfig
- type Product
- type ProductAddOnPriceBookRequest
- type ProductLocationDetails
- type ProductService
- type ProductServiceOp
- func (svc *ProductServiceOp) DeleteProduct(ctx context.Context, req *DeleteProductRequest) (*DeleteProductResponse, error)
- func (svc *ProductServiceOp) ExecuteOrder(ctx context.Context, requestBody interface{}) (*[]byte, error)
- func (svc *ProductServiceOp) GetProductPricing(ctx context.Context, req PriceBookRequest) (*PriceBookDTO, error)
- func (svc *ProductServiceOp) GetProductPricingForCompany(ctx context.Context, pricingReq *GetProductPricingRequest) (*PriceBookDTO, error)
- func (svc *ProductServiceOp) GetProductType(ctx context.Context, productUID string) (string, error)
- func (svc *ProductServiceOp) ListProductResourceTags(ctx context.Context, productUID string) ([]ResourceTag, error)
- func (svc *ProductServiceOp) ListProducts(ctx context.Context) ([]Product, error)
- func (svc *ProductServiceOp) ManageProductLock(ctx context.Context, req *ManageProductLockRequest) (*ManageProductLockResponse, error)
- func (svc *ProductServiceOp) ModifyProduct(ctx context.Context, req *ModifyProductRequest) (*ModifyProductResponse, error)
- func (svc *ProductServiceOp) RestoreProduct(ctx context.Context, productId string) (*RestoreProductResponse, error)
- func (svc *ProductServiceOp) UpdateProductResourceTags(ctx context.Context, productUID string, ...) error
- func (svc *ProductServiceOp) ValidateProductOrder(ctx context.Context, requestBody interface{}) error
- type RequestCompletionCallback
- type ResourceTag
- type RestoreMCRResponse
- type RestorePortRequest
- type RestorePortResponse
- type RestoreProductRequest
- type RestoreProductResponse
- type RoundTripTime
- type RoundTripTimeResponse
- type RouteProtocol
- type ServiceKey
- type ServiceKeyService
- type ServiceKeyServiceOp
- func (svc *ServiceKeyServiceOp) CreateServiceKey(ctx context.Context, req *CreateServiceKeyRequest) (*CreateServiceKeyResponse, error)
- func (svc *ServiceKeyServiceOp) GetServiceKey(ctx context.Context, keyId string) (*ServiceKey, error)
- func (svc *ServiceKeyServiceOp) ListServiceKeys(ctx context.Context, req *ListServiceKeysRequest) (*ListServiceKeysResponse, error)
- func (svc *ServiceKeyServiceOp) UpdateServiceKey(ctx context.Context, req *UpdateServiceKeyRequest) (*UpdateServiceKeyResponse, error)
- type ServiceTelemetryResponse
- type SetBillingMarketRequest
- type SetBillingMarketResponse
- type SixwindVSRConfig
- type TelemetryMetricData
- type TelemetrySample
- type TelemetryTimeFrame
- type TelemetryUnit
- type Time
- type TokenProvider
- type UnlockPortRequest
- type UnlockPortResponse
- type UpdateIXRequest
- type UpdateNATGatewayRequest
- type UpdateProductResourceTagsRequest
- type UpdateServiceKeyRequest
- type UpdateServiceKeyResponse
- type UpdateUserRequest
- type UpdateVXCRequest
- type UpdateVXCResponse
- type User
- type UserActivity
- type UserEmail
- type UserManagementService
- type UserManagementServiceOp
- func (svc *UserManagementServiceOp) CreateUser(ctx context.Context, req *CreateUserRequest) (*CreateUserResponse, error)
- func (svc *UserManagementServiceOp) DeactivateUser(ctx context.Context, employeeID int) error
- func (svc *UserManagementServiceOp) DeleteUser(ctx context.Context, employeeID int) error
- func (svc *UserManagementServiceOp) GetUser(ctx context.Context, employeeID int) (*User, error)
- func (svc *UserManagementServiceOp) GetUserActivity(ctx context.Context, req *GetUserActivityRequest) ([]*UserActivity, error)
- func (svc *UserManagementServiceOp) ListCompanyUsers(ctx context.Context) ([]*User, error)
- func (svc *UserManagementServiceOp) UpdateUser(ctx context.Context, employeeID int, req *UpdateUserRequest) error
- type UserPosition
- type VLLConfig
- type VXC
- type VXCApproval
- type VXCEndConfiguration
- type VXCOrder
- type VXCOrderAEndPartnerConfigdeprecated
- type VXCOrderConfiguration
- type VXCOrderConfirmation
- type VXCOrderEndpointConfiguration
- type VXCOrderMVEConfig
- type VXCOrderVrouterPartnerConfig
- type VXCPartnerConfigAWS
- type VXCPartnerConfigAzure
- type VXCPartnerConfigGoogle
- type VXCPartnerConfigIBM
- type VXCPartnerConfigOracle
- type VXCPartnerConfigTransit
- type VXCPartnerConfiguration
- type VXCPriceBookRequest
- type VXCResources
- type VXCService
- type VXCServiceOp
- func (svc *VXCServiceOp) BuyVXC(ctx context.Context, req *BuyVXCRequest) (*BuyVXCResponse, error)
- func (svc *VXCServiceOp) DeleteVXC(ctx context.Context, id string, req *DeleteVXCRequest) error
- func (svc *VXCServiceOp) GetVXC(ctx context.Context, id string) (*VXC, error)
- func (svc *VXCServiceOp) ListPartnerPorts(ctx context.Context, req *ListPartnerPortsRequest) (*ListPartnerPortsResponse, error)
- func (svc *VXCServiceOp) ListVXCResourceTags(ctx context.Context, vxcID string) (map[string]string, error)
- func (svc *VXCServiceOp) ListVXCs(ctx context.Context, req *ListVXCsRequest) ([]*VXC, error)
- func (svc *VXCServiceOp) LookupPartnerPorts(ctx context.Context, req *LookupPartnerPortsRequest) (*LookupPartnerPortsResponse, error)
- func (svc *VXCServiceOp) UpdateVXC(ctx context.Context, id string, req *UpdateVXCRequest) (*VXC, error)
- func (svc *VXCServiceOp) UpdateVXCResourceTags(ctx context.Context, vxcID string, tags map[string]string) error
- func (svc *VXCServiceOp) ValidateVXCOrder(ctx context.Context, req *BuyVXCRequest) error
- type VXCUpdate
- type ValidFor
- type VendorConfig
- type VersaConfig
- type VirtualRouter
- type VmwareConfig
Examples ¶
Constants ¶
const ( FIRST_PARTY_ID_US = 1558 FIRST_PARTY_ID_AU = 808 FIRST_PARTY_ID_AT = 20442 FIRST_PARTY_ID_BE = 20449 FIRST_PARTY_ID_BG = 4640 FIRST_PARTY_ID_CA = 1652 FIRST_PARTY_ID_CH = 8299 FIRST_PARTY_ID_DE = 4515 FIRST_PARTY_ID_DK = 20447 FIRST_PARTY_ID_ES = 30369 FIRST_PARTY_ID_FI = 20440 FIRST_PARTY_ID_FR = 20451 FIRST_PARTY_ID_HK = 819 FIRST_PARTY_ID_IE = 2683 FIRST_PARTY_ID_IT = 30367 FIRST_PARTY_ID_JP = 20453 FIRST_PARTY_ID_LU = 30423 FIRST_PARTY_ID_NL = 2685 FIRST_PARTY_ID_NO = 20438 FIRST_PARTY_ID_NZ = 855 FIRST_PARTY_ID_PL = 20444 FIRST_PARTY_ID_SE = 2681 FIRST_PARTY_ID_SG = 817 FIRST_PARTY_ID_UK = 2675 )
FIRST_PARTY_ID constants for supported billing markets.
const ( MAINTENANCE_STATE_COMPLETED = MaintenanceState("Completed") MAINTENANCE_STATE_SCHEDULED = MaintenanceState("Scheduled") MAINTENANCE_STATE_CANCELLED = MaintenanceState("Cancelled") MAINTENANCE_STATE_RUNNING = MaintenanceState("Running") OUTAGE_STATE_ONGOING = OutageState("Ongoing") OUTAGE_STATE_RESOLVED = OutageState("Resolved") )
const ( LocationStatusActive = "Active" LocationStatusDeployment = "Deployment" LocationStatusRestricted = "Restricted" LocationStatusExtended = "Extended" LocationStatusNew = "New" LocationStatusExpired = "Expired" )
LocationV3 status values returned by GET /v3/locations. Source: Megaport OpenAPI spec, schema "LocationStatus".
const ( PacketFilterActionPermit = "permit" PacketFilterActionDeny = "deny" )
Packet filter action values accepted by the API.
const ( PrefixListActionPermit = "permit" PrefixListActionDeny = "deny" )
Prefix list action values accepted by the API.
const ( AddressFamilyIPv4 = "IPv4" AddressFamilyIPv6 = "IPv6" )
Address family values accepted by the API.
const ( BGPRouteDirectionReceived = "RECEIVED" BGPRouteDirectionAdvertised = "ADVERTISED" )
BGP route direction values for the BGP neighbor endpoint.
const ( PricingAddOnTypeCrossConnect = "CROSS_CONNECT" PricingAddOnTypeIPSec = "IP_SEC" )
PricingAddOnType constants for use with ProductAddOnPriceBookRequest.AddOnType.
const ( SERVICE_CONFIGURED = "CONFIGURED" // The CONFIGURED service state. SERVICE_LIVE = "LIVE" // The LIVE service state. // STATUS_DESIGN is the pre-order state for products that are created but // not yet validated or purchased (currently: NAT Gateways). STATUS_DESIGN = "DESIGN" // Product types PRODUCT_MEGAPORT = "megaport" PRODUCT_VXC = "vxc" PRODUCT_MCR = "mcr2" PRODUCT_MVE = "mve" PRODUCT_IX = "ix" PRODUCT_NAT_GATEWAY = "nat_gateway" // Cancellation states STATUS_DECOMMISSIONED = "DECOMMISSIONED" STATUS_CANCELLED = "CANCELLED" // Port Types SINGLE_PORT = "Single" LAG_PORT = "LAG" // AWS VXC Types CONNECT_TYPE_AWS_VIF = "AWS" CONNECT_TYPE_AWS_HOSTED_CONNECTION = "AWSHC" // InterfaceTypeSubInterface and InterfaceTypeIPSecTunnel are the // interface type values accepted by the Megaport API. They are // camelCase and the API matches them exactly. InterfaceTypeSubInterface = "subInterface" InterfaceTypeIPSecTunnel = "ipSecTunnel" )
const AddOnTypeIPsec = "IP_SEC"
const PARTNER_AWS string = "AWS"
const PARTNER_AZURE string = "AZURE"
Partner Providers
const PARTNER_GOOGLE string = "GOOGLE"
const PARTNER_OCI string = "ORACLE"
Variables ¶
var ( VALID_MAINTENANCE_STATES = []MaintenanceState{ MAINTENANCE_STATE_COMPLETED, MAINTENANCE_STATE_SCHEDULED, MAINTENANCE_STATE_CANCELLED, MAINTENANCE_STATE_RUNNING, } VALID_OUTAGE_STATES = []OutageState{ OUTAGE_STATE_ONGOING, OUTAGE_STATE_RESOLVED, } )
var ( ErrMCRPingDestinationRequired = errors.New("destination address is required") ErrMCRPingPacketCountOutOfRange = errors.New("packet_count must be between 1 and 60") ErrMCRPingPacketSizeOutOfRange = errors.New("packet_size must be between 1 and 9186") ErrMCRTracerouteDestinationRequired = errors.New("destination address is required") ErrMCRDiagnosticsMCRUIDRequired = errors.New("MCR UID is required") ErrMCRDiagnosticsOperationEmpty = errors.New("operation ID is required") ErrMCRDiagnosticsTimeout = errors.New("timed out waiting for diagnostics operation to complete") )
Errors for MCR diagnostics operations.
var ( ErrNATGatewayDiagnosticsPeerIPRequired = errors.New("BGP neighbor diagnostics require a peer IP address") ErrNATGatewayDiagnosticsDirectionInvalid = errors.New("BGP neighbor diagnostics require a direction (RECEIVED or ADVERTISED)") ErrNATGatewayDiagnosticsOperationEmpty = errors.New("operation ID is required") ErrNATGatewayDiagnosticsTimeout = errors.New("timed out waiting for diagnostics operation to complete") )
Diagnostics validation errors.
var ( ErrNATGatewayPacketFilterIDRequired = errors.New("packet filter ID must be greater than 0") ErrNATGatewayPacketFilterDescriptionEmpty = errors.New("packet filter description is required") ErrNATGatewayPacketFilterEntriesEmpty = errors.New("packet filter requires at least one entry") )
Packet filter validation errors.
var ( ErrNATGatewayPrefixListIDRequired = errors.New("prefix list ID must be greater than 0") ErrNATGatewayPrefixListDescriptionEmpty = errors.New("prefix list description is required") ErrNATGatewayPrefixListAddressFamilyEmpty = errors.New("prefix list addressFamily is required") ErrNATGatewayPrefixListEntriesEmpty = errors.New("prefix list requires at least one entry") ErrNATGatewayPrefixListEmptyResponse = errors.New("API returned a 2xx response with an empty prefix list payload") )
Prefix list validation errors.
var ( ErrPricingRequestNil = errors.New("pricing request is required") ErrPricingVXCLocationRequired = errors.New("vxc pricing requires aLocationId and bLocationId") ErrPricingVXCSpeedRequired = errors.New("vxc pricing requires speed") ErrPricingLocationRequired = errors.New("pricing requires locationId") ErrPricingSpeedRequired = errors.New("pricing requires speed") ErrPricingIXTypeRequired = errors.New("ix pricing requires ixType") ErrPricingIXLocationRequired = errors.New("ix pricing requires portLocationId") ErrPricingNATSessionRequired = errors.New("nat gateway pricing requires sessionCount") ErrPricingIPBlockRequired = errors.New("ip address pricing requires ipBlock") ErrPricingIPLocationRequired = errors.New("ip address pricing requires locationId") ErrPricingCompanyIDAndUIDSet = errors.New("companyId and companyUid are mutually exclusive; set only one") ErrPricingMVELocationRequired = errors.New("mve pricing requires locationId") ErrProductPricingResponseEmpty = errors.New("product pricing response missing data") )
var ( // VALID_CONTRACT_TERMS lists the valid contract terms in months. VALID_CONTRACT_TERMS = []int{1, 12, 24, 36, 48, 60} VALID_MCR_PORT_SPEEDS = []int{1000, 2500, 5000, 10000, 25000, 50000, 100000, 400000} // SERVICE_STATE_READY is a list of service states that are considered ready for use. SERVICE_STATE_READY = []string{SERVICE_CONFIGURED, SERVICE_LIVE} )
var ErrBuyIXRequestNil = errors.New("buy IX request cannot be nil")
ErrBuyIXRequestNil is returned when BuyIX or ValidateIXOrder is called with a nil request.
var ErrBuyMCRRequestNil = errors.New("buy MCR request cannot be nil")
ErrBuyMCRRequestNil is returned when BuyMCR or ValidateMCROrder is called with a nil request.
var ErrBuyMVERequestNil = errors.New("buy MVE request cannot be nil")
ErrBuyMVERequestNil is returned when BuyMVE or ValidateMVEOrder is called with a nil request.
var ErrBuyPortRequestNil = errors.New("buy port request cannot be nil")
ErrBuyPortRequestNil is returned when BuyPort or ValidatePortOrder is called with a nil request.
var ErrBuyVXCRequestNil = errors.New("buy VXC request cannot be nil")
ErrBuyVXCRequestNil is returned when BuyVXC or ValidateVXCOrder is called with a nil request.
var ErrCostCentreTooLong = errors.New("cost centre must be less than 255 characters")
ErrCostCentreTooLong is returned when a cost centre is longer than 255 characters
var ErrCreateMCRPrefixFilterListRequestNil = errors.New("create MCR prefix filter list request cannot be nil")
ErrCreateMCRPrefixFilterListRequestNil is returned when CreatePrefixFilterList is called with a nil request.
var ErrCreateServiceKeyRequestNil = errors.New("create service key request cannot be nil")
ErrCreateServiceKeyRequestNil is returned when CreateServiceKey is called with a nil request.
var ErrCreateUserRequestNil = errors.New("create user request cannot be nil")
ErrCreateUserRequestNil is returned when CreateUser is called with a nil request.
var ErrDeleteIXRequestNil = errors.New("delete IX request cannot be nil")
ErrDeleteIXRequestNil is returned when DeleteIX is called with a nil request.
var ErrDeleteMCRRequestNil = errors.New("delete MCR request cannot be nil")
ErrDeleteMCRRequestNil is returned when DeleteMCR is called with a nil request.
var ErrDeleteMVERequestNil = errors.New("delete MVE request cannot be nil")
ErrDeleteMVERequestNil is returned when DeleteMVE is called with a nil request.
var ErrDeletePortRequestNil = errors.New("delete port request cannot be nil")
ErrDeletePortRequestNil is returned when DeletePort is called with a nil request.
var ErrDeleteProductRequestNil = errors.New("delete product request cannot be nil")
ErrDeleteProductRequestNil is returned when DeleteProduct is called with a nil request.
var ErrDeleteVXCRequestNil = errors.New("delete VXC request cannot be nil")
ErrDeleteVXCRequestNil is returned when DeleteVXC is called with a nil request.
var ErrInvalidAddOnType = errors.New("invalid add-on type, currently only IP_SEC is supported")
ErrInvalidAddOnType is returned when an invalid add-on type is provided
var ErrInvalidIPsecTunnelCount = errors.New("invalid IPsec tunnel count, valid values are 10, 20, or 30 (0 defaults to 10)")
ErrInvalidIPsecTunnelCount is returned when the IPsec tunnel count is not valid
var ErrInvalidMaintenanceState = fmt.Errorf("invalid maintenance state, valid states are %s", strings.Join(maintenanceStatesToString(VALID_MAINTENANCE_STATES), ", "))
var ErrInvalidMonth = errors.New("invalid month, must be between 1 and 12")
ErrInvalidMonth is returned when RTT statistics are requested for an invalid month
var ErrInvalidOutageState = fmt.Errorf("invalid outage state, valid states are %s", strings.Join(outageStatesToString(VALID_OUTAGE_STATES), ", "))
var ErrInvalidTerm = fmt.Errorf("invalid term, valid terms are %s months", intSliceToString(VALID_CONTRACT_TERMS))
ErrInvalidTerm creates an error indicating an invalid contract term, dynamically listing the valid terms.
var ErrInvalidVLAN = errors.New("invalid VLAN, must be between 0 and 4094")
ErrInvalidVLAN is returned when a VLAN is invalid
var ErrInvalidVXCAEndPartnerConfig = errors.New("invalid vxc a-end partner config")
ErrInvalidVXCAEndPartnerConfig is returned when an invalid VXC A-End partner config is provided
var ErrInvalidVXCBEndPartnerConfig = errors.New("invalid vxc b-end partner config")
ErrInvalidVXCBEndPartnerConfig is returned when an invalid VXC B-End partner config is provided
var ErrInvalidYear = errors.New("invalid year, must be between 0 and 99")
ErrInvalidYear is returned when RTT statistics are requested for an invalid year
var ErrListPartnerPortsRequestNil = errors.New("list partner ports request cannot be nil")
ErrListPartnerPortsRequestNil is returned when ListPartnerPorts is called with a nil request.
var ErrLocationNotFound = errors.New("unable to find location")
ErrLocationNotFound is returned when a location can't be found
var ErrLookupPartnerPortsRequestNil = errors.New("lookup partner ports request cannot be nil")
ErrLookupPartnerPortsRequestNil is returned when LookupPartnerPorts is called with a nil request.
var ErrMCRCancelLaterNotAllowed = errors.New("mcr products do not support scheduled deletion (cancel later), only immediate deletion (CANCEL_NOW) is allowed")
ErrMCRCancelLaterNotAllowed is returned when attempting to schedule MCR deletion for later (only CANCEL_NOW is allowed)
var ErrMCRDecommissioned = errors.New("mcr has been decommissioned")
ErrMCRDecommissioned is returned when an MCR has been decommissioned.
var ErrMCRInvalidPortSpeed = fmt.Errorf("invalid mcr port speed, valid speeds are %s", intSliceToString(VALID_MCR_PORT_SPEEDS))
ErrMCRInvalidPortSpeed creates an error indicating an invalid MCR port speed, dynamically listing the valid speeds.
var ErrMCRNotFound = errors.New("mcr not found or deleted")
ErrMCRNotFound is returned when an MCR cannot be found (deleted or never existed).
var ErrManageProductLockRequestNil = errors.New("manage product lock request cannot be nil")
ErrManageProductLockRequestNil is returned when ManageProductLock is called with a nil request.
var ErrManagedAccountNotFound = errors.New("managed account not found")
ErrManagedAccountNotFound is returned when a managed account can't be found
var ErrModifyMCRRequestNil = errors.New("modify MCR request cannot be nil")
ErrModifyMCRRequestNil is returned when ModifyMCR is called with a nil request.
var ErrModifyMVERequestNil = errors.New("modify MVE request cannot be nil")
ErrModifyMVERequestNil is returned when ModifyMVE is called with a nil request.
var ErrModifyPortRequestNil = errors.New("modify port request cannot be nil")
ErrModifyPortRequestNil is returned when ModifyPort is called with a nil request.
var ErrModifyProductRequestNil = errors.New("modify product request cannot be nil")
ErrModifyProductRequestNil is returned when ModifyProduct is called with a nil request.
var ErrNATGatewayInvalidTerm = fmt.Errorf("term must be one of: %s", intSliceToString(VALID_CONTRACT_TERMS))
ErrNATGatewayInvalidTerm is returned when a Term is not a valid contract term. The message is derived from VALID_CONTRACT_TERMS so it stays in sync if the allowed set ever changes.
var ErrNATGatewayLocationIDRequired = errors.New("location ID must be greater than 0")
ErrNATGatewayLocationIDRequired is returned when a LocationID is not provided or is invalid.
var ErrNATGatewayOrderResponseEmpty = errors.New("nat gateway order response contained no data")
ErrNATGatewayOrderResponseEmpty is returned when the API response data array is empty (the endpoints are expected to return one entry per submitted productUid).
var ErrNATGatewayProductNameRequired = errors.New("product name is required")
ErrNATGatewayProductNameRequired is returned when a ProductName is not provided.
var ErrNATGatewayProductUIDRequired = errors.New("product UID is required")
ErrNATGatewayProductUIDRequired is returned when a ProductUID is not provided.
var ErrNATGatewayRequestNil = errors.New("request must not be nil")
ErrNATGatewayRequestNil is returned when a nil request is passed to a NAT Gateway validator. The previous code dereferenced these without a guard and would panic on a nil pointer; the validators now return this error instead.
var ErrNATGatewaySpeedRequired = errors.New("speed must be greater than 0")
ErrNATGatewaySpeedRequired is returned when a Speed is not provided or is invalid.
var ErrNATGatewayTelemetryDaysOutOfRange = errors.New("days must be between 1 and 180")
ErrNATGatewayTelemetryDaysOutOfRange is returned when Days is not between 1 and 180.
var ErrNATGatewayTelemetryFromToIncomplete = errors.New("both from and to must be provided together")
ErrNATGatewayTelemetryFromToIncomplete is returned when only one of From/To is provided.
var ErrNATGatewayTelemetryTimeExclusive = errors.New("days and from/to are mutually exclusive")
ErrNATGatewayTelemetryTimeExclusive is returned when both Days and From/To are provided.
var ErrNATGatewayTelemetryTypesRequired = errors.New("at least one telemetry type is required")
ErrNATGatewayTelemetryTypesRequired is returned when no telemetry types are provided.
var ErrNoAvailableVxcPorts = errors.New("there are no available ports for you to connect to")
ErrNoAvailableVxcPorts is returned when there are no available ports for a user to connect to
var ErrNoMatchingLocations = errors.New("could not find any matching locations from search")
ErrNoMatchingLocations is returned when a fuzzy search for a location doesn't return any results
var ErrNoPartnerPortsFound = errors.New("sorry there were no results returned based on the given filters")
ErrNoPartnerPortsFound is returned when no partner ports could be found matching the filters provided
var ErrOrderApprovalUIDRequired = errors.New("order approval UID is required")
ErrOrderApprovalUIDRequired is returned when an order approval UID is not provided.
var ErrPortAlreadyLocked = errors.New("that port is already locked, cannot lock")
ErrPortAlreadyLocked is returned when a port is already locked
var ErrPortCancelLaterNotAllowed = errors.New("port products do not support scheduled deletion (cancel later), only immediate deletion (CANCEL_NOW) is allowed")
ErrPortCancelLaterNotAllowed is returned when attempting to schedule Port deletion for later (only CANCEL_NOW is allowed)
var ErrPortNotLocked = errors.New("that port not locked, cannot unlock")
ErrPortNotLocked is returned when a port is not locked
var ErrTransitVXCCancelLaterNotAllowed = errors.New("transit vxc (megaport internet) does not support scheduled deletion (cancel later), only immediate deletion (CANCEL_NOW) is allowed")
ErrTransitVXCCancelLaterNotAllowed is returned when attempting to schedule Transit VXC deletion for later (only CANCEL_NOW is allowed)
var ErrUpdateIXRequestNil = errors.New("update IX request cannot be nil")
ErrUpdateIXRequestNil is returned when UpdateIX is called with a nil request.
var ErrUpdateServiceKeyRequestNil = errors.New("update service key request cannot be nil")
ErrUpdateServiceKeyRequestNil is returned when UpdateServiceKey is called with a nil request.
var ErrUpdateUserRequestNil = errors.New("update user request cannot be nil")
ErrUpdateUserRequestNil is returned when UpdateUser is called with a nil request.
var ErrUpdateVXCRequestNil = errors.New("update VXC request cannot be nil")
ErrUpdateVXCRequestNil is returned when UpdateVXC is called with a nil request.
var ErrVnicsOnNonMVE = errors.New("vNICs can only be modified on MVE products")
ErrVnicsOnNonMVE is returned when vNIC updates are supplied for a non-MVE product
var ErrWrongProductModify = errors.New("you can only update Ports, MCR, and MVE using this method")
ErrWrongProductModify is returned when a user attempts to modify a product that can't be modified
var ValidIPsecTunnelCounts = []int{10, 20, 30}
ValidIPsecTunnelCounts contains the valid tunnel counts for IPsec add-ons per the API spec.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored. If the API error response does not include the request ID in its body, the one from its header will be used.
func DoRequestWithClient ¶
func DoRequestWithClient( ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
DoRequestWithClient submits an HTTP request using the specified client.
func IsServiceNotFoundError ¶ added in v1.10.1
IsServiceNotFoundError reports whether err is a Megaport API not-found response — either HTTP 404 or the non-standard HTTP 400 "Could not find a service with UID" form.
Types ¶
type APIMCRPrefixFilterList ¶ added in v1.0.6
type APIMCRPrefixFilterList struct {
ID int `json:"id"`
Description string `json:"description"`
AddressFamily string `json:"addressFamily"`
Entries []*APIMCRPrefixFilterListEntry `json:"entries"`
}
func (*APIMCRPrefixFilterList) ToMCRPrefixFilterList ¶ added in v1.0.6
func (e *APIMCRPrefixFilterList) ToMCRPrefixFilterList() (*MCRPrefixFilterList, error)
type APIMCRPrefixFilterListEntry ¶ added in v1.0.6
type APIMCRPrefixFilterListEntry struct {
Action string `json:"action"`
Prefix string `json:"prefix"`
Ge string `json:"ge,omitempty"` // Greater than or equal to - (Optional) The minimum starting prefix length to be matched. Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6). The minimum (ge) must be no greater than or equal to the maximum value (le).
Le string `json:"le,omitempty"` // Less than or equal to - (Optional) The maximum ending prefix length to be matched. The prefix length is greater than or equal to the minimum value (ge). Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6), but the maximum must be no less than the minimum value (ge).
}
APIMCRPrefixFilterListEntry represents an entry in a prefix filter list.
func (*APIMCRPrefixFilterListEntry) ToMCRPrefixFilterListEntry ¶ added in v1.0.6
func (e *APIMCRPrefixFilterListEntry) ToMCRPrefixFilterListEntry() (*MCRPrefixListEntry, error)
type AWSVXCOrder ¶
type AWSVXCOrder struct {
AssociatedVXCs []AWSVXCOrderConfiguration `json:"associatedVxcs"`
PortID string `json:"productUid"`
}
AWSVXCOrder represents the request to order an AWS VXC from the Megaport Products API.
type AWSVXCOrderConfiguration ¶
type AWSVXCOrderConfiguration struct {
Name string `json:"productName"`
RateLimit int `json:"rateLimit"`
AEnd VXCOrderEndpointConfiguration `json:"aEnd"`
BEnd VXCOrderEndpointConfiguration `json:"bEnd"`
}
AWSVXCOrderConfiguration represents the configuration of an AWS VXC to be ordered from the Megaport Products API.
type ArubaConfig ¶
type ArubaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AccountName string `json:"accountName,omitempty"`
AccountKey string `json:"accountKey,omitempty"`
SystemTag string `json:"systemTag,omitempty"`
}
ArubaConfig represents the configuration for an Aruba MVE.
type AssociatedIXOrder ¶ added in v1.3.2
type AssociatedIXOrder struct {
ProductName string `json:"productName"` // Name of the IX
NetworkServiceType string `json:"networkServiceType"` // The IX type/network service to connect to (e.g. "Los Angeles IX")
ASN int `json:"asn"` // ASN (Autonomous System Number) for BGP peering
MACAddress string `json:"macAddress"` // MAC address for the IX interface
RateLimit int `json:"rateLimit"` // Rate limit in Mbps
VLAN int `json:"vlan"` // VLAN ID for the IX connection
Shutdown bool `json:"shutdown"` // Whether the IX is initially shut down (true) or enabled (false)
PromoCode string `json:"promoCode,omitempty"` // Optional promotion code for discounts
}
AssociatedIX represents an IX configuration in an IX order
type AsyncBGPNeighborRoutesData ¶ added in v1.9.0
type AsyncBGPNeighborRoutesData struct {
JobID string `json:"jobId"`
Status LookingGlassAsyncStatus `json:"status"`
Routes []*LookingGlassBGPNeighborRoute `json:"routes"`
}
AsyncBGPNeighborRoutesData contains the async job metadata and neighbor routes.
type AsyncIPRoutesData ¶ added in v1.9.0
type AsyncIPRoutesData struct {
JobID string `json:"jobId"`
Status LookingGlassAsyncStatus `json:"status"`
Routes []*LookingGlassIPRoute `json:"routes"`
}
AsyncIPRoutesData contains the async job metadata and routes.
type AviatrixConfig ¶ added in v1.2.2
type AviatrixConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
CloudInit string `json:"cloudInit,omitempty"`
}
AviatrixConfig represents the configuration for an Aviatrix Secure Edge MVE.
type BGPSessionStatus ¶ added in v1.9.0
type BGPSessionStatus string
BGPSessionStatus represents the status of a BGP session.
const ( BGPSessionStatusUp BGPSessionStatus = "UP" BGPSessionStatusDown BGPSessionStatus = "DOWN" BGPSessionStatusUnknown BGPSessionStatus = "UNKNOWN" )
type BfdConfig ¶
type BfdConfig struct {
TxInterval int `json:"txInterval,omitempty"`
RxInterval int `json:"rxInterval,omitempty"`
Multiplier int `json:"multiplier,omitempty"`
}
BfdConfig represents the configuration of BFD.
type BgpConnectionConfig ¶
type BgpConnectionConfig struct {
PeerAsn int `json:"peerAsn"`
LocalAsn *int `json:"localAsn,omitempty"`
LocalIpAddress string `json:"localIpAddress"`
PeerIpAddress string `json:"peerIpAddress"`
Password string `json:"password,omitempty"`
Shutdown bool `json:"shutdown"`
Description string `json:"description,omitempty"`
MedIn int `json:"medIn,omitempty"`
MedOut int `json:"medOut,omitempty"`
BfdEnabled bool `json:"bfdEnabled"`
ExportPolicy string `json:"exportPolicy,omitempty"`
PermitExportTo []string `json:"permitExportTo,omitempty"`
DenyExportTo []string `json:"denyExportTo,omitempty"`
ImportWhitelist int `json:"importWhitelist,omitempty"`
ImportBlacklist int `json:"importBlacklist,omitempty"`
ExportWhitelist int `json:"exportWhitelist,omitempty"`
ExportBlacklist int `json:"exportBlacklist,omitempty"`
AsPathPrependCount int `json:"asPathPrependCount,omitempty"`
PeerType string `json:"peerType,omitempty"` // can be NON_CLOUD, PRIV_CLOUD, or PUB_CLOUD
AsOverride *bool `json:"asOverride,omitempty"` // nil applies the API default; only valid for eBGP
}
BgpConnectionConfig represents the configuration of a BGP connection.
type BillingMarket ¶ added in v1.4.4
type BillingMarket struct {
ID int `json:"id"`
WellKnownSupplier string `json:"wellKnownSupplier"`
SupplierName string `json:"supplierName"`
CurrencyEnum string `json:"currencyEnum"`
Language string `json:"language"`
BillingContactName string `json:"billingContactName"`
BillingContactEmail string `json:"billingContactEmail"`
BillingContactPhone string `json:"billingContactPhone"`
Address1 string `json:"address1"`
Postcode string `json:"postcode"`
Country string `json:"country"`
City string `json:"city"`
State string `json:"state"`
InvoiceTemplate string `json:"invoiceTemplate"`
TaxRate float64 `json:"taxRate"`
EstimateInvoice float64 `json:"estimateInvoice"`
FirstPartyID int `json:"firstPartyId"`
SecondPartyID int `json:"secondPartyId"`
AttachInvoiceToEmail bool `json:"attachInvoiceToEmail"`
Region string `json:"region"`
PaymentTermInDays int `json:"paymentTermInDays"`
StripeAccountPublishableKey string `json:"stripeAccountPublishableKey"`
StripeSupportedBankCurrencies []string `json:"stripeSupportedBankCurrencies"`
VATExempt bool `json:"vatExempt"`
Active bool `json:"active"`
SecuredHash string `json:"securedHash"`
}
BillingMarket represents a billing market as returned by the Megaport API.
type BillingMarketService ¶ added in v1.4.4
type BillingMarketService interface {
// SetBillingMarket configures the billing market (and currency) and the billing contact details.
SetBillingMarket(ctx context.Context, req *SetBillingMarketRequest) (*SetBillingMarketResponse, error)
// GetBillingMarkets retrieves the billing markets and contact details for the account.
GetBillingMarkets(ctx context.Context) ([]*BillingMarket, error)
}
BillingMarketService is an interface for interfacing with the Billing Market endpoints of the Megaport API
func NewBillingMarketService ¶ added in v1.4.4
func NewBillingMarketService(c *Client) BillingMarketService
NewBillingMarketService returns a BillingMarketService
type BillingMarketServiceOp ¶ added in v1.4.4
type BillingMarketServiceOp struct {
// contains filtered or unexported fields
}
BillingMarketServiceOp handles communication with the Billing Market related methods of the Megaport API.
func (*BillingMarketServiceOp) GetBillingMarkets ¶ added in v1.4.4
func (svc *BillingMarketServiceOp) GetBillingMarkets(ctx context.Context) ([]*BillingMarket, error)
GetBillingMarkets retrieves the billing markets and contact details for the account.
func (*BillingMarketServiceOp) SetBillingMarket ¶ added in v1.4.4
func (svc *BillingMarketServiceOp) SetBillingMarket(ctx context.Context, req *SetBillingMarketRequest) (*SetBillingMarketResponse, error)
SetBillingMarket creates or updates a billing market using the Megaport API. It sends a POST request to /v2/market with the provided SetBillingMarketRequest.
type BuyIXRequest ¶ added in v1.3.2
type BuyIXRequest struct {
ProductUID string `json:"productUid"` // The productUid of the port to attach the IX to
Name string `json:"productName"` // Name of the IX
NetworkServiceType string `json:"networkServiceType"` // The IX type/network service to connect to (e.g. "Los Angeles IX")
ASN int `json:"asn"` // ASN (Autonomous System Number) for BGP peering
MACAddress string `json:"macAddress"` // MAC address for the IX interface
RateLimit int `json:"rateLimit"` // Rate limit in Mbps
VLAN int `json:"vlan"` // VLAN ID for the IX connection
Shutdown bool `json:"shutdown"` // Whether the IX is initially shut down (true) or enabled (false)
WaitForProvision bool // Client-side option to wait until IX is provisioned before returning
PromoCode string `json:"promoCode,omitempty"` // Optional promotion code for discounts. The code is not validated by the API, so if the code doesn't exist or doesn't work for the service, the call will still be successful.
WaitForTime time.Duration // Maximum duration to wait for provisioning
}
type BuyIXResponse ¶ added in v1.3.2
type BuyIXResponse struct {
TechnicalServiceUID string `json:"technicalServiceUid,omitempty"` // Unique identifier for the newly created IX service
}
type BuyMCRRequest ¶
type BuyMCRRequest struct {
LocationID int
Name string
DiversityZone string
Term int
PortSpeed int
MCRAsn int
CostCentre string
PromoCode string
// MarketplaceVisibility is sent only when non-nil. Leaving it nil omits the
// field so the API applies its own default, rather than forcing false.
MarketplaceVisibility *bool
ResourceTags map[string]string `json:"resourceTags,omitempty"`
AddOns []MCRAddOn `json:"addOns,omitempty"`
WaitForProvision bool // Wait until the MCR provisions before returning
WaitForTime time.Duration // How long to wait for the MCR to provision if WaitForProvision is true (default is 5 minutes; must be at least 30 seconds for the poller to fire)
}
BuyMCRRequest represents a request to buy an MCR
type BuyMCRResponse ¶
type BuyMCRResponse struct {
TechnicalServiceUID string
}
BuyMCRResponse represents a response from buying an MCR
type BuyMVERequest ¶
type BuyMVERequest struct {
LocationID int
Name string
Term int
VendorConfig VendorConfig
Vnics []MVENetworkInterface
DiversityZone string
PromoCode string
CostCentre string
ResourceTags map[string]string `json:"resourceTags,omitempty"`
WaitForProvision bool // Wait until the MVE provisions before returning
WaitForTime time.Duration // How long to wait for the MVE to provision if WaitForProvision is true (default is 5 minutes)
}
BuyMVERequest represents a request to buy an MVE
type BuyMVEResponse ¶
type BuyMVEResponse struct {
TechnicalServiceUID string
}
BuyMVEResponse represents a response from buying an MVE
type BuyPortRequest ¶
type BuyPortRequest struct {
Name string `json:"name"`
Term int `json:"term"`
PortSpeed int `json:"portSpeed"`
LocationId int `json:"locationId"`
Market string `json:"market"`
LagCount int `json:"lagCount"` // A lag count of 1 or higher will order the port as a single LAG
MarketPlaceVisibility bool `json:"marketPlaceVisibility"`
DiversityZone string `json:"diversityZone"`
CostCentre string `json:"costCentre"`
PromoCode string `json:"promoCode"`
ResourceTags map[string]string `json:"resourceTags"`
WaitForProvision bool // Wait until the VXC provisions before returning
WaitForTime time.Duration // How long to wait for the VXC to provision if WaitForProvision is true (default is 5 minutes)
}
BuyPortRequest represents a request to buy a port.
type BuyPortResponse ¶
type BuyPortResponse struct {
TechnicalServiceUIDs []string
}
BuyPortResponse represents a response from buying a port.
type BuyVXCRequest ¶
type BuyVXCRequest struct {
PortUID string
VXCName string
RateLimit int
Term int
Shutdown bool
PromoCode string
ServiceKey string
CostCentre string
AEndConfiguration VXCOrderEndpointConfiguration
BEndConfiguration VXCOrderEndpointConfiguration
WaitForProvision bool // Wait until the VXC provisions before returning
WaitForTime time.Duration // How long to wait for the VXC to provision if WaitForProvision is true (default is 5 minutes)
ResourceTags map[string]string `json:"resourceTags,omitempty"`
}
BuyVXCRequest represents a request to buy a VXC from the Megaport VXC API.
type BuyVXCResponse ¶
type BuyVXCResponse struct {
TechnicalServiceUID string
}
BuyVXCResponse represents a response from buying a VXC from the Megaport VXC API.
type CSPConnection ¶
type CSPConnection struct {
CSPConnection []CSPConnectionConfig
}
CSPConnection represents the configuration of a CSP connection.
func (*CSPConnection) UnmarshalJSON ¶
func (c *CSPConnection) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom unmarshaler for the CSPConnection type.
type CSPConnectionAWS ¶
type CSPConnectionAWS struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
VLAN int `json:"vlan"`
Account string `json:"account"`
AmazonAddress string `json:"amazon_address"`
ASN int `json:"asn"`
AmazonASN int `json:"amazonAsn"`
AuthKey string `json:"authKey"`
CustomerAddress string `json:"customer_address"`
CustomerIPAddress string `json:"customerIpAddress"`
ID int `json:"id"`
Name string `json:"name"`
OwnerAccount string `json:"ownerAccount"`
PeerASN int `json:"peerAsn"`
Type string `json:"type"`
VIFID string `json:"vif_id"`
}
CSPConnectionAWS represents the configuration of a CSP connection for AWS Virtual Interface.
type CSPConnectionAWSHC ¶
type CSPConnectionAWSHC struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Bandwidth int `json:"bandwidth"`
Name string `json:"name"`
OwnerAccount string `json:"ownerAccount"`
Bandwidths []int `json:"bandwidths"`
ConnectionID string `json:"connectionId"`
}
CSPConnectionAWSHC represents the configuration of a CSP connection for AWS Hosted Connection.
type CSPConnectionAzure ¶
type CSPConnectionAzure struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Bandwidth int `json:"bandwidth"`
Managed bool `json:"managed"`
Megaports []CSPConnectionAzureMegaport `json:"megaports"`
Ports []CSPConnectionAzurePort `json:"ports"`
ServiceKey string `json:"service_key"`
VLAN int `json:"vlan"`
Peers []CSPConnectionAzurePeeringConfig `json:"peers"`
}
CSPConnectionAzure represents the configuration of a CSP connection for Azure ExpressRoute.
type CSPConnectionAzureMegaport ¶
type CSPConnectionAzureMegaport struct {
Port int `json:"port"`
Type string `json:"type"`
VXC int `json:"vxc,omitempty"`
}
CSPConnectionAzureMegaport represents the configuration of a CSP connection for Azure ExpressRoute megaport.
type CSPConnectionAzurePeeringConfig ¶ added in v1.2.1
type CSPConnectionAzurePeeringConfig struct {
Type string `json:"type"`
PeerASN int `json:"peer_asn"`
PrimarySubnet string `json:"primary_subnet"`
SecondarySubnet string `json:"secondary_subnet"`
Prefixes string `json:"prefixes,omitempty"`
VLAN int `json:"vlan"`
}
CSPConnectionAzurePeeringConfig represents the configuration of an Azure peering partner.
type CSPConnectionAzurePort ¶
type CSPConnectionAzurePort struct {
ServiceID int `json:"service_id"`
Type string `json:"type"`
VXCServiceIDs []int `json:"vxc_service_ids"`
}
CSPConnectionAzurePort represents the configuration of a CSP connection for Azure ExpressRoute port.
type CSPConnectionConfig ¶
type CSPConnectionConfig interface {
IsCSPConnectionConfig()
}
CSPConnectionConfig represents the configuration of a CSP connection.
type CSPConnectionGoogle ¶
type CSPConnectionGoogle struct {
CSPConnectionConfig
Bandwidth int `json:"bandwidth"`
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Bandwidths []int `json:"bandwidths"`
Megaports []CSPConnectionGoogleMegaport `json:"megaports"`
Ports []CSPConnectionGooglePort `json:"ports"`
CSPName string `json:"csp_name"`
PairingKey string `json:"pairingKey"`
}
CSPConnectionGoogle represents the configuration of a CSP connection for Google Cloud Interconnect.
type CSPConnectionGoogleMegaport ¶
CSPConnectionGoogleMegaport represents the configuration of a CSP connection for Google Cloud Interconnect megaport.
type CSPConnectionGooglePort ¶
type CSPConnectionGooglePort struct {
ServiceID int `json:"service_id"`
VXCServiceIDs []int `json:"vxc_service_ids"`
}
CSPConnectionGooglePort represents the configuration of a CSP connection for Google Cloud Interconnect port.
type CSPConnectionIBM ¶ added in v1.2.3
type CSPConnectionIBM struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
CSPName string `json:"csp_name"`
Bandwidth int `json:"bandwidth"`
AccountID string `json:"account_id"`
CustomerASN int `json:"customer_asn"`
ProviderIPAddress string `json:"provider_ip_address"`
CustomerIPAddress string `json:"customer_ip_address"`
Bandwidths []int `json:"bandwidths"`
}
CSPConnectionIBM represents the configuration of a CSP connection for IBM Cloud Direct Link.
type CSPConnectionOracle ¶ added in v1.1.12
type CSPConnectionOracle struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
CSPName string `json:"csp_name"`
Bandwidth int `json:"bandwidth"`
Megaports []CSPConnectionOracleMegaport `json:"megaports"`
Ports []CSPConnectionOraclePort `json:"ports"`
VirtualCircuitId string `json:"virtualCircuitId"`
}
type CSPConnectionOracleMegaport ¶ added in v1.2.1
type CSPConnectionOraclePort ¶ added in v1.2.1
type CSPConnectionOther ¶
type CSPConnectionOther struct {
CSPConnectionConfig
CSPConnection map[string]interface{}
}
CSPConnectionOther represents the configuration of a CSP connection for any other CSP that is not presently defined.
type CSPConnectionTransit ¶
type CSPConnectionTransit struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
CustomerIP4Address string `json:"customer_ip4_address"`
CustomerIP6Network string `json:"customer_ip6_network"`
IPv4GatewayAddress string `json:"ipv4_gateway_address"`
IPv6GatewayAddress string `json:"ipv6_gateway_address"`
}
CSPConnectionTransit represents the configuration of a CSP connection for a Transit VXC.
type CSPConnectionVirtualRouter ¶
type CSPConnectionVirtualRouter struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
VLAN int `json:"vlan"`
Interfaces []CSPConnectionVirtualRouterInterface `json:"interfaces"`
IPAddresses []string `json:"ip_addresses"`
VirtualRouterName string `json:"virtualRouterName"`
}
CSPConnectionVirtualRouter represents the configuration of a CSP connection for Virtual Router.
type CSPConnectionVirtualRouterInterface ¶
type CSPConnectionVirtualRouterInterface struct {
IPAddresses []string `json:"ipAddresses"`
IPRoutes []IpRoute `json:"ipRoutes"`
BGPConnections []BgpConnectionConfig `json:"bgpConnections"`
NatIPAddresses []string `json:"natIpAddresses"`
BFD BfdConfig `json:"bfd"`
}
CSPConnectionVirtualRouterInterface represents the configuration of a CSP connection for Virtual Router interface.
type CiscoConfig ¶
type CiscoConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
ManageLocally bool `json:"manageLocally,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
AdminPassword string `json:"adminPassword,omitempty"`
CloudInit string `json:"cloudInit,omitempty"`
FMCIPAddress string `json:"fmcIpAddress,omitempty"`
FMCRegistrationKey string `json:"fmcRegistrationKey,omitempty"`
FMCNatID string `json:"fmcNatId,omitempty"`
}
CiscoConfig represents the configuration for a Cisco MVE.
type Client ¶
type Client struct {
// HTTP Client used to communicate with the Megaport API
HTTPClient *http.Client
// Logger for client
Logger *slog.Logger
// Base URL
BaseURL *url.URL
// User agent for client
UserAgent string
// The access key for the API token
AccessKey string
// The secret key for the API token
SecretKey string
// PortService provides methods for interacting with the Ports API
PortService PortService
// PartnerService provides methods for interacting with the Partners API
PartnerService PartnerService
// ProductService provides methods for interacting with the Products API
ProductService ProductService
// LocationService provides methods for interacting with the Locations API
LocationService LocationService
// VXCService provides methods for interacting with the VXCs API
VXCService VXCService
// MCRService provides methods for interacting with the MCRs API
MCRService MCRService
// MVEService provides methods for interacting with the MVEs API
MVEService MVEService
// ServiceKeyService provides methods for interacting with the Service Keys API
ServiceKeyService ServiceKeyService
// UserManagementService provides methods for interacting with the User Management API
UserManagementService UserManagementService
// ManagedAccountService provides methods for interacting with the Managed Accounts API
ManagedAccountService ManagedAccountService
// IXService provides methods for interacting with the IX API
IXService IXService
// EventsService provides methods for interacting with the Events API
EventsService EventsService
// BillingMarketService provides methods for interacting with the Billing Market API
BillingMarketService BillingMarketService
// NATGatewayService provides methods for interacting with the NAT Gateway API
NATGatewayService NATGatewayService
// MCRLookingGlassService provides methods for interacting with the MCR Looking Glass API
MCRLookingGlassService MCRLookingGlassService
// OrderApprovalService provides methods for interacting with the Order Approvals API
OrderApprovalService OrderApprovalService
LogResponseBody bool // Log Response Body of HTTP Requests
// contains filtered or unexported fields
}
Client manges communication with the Megaport API
func NewClient ¶
NewClient returns a new Megaport API client, using the given http.Client to perform all requests.
func (*Client) Authorize ¶
Authorize performs an OAuth-style login using the client's AccessKey and SecretKey and updates the client's access token on a successful response. If a TokenProvider is set, it will be used instead and this method returns immediately.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
func (*Client) SetAccessToken ¶ added in v1.4.7
SetAccessToken allows setting an externally obtained access token directly, bypassing the AccessKey/SecretKey OAuth flow. This is useful for WASM clients where the token is already obtained through the portal's authentication. If expiry is zero, the token is assumed to be valid indefinitely (or managed externally).
func (*Client) SetOnRequestCompleted ¶
func (c *Client) SetOnRequestCompleted(rc RequestCompletionCallback)
SetOnRequestCompleted sets the Megaport API request completion callback
func (*Client) SetTokenProvider ¶ added in v1.4.7
func (c *Client) SetTokenProvider(tp TokenProvider)
SetTokenProvider sets a custom token provider for the client. When set, the client will use this provider instead of the AccessKey/SecretKey flow.
type ClientOpt ¶
ClientOpt are options for New.
func WithAccessToken ¶ added in v1.4.7
WithAccessToken is a client option for setting a pre-obtained access token. Use this when integrating with web clients that already have a valid session token. If expiry is zero, the token is assumed to be valid indefinitely (or managed externally).
func WithBaseURL ¶
WithBaseURL is a client option for setting the base URL.
func WithCallContext ¶ added in v1.16.0
WithCallContext sets the X-Call-Context header so requests act on behalf of the given managed account; companyUID is that company's UID. An empty UID sets no header.
func WithCredentials ¶
WithCredentials sets the client's API credentials
func WithCustomHeaders ¶
WithCustomHeaders sets optional HTTP headers on the client that are sent on each HTTP request.
func WithEnvironment ¶
func WithEnvironment(e Environment) ClientOpt
WithEnvironment is a helper for setting a BaseURL by environment
func WithLogHandler ¶
WithLogHandler is an option to pass in a custom slog handler
func WithLogResponseBody ¶ added in v1.2.3
func WithLogResponseBody() ClientOpt
WithLogResponseBody is a client option for setting the log response body flag
func WithTokenProvider ¶ added in v1.4.7
func WithTokenProvider(tp TokenProvider) ClientOpt
WithTokenProvider sets a custom token provider for the client. When set, the client will use this provider instead of the AccessKey/SecretKey flow. This is ideal for WASM clients where the web portal manages the authentication token.
func WithTokenURL ¶ added in v1.13.0
WithTokenURL overrides the OAuth token endpoint used by Authorize. When set, the host-based environment switch is bypassed entirely, allowing non-standard base URLs (e.g. localhost) to authenticate.
func WithUserAgent ¶
WithUserAgent is a client option for setting the user agent.
type CompanyEnablement ¶
type CompanyEnablement struct {
TradingName string `json:"tradingName"`
}
CompanyEnablement represents a company enablement in the Megaport API.
type Country ¶
type Country struct {
Code string `json:"code"`
Name string `json:"name"`
Prefix string `json:"prefix"`
SiteCount int `json:"siteCount"`
}
Country represents a country in the Megaport Locations API.
type CreateMCRPrefixFilterListRequest ¶
type CreateMCRPrefixFilterListRequest struct {
MCRID string
PrefixFilterList MCRPrefixFilterList
}
CreateMCRPrefixFilterListRequest represents a request to create a prefix filter list on an MCR
type CreateMCRPrefixFilterListResponse ¶
type CreateMCRPrefixFilterListResponse struct {
IsCreated bool
PrefixFilterListID int // The ID of the created prefix filter list
}
CreateMCRPrefixFilterListResponse represents a response from creating a prefix filter list on an MCR
type CreateNATGatewayRequest ¶ added in v1.7.0
type CreateNATGatewayRequest struct {
AutoRenewTerm bool `json:"autoRenewTerm"`
Config NATGatewayNetworkConfig `json:"config"`
LocationID int `json:"locationId"`
ProductName string `json:"productName"`
PromoCode string `json:"promoCode,omitempty"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
ServiceLevelReference string `json:"serviceLevelReference,omitempty"`
Speed int `json:"speed"`
Term int `json:"term"`
}
CreateNATGatewayRequest represents a request to create a NAT Gateway.
type CreateServiceKeyAPIResponse ¶ added in v1.0.3
type CreateServiceKeyAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data CreateServiceKeyAPIResponseData `json:"data"`
}
CreateServiceKeyAPIResponse represents a response from creating a service key from the Megaport Service Key API.
type CreateServiceKeyAPIResponseData ¶ added in v1.0.3
type CreateServiceKeyAPIResponseData struct {
Key string `json:"key"`
}
CreateServiceKeyAPIResponseData represents the data field in the CreateServiceKeyAPIResponse.
type CreateServiceKeyRequest ¶ added in v1.0.3
type CreateServiceKeyRequest struct {
ProductUID string `json:"productUid,omitempty"` // The Port ID for the service key. API can take either UID or ID.
ProductID int `json:"productId,omitempty"` // The Port UID for the service key. API can take either UID or ID.
SingleUse bool `json:"singleUse"` // Determines whether to create a single-use or multi-use service key. Valid values are true (single-use) and false (multi-use). With a multi-use key, the customer that you share the key with can request multiple connections using that key. For single-use keys only, specify a VLAN ID (vlan).
MaxSpeed int `json:"maxSpeed"`
Active bool `json:"active,omitempty"` // Determines whether the service key is available for use. Valid values are true if you want the key to be available right away and false if you don’t want the key to be available right away.
PreApproved bool `json:"preApproved,omitempty"` // Whether the service key is pre-approved for use.
Description string `json:"description,omitempty"` // A description for the service key.
VLAN int `json:"vlan,omitempty"` // The VLAN ID for the service key. Required for single-use keys only.
OrderValidFor *OrderValidFor `json:"validFor,omitempty"` // The ValidFor field parsed for the Megaport API
ValidFor *ValidFor // The range of dates for which the service key is valid.
}
CreateServiceKeyRequest represents a request to create a service key from the Megaport Service Key API.
type CreateServiceKeyResponse ¶ added in v1.0.3
type CreateServiceKeyResponse struct {
ServiceKeyUID string
}
CreateServiceKeyResponse represents a response from creating a service key from the Megaport Service Key API.
type CreateUserRequest ¶ added in v1.4.5
type CreateUserRequest struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Active bool `json:"active"`
Email string `json:"email"`
Phone string `json:"phone"`
Position UserPosition `json:"position"`
}
func (*CreateUserRequest) Validate ¶ added in v1.4.5
func (req *CreateUserRequest) Validate() error
Validate validates the CreateUserRequest according to the Megaport API requirements
type CreateUserResponse ¶ added in v1.4.5
type CreateUserResponse struct {
CompanyID int `json:"companyId"`
EmploymentID int `json:"employmentId"`
EmployeeID int `json:"employeeId"`
}
CreateUserResponse represents the data returned when creating a new user.
type DeleteIXRequest ¶ added in v1.3.2
type DeleteIXRequest struct {
DeleteNow bool // If true, delete immediately; if false, cancel at end of term
}
type DeleteMCRPrefixFilterListResponse ¶ added in v1.0.6
type DeleteMCRPrefixFilterListResponse struct {
IsDeleted bool
}
DeleteMCRPrefixFilterListResponse represents a response from deleting a prefix filter list on an MCR
type DeleteMCRRequest ¶
type DeleteMCRRequest struct {
MCRID string
DeleteNow bool
SafeDelete bool // If true, the API will check whether the MCR has any attached resources before deleting it. If the MCR has attached resources, the API will return an error.
}
DeleteMCRRequest represents a request to delete an MCR
type DeleteMCRResponse ¶
type DeleteMCRResponse struct {
IsDeleting bool
}
DeleteMCRResponse represents a response from deleting an MCR
type DeleteMVERequest ¶
type DeleteMVERequest struct {
MVEID string
SafeDelete bool // If true, the API will check whether the MVE has any attached resources before deleting it. If the MVE has attached resources, the API will return an error.
}
DeleteMVERequest represents a request to delete an MVE
type DeleteMVEResponse ¶
type DeleteMVEResponse struct {
IsDeleted bool
}
DeleteMVEResponse represents a response from deleting an MVE
type DeleteNATGatewayResponse ¶ added in v1.7.0
type DeleteNATGatewayResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
}
DeleteNATGatewayResponse is the API response for deleting a NAT Gateway.
type DeletePortRequest ¶
type DeletePortRequest struct {
PortID string
DeleteNow bool
SafeDelete bool // If true, the API will return an error if the port is in use by a VXC or other product
}
DeletePortRequest represents a request to delete a port.
DeleteNow must be true: ports only support immediate deletion (CANCEL_NOW). Requests with DeleteNow=false are rejected with ErrPortCancelLaterNotAllowed.
type DeletePortResponse ¶
type DeletePortResponse struct {
IsDeleting bool
}
DeletePortResponse represents a response from deleting a port.
type DeleteProductRequest ¶
type DeleteProductRequest struct {
ProductID string
DeleteNow bool
SafeDelete bool // If true, the call will check if the product has any attached resources. If it does, the API will return an error and the product will not be deleted.
}
DeleteProductRequest represents a request to delete a product in the Megaport Products API.
type DeleteProductResponse ¶
type DeleteProductResponse struct{}
DeleteProductResponse represents a response from the Megaport Products API after deleting a product.
type DeleteVXCRequest ¶
type DeleteVXCRequest struct {
DeleteNow bool
}
DeleteVXCRequest represents a request to delete a VXC in the Megaport VXC API.
type DeleteVXCResponse ¶
type DeleteVXCResponse struct {
IsDeleting bool
}
DeleteVXCResponse represents a response from deleting a VXC in the Megaport VXC API.
type DiscountDetails ¶ added in v1.12.0
type DiscountDetails struct {
UID string `json:"uid"`
Code string `json:"code"`
Description string `json:"description"`
PercentageAmount float64 `json:"percentageAmount,omitempty"`
AllocationMethod string `json:"allocationMethod,omitempty"`
Mechanism string `json:"mechanism,omitempty"`
}
DiscountDetails contains additional information about an applied discount.
type DiscountReason ¶ added in v1.12.0
type DiscountReason string
DiscountReason is the reason for a discount element.
const ( DiscountReasonTerm DiscountReason = "TERM" DiscountReasonWholesale DiscountReason = "WHOLESALE" DiscountReasonPartner DiscountReason = "PARTNER" DiscountReasonPartnerManaged DiscountReason = "PARTNER_MANAGED" DiscountReasonReseller DiscountReason = "RESELLER" )
type Environment ¶
type Environment string
const ( EnvironmentStaging Environment = "https://api-staging.megaport.com/" EnvironmentProduction Environment = "https://api.megaport.com/" EnvironmentDevelopment Environment = "https://api-mpone-dev.megaport.com" )
type ErrorResponse ¶
type ErrorResponse struct {
// HTTP response that caused this error
Response *http.Response
// Error message
Message string `json:"message"`
// Error Data
Data string `json:"data"`
// Trace ID returned from the API.
TraceID string `json:"trace_id"`
}
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Error returns the string representation of the error
type EventsService ¶ added in v1.7.1
type EventsService interface {
// GetMaintenanceEvents returns details about maintenance events, filtered by the specified state value.
GetMaintenanceEvents(ctx context.Context, state string) ([]MaintenanceEvent, error)
// GetOutageEvents returns details about outage events, filtered by the specified state value.
GetOutageEvents(ctx context.Context, state string) ([]OutageEvent, error)
}
func NewEventsService ¶ added in v1.7.1
func NewEventsService(client *Client) EventsService
type EventsServiceOp ¶ added in v1.7.1
type EventsServiceOp struct {
// contains filtered or unexported fields
}
func (*EventsServiceOp) GetMaintenanceEvents ¶ added in v1.7.1
func (svc *EventsServiceOp) GetMaintenanceEvents(ctx context.Context, state string) ([]MaintenanceEvent, error)
GetMaintenanceEvents retrieves maintenance events from the Megaport API, filtered by the specified state. It validates the state against the valid maintenance states and returns an error if invalid.
func (*EventsServiceOp) GetOutageEvents ¶ added in v1.7.1
func (svc *EventsServiceOp) GetOutageEvents(ctx context.Context, state string) ([]OutageEvent, error)
GetOutageEvents retrieves outage events from the Megaport API, filtered by the specified state. It validates the state against the valid outage states and returns an error if invalid.
type FortinetConfig ¶
type FortinetConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
LicenseData string `json:"licenseData,omitempty"`
}
FortinetConfig represents the configuration for a Fortinet MVE.
type GetNATGatewayTelemetryRequest ¶ added in v1.6.0
type GetNATGatewayTelemetryRequest struct {
ProductUID string // The product UID of the NAT Gateway.
Types []string // Telemetry types to retrieve, e.g. "BITS", "PACKETS", "SPEED".
From *time.Time // Start time. Mutually exclusive with Days.
To *time.Time // End time. Mutually exclusive with Days.
Days *int32 // Number of days of telemetry (1-180). Mutually exclusive with From/To.
}
GetNATGatewayTelemetryRequest represents a request to get telemetry data for a NAT Gateway.
type GetPortRequest ¶
type GetPortRequest struct {
PortID string
}
GetPortRequest represents a request to get a port.
type GetProductPricingRequest ¶ added in v1.12.0
type GetProductPricingRequest struct {
// Req is the product-specific pricing request.
Req PriceBookRequest
// CompanyID optionally scopes the pricing to a specific company (by numeric ID).
// Mutually exclusive with CompanyUID.
CompanyID int
// CompanyUID optionally scopes the pricing to a specific company (by UUID).
// Mutually exclusive with CompanyID.
CompanyUID string
}
GetProductPricingRequest wraps a PriceBookRequest with optional company context query params.
type GetServiceKeyAPIResponse ¶ added in v1.0.3
type GetServiceKeyAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *ServiceKey `json:"data"`
}
GetServiceKeyAPIResponse represents the Megaport API HTTP response from getting a service key from the Megaport Service Key API.
type GetUserActivityRequest ¶ added in v1.4.5
type GetUserActivityRequest struct {
// PersonIdOrUid is the user's person ID or UID to filter activity for a specific user.
PersonIdOrUid string
// CompanyIdOrUid is the company ID or UID to filter activity for a specific company.
CompanyIdOrUid string
}
GetUserActivityRequest represents the query parameters for retrieving user activity. If a field is not an empty string, it will be included as a query parameter.
type IPAddressPriceBookRequest ¶ added in v1.12.0
type IPAddressPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
LocationID int `json:"locationId"`
IPBlock string `json:"ipBlock"` // e.g. "/24"
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
IPAddressPriceBookRequest is a pricing request for an IP Address block.
type IPsecTunnelConfig ¶ added in v1.12.0
type IPsecTunnelConfig struct {
SourceIpAddress string `json:"sourceIpAddress"`
DestinationIpAddress string `json:"destinationIpAddress"`
Passive *bool `json:"passive,omitempty"` // nil applies the API default (true)
LocalId string `json:"localId,omitempty"` // IKE local identifier override, for peers behind NAT
RemoteId string `json:"remoteId,omitempty"` // IKE remote identifier override, for peers behind NAT
Phase1Lifetime *int `json:"phase1Lifetime,omitempty"` // seconds, 3600-604800, API default 28800
Phase2Lifetime *int `json:"phase2Lifetime,omitempty"` // seconds, 600-86400, must be < Phase1Lifetime, API default 3600
}
IPsecTunnelConfig is the IPsec tunnel on a VXC A-End ipSecTunnel interface on an MCR (PartnerConfigInterface.IpSecTunnelOptions, one per interface). Attach multiple ipSecTunnel interfaces for multiple tunnels, up to the MCR's IPsec add-on tunnel count. See https://docs.megaport.com/mcr/ipsec-mcr/. The MCR must have an IPsec add-on provisioned (see MCRAddOnIPsecConfig). The tunnel takes its description from the enclosing PartnerConfigInterface.Description.
type IX ¶ added in v1.3.2
type IX struct {
ProductID int `json:"productId"`
ProductUID string `json:"productUid"`
LocationID int `json:"locationId"`
LocationDetail IXLocationDetail `json:"locationDetail"`
Term int `json:"term"`
LocationUID string `json:"locationUid"`
ProductName string `json:"productName"`
ProvisioningStatus string `json:"provisioningStatus"`
RateLimit int `json:"rateLimit"`
PromoCode string `json:"promoCode"`
CreateDate *Time `json:"createDate"`
DeployDate *Time `json:"deployDate"`
SecondaryName string `json:"secondaryName"`
AttributeTags map[string]string `json:"attributeTags"`
VLAN int `json:"vlan"`
MACAddress string `json:"macAddress"`
IXPeerMacro string `json:"ixPeerMacro"`
ASN int `json:"asn"`
NetworkServiceType string `json:"networkServiceType"`
PublicGraph bool `json:"publicGraph"`
UsageAlgorithm string `json:"usageAlgorithm"`
Resources IXResources `json:"resources"`
}
IX represents an Internet Exchange in the Megaport API
type IXBGPConnection ¶ added in v1.3.2
type IXBGPConnection struct {
ASN int `json:"asn"`
CustomerASN int `json:"customer_asn"`
CustomerIPAddress string `json:"customer_ip_address"`
ISPASN int `json:"isp_asn"`
ISPIPAddress string `json:"isp_ip_address"`
IXPeerPolicy string `json:"ix_peer_policy"`
MaxPrefixes int `json:"max_prefixes"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
}
IXBGPConnection represents a BGP connection configuration for an IX
type IXIPAddress ¶ added in v1.3.2
type IXIPAddress struct {
Address string `json:"address"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Version int `json:"version"`
ReverseDNS string `json:"reverse_dns"`
}
IXIPAddress represents an IP address allocated for an IX
type IXInterface ¶ added in v1.3.2
type IXInterface struct {
Demarcation string `json:"demarcation"`
LOATemplate string `json:"loa_template"`
Media string `json:"media"`
PortSpeed int `json:"port_speed"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Up int `json:"up"`
Shutdown bool `json:"shutdown"`
}
IXInterface represents the physical interface details for an IX
type IXLocationDetail ¶ added in v1.3.2
type IXLocationDetail struct {
Name string `json:"name"`
City string `json:"city"`
Metro string `json:"metro"`
Country string `json:"country"`
}
IXLocationDetail represents the location information for an IX
type IXOrder ¶ added in v1.3.2
type IXOrder struct {
ProductUID string `json:"productUid"` // The productUid of the port to attach the IX to
AssociatedIXs []AssociatedIXOrder `json:"associatedIxs"` // List of IX configurations to associate with the port
}
IXOrder represents the full structure of an IX order for the API
func ConvertBuyIXRequestToIXOrder ¶ added in v1.3.2
func ConvertBuyIXRequestToIXOrder(req BuyIXRequest) []IXOrder
ConvertBuyIXRequestToIXOrder converts a BuyIXRequest to an IX order
type IXP ¶ added in v1.12.0
type IXP struct {
ID int `json:"id"`
ASN int `json:"asn"`
Name string `json:"name"`
Metro string `json:"metro"`
IPv4Network string `json:"ipv4_network"`
IPv6Network string `json:"ipv6_network"`
}
IXP represents a globally available Internet Exchange Point from GET /v2/ixp. This is distinct from IX, which represents a provisioned IX service on the account.
type IXPriceBookRequest ¶ added in v1.12.0
type IXPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
PortLocationID int `json:"portLocationId"`
IXType string `json:"ixType"`
Speed int `json:"speed"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
IXPriceBookRequest is a pricing request for an IX.
type IXResources ¶ added in v1.3.2
type IXResources struct {
Interface IXInterface `json:"interface"`
BGPConnections []IXBGPConnection `json:"bgp_connection"`
IPAddresses []IXIPAddress `json:"ip_address"`
VPLSInterface IXVPLSInterface `json:"vpls_interface"`
}
IXResources represents the resources associated with an IX
type IXService ¶ added in v1.3.2
type IXService interface {
// GetIX retrieves details about a specific Internet Exchange by ID
GetIX(ctx context.Context, id string) (*IX, error)
// BuyIX purchases a new Internet Exchange
BuyIX(ctx context.Context, req *BuyIXRequest) (*BuyIXResponse, error)
// ValidateIXOrder validates an Internet Exchange order without submitting it
ValidateIXOrder(ctx context.Context, req *BuyIXRequest) error
// UpdateIX updates an existing Internet Exchange
UpdateIX(ctx context.Context, id string, req *UpdateIXRequest) (*IX, error)
// DeleteIX deletes an Internet Exchange
DeleteIX(ctx context.Context, id string, req *DeleteIXRequest) error
// ListIXs lists all Internet Exchanges with optional filters
ListIXs(ctx context.Context, req *ListIXsRequest) ([]*IX, error)
// ListIXPs returns all globally available Internet Exchange Points with optional filters.
ListIXPs(ctx context.Context, req *ListIXPsRequest) ([]*IXP, error)
}
IXService is an interface for interacting with the IX endpoints of the Megaport API
func NewIXService ¶ added in v1.3.2
type IXServiceOp ¶ added in v1.3.2
type IXServiceOp struct {
Client *Client
}
IXServiceOp handles communication with the IX related methods of the Megaport API
func (*IXServiceOp) BuyIX ¶ added in v1.3.2
func (svc *IXServiceOp) BuyIX(ctx context.Context, req *BuyIXRequest) (*BuyIXResponse, error)
BuyIX purchases a new Internet Exchange from the Megaport API
func (*IXServiceOp) DeleteIX ¶ added in v1.3.2
func (svc *IXServiceOp) DeleteIX(ctx context.Context, id string, req *DeleteIXRequest) error
DeleteIX deletes an Internet Exchange
func (*IXServiceOp) ListIXPs ¶ added in v1.12.0
func (svc *IXServiceOp) ListIXPs(ctx context.Context, req *ListIXPsRequest) ([]*IXP, error)
ListIXPs returns globally available Internet Exchange Points. A nil req (or empty Metro) returns all IXPs; otherwise results are filtered to those whose metro contains req.Metro (case-insensitive).
func (*IXServiceOp) ListIXs ¶ added in v1.3.8
func (svc *IXServiceOp) ListIXs(ctx context.Context, req *ListIXsRequest) ([]*IX, error)
ListIXs lists all Internet Exchanges from the Products API
func (*IXServiceOp) UpdateIX ¶ added in v1.3.2
func (svc *IXServiceOp) UpdateIX(ctx context.Context, id string, req *UpdateIXRequest) (*IX, error)
UpdateIX updates an existing Internet Exchange
func (*IXServiceOp) ValidateIXOrder ¶ added in v1.3.2
func (svc *IXServiceOp) ValidateIXOrder(ctx context.Context, req *BuyIXRequest) error
ValidateIXOrder validates an Internet Exchange order without submitting it
type IXUpdate ¶ added in v1.3.2
type IXUpdate struct {
Name string `json:"name,omitempty"`
RateLimit *int `json:"rateLimit,omitempty"`
CostCentre string `json:"costCentre,omitempty"`
VLAN *int `json:"vlan,omitempty"`
MACAddress string `json:"macAddress,omitempty"`
ASN *int `json:"asn,omitempty"`
Password string `json:"password,omitempty"`
PublicGraph *bool `json:"publicGraph,omitempty"`
ReverseDns string `json:"reverseDns,omitempty"`
AEndProductUid string `json:"aEndProductUid,omitempty"`
Shutdown *bool `json:"shutdown,omitempty"`
}
IXUpdate represents the structure for updating an IX
type IXVPLSInterface ¶ added in v1.3.2
type IXVPLSInterface struct {
MACAddress string `json:"mac_address"`
RateLimitMbps int `json:"rate_limit_mbps"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
VLAN int `json:"vlan"`
Shutdown bool `json:"shutdown"`
}
IXVPLSInterface represents the VPLS interface configuration for an IX
type IpRoute ¶
type IpRoute struct {
Prefix string `json:"prefix"`
Description string `json:"description,omitempty"`
NextHop string `json:"nextHop"`
}
IpRoute represents an IP route.
type LevelFilterHandler ¶ added in v1.2.3
type LevelFilterHandler struct {
// contains filtered or unexported fields
}
Custom Handler with Log Filtering
func NewLevelFilterHandler ¶ added in v1.2.3
func NewLevelFilterHandler(level slog.Level, handler slog.Handler) *LevelFilterHandler
type ListBGPNeighborRoutesRequest ¶ added in v1.9.0
type ListBGPNeighborRoutesRequest struct {
MCRID string // The MCR UID
SessionID string // The BGP session ID
Direction LookingGlassRouteDirection // The direction (advertised or received)
IPFilter string // Optional: filter by IP address or prefix
}
ListBGPNeighborRoutesRequest represents a request to list routes from a specific BGP neighbor.
type ListBGPRoutesRequest ¶ added in v1.9.0
type ListBGPRoutesRequest struct {
MCRID string // The MCR UID
IPFilter string // Optional: filter by IP address or prefix
}
ListBGPRoutesRequest represents a request to list BGP routes from the MCR Looking Glass.
type ListBGPSessionsRequest ¶ added in v1.9.0
type ListBGPSessionsRequest struct {
MCRID string // The MCR UID
}
ListBGPSessionsRequest represents a request to list BGP sessions from the MCR Looking Glass.
type ListIPRoutesRequest ¶ added in v1.9.0
type ListIPRoutesRequest struct {
MCRID string // The MCR UID
Protocol RouteProtocol // Optional: filter by protocol
IPFilter string // Optional: filter by IP address or prefix
}
ListIPRoutesRequest represents a request to list IP routes from the MCR Looking Glass.
type ListIXPsRequest ¶ added in v1.12.0
type ListIXPsRequest struct {
Metro string // filter by metro name (case-insensitive substring match)
}
ListIXPsRequest carries optional filters for ListIXPs. All fields are optional; a nil or zero-value request returns all IXPs.
type ListIXsRequest ¶ added in v1.3.8
type ListIXsRequest struct {
// Basic filters
Name string // Filter by name (exact match)
NameContains string // Filter by partial name match
// Status filters
Status []string // Filter by specific provisioning statuses (e.g. "LIVE", "CONFIGURED")
// IX-specific filters
ASN int // Filter by specific ASN
VLAN int // Filter by specific VLAN
NetworkServiceType string // Filter by specific network service type
LocationID int // Filter by specific location ID
// Other common filters
RateLimit int // Filter by specific rate limit (in Mbps)
IncludeInactive bool // Include inactive IXs in the results
}
type ListLocationsV3Options ¶ added in v1.12.0
type ListLocationsV3Options struct {
Statuses []string
}
ListLocationsV3Options configures ListLocationsV3WithOptions.
Statuses filters the returned locations to the given status values, sent as repeated locationStatuses query parameters. An empty Statuses — or a nil *ListLocationsV3Options — sends no filter and returns all statuses, matching ListLocationsV3. To request only orderable sites, pass Statuses: []string{LocationStatusActive}.
type ListMCRsRequest ¶ added in v1.3.3
type ListMCRsRequest struct {
IncludeInactive bool
}
ListMCRsRequest represents a request to list MCRs. It allows you to filter by whether the provisioning status is active.
type ListMVEsRequest ¶ added in v1.3.3
type ListMVEsRequest struct {
IncludeInactive bool
}
ListMVEsRequest represents a request to list MVEs. It allows you to determine whether to include inactive MVEs in the response. The default is to include only active MVEs.
type ListOrderApprovalsAPIResponse ¶ added in v1.8.0
type ListOrderApprovalsAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*OrderApproval `json:"data"`
}
ListOrderApprovalsAPIResponse represents the Megaport API HTTP response from listing order approvals.
type ListOrderApprovalsRequest ¶ added in v1.8.0
type ListOrderApprovalsRequest struct {
Status *OrderApprovalStatus // Filter by approval status (optional).
ServiceIDs []int // Filter by service IDs (optional).
PageNumber *int // Page number for pagination; if nil, the API default is used.
PageSize *int // Page size for pagination; if nil, the API default is used.
Sort *string // Field to sort by (optional).
Direction *string // Sort direction: ASC or DESC (default DESC).
}
ListOrderApprovalsRequest represents a request to list order approvals from the Megaport API.
type ListOrderApprovalsResponse ¶ added in v1.8.0
type ListOrderApprovalsResponse struct {
OrderApprovals []*OrderApproval
TotalCount int
Page int
Limit int
TotalPages int
}
ListOrderApprovalsResponse represents the Go SDK response from listing order approvals.
type ListPartnerPortsRequest ¶ added in v1.0.11
ListPartnerPortsRequest represents a request to list available partner ports in the Megaport VXC API.
type ListPartnerPortsResponse ¶ added in v1.0.11
type ListPartnerPortsResponse struct {
Data PartnerLookup
}
type ListServiceKeysAPIResponse ¶ added in v1.0.3
type ListServiceKeysAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*ServiceKey `json:"data"`
}
ListServiceKeysAPIResponse represents the Megaport API HTTP response from listing service keys from the Megaport Service Key API.
type ListServiceKeysRequest ¶ added in v1.0.3
type ListServiceKeysRequest struct {
ProductUID *string // List keys linked to the Port specified by the product ID or UID. (Optional)
}
ListServiceKeysRequest represents a request to list service keys from the Megaport Service Key API.
type ListServiceKeysResponse ¶ added in v1.0.3
type ListServiceKeysResponse struct {
ServiceKeys []*ServiceKey
}
ListServiceKeysResponse represents the Go SDK response from listing service keys from the Megaport Service Key API.
type ListVXCsRequest ¶ added in v1.3.8
type ListVXCsRequest struct {
// Basic filters
Name string // Filter by name (exact match)
NameContains string // Filter by partial name match
// Status filters
Status []string // Filter by specific provisioning statuses (e.g. "LIVE", "CONFIGURED")
// Connection filters
AEndProductUID string // Filter by A-End product UID
BEndProductUID string // Filter by B-End product UID
// Other common filters
RateLimit int // Filter by specific rate limit (in Mbps)
IncludeInactive bool // Include inactive VXCs in the results
}
ListVXCsRequest represents a request to list VXCs in the Megaport VXC API.
type Location
deprecated
type Location struct {
Name string `json:"name"`
Country string `json:"country"`
LiveDate *Time `json:"liveDate"`
SiteCode string `json:"siteCode"`
NetworkRegion string `json:"networkRegion"`
Address map[string]string `json:"address"`
Campus string `json:"campus"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Products *LocationProducts `json:"products"`
Market string `json:"market"`
Metro string `json:"metro"`
VRouterAvailable bool `json:"vRouterAvailable"`
ID int `json:"id"`
Status string `json:"status"`
}
Location represents a location in the Megaport API v2.
Deprecated: This struct is maintained for backward compatibility but should not be used for new code. Use LocationV3 for new implementations.
type LocationMVE
deprecated
type LocationMVE struct {
Sizes []string `json:"sizes"`
Details []LocationMVEDetails `json:"details"`
MaxCPUCount int `json:"maxCpuCount"`
Version string `json:"version"`
Product string `json:"product"`
Vendor string `json:"vendor"`
VendorDescription string `json:"vendorDescription"`
ID int `json:"id"`
ReleaseImage bool `json:"releaseImage"`
}
LocationMVE represents the MVE product available at a location in the Megaport API v2.
Deprecated: This struct is part of the v2 API and is maintained for backward compatibility. Use LocationV3 for new implementations.
type LocationMVEDetails
deprecated
type LocationMVEDetails struct {
Size string `json:"size"`
Label string `json:"label"`
CPUCoreCount int `json:"cpuCoreCount"`
RamGB int `json:"ramGB"`
BandwidthMbps int `json:"bandwidthMbps"`
}
LocationMVEDetails represents the details of the MVE product available at a location in the Megaport API v2.
Deprecated: This struct is part of the v2 API and is maintained for backward compatibility. Use LocationV3 for new implementations.
type LocationProductKind ¶ added in v1.12.0
type LocationProductKind string
LocationProductKind identifies a product whose orderability can be checked against a LocationV3 via IsOrderable.
const ( LocationProductPort LocationProductKind = "PORT" LocationProductMCR LocationProductKind = "MCR" LocationProductMVE LocationProductKind = "MVE" LocationProductCrossConnect LocationProductKind = "CROSS_CONNECT" LocationProductNATGateway LocationProductKind = "NAT_GATEWAY" )
type LocationProducts
deprecated
type LocationProducts struct {
MCR bool `json:"mcr"`
MCRVersion int `json:"mcrVersion"`
Megaport []int `json:"megaport"`
MVE []LocationMVE `json:"mve"`
MCR1 []int `json:"mcr1"`
MCR2 []int `json:"mcr2"`
}
LocationProducts represents the products available at a location in the Megaport API v2.
Deprecated: This struct is part of the v2 API and is maintained for backward compatibility. Use LocationV3 with its DiversityZones field for new implementations.
type LocationService ¶
type LocationService interface {
// V3 API methods (RECOMMENDED for new code)
// ListLocationsV3 returns a list of all locations in the Megaport Locations API v3.
ListLocationsV3(ctx context.Context) ([]*LocationV3, error)
// ListLocationsV3WithOptions returns locations filtered server-side by
// the provided options. A nil opts is equivalent to ListLocationsV3.
ListLocationsV3WithOptions(ctx context.Context, opts *ListLocationsV3Options) ([]*LocationV3, error)
// GetLocationByIDV3 returns a location by its ID in the Megaport Locations API v3.
GetLocationByIDV3(ctx context.Context, locationID int) (*LocationV3, error)
// GetLocationByNameV3 returns a location by its name in the Megaport Locations API v3.
GetLocationByNameV3(ctx context.Context, locationName string) (*LocationV3, error)
// GetLocationByNameFuzzyV3 returns a location by its name in the Megaport Locations API v3 using fuzzy search.
GetLocationByNameFuzzyV3(ctx context.Context, search string) ([]*LocationV3, error)
// FilterLocationsByMarketCodeV3 filters locations by market code in the Megaport Locations API v3.
FilterLocationsByMarketCodeV3(ctx context.Context, marketCode string, locations []*LocationV3) ([]*LocationV3, error)
// FilterLocationsByMcrAvailabilityV3 filters locations by MCR availability in the Megaport Locations API v3.
FilterLocationsByMcrAvailabilityV3(ctx context.Context, mcrAvailable bool, locations []*LocationV3) []*LocationV3
// FilterLocationsByMetroV3 filters locations by metro name in the Megaport Locations API v3.
FilterLocationsByMetroV3(ctx context.Context, metro string, locations []*LocationV3) []*LocationV3
// FilterLocationsByNATGatewaySpeedV3 filters locations by NAT Gateway
// speed availability (Mbps) advertised in the v3 API diversity zones.
FilterLocationsByNATGatewaySpeedV3(ctx context.Context, speedMbps int, locations []*LocationV3) []*LocationV3
// Shared methods (work with both v2 and v3)
// ListCountries returns a list of all countries in the Megaport Network Regions API.
ListCountries(ctx context.Context) ([]*Country, error)
// ListMarketCodes returns a list of all market codes in the Megaport Network Regions API.
ListMarketCodes(ctx context.Context) ([]string, error)
// IsValidMarketCode checks if a market code is valid in the Megaport Network Regions API.
IsValidMarketCode(ctx context.Context, marketCode string) (bool, error)
// GetRoundTripTimes returns a list of median RTTs between a specified location and other Megaport locations.
GetRoundTripTimes(ctx context.Context, srcLocation, year, month int) ([]*RoundTripTime, error)
// ListLocations returns a list of all locations in the Megaport Locations API v2.
//
// Deprecated: Use ListLocationsV3 instead. The v2 API will be removed in a future version.
ListLocations(ctx context.Context) ([]*Location, error)
// GetLocationByID returns a location by its ID in the Megaport Locations API v2.
//
// Deprecated: Use GetLocationByIDV3 instead. The v2 API will be removed in a future version.
GetLocationByID(ctx context.Context, locationID int) (*Location, error)
// GetLocationByName returns a location by its name in the Megaport Locations API v2.
//
// Deprecated: Use GetLocationByNameV3 instead. The v2 API will be removed in a future version.
GetLocationByName(ctx context.Context, locationName string) (*Location, error)
// GetLocationByNameFuzzy returns a location by its name in the Megaport Locations API v2 using fuzzy search.
//
// Deprecated: Use GetLocationByNameFuzzyV3 instead. The v2 API will be removed in a future version.
GetLocationByNameFuzzy(ctx context.Context, search string) ([]*Location, error)
// FilterLocationsByMarketCode filters locations by market code in the Megaport Locations API v2.
//
// Deprecated: Use FilterLocationsByMarketCodeV3 instead. The v2 API will be removed in a future version.
FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error)
// FilterLocationsByMcrAvailability filters locations by MCR availability in the Megaport Locations API v2.
//
// Deprecated: Use FilterLocationsByMcrAvailabilityV3 instead. The v2 API will be removed in a future version.
FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*Location) []*Location
}
LocationService is an interface for interfacing with the Location endpoints of the Megaport API.
type LocationServiceOp ¶
type LocationServiceOp struct {
Client *Client
}
LocationServiceOp handles communication with Location methods of the Megaport API.
func NewLocationService ¶
func NewLocationService(c *Client) *LocationServiceOp
NewLocationService creates a new instance of the Location Service.
func (*LocationServiceOp) FilterLocationsByMarketCode
deprecated
func (svc *LocationServiceOp) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error)
FilterLocationsByMarketCode filters locations by market code in the Megaport Locations API.
Deprecated: Use FilterLocationsByMarketCodeV3 instead. The v2 API will be removed in a future version.
func (*LocationServiceOp) FilterLocationsByMarketCodeV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) FilterLocationsByMarketCodeV3(ctx context.Context, marketCode string, locations []*LocationV3) ([]*LocationV3, error)
FilterLocationsByMarketCodeV3 filters locations by market code using the v3 API.
func (*LocationServiceOp) FilterLocationsByMcrAvailability
deprecated
func (svc *LocationServiceOp) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*Location) []*Location
FilterLocationsByMcrAvailability filters locations by MCR availability in the Megaport Locations API.
Deprecated: Use FilterLocationsByMcrAvailabilityV3 instead. The v2 API will be removed in a future version.
func (*LocationServiceOp) FilterLocationsByMcrAvailabilityV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) FilterLocationsByMcrAvailabilityV3(ctx context.Context, mcrAvailable bool, locations []*LocationV3) []*LocationV3
FilterLocationsByMcrAvailabilityV3 filters locations by MCR availability using the v3 API.
func (*LocationServiceOp) FilterLocationsByMetroV3 ¶ added in v1.12.0
func (svc *LocationServiceOp) FilterLocationsByMetroV3(ctx context.Context, metro string, locations []*LocationV3) []*LocationV3
FilterLocationsByMetroV3 filters locations by metro name using the v3 API. If metro is empty, all locations are returned.
func (*LocationServiceOp) FilterLocationsByNATGatewaySpeedV3 ¶ added in v1.7.1
func (svc *LocationServiceOp) FilterLocationsByNATGatewaySpeedV3(ctx context.Context, speedMbps int, locations []*LocationV3) []*LocationV3
FilterLocationsByNATGatewaySpeedV3 returns only locations where at least one diversity zone advertises the given NAT Gateway speed (Mbps).
func (*LocationServiceOp) GetLocationByID
deprecated
func (*LocationServiceOp) GetLocationByIDV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) GetLocationByIDV3(ctx context.Context, locationID int) (*LocationV3, error)
GetLocationByIDV3 returns a location by its ID using the v3 API.
func (*LocationServiceOp) GetLocationByName
deprecated
func (*LocationServiceOp) GetLocationByNameFuzzy
deprecated
func (svc *LocationServiceOp) GetLocationByNameFuzzy(ctx context.Context, search string) ([]*Location, error)
GetLocationByNameFuzzy returns a location by its name in the Megaport Locations API using fuzzy search.
Deprecated: Use GetLocationByNameFuzzyV3 instead. The v2 API will be removed in a future version.
func (*LocationServiceOp) GetLocationByNameFuzzyV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) GetLocationByNameFuzzyV3(ctx context.Context, search string) ([]*LocationV3, error)
GetLocationByNameFuzzyV3 returns locations by name using fuzzy search with the v3 API.
func (*LocationServiceOp) GetLocationByNameV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) GetLocationByNameV3(ctx context.Context, locationName string) (*LocationV3, error)
GetLocationByNameV3 returns a location by its name using the v3 API.
func (*LocationServiceOp) GetRoundTripTimes ¶ added in v1.5.0
func (svc *LocationServiceOp) GetRoundTripTimes(ctx context.Context, srcLocation, year, month int) ([]*RoundTripTime, error)
GetRoundTripTimes returns a list of median RTTs from a specified location to other Megaport locations, for the given month. Note that the statistics provided by this endpoint are historical, rather than on-demand. Data for the current month will not reliably be available. Also note that at time of writing, data is not made available in the staging environment; an empty slice of RTTs will be returned.
func (*LocationServiceOp) IsValidMarketCode ¶
func (svc *LocationServiceOp) IsValidMarketCode(ctx context.Context, marketCode string) (bool, error)
IsValidMarketCode checks if a market code is valid in the Megaport Network Regions API.
func (*LocationServiceOp) ListCountries ¶
func (svc *LocationServiceOp) ListCountries(ctx context.Context) ([]*Country, error)
ListCountries returns a list of all countries in the Megaport Network Regions API.
func (*LocationServiceOp) ListLocations
deprecated
func (svc *LocationServiceOp) ListLocations(ctx context.Context) ([]*Location, error)
ListLocations returns a list of all locations in the Megaport Locations API.
Deprecated: Use ListLocationsV3 instead. The v2 API will be removed in a future version.
func (*LocationServiceOp) ListLocationsV3 ¶ added in v1.4.0
func (svc *LocationServiceOp) ListLocationsV3(ctx context.Context) ([]*LocationV3, error)
ListLocationsV3 returns a list of all locations using the v3 API.
func (*LocationServiceOp) ListLocationsV3WithOptions ¶ added in v1.12.0
func (svc *LocationServiceOp) ListLocationsV3WithOptions(ctx context.Context, opts *ListLocationsV3Options) ([]*LocationV3, error)
ListLocationsV3WithOptions returns locations filtered server-side by the provided options. When opts is nil, no filter is applied and the call is equivalent to ListLocationsV3.
func (*LocationServiceOp) ListMarketCodes ¶
func (svc *LocationServiceOp) ListMarketCodes(ctx context.Context) ([]string, error)
ListMarketCodes returns a list of all market codes in the Megaport Network Regions API.
type LocationV3 ¶ added in v1.4.0
type LocationV3 struct {
// Core location identifiers (preserved from v2)
ID int `json:"id"`
Name string `json:"name"`
Metro string `json:"metro"`
Market string `json:"market"`
Status string `json:"status"`
// Geographic information (preserved from v2)
Address LocationV3Address `json:"address"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
// Data center information (NEW in v3)
DataCentre LocationV3DataCentre `json:"dataCentre"`
// Product and availability information (NEW structure in v3)
DiversityZones *LocationV3DiversityZones `json:"diversityZones"`
ProductAddOns *LocationV3ProductAddOns `json:"productAddOns"`
OrderingMessage *string `json:"orderingMessage"`
}
LocationV3 represents a location in the Megaport API v3. This struct should be used for all new implementations.
func (*LocationV3) GetCountry ¶ added in v1.4.0
func (l *LocationV3) GetCountry() string
GetCountry returns the country from the address.
func (*LocationV3) GetCrossConnectType ¶ added in v1.4.0
func (l *LocationV3) GetCrossConnectType() string
GetCrossConnectType returns the cross-connect type if available.
func (*LocationV3) GetDataCenterID ¶ added in v1.4.0
func (l *LocationV3) GetDataCenterID() int
GetDataCenterID returns the data center ID.
func (*LocationV3) GetDataCenterName ¶ added in v1.4.0
func (l *LocationV3) GetDataCenterName() string
GetDataCenterName returns the data center name.
func (*LocationV3) GetMCRSpeeds ¶ added in v1.4.0
func (l *LocationV3) GetMCRSpeeds() []int
GetMCRSpeeds returns all available MCR speeds from both diversity zones.
func (*LocationV3) GetMVEMaxCpuCores ¶ added in v1.4.0
func (l *LocationV3) GetMVEMaxCpuCores() *int
GetMVEMaxCpuCores returns the maximum MVE CPU cores available across all zones.
func (*LocationV3) GetMegaportSpeeds ¶ added in v1.4.0
func (l *LocationV3) GetMegaportSpeeds() []int
GetMegaportSpeeds returns all available Megaport speeds from both diversity zones.
func (*LocationV3) GetNATGatewaySpeeds ¶ added in v1.7.1
func (l *LocationV3) GetNATGatewaySpeeds() []int
GetNATGatewaySpeeds returns the deduplicated list of NAT Gateway speeds supported at this location across both diversity zones.
func (*LocationV3) HasCrossConnectSupport ¶ added in v1.4.0
func (l *LocationV3) HasCrossConnectSupport() bool
HasCrossConnectSupport checks if the location supports cross-connects.
func (*LocationV3) HasMCRSupport ¶ added in v1.4.0
func (l *LocationV3) HasMCRSupport() bool
HasMCRSupport checks if the location supports MCR based on v3 diversity zones.
func (*LocationV3) HasMVESupport ¶ added in v1.4.0
func (l *LocationV3) HasMVESupport() bool
HasMVESupport checks if the location supports MVE.
func (*LocationV3) HasNATGatewaySupport ¶ added in v1.7.1
func (l *LocationV3) HasNATGatewaySupport() bool
HasNATGatewaySupport checks if the location supports NAT Gateway in any diversity zone.
func (*LocationV3) IsOrderable ¶ added in v1.12.0
func (l *LocationV3) IsOrderable(product LocationProductKind) bool
IsOrderable reports whether the location is currently orderable for the given product. A location is orderable only when its Status is Active AND the product-specific availability is set. Unknown LocationProductKind values return false.
func (*LocationV3) IsStatusOrderable ¶ added in v1.12.0
func (l *LocationV3) IsStatusOrderable() bool
IsStatusOrderable reports whether the location's Status permits ordering. Only Active is considered orderable.
func (*LocationV3) SupportsNATGatewaySpeed ¶ added in v1.7.1
func (l *LocationV3) SupportsNATGatewaySpeed(speedMbps int) bool
SupportsNATGatewaySpeed reports whether the location supports a NAT Gateway at the given speed (Mbps) in any diversity zone.
func (*LocationV3) ToLegacyLocation ¶ added in v1.4.0
func (l *LocationV3) ToLegacyLocation() *Location
ToLegacyLocation converts a LocationV3 to the legacy Location struct for backward compatibility. Note: Some fields cannot be accurately converted due to structural differences between v2 and v3.
type LocationV3Address ¶ added in v1.4.0
type LocationV3Address struct {
Street string `json:"street"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Country string `json:"country"`
}
LocationV3Address represents the address structure in v3 API
type LocationV3CrossConnect ¶ added in v1.4.0
type LocationV3CrossConnect struct {
Available bool `json:"available"`
Type *string `json:"type,omitempty"`
}
LocationV3CrossConnect represents cross-connect availability and type
type LocationV3DataCentre ¶ added in v1.4.0
LocationV3DataCentre represents data center information in v3 API
type LocationV3DiversityZone ¶ added in v1.4.0
type LocationV3DiversityZone struct {
McrSpeedMbps []int `json:"mcrSpeedMbps,omitempty"`
MegaportSpeedMbps []int `json:"megaportSpeedMbps,omitempty"`
MveMaxCpuCoreCount *int `json:"mveMaxCpuCoreCount,omitempty"`
MveAvailable bool `json:"mveAvailable"`
NATGatewaySpeedMbps []int `json:"natGatewaySpeedMbps,omitempty"`
}
LocationV3DiversityZone represents a single diversity zone with product availability
type LocationV3DiversityZones ¶ added in v1.4.0
type LocationV3DiversityZones struct {
Red *LocationV3DiversityZone `json:"red,omitempty"`
Blue *LocationV3DiversityZone `json:"blue,omitempty"`
}
LocationV3DiversityZones represents the diversity zones and product availability in v3 API
type LocationV3ProductAddOns ¶ added in v1.4.0
type LocationV3ProductAddOns struct {
CrossConnect *LocationV3CrossConnect `json:"crossConnect,omitempty"`
}
LocationV3ProductAddOns represents additional product options available at the location
type LockPortRequest ¶
type LockPortRequest struct {
PortID string
}
LockPortRequest represents a request to lock a port.
type LockPortResponse ¶
type LockPortResponse struct {
IsLocking bool
}
LockPortResponse represents a response from locking a port.
type LookingGlassAsyncBGPNeighborRoutesResponse ¶ added in v1.9.0
type LookingGlassAsyncBGPNeighborRoutesResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *AsyncBGPNeighborRoutesData `json:"data"`
}
LookingGlassAsyncBGPNeighborRoutesResponse represents the API response for async BGP neighbor routes result.
type LookingGlassAsyncIPRoutesResponse ¶ added in v1.9.0
type LookingGlassAsyncIPRoutesResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *AsyncIPRoutesData `json:"data"`
}
LookingGlassAsyncIPRoutesResponse represents the API response for async IP routes result.
type LookingGlassAsyncJob ¶ added in v1.9.0
type LookingGlassAsyncJob struct {
JobID string `json:"jobId"` // The unique job identifier
Status LookingGlassAsyncStatus `json:"status"` // The job status
CreatedAt *Time `json:"createdAt"` // When the job was created
UpdatedAt *Time `json:"updatedAt"` // When the job was last updated
ExpiresAt *Time `json:"expiresAt"` // When the job results expire
}
LookingGlassAsyncJob represents an async job for Looking Glass queries.
type LookingGlassAsyncJobResponse ¶ added in v1.9.0
type LookingGlassAsyncJobResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *LookingGlassAsyncJob `json:"data"`
}
LookingGlassAsyncJobResponse represents the API response for an async job submission.
type LookingGlassAsyncStatus ¶ added in v1.9.0
type LookingGlassAsyncStatus string
LookingGlassAsyncStatus represents the status of an async Looking Glass operation.
const ( LookingGlassAsyncStatusPending LookingGlassAsyncStatus = "PENDING" LookingGlassAsyncStatusProcessing LookingGlassAsyncStatus = "PROCESSING" LookingGlassAsyncStatusComplete LookingGlassAsyncStatus = "COMPLETE" LookingGlassAsyncStatusFailed LookingGlassAsyncStatus = "FAILED" )
type LookingGlassBGPNeighborRoute ¶ added in v1.9.0
type LookingGlassBGPNeighborRoute struct {
Prefix string `json:"prefix"` // The network prefix
NextHop string `json:"nextHop"` // The next hop IP address
ASPath []int `json:"asPath"` // The AS path
LocalPref *int `json:"localPref"` // Local preference
MED *int `json:"med"` // Multi-Exit Discriminator
Origin string `json:"origin"` // Origin attribute
Communities []string `json:"communities"` // BGP communities
Valid bool `json:"valid"` // Whether the route is valid
Best bool `json:"best"` // Whether this is the best path
}
LookingGlassBGPNeighborRoute represents a route advertised or received from a BGP neighbor.
type LookingGlassBGPNeighborRoutesResponse ¶ added in v1.9.0
type LookingGlassBGPNeighborRoutesResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*LookingGlassBGPNeighborRoute `json:"data"`
}
LookingGlassBGPNeighborRoutesResponse represents the API response for BGP neighbor routes.
type LookingGlassBGPRoute ¶ added in v1.9.0
type LookingGlassBGPRoute struct {
Prefix string `json:"prefix"` // The network prefix
NextHop string `json:"nextHop"` // The next hop IP address
ASPath []int `json:"asPath"` // The AS path
LocalPref *int `json:"localPref"` // Local preference
MED *int `json:"med"` // Multi-Exit Discriminator
Origin string `json:"origin"` // Origin attribute (IGP, EGP, INCOMPLETE)
Communities []string `json:"communities"` // BGP communities
Weight *int `json:"weight"` // BGP weight
Valid bool `json:"valid"` // Whether the route is valid
Best bool `json:"best"` // Whether this is the best path
NeighborIP string `json:"neighborIp"` // The BGP neighbor IP that advertised this route
NeighborASN *int `json:"neighborAsn"` // The BGP neighbor ASN
Age *int `json:"age"` // Age of the route in seconds
VXCID *int `json:"vxcId"` // Associated VXC ID
VXCName string `json:"vxcName"` // Associated VXC name
}
LookingGlassBGPRoute represents a BGP-specific route with full BGP attributes.
type LookingGlassBGPRoutesResponse ¶ added in v1.9.0
type LookingGlassBGPRoutesResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*LookingGlassBGPRoute `json:"data"`
}
LookingGlassBGPRoutesResponse represents the API response for BGP routes.
type LookingGlassBGPSession ¶ added in v1.9.0
type LookingGlassBGPSession struct {
SessionID string `json:"sessionId"` // Unique identifier for the BGP session
NeighborAddress string `json:"neighborAddress"` // The BGP neighbor IP address
NeighborASN int `json:"neighborAsn"` // The BGP neighbor ASN
LocalASN int `json:"localAsn"` // The local ASN
Status BGPSessionStatus `json:"status"` // Session status (UP, DOWN, UNKNOWN)
Uptime *int `json:"uptime"` // Session uptime in seconds
PrefixesIn *int `json:"prefixesIn"` // Number of prefixes received
PrefixesOut *int `json:"prefixesOut"` // Number of prefixes advertised
VXCID int `json:"vxcId"` // Associated VXC ID
VXCName string `json:"vxcName"` // Associated VXC name
LastStateChange *int `json:"lastStateChange"` // Seconds since last state change
Description string `json:"description"` // Session description
}
LookingGlassBGPSession represents a BGP session on the MCR.
type LookingGlassBGPSessionsResponse ¶ added in v1.9.0
type LookingGlassBGPSessionsResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*LookingGlassBGPSession `json:"data"`
}
LookingGlassBGPSessionsResponse represents the API response for BGP sessions.
type LookingGlassIPRoute ¶ added in v1.9.0
type LookingGlassIPRoute struct {
Prefix string `json:"prefix"` // The network prefix (e.g., "10.0.0.0/24")
NextHop string `json:"nextHop"` // The next hop IP address
Protocol RouteProtocol `json:"protocol"` // The protocol that learned this route
Metric *int `json:"metric"` // The route metric (optional)
LocalPref *int `json:"localPref"` // BGP local preference (optional)
ASPath []int `json:"asPath"` // BGP AS path (optional)
Age *int `json:"age"` // Age of the route in seconds (optional)
Interface string `json:"interface"` // The interface for this route
VXCID *int `json:"vxcId"` // Associated VXC ID (optional)
VXCName string `json:"vxcName"` // Associated VXC name (optional)
Communities []string `json:"communities"` // BGP communities (optional)
Origin string `json:"origin"` // BGP origin attribute (optional)
MED *int `json:"med"` // BGP Multi-Exit Discriminator (optional)
Best *bool `json:"best"` // Whether this is the best route (optional)
}
LookingGlassIPRoute represents an IP route in the MCR routing table.
type LookingGlassIPRoutesResponse ¶ added in v1.9.0
type LookingGlassIPRoutesResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*LookingGlassIPRoute `json:"data"`
}
LookingGlassIPRoutesResponse represents the API response for IP routes.
type LookingGlassPingResult ¶ added in v1.15.0
type LookingGlassPingResult struct {
RawOutput string `json:"rawOutput,omitempty"`
Statistics *LookingGlassPingStatistics `json:"statistics,omitempty"`
}
LookingGlassPingResult is the result of a ping operation.
type LookingGlassPingStatistics ¶ added in v1.15.0
type LookingGlassPingStatistics struct {
Duplicates int `json:"duplicates"`
Errors int `json:"errors"`
PacketLossPct float64 `json:"packetLossPct"`
PacketsReceived int `json:"packetsReceived"`
PacketsTransmitted int `json:"packetsTransmitted"`
RTTAvgMs float64 `json:"rttAvgMs"`
RTTMaxMs float64 `json:"rttMaxMs"`
RTTMdevMs float64 `json:"rttMdevMs"`
RTTMinMs float64 `json:"rttMinMs"`
TotalTimeMs float64 `json:"totalTimeMs"`
}
LookingGlassPingStatistics holds RTT and packet stats from a ping.
type LookingGlassRouteDirection ¶ added in v1.9.0
type LookingGlassRouteDirection string
LookingGlassRouteDirection represents the direction for BGP neighbor routes.
const ( LookingGlassRouteDirectionAdvertised LookingGlassRouteDirection = "advertised" LookingGlassRouteDirectionReceived LookingGlassRouteDirection = "received" )
type LookingGlassTracerouteHop ¶ added in v1.15.0
type LookingGlassTracerouteHop struct {
Hop string `json:"hop"`
Probes []*LookingGlassTracerouteProbe `json:"probes"`
}
LookingGlassTracerouteHop is one hop in a traceroute result.
type LookingGlassTracerouteProbe ¶ added in v1.15.0
type LookingGlassTracerouteProbe struct {
Host string `json:"host,omitempty"`
RTTMs float64 `json:"rttMs,omitempty"`
}
LookingGlassTracerouteProbe is a single probe result within a traceroute hop.
type LookingGlassTracerouteResult ¶ added in v1.15.0
type LookingGlassTracerouteResult struct {
RawOutput string `json:"rawOutput,omitempty"`
Hops []*LookingGlassTracerouteHop `json:"hops"`
}
LookingGlassTracerouteResult is the result of a traceroute operation.
type LookupPartnerPortsRequest ¶
LookupPartnerPortsRequest represents a request to lookup available partner ports in the Megaport VXC API.
type LookupPartnerPortsResponse ¶
type LookupPartnerPortsResponse struct {
ProductUID string
}
LookupPartnerPortsResponse represents a response from looking up available partner ports in the Megaport VXC API.
type MCR ¶
type MCR struct {
ID int `json:"productId"`
UID string `json:"productUid"`
Name string `json:"productName"`
Type string `json:"productType"`
ProvisioningStatus string `json:"provisioningStatus"`
CreateDate *Time `json:"createDate"`
CreatedBy string `json:"createdBy"`
CostCentre string `json:"costCentre"`
PortSpeed int `json:"portSpeed"`
TerminateDate *Time `json:"terminateDate"`
LiveDate *Time `json:"liveDate"`
Market string `json:"market"`
LocationID int `json:"locationId"`
UsageAlgorithm string `json:"usageAlgorithm"`
MarketplaceVisibility bool `json:"marketplaceVisibility"`
VXCPermitted bool `json:"vxcpermitted"`
VXCAutoApproval bool `json:"vxcAutoApproval"`
SecondaryName string `json:"secondaryName"`
LAGPrimary bool `json:"lagPrimary"`
LAGID int `json:"lagId"`
AggregationID int `json:"aggregationId"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
ContractStartDate *Time `json:"contractStartDate"`
ContractEndDate *Time `json:"contractEndDate"`
ContractTermMonths int `json:"contractTermMonths"`
AttributeTags map[string]string `json:"attributeTags"`
Virtual bool `json:"virtual"`
BuyoutPort bool `json:"buyoutPort"`
Locked bool `json:"locked"`
AdminLocked bool `json:"adminLocked"`
Cancelable bool `json:"cancelable"`
Resources MCRResources `json:"resources"`
DiversityZone string `json:"diversityZone"`
LocationDetails *ProductLocationDetails `json:"locationDetail"`
AssociatedVXCs []*VXC `json:"associatedVxcs"`
AssociatedIXs []*IX `json:"associatedIxs"`
AddOns []*MCRAddOnIPsecConfig `json:"addOns,omitempty"`
}
MCR represents a Megaport Cloud Router in the Megaport MCR API.
func (*MCR) GetAssociatedIXs ¶ added in v1.3.8
func (*MCR) GetAssociatedVXCs ¶ added in v1.3.8
func (*MCR) GetProvisioningStatus ¶ added in v1.3.3
type MCRAddOn ¶ added in v1.6.0
type MCRAddOn interface {
IsMCRAddOn()
GetAddOnType() string
}
MCRAddOn is an interface for MCR add-on configuration.
type MCRAddOnIPsecConfig ¶ added in v1.6.0
type MCRAddOnIPsecConfig struct {
ProductUID string `json:"productUid,omitempty"`
AddOnUID string `json:"addOnUid,omitempty"`
AddOnType string `json:"addOnType,omitempty"`
TunnelCount int `json:"tunnelCount,omitempty"`
PackCount int `json:"packCount,omitempty"`
}
MCRAddOnIPsecConfig represents the IPsec add-on configuration for an MCR order.
func (*MCRAddOnIPsecConfig) GetAddOnType ¶ added in v1.6.0
func (*MCRAddOnIPsecConfig) GetAddOnType() string
func (*MCRAddOnIPsecConfig) IsMCRAddOn ¶ added in v1.6.0
func (*MCRAddOnIPsecConfig) IsMCRAddOn()
type MCRAddOnRequest ¶ added in v1.6.0
type MCRLookingGlassService ¶ added in v1.9.0
type MCRLookingGlassService interface {
// ListIPRoutes retrieves the IP routing table from the MCR Looking Glass.
// This returns all routes (BGP, static, connected, local) that the MCR knows about.
ListIPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassIPRoute, error)
// ListIPRoutesWithFilter retrieves the IP routing table with optional filtering.
ListIPRoutesWithFilter(ctx context.Context, req *ListIPRoutesRequest) ([]*LookingGlassIPRoute, error)
// ListBGPRoutes retrieves BGP routes from the MCR Looking Glass.
// This returns routes learned via BGP with full BGP attributes.
ListBGPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassBGPRoute, error)
// ListBGPRoutesWithFilter retrieves BGP routes with optional filtering.
ListBGPRoutesWithFilter(ctx context.Context, req *ListBGPRoutesRequest) ([]*LookingGlassBGPRoute, error)
// ListBGPSessions retrieves all BGP sessions configured on the MCR.
ListBGPSessions(ctx context.Context, mcrUID string) ([]*LookingGlassBGPSession, error)
// ListBGPNeighborRoutes retrieves routes advertised to or received from a specific BGP neighbor.
ListBGPNeighborRoutes(ctx context.Context, req *ListBGPNeighborRoutesRequest) ([]*LookingGlassBGPNeighborRoute, error)
// ListIPRoutesAsync initiates an async query for IP routes and returns the job ID.
// Use GetAsyncIPRoutes to poll for results.
ListIPRoutesAsync(ctx context.Context, mcrUID string) (*LookingGlassAsyncJob, error)
// GetAsyncIPRoutes retrieves the results of an async IP routes query.
GetAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncIPRoutesData, error)
// ListBGPNeighborRoutesAsync initiates an async query for BGP neighbor routes.
// Use GetAsyncBGPNeighborRoutes to poll for results.
ListBGPNeighborRoutesAsync(ctx context.Context, req *ListBGPNeighborRoutesRequest) (*LookingGlassAsyncJob, error)
// GetAsyncBGPNeighborRoutes retrieves the results of an async BGP neighbor routes query.
GetAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncBGPNeighborRoutesData, error)
// WaitForAsyncIPRoutes polls for async IP routes results until the job
// completes or the context is cancelled. Callers control the overall
// timeout by passing a context with a deadline; if the context has no
// deadline, a default of defaultAsyncJobTimeout is applied.
WaitForAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassIPRoute, error)
// WaitForAsyncBGPNeighborRoutes polls for async BGP neighbor routes
// results until the job completes or the context is cancelled. Callers
// control the overall timeout by passing a context with a deadline; if
// the context has no deadline, a default of defaultAsyncJobTimeout is
// applied.
WaitForAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassBGPNeighborRoute, error)
// PingMCR initiates an ICMP ping from the MCR and returns the operation ID to poll with GetMCRPingResult.
PingMCR(ctx context.Context, req *MCRPingRequest) (string, error)
// TracerouteMCR initiates a traceroute from the MCR and returns the operation ID to poll with GetMCRTracerouteResult.
TracerouteMCR(ctx context.Context, req *MCRTracerouteRequest) (string, error)
// GetMCRPingResult retrieves the result of a pending ping operation. Returns nil result when still pending.
GetMCRPingResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
// GetMCRTracerouteResult retrieves the result of a pending traceroute operation. Returns nil result when still pending.
GetMCRTracerouteResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
// WaitForMCRPing polls until the ping result is available or context is cancelled.
WaitForMCRPing(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
// WaitForMCRTraceroute polls until the traceroute result is available or context is cancelled.
WaitForMCRTraceroute(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
}
MCRLookingGlassService is an interface for interfacing with the MCR Looking Glass endpoints of the Megaport API. The Looking Glass provides visibility into traffic routing, helping you troubleshoot connections by showing the status of protocols and routing tables in the MCR.
type MCRLookingGlassServiceOp ¶ added in v1.9.0
type MCRLookingGlassServiceOp struct {
Client *Client
// contains filtered or unexported fields
}
MCRLookingGlassServiceOp handles communication with MCR Looking Glass methods of the Megaport API.
func NewMCRLookingGlassService ¶ added in v1.9.0
func NewMCRLookingGlassService(c *Client) *MCRLookingGlassServiceOp
NewMCRLookingGlassService creates a new instance of the MCR Looking Glass Service.
func (*MCRLookingGlassServiceOp) GetAsyncBGPNeighborRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) GetAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncBGPNeighborRoutesData, error)
GetAsyncBGPNeighborRoutes retrieves the results of an async BGP neighbor routes query.
func (*MCRLookingGlassServiceOp) GetAsyncIPRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) GetAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) (*AsyncIPRoutesData, error)
GetAsyncIPRoutes retrieves the results of an async IP routes query.
func (*MCRLookingGlassServiceOp) GetMCRPingResult ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) GetMCRPingResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
GetMCRPingResult retrieves the result of a pending ping operation. Returns nil when still pending.
func (*MCRLookingGlassServiceOp) GetMCRTracerouteResult ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) GetMCRTracerouteResult(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
GetMCRTracerouteResult retrieves the result of a pending traceroute operation. Returns nil when still pending.
func (*MCRLookingGlassServiceOp) ListBGPNeighborRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListBGPNeighborRoutes(ctx context.Context, req *ListBGPNeighborRoutesRequest) ([]*LookingGlassBGPNeighborRoute, error)
ListBGPNeighborRoutes retrieves routes advertised to or received from a specific BGP neighbor.
func (*MCRLookingGlassServiceOp) ListBGPNeighborRoutesAsync ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListBGPNeighborRoutesAsync(ctx context.Context, req *ListBGPNeighborRoutesRequest) (*LookingGlassAsyncJob, error)
ListBGPNeighborRoutesAsync initiates an async query for BGP neighbor routes.
func (*MCRLookingGlassServiceOp) ListBGPRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListBGPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassBGPRoute, error)
ListBGPRoutes retrieves BGP routes from the MCR Looking Glass.
func (*MCRLookingGlassServiceOp) ListBGPRoutesWithFilter ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListBGPRoutesWithFilter(ctx context.Context, req *ListBGPRoutesRequest) ([]*LookingGlassBGPRoute, error)
ListBGPRoutesWithFilter retrieves BGP routes with optional filtering.
func (*MCRLookingGlassServiceOp) ListBGPSessions ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListBGPSessions(ctx context.Context, mcrUID string) ([]*LookingGlassBGPSession, error)
ListBGPSessions retrieves all BGP sessions configured on the MCR.
func (*MCRLookingGlassServiceOp) ListIPRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListIPRoutes(ctx context.Context, mcrUID string) ([]*LookingGlassIPRoute, error)
ListIPRoutes retrieves the IP routing table from the MCR Looking Glass.
func (*MCRLookingGlassServiceOp) ListIPRoutesAsync ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListIPRoutesAsync(ctx context.Context, mcrUID string) (*LookingGlassAsyncJob, error)
ListIPRoutesAsync initiates an async query for IP routes.
func (*MCRLookingGlassServiceOp) ListIPRoutesWithFilter ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) ListIPRoutesWithFilter(ctx context.Context, req *ListIPRoutesRequest) ([]*LookingGlassIPRoute, error)
ListIPRoutesWithFilter retrieves the IP routing table with optional filtering.
func (*MCRLookingGlassServiceOp) PingMCR ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) PingMCR(ctx context.Context, req *MCRPingRequest) (string, error)
PingMCR initiates an ICMP ping from the MCR and returns the operation ID.
func (*MCRLookingGlassServiceOp) TracerouteMCR ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) TracerouteMCR(ctx context.Context, req *MCRTracerouteRequest) (string, error)
TracerouteMCR initiates a traceroute from the MCR and returns the operation ID.
func (*MCRLookingGlassServiceOp) WaitForAsyncBGPNeighborRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) WaitForAsyncBGPNeighborRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassBGPNeighborRoute, error)
WaitForAsyncBGPNeighborRoutes polls for async BGP neighbor routes results until the job completes or the context is cancelled. If the context has no deadline, defaultAsyncJobTimeout is applied so callers who pass a bare context are still protected from hanging indefinitely.
func (*MCRLookingGlassServiceOp) WaitForAsyncIPRoutes ¶ added in v1.9.0
func (svc *MCRLookingGlassServiceOp) WaitForAsyncIPRoutes(ctx context.Context, mcrUID string, jobID string) ([]*LookingGlassIPRoute, error)
WaitForAsyncIPRoutes polls for async IP routes results until the job completes or the context is cancelled. If the context has no deadline, defaultAsyncJobTimeout is applied so callers who pass a bare context are still protected from hanging indefinitely.
func (*MCRLookingGlassServiceOp) WaitForMCRPing ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) WaitForMCRPing(ctx context.Context, mcrUID, operationID string) (*LookingGlassPingResult, error)
WaitForMCRPing polls until the ping result is available or context is cancelled. If the context has no deadline, mcrDiagnosticsPollTimeout is applied.
func (*MCRLookingGlassServiceOp) WaitForMCRTraceroute ¶ added in v1.15.0
func (svc *MCRLookingGlassServiceOp) WaitForMCRTraceroute(ctx context.Context, mcrUID, operationID string) (*LookingGlassTracerouteResult, error)
WaitForMCRTraceroute polls until the traceroute result is available or context is cancelled. If the context has no deadline, mcrDiagnosticsPollTimeout is applied.
type MCROrder ¶
type MCROrder struct {
LocationID int `json:"locationId"`
Name string `json:"productName"`
Term int `json:"term"`
Type string `json:"productType"`
PortSpeed int `json:"portSpeed"`
CostCentre string `json:"costCentre"`
PromoCode string `json:"promoCode,omitempty"`
MarketplaceVisibility *bool `json:"marketplaceVisibility,omitempty"`
Config MCROrderConfig `json:"config"`
AddOns []MCRAddOn `json:"addOns,omitempty"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
}
MCROrder represents a request to buy an MCR from the Megaport Products API.
type MCROrderConfig ¶
type MCROrderConfig struct {
ASN int `json:"mcrAsn,omitempty"`
DiversityZone string `json:"diversityZone,omitempty"`
}
MCROrderConfig represents the configuration for an MCR order.
type MCROrderConfirmation ¶
type MCROrderConfirmation struct {
TechnicalServiceUID string `json:"technicalServiceUid"`
}
MCROrderConfirmation represents a response from the Megaport Products API after ordering an MCR.
type MCRPingRequest ¶ added in v1.15.0
type MCRPingRequest struct {
MCRID string
DestinationAddress string // required
SourceAddress string // optional
PacketCount *int32 // optional, 1-60
PacketSize *int32 // optional, 1-9186
}
MCRPingRequest represents a request to ping a destination from an MCR.
type MCRPrefixFilterList ¶
type MCRPrefixFilterList struct {
ID int `json:"id"` // ID of the prefix filter list.
Description string `json:"description"`
AddressFamily string `json:"addressFamily"`
Entries []*MCRPrefixListEntry `json:"entries"`
}
MCRPrefixFilterList represents a prefix filter list associated with an MCR.
type MCRPrefixListEntry ¶
type MCRPrefixListEntry struct {
Action string `json:"action"`
Prefix string `json:"prefix"`
Ge int `json:"ge,omitempty"` // Great than or equal to - (Optional) The minimum starting prefix length to be matched. Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6). The minimum (ge) must be no greater than or equal to the maximum value (le).
Le int `json:"le,omitempty"` // Less than or equal to - (Optional) The maximum ending prefix length to be matched. The prefix length is greater than or equal to the minimum value (ge). Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6), but the maximum must be no less than the minimum value (ge).
}
MCRPrefixListEntry represents an entry in a prefix filter list.
type MCRPriceBookRequest ¶ added in v1.12.0
type MCRPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
LocationID int `json:"locationId"`
Speed int `json:"speed"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
MCRPriceBookRequest is a pricing request for an MCR.
type MCRResources ¶
type MCRResources struct {
Interface PortInterface `json:"interface"`
VirtualRouter MCRVirtualRouter `json:"virtual_router"`
}
MCRResources represents the resources associated with an MCR.
type MCRService ¶
type MCRService interface {
// BuyMCR buys an MCR from the Megaport MCR API.
BuyMCR(ctx context.Context, req *BuyMCRRequest) (*BuyMCRResponse, error)
// ValidateMCROrder validates an MCR order in the Megaport Products API.
ValidateMCROrder(ctx context.Context, req *BuyMCRRequest) error
// ListMCRs lists all MCRs in the Megaport API. It allows you to filter by whether the provisioning status is active.
ListMCRs(ctx context.Context, req *ListMCRsRequest) ([]*MCR, error)
// GetMCR gets details about a single MCR from the Megaport MCR API.
GetMCR(ctx context.Context, mcrId string) (*MCR, error)
// CreatePrefixFilterList creates a Prefix Filter List on an MCR from the Megaport MCR API.
CreatePrefixFilterList(ctx context.Context, req *CreateMCRPrefixFilterListRequest) (*CreateMCRPrefixFilterListResponse, error)
// ListMCRPrefixFilterLists returns prefix filter lists for the specified MCR2 from the Megaport MCR API.
ListMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
// GetMCRPrefixFilterList returns a single prefix filter list by ID for the specified MCR2 from the Megaport MCR API.
GetMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*MCRPrefixFilterList, error)
// ModifyMCRPrefixFilterList modifies a prefix filter list on an MCR in the Megaport MCR API.
ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int, prefixFilterList *MCRPrefixFilterList) (*ModifyMCRPrefixFilterListResponse, error)
// DeleteMCRPrefixFilterList deletes a prefix filter list on an MCR from the Megaport MCR API.
DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*DeleteMCRPrefixFilterListResponse, error)
// ModifyMCR modifies an MCR in the Megaport MCR API.
ModifyMCR(ctx context.Context, req *ModifyMCRRequest) (*ModifyMCRResponse, error)
// DeleteMCR deletes an MCR in the Megaport MCR API.
DeleteMCR(ctx context.Context, req *DeleteMCRRequest) (*DeleteMCRResponse, error)
// RestoreMCR restores a deleted MCR in the Megaport MCR API.
RestoreMCR(ctx context.Context, mcrId string) (*RestoreMCRResponse, error)
// ListMCRResourceTags returns the resource tags for an MCR in the Megaport MCR API.
ListMCRResourceTags(ctx context.Context, mcrID string) (map[string]string, error)
// UpdateMCRResourceTags updates the resource tags for an MCR in the Megaport MCR API.
UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error
// UpdateMCRWithAddOn adds an IPsec add-on to an existing MCR.
UpdateMCRWithAddOn(ctx context.Context, mcrID string, req MCRAddOnRequest) error
// UpdateMCRIPsecAddOn updates an existing IPsec add-on on an MCR. Setting tunnelCount to 0 will disable IPsec.
UpdateMCRIPsecAddOn(ctx context.Context, mcrID string, addOnUID string, tunnelCount int) error
// WaitForMCRReady polls until the MCR reaches a ready provisioning state.
// A zero timeout defaults to 5 minutes. Returns ErrMCRNotFound or ErrMCRDecommissioned
// if the MCR is deleted or decommissioned while polling.
WaitForMCRReady(ctx context.Context, mcrID string, timeout time.Duration) error
// GetMCRPrefixFilterLists returns prefix filter lists for the specified MCR2.
//
// Deprecated: Use ListMCRPrefixFilterLists instead.
GetMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
}
MCRService is an interface for interfacing with the MCR endpoints of the Megaport API.
type MCRServiceOp ¶
type MCRServiceOp struct {
Client *Client
}
MCRServiceOp handles communication with MCR methods of the Megaport API.
func NewMCRService ¶
func NewMCRService(c *Client) *MCRServiceOp
NewMCRService creates a new instance of the MCR Service.
func (*MCRServiceOp) BuyMCR ¶
func (svc *MCRServiceOp) BuyMCR(ctx context.Context, req *BuyMCRRequest) (*BuyMCRResponse, error)
BuyMCR purchases an MCR from the Megaport MCR API.
func (*MCRServiceOp) CreatePrefixFilterList ¶
func (svc *MCRServiceOp) CreatePrefixFilterList(ctx context.Context, req *CreateMCRPrefixFilterListRequest) (*CreateMCRPrefixFilterListResponse, error)
CreatePrefixFilterList creates a Prefix Filter List on an MCR from the Megaport MCR API.
func (*MCRServiceOp) DeleteMCR ¶
func (svc *MCRServiceOp) DeleteMCR(ctx context.Context, req *DeleteMCRRequest) (*DeleteMCRResponse, error)
DeleteMCR deletes an MCR in the Megaport MCR API. Note: MCR products only support immediate deletion (CANCEL_NOW). Requests with DeleteNow=false are rejected with ErrMCRCancelLaterNotAllowed, and accepted requests always call the underlying API with DeleteNow=true.
func (*MCRServiceOp) DeleteMCRPrefixFilterList ¶ added in v1.0.6
func (svc *MCRServiceOp) DeleteMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*DeleteMCRPrefixFilterListResponse, error)
DeleteMCRPrefixFilterList deletes a prefix filter list on an MCR from the Megaport MCR API.
func (*MCRServiceOp) GetMCRPrefixFilterList ¶ added in v1.0.6
func (svc *MCRServiceOp) GetMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int) (*MCRPrefixFilterList, error)
GetMCRPrefixFilterList returns a single prefix filter list by ID for the specified MCR2 from the Megaport MCR API.
func (*MCRServiceOp) GetMCRPrefixFilterLists
deprecated
func (svc *MCRServiceOp) GetMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
GetMCRPrefixFilterLists returns prefix filter lists for the specified MCR2.
Deprecated: Use ListMCRPrefixFilterLists instead.
func (*MCRServiceOp) ListMCRPrefixFilterLists ¶ added in v1.0.6
func (svc *MCRServiceOp) ListMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
GetMCRPrefixFilterLists returns prefix filter lists for the specified MCR2 from the Megaport MCR API.
func (*MCRServiceOp) ListMCRResourceTags ¶ added in v1.2.5
func (svc *MCRServiceOp) ListMCRResourceTags(ctx context.Context, mcrID string) (map[string]string, error)
ListMCRResourceTags returns the resource tags for an MCR in the Megaport MCR API.
func (*MCRServiceOp) ListMCRs ¶ added in v1.3.3
func (svc *MCRServiceOp) ListMCRs(ctx context.Context, req *ListMCRsRequest) ([]*MCR, error)
ListMCRs lists all MCRs in the Megaport API.
func (*MCRServiceOp) ModifyMCR ¶
func (svc *MCRServiceOp) ModifyMCR(ctx context.Context, req *ModifyMCRRequest) (*ModifyMCRResponse, error)
ModifyMCR modifies an MCR in the Megaport MCR API.
func (*MCRServiceOp) ModifyMCRPrefixFilterList ¶ added in v1.0.6
func (svc *MCRServiceOp) ModifyMCRPrefixFilterList(ctx context.Context, mcrID string, prefixFilterListID int, prefixFilterList *MCRPrefixFilterList) (*ModifyMCRPrefixFilterListResponse, error)
ModifyMCRPrefixFilterList modifies a prefix filter list on an MCR in the Megaport MCR API.
func (*MCRServiceOp) RestoreMCR ¶
func (svc *MCRServiceOp) RestoreMCR(ctx context.Context, mcrId string) (*RestoreMCRResponse, error)
Restore restores a deleted MCR in the Megaport MCR API.
func (*MCRServiceOp) UpdateMCRIPsecAddOn ¶ added in v1.6.0
func (svc *MCRServiceOp) UpdateMCRIPsecAddOn(ctx context.Context, mcrID string, addOnUID string, tunnelCount int) error
UpdateMCRIPsecAddOn updates an existing IPsec add-on on an MCR. Set tunnelCount to 0 to disable the IPsec add-on. PUT /v3/product/{productUid}/addon/{addOnUid}
func (*MCRServiceOp) UpdateMCRResourceTags ¶ added in v1.2.5
func (svc *MCRServiceOp) UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error
UpdateMCRResourceTags updates the resource tags for an MCR in the Megaport MCR API.
func (*MCRServiceOp) UpdateMCRWithAddOn ¶ added in v1.6.0
func (svc *MCRServiceOp) UpdateMCRWithAddOn(ctx context.Context, mcrID string, req MCRAddOnRequest) error
func (*MCRServiceOp) ValidateMCROrder ¶ added in v1.0.15
func (svc *MCRServiceOp) ValidateMCROrder(ctx context.Context, req *BuyMCRRequest) error
func (*MCRServiceOp) WaitForMCRReady ¶ added in v1.10.1
func (svc *MCRServiceOp) WaitForMCRReady(ctx context.Context, mcrID string, timeout time.Duration) error
WaitForMCRReady polls until the MCR identified by mcrID reaches a ready provisioning state. A zero timeout defaults to 5 minutes. Returns ErrMCRNotFound if the MCR is deleted while polling, or ErrMCRDecommissioned if it has been decommissioned.
type MCRTracerouteRequest ¶ added in v1.15.0
type MCRTracerouteRequest struct {
MCRID string
DestinationAddress string // required
SourceAddress string // optional
}
MCRTracerouteRequest represents a request to traceroute from an MCR.
type MCRVirtualRouter ¶
type MCRVirtualRouter struct {
ID int `json:"id"`
ASN int `json:"mcrAsn"`
Name string `json:"name"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Speed int `json:"speed"`
}
MCRVirtualRouter represents the virtual router associated with an MCR.
type MVE ¶
type MVE struct {
ID int `json:"productId"`
UID string `json:"productUid"`
Name string `json:"productName"`
Type string `json:"productType"`
ProvisioningStatus string `json:"provisioningStatus"`
CreateDate *Time `json:"createDate"`
CreatedBy string `json:"createdBy"`
TerminateDate *Time `json:"terminateDate"`
LiveDate *Time `json:"liveDate"`
Market string `json:"market"`
LocationID int `json:"locationId"`
UsageAlgorithm string `json:"usageAlgorithm"`
MarketplaceVisibility bool `json:"marketplaceVisibility"`
VXCPermitted bool `json:"vxcpermitted"`
VXCAutoApproval bool `json:"vxcAutoApproval"`
SecondaryName string `json:"secondaryName"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
ContractStartDate *Time `json:"contractStartDate"`
ContractEndDate *Time `json:"contractEndDate"`
ContractTermMonths int `json:"contractTermMonths"`
AttributeTags map[string]string `json:"attributeTags"`
CostCentre string `json:"costCentre"`
Virtual bool `json:"virtual"`
BuyoutPort bool `json:"buyoutPort"`
Locked bool `json:"locked"`
AdminLocked bool `json:"adminLocked"`
Cancelable bool `json:"cancelable"`
Resources *MVEResources `json:"resources"`
Vendor string `json:"vendor"`
Size string `json:"mveSize"`
DiversityZone string `json:"diversityZone"`
NetworkInterfaces []*MVENetworkInterface `json:"vnics"`
LocationDetails *ProductLocationDetails `json:"locationDetail"`
AssociatedVXCs []*VXC `json:"associatedVxcs"`
AssociatedIXs []*IX `json:"associatedIxs"`
}
MVE represents a Megaport Virtual Edge from the Megaport MVE API.
func (*MVE) GetAssociatedIXs ¶ added in v1.3.8
func (*MVE) GetAssociatedVXCs ¶ added in v1.3.8
func (*MVE) GetProvisioningStatus ¶ added in v1.3.3
type MVEConfig ¶ added in v1.0.17
type MVEConfig struct {
DiversityZone string `json:"diversityZone,omitempty"`
}
Nested configuration Fields for the MVE Order
type MVEImage ¶ added in v1.0.3
type MVEImage struct {
ID int `json:"id"`
Version string `json:"version"`
Product string `json:"product"` // Denormalized from parent in v4 API
Vendor string `json:"vendor"` // Denormalized from parent in v4 API
VendorDescription string `json:"vendorDescription"`
ReleaseImage bool `json:"releaseImage"`
ProductCode string `json:"productCode"`
AvailableSizes []string `json:"availableSizes"` // New in v4 API - list of compatible MVE sizes
}
MVEImage represents details for an MVE image, including image ID, version, product, and vendor. In the v4 API, Product and Vendor are at the parent level (MVEImageProduct), but we denormalize them here for backward compatibility with existing code.
type MVEImageAPIResponse
deprecated
added in
v1.0.3
type MVEImageAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *MVEImageAPIResponseData `json:"data"`
}
MVEImageAPIResponse represents the response to an MVE image request from the v3 API.
Deprecated: This struct is part of the v3 API and is maintained for backward compatibility. Use MVEImageAPIResponseV4 for new implementations.
type MVEImageAPIResponseData
deprecated
added in
v1.0.3
type MVEImageAPIResponseData struct {
Images []*MVEImage `json:"mveImages"`
}
MVEImageAPIResponseData represents the data in an MVE image response from the v3 API.
Deprecated: This struct is part of the v3 API and is maintained for backward compatibility. Use MVEImageAPIResponseDataV4 for new implementations.
type MVEImageAPIResponseDataV4 ¶ added in v1.4.8
type MVEImageAPIResponseDataV4 struct {
Images []*MVEImageProduct `json:"mveImages"`
}
MVEImageAPIResponseDataV4 represents the data in an MVE image response from the v4 API.
type MVEImageAPIResponseV4 ¶ added in v1.4.8
type MVEImageAPIResponseV4 struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *MVEImageAPIResponseDataV4 `json:"data"`
}
MVEImageAPIResponseV4 represents the response to an MVE image request from the v4 API.
type MVEImageProduct ¶ added in v1.4.8
type MVEImageProduct struct {
Product string `json:"product"`
Vendor string `json:"vendor"`
VendorProductID string `json:"vendorProductId"`
Images []*MVEImageVersion `json:"images"`
}
MVEImageProduct represents a vendor/product grouping of MVE images from the v4 API. Each product contains multiple image versions.
type MVEImageVersion ¶ added in v1.4.8
type MVEImageVersion struct {
ID int `json:"id"`
Version string `json:"version"`
ProductCode string `json:"productCode"`
VendorDescription string `json:"vendorDescription"`
ReleaseImage bool `json:"releaseImage"`
AvailableSizes []string `json:"availableSizes"`
}
MVEImageVersion represents an individual MVE image version within a product group (v4 API structure).
type MVEInstanceSize ¶
type MVEInstanceSize string
InstanceSize encodes the available MVE instance sizes.
const ( MVE_SMALL MVEInstanceSize = "SMALL" MVE_MEDIUM MVEInstanceSize = "MEDIUM" MVE_LARGE MVEInstanceSize = "LARGE" MVE_XLARGE MVEInstanceSize = "X_LARGE_12" )
MVE instance sizes.
type MVENetworkInterface ¶
MVENetworkInterface represents a vNIC.
type MVEOrderConfig ¶
type MVEOrderConfig struct {
LocationID int `json:"locationId"`
Name string `json:"productName"`
Term int `json:"term"`
ProductType string `json:"productType"`
PromoCode string `json:"promoCode,omitempty"`
CostCentre string `json:"costCentre,omitempty"`
NetworkInterfaces []MVENetworkInterface `json:"vnics"`
VendorConfig VendorConfig `json:"vendorConfig"`
Config MVEConfig `json:"config"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
}
MVEOrderConfig represents a request to buy an MVE from the Megaport Products API.
type MVEOrderConfirmation ¶
type MVEOrderConfirmation struct {
TechnicalServiceUID string `json:"technicalServiceUid"`
}
MVEOrderConfirmation represents the response to an MVE order request.
type MVEPriceBookRequest ¶ added in v1.12.0
type MVEPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
LocationID int `json:"locationId"`
Size string `json:"size,omitempty"`
MVELabel string `json:"mveLabel,omitempty"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
MVEPriceBookRequest is a pricing request for an MVE.
type MVEResources ¶
type MVEResources struct {
Interface *PortInterface `json:"interface"`
VirtualMachines []*MVEVirtualMachine `json:"virtual_machine"`
}
MVEResources represents the resources associated with an MVE.
type MVEService ¶
type MVEService interface {
// BuyMVE buys an MVE from the Megaport MVE API.
BuyMVE(ctx context.Context, req *BuyMVERequest) (*BuyMVEResponse, error)
// ValidateMVEOrder validates an MVE order in the Megaport Products API.
ValidateMVEOrder(ctx context.Context, req *BuyMVERequest) error
// ListMVEs lists all MVEs in the Megaport API.
ListMVEs(ctx context.Context, req *ListMVEsRequest) ([]*MVE, error)
// GetMVE gets details about a single MVE from the Megaport MVE API.
GetMVE(ctx context.Context, mveId string) (*MVE, error)
// ModifyMVE modifies an MVE in the Megaport MVE API.
ModifyMVE(ctx context.Context, req *ModifyMVERequest) (*ModifyMVEResponse, error)
// DeleteMVE deletes an MVE in the Megaport MVE API.
DeleteMVE(ctx context.Context, req *DeleteMVERequest) (*DeleteMVEResponse, error)
// ListMVEImages returns a list of currently supported MVE images and details for each image, including image ID, version, product, and vendor. The image id returned indicates the software version and key configuration parameters of the image. The releaseImage value returned indicates whether the MVE image is available for selection when ordering an MVE.
ListMVEImages(ctx context.Context) ([]*MVEImage, error)
// ListAvailableMVESizes returns a list of currently available MVE sizes and details for each size. The instance size determines the MVE capabilities, such as how many concurrent connections it can support. The compute sizes are 2/8, 4/16, 8/32, and 12/48, where the first number is the CPU and the second number is the GB of available RAM. Each size has 4 GB of RAM for every vCPU allocated.
ListAvailableMVESizes(ctx context.Context) ([]*MVESize, error)
// ListMVEResourceTags returns a list of resource tags for an MVE in the Megaport MVE API.
ListMVEResourceTags(ctx context.Context, mveID string) (map[string]string, error)
// UpdateMVEResourceTags updates the resource tags for an MVE in the Megaport MVE API.
UpdateMVEResourceTags(ctx context.Context, mveID string, tags map[string]string) error
}
MVEService is an interface for interfacing with the MVE endpoints of the Megaport API.
type MVEServiceOp ¶
type MVEServiceOp struct {
Client *Client
}
MVEServiceOp handles communication with MVE methods of the Megaport API.
func NewMVEService ¶
func NewMVEService(c *Client) *MVEServiceOp
NewMVEService creates a new instance of the MVE Service.
func (*MVEServiceOp) BuyMVE ¶
func (svc *MVEServiceOp) BuyMVE(ctx context.Context, req *BuyMVERequest) (*BuyMVEResponse, error)
BuyMVE buys an MVE from the Megaport MVE API.
func (*MVEServiceOp) DeleteMVE ¶
func (svc *MVEServiceOp) DeleteMVE(ctx context.Context, req *DeleteMVERequest) (*DeleteMVEResponse, error)
DeleteMVE deletes an MVE in the Megaport MVE API.
func (*MVEServiceOp) ListAvailableMVESizes ¶ added in v1.0.3
func (svc *MVEServiceOp) ListAvailableMVESizes(ctx context.Context) ([]*MVESize, error)
ListAvailableMVESizes returns a list of currently available MVE sizes and details for each size. The instance size determines the MVE capabilities, such as how many concurrent connections it can support. The compute sizes are 2/8, 4/16, 8/32, and 12/48, where the first number is the CPU and the second number is the GB of available RAM. Each size has 4 GB of RAM for every vCPU allocated.
func (*MVEServiceOp) ListMVEImages ¶ added in v1.0.3
func (svc *MVEServiceOp) ListMVEImages(ctx context.Context) ([]*MVEImage, error)
ListMVEImages returns a list of currently supported MVE images and details for each image, including image ID, version, product, and vendor. The image id returned indicates the software version and key configuration parameters of the image. The releaseImage value returned indicates whether the MVE image is available for selection when ordering an MVE. This method uses the v4 API and flattens the nested response to maintain backward compatibility.
func (*MVEServiceOp) ListMVEResourceTags ¶ added in v1.2.5
func (*MVEServiceOp) ListMVEs ¶ added in v1.3.3
func (svc *MVEServiceOp) ListMVEs(ctx context.Context, req *ListMVEsRequest) ([]*MVE, error)
ListMVEs lists all MVEs in the Megaport API.
func (*MVEServiceOp) ModifyMVE ¶
func (svc *MVEServiceOp) ModifyMVE(ctx context.Context, req *ModifyMVERequest) (*ModifyMVEResponse, error)
ModifyMVE modifies an MVE in the Megaport MVE API.
func (*MVEServiceOp) UpdateMVEResourceTags ¶ added in v1.2.5
func (svc *MVEServiceOp) UpdateMVEResourceTags(ctx context.Context, mveID string, tags map[string]string) error
UpdateMVEResourceTags updates the resource tags for an MVE in the Megaport MVE API.
func (*MVEServiceOp) ValidateMVEOrder ¶ added in v1.0.15
func (svc *MVEServiceOp) ValidateMVEOrder(ctx context.Context, req *BuyMVERequest) error
type MVESize ¶ added in v1.0.3
type MVESize struct {
Size string `json:"size"`
Label string `json:"label"`
CPUCoreCount int `json:"cpuCoreCount"`
RamGB int `json:"ramGB"`
}
MVESize represents the details on the MVE size. The instance size determines the MVE capabilities, such as how many concurrent connections it can support. The compute sizes are 2/8, 4/16, 8/32, and 12/48, where the first number is the CPU and the second number is the GB of available RAM. Each size has 4 GB of RAM for every vCPU allocated.
type MVEVirtualMachine ¶
type MVEVirtualMachine struct {
ID int `json:"id"`
CpuCount int `json:"cpu_count"`
Image *MVEVirtualMachineImage `json:"image"`
ResourceType string `json:"resource_type"`
Up bool `json:"up"`
Vnics []*MVENetworkInterface `json:"vnics"`
}
MVEVirtualMachine represents a virtual machine associated with an MVE.
type MVEVirtualMachineImage ¶
type MVEVirtualMachineImage struct {
ID int `json:"id"`
Vendor string `json:"vendor"`
Product string `json:"product"`
Version string `json:"version"`
}
MVVEVirtualMachineImage represents the image associated with an MVE virtual machine.
type MVEVnicUpdate ¶ added in v1.12.1
type MVEVnicUpdate struct {
Description string `json:"description"`
}
MVEVnicUpdate carries the per-vNIC fields the PUT /v2/product/mve/{uid} endpoint accepts. Description is the only mutable vNIC attribute — VLANs and other vNIC fields are immutable after MVE creation.
type MaintenanceEvent ¶ added in v1.7.1
type MaintenanceEvent struct {
// EventID is the ticket number against which a particular event is created.
EventID string `json:"eventId"`
// State is the current state of the event.
State string `json:"state"`
// StartTime is the event start time in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
StartTime string `json:"startTime"`
// EndTime is the event end time in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
EndTime string `json:"endTime"`
// Impact is the impact of the event on the services, if any.
Impact string `json:"impact"`
// Purpose is the reason why this event is created.
Purpose string `json:"purpose"`
// CancelReason is returned if the event is canceled, stating the cancellation reason.
CancelReason string `json:"cancelReason"`
// EventType is "Emergency" if the event is created on short notice; otherwise, it is a "Planned" event.
EventType string `json:"eventType"`
// ServiceIDs is the list of services affected by the event, containing the short UUIDs of the services.
ServiceIDs []string `json:"services"`
}
MaintenanceEvent represents a maintenance event returned by the Events API. The response may include optional fields depending on the event state and circumstances.
type MaintenanceState ¶ added in v1.7.1
type MaintenanceState string
type ManageProductLockRequest ¶
ManageProductLockRequest represents a request to lock or unlock a product in the Megaport Products API.
type ManageProductLockResponse ¶
type ManageProductLockResponse struct{}
ManageProductLockResponse represents a response from the Megaport Products API after locking or unlocking a product.
type ManagedAccount ¶ added in v1.2.3
type ManagedAccountRequest ¶ added in v1.2.3
type ManagedAccountRequest struct {
AccountName string `json:"accountName"` // A required string that specifies a unique, easily identifiable name for the account. The length can range from 1 to 128 characters.
AccountRef string `json:"accountRef"` // A required string that specifies a reference ID for the managed account. The accountRef is typically an identifier used in partner systems (for example, CRM or billing). This value is shown on the invoices as the Managed Account Reference. The accountRef also identifies the account in email notifications. (The accountRef value maps to the Managed Account UID in the Portal interface.)
}
type ManagedAccountService ¶ added in v1.2.3
type ManagedAccountService interface {
// ListManagedAccounts retrieves a list of managed accounts. Megaport Partners can use this command to list all the managed companies linked to their account.
ListManagedAccounts(ctx context.Context) ([]*ManagedAccount, error)
// CreateManagedAccount creates a new managed account. As a Megaport Partner, use this endpoint to create a new managed company.
CreateManagedAccount(ctx context.Context, req *ManagedAccountRequest) (*ManagedAccount, error)
// UpdateManagedAccount updates an existing managed account. As a Megaport Partner, use this endpoint to update an existing managed company. You identify the company by providing the companyUid as a parameter for the endpoint.
UpdateManagedAccount(ctx context.Context, companyUID string, req *ManagedAccountRequest) (*ManagedAccount, error)
// GetManagedAccount retrieves a managed account by name. As a Megaport Partner, use this endpoint to retrieve a managed company by name.
GetManagedAccount(ctx context.Context, companyUID string, managedAccountName string) (*ManagedAccount, error)
}
type ManagedAccountServiceOp ¶ added in v1.2.3
type ManagedAccountServiceOp struct {
Client *Client
}
func NewManagedAccountService ¶ added in v1.2.3
func NewManagedAccountService(c *Client) *ManagedAccountServiceOp
NewManagedAccountService creates a new instance of the ManagedAccount Service.
func (*ManagedAccountServiceOp) CreateManagedAccount ¶ added in v1.2.3
func (svc *ManagedAccountServiceOp) CreateManagedAccount(ctx context.Context, req *ManagedAccountRequest) (*ManagedAccount, error)
func (*ManagedAccountServiceOp) GetManagedAccount ¶ added in v1.2.3
func (svc *ManagedAccountServiceOp) GetManagedAccount(ctx context.Context, companyUID string, managedAccountName string) (*ManagedAccount, error)
func (*ManagedAccountServiceOp) ListManagedAccounts ¶ added in v1.2.3
func (svc *ManagedAccountServiceOp) ListManagedAccounts(ctx context.Context) ([]*ManagedAccount, error)
func (*ManagedAccountServiceOp) UpdateManagedAccount ¶ added in v1.2.3
func (svc *ManagedAccountServiceOp) UpdateManagedAccount(ctx context.Context, companyUID string, req *ManagedAccountRequest) (*ManagedAccount, error)
type Market ¶
type Market struct {
Currency string `json:"currencyEnum"`
Language string `json:"language"`
CompanyLegalIdentifier string `json:"companyLegalIdentifier"`
CompanyLegalName string `json:"companyLegalName"`
BillingContactName string `json:"billingContactName"`
BillingContactPhone string `json:"billingContactPhone"`
BillingContactEmail string `json:"billingContactEmail"`
AddressLine1 string `json:"address1"`
AddressLine2 string `json:"address2"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Country string `json:"country"`
PONumber string `json:"yourPoNumber"`
TaxNumber string `json:"taxNumber"`
FirstPartyID int `json:"firstPartyId"`
}
Market represents a market in the Megaport API.
type MegaportPriceBookRequest ¶ added in v1.12.0
type MegaportPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
LocationID int `json:"locationId"`
Speed int `json:"speed"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
MegaportPriceBookRequest is a pricing request for a Port.
type MerakiConfig ¶
type MerakiConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
Token string `json:"token,omitempty"`
}
MerakiConfig represents the configuration for a Meraki MVE.
type ModifyMCRPrefixFilterListResponse ¶ added in v1.0.6
type ModifyMCRPrefixFilterListResponse struct {
IsUpdated bool
}
ModifyMCRPrefixFilterListRequest represents a request to modify a prefix filter list on an MCR
type ModifyMCRRequest ¶
type ModifyMCRRequest struct {
MCRID string
Name string
CostCentre string
MarketplaceVisibility *bool
ContractTermMonths *int
// MCRAsn updates the MCR's BGP ASN in place when non-nil. The Megaport
// platform supports modifying ASN on a configured/live MCR; setting this
// avoids the destroy-and-recreate that callers would otherwise need.
MCRAsn *int
WaitForUpdate bool // Wait until the MCR updates before returning
WaitForTime time.Duration // How long to wait for the MCR to update if WaitForUpdate is true (default is 5 minutes; must be at least 30 seconds for the poller to fire)
}
ModifyMCRRequest represents a request to modify an MCR
type ModifyMCRResponse ¶
type ModifyMCRResponse struct {
IsUpdated bool
}
ModifyMCRResponse represents a response from modifying an MCR
type ModifyMVERequest ¶
type ModifyMVERequest struct {
MVEID string
Name string
// MarketplaceVisibility is forwarded to the API when non-nil. Leave nil
// to leave the current visibility unchanged.
MarketplaceVisibility *bool
CostCentre string
ContractTermMonths *int // Contract term in months
// Vnics updates the description for each vNIC on the MVE. Order matters —
// entries map positionally to the existing vNICs. Leave nil or empty to
// leave descriptions unchanged. Every entry must have a non-empty
// description — the API rejects empty ones, so descriptions can't be
// cleared once set.
Vnics []MVEVnicUpdate
WaitForUpdate bool // Wait until the MVE updates before returning
WaitForTime time.Duration // How long to wait for the MVE to update if WaitForUpdate is true (default is 5 minutes)
}
ModifyMVERequest represents a request to modify an MVE
type ModifyMVEResponse ¶
type ModifyMVEResponse struct {
MVEUpdated bool
}
ModifyMVEResponse represents a response from modifying an MVE
type ModifyPortRequest ¶
type ModifyPortRequest struct {
PortID string
Name string
MarketplaceVisibility *bool
CostCentre string
ContractTermMonths *int
WaitForUpdate bool // Wait until the Port updates before returning
WaitForTime time.Duration // How long to wait for the Port to update if WaitForUpdate is true (default is 5 minutes)
}
ModifyPortRequest represents a request to modify a port.
type ModifyPortResponse ¶
type ModifyPortResponse struct {
IsUpdated bool
}
ModifyPortResponse represents a response from modifying a port.
type ModifyProductRequest ¶
type ModifyProductRequest struct {
ProductID string
ProductType string
Name string `json:"name,omitempty"`
CostCentre string `json:"costCentre"`
MarketplaceVisibility *bool `json:"marketplaceVisibility,omitempty"`
ContractTermMonths int `json:"term,omitempty"`
// ASN is currently only meaningful for MCR products. Sent as-is to the
// PUT /v2/product/mcr2/{productUid} endpoint when non-nil.
ASN *int `json:"asn,omitempty"`
// Vnics updates vNIC descriptions on PUT /v2/product/mve/{productUid}.
// Only set this for MVE products — the API silently ignores vnics on
// Port/MCR, so the SDK rejects them up front to avoid a silent no-op.
Vnics []MVEVnicUpdate `json:"vnics,omitempty"`
}
ModifyProductRequest represents a request to modify a product in the Megaport Products API.
type ModifyProductResponse ¶
type ModifyProductResponse struct {
IsUpdated bool
}
ModifyProductResponse represents a response from the Megaport Products API after modifying a product.
type NATGateway ¶ added in v1.7.0
type NATGateway struct {
AdminLocked bool `json:"adminLocked"`
AutoRenewTerm bool `json:"autoRenewTerm"`
Config NATGatewayNetworkConfig `json:"config"`
ContractEndDate string `json:"contractEndDate"`
CreateDate string `json:"createDate"`
CreatedBy string `json:"createdBy"`
LocationID int `json:"locationId"`
Locked bool `json:"locked"`
OrderApprovalStatus string `json:"orderApprovalStatus"`
ProductName string `json:"productName"`
ProductUID string `json:"productUid"`
PromoCode string `json:"promoCode"`
ProvisioningStatus string `json:"provisioningStatus"`
ResourceTags []ResourceTag `json:"resourceTags"`
ServiceLevelReference string `json:"serviceLevelReference"`
Speed int `json:"speed"`
Term int `json:"term"`
}
NATGateway represents a NAT Gateway product from the Megaport API.
type NATGatewayBGPNeighborRoutesRequest ¶ added in v1.10.0
type NATGatewayBGPNeighborRoutesRequest struct {
ProductUID string
PeerIPAddress string
Direction string // BGPRouteDirectionReceived or BGPRouteDirectionAdvertised.
}
NATGatewayBGPNeighborRoutesRequest contains the parameters for the BGP neighbor diagnostics endpoint.
type NATGatewayBGPRoute ¶ added in v1.10.0
type NATGatewayBGPRoute struct {
Prefix string `json:"prefix"`
ASPath string `json:"asPath,omitempty"`
Origin string `json:"origin,omitempty"`
Source string `json:"source,omitempty"`
LocalPref int `json:"localPref,omitempty"`
MED int `json:"med,omitempty"`
Best bool `json:"best,omitempty"`
External bool `json:"external,omitempty"`
Since string `json:"since,omitempty"`
Communities []string `json:"communities,omitempty"`
AdvertisedTo []string `json:"advertisedTo,omitempty"`
NextHop NATGatewayRouteNextHop `json:"nextHop"`
}
NATGatewayBGPRoute is a single BGP route returned by the diagnostics BGP and BGP neighbor endpoints.
type NATGatewayBuyResult ¶ added in v1.7.1
type NATGatewayBuyResult struct {
ProductUID string `json:"uid"`
ProductName string `json:"name"`
ServiceName string `json:"serviceName"`
ProductType string `json:"productType"`
ProvisioningStatus string `json:"provisioningStatus"`
RateLimit int `json:"rateLimit"`
LocationID int `json:"aLocationId"`
ContractTermMonths int `json:"contractTermMonths"`
CreateDate int64 `json:"createDate"`
}
NATGatewayBuyResult is a single entry returned by POST /v3/networkdesign/buy after a NAT Gateway design is purchased.
type NATGatewayIPRoute ¶ added in v1.10.0
type NATGatewayIPRoute struct {
Prefix string `json:"prefix"`
Protocol string `json:"protocol"`
Distance int `json:"distance,omitempty"`
Metric int `json:"metric,omitempty"`
NextHop NATGatewayRouteNextHop `json:"nextHop"`
}
NATGatewayIPRoute is a single IP route returned by the diagnostics IP routes endpoint.
type NATGatewayListResponse ¶ added in v1.7.0
type NATGatewayListResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*NATGateway `json:"data"`
}
NATGatewayListResponse is the API response for listing NAT Gateways.
type NATGatewayNetworkConfig ¶ added in v1.7.0
type NATGatewayNetworkConfig struct {
ASN int `json:"asn"`
BGPShutdownDefault bool `json:"bgpShutdownDefault"`
DiversityZone string `json:"diversityZone"`
SessionCount int `json:"sessionCount"`
}
NATGatewayNetworkConfig represents the network configuration for a NAT Gateway.
type NATGatewayOrderPrice ¶ added in v1.7.1
type NATGatewayOrderPrice struct {
HourlySetup float64 `json:"hourlySetup"`
DailySetup float64 `json:"dailySetup"`
MonthlySetup float64 `json:"monthlySetup"`
HourlyRate float64 `json:"hourlyRate"`
DailyRate float64 `json:"dailyRate"`
MonthlyRate float64 `json:"monthlyRate"`
FixedRecurringCharge float64 `json:"fixedRecurringCharge"`
LongHaulMbpsRate float64 `json:"longHaulMbpsRate"`
MbpsRate float64 `json:"mbpsRate"`
Currency string `json:"currency"`
ProductType string `json:"productType"`
MonthlyRackRate float64 `json:"monthlyRackRate"`
}
NATGatewayOrderPrice captures the pricing preview returned by POST /v3/networkdesign/validate for a NAT Gateway order.
type NATGatewayPacketFilter ¶ added in v1.10.0
type NATGatewayPacketFilter struct {
ID int `json:"id"`
NATGatewayPacketFilterRequest
}
NATGatewayPacketFilter is a server-side packet filter including its assigned ID.
type NATGatewayPacketFilterEntry ¶ added in v1.10.0
type NATGatewayPacketFilterEntry struct {
Action string `json:"action"` // PacketFilterActionPermit or PacketFilterActionDeny.
Description string `json:"description,omitempty"`
SourceAddress string `json:"sourceAddress"`
DestinationAddress string `json:"destinationAddress"`
SourcePorts string `json:"sourcePorts,omitempty"`
DestinationPorts string `json:"destinationPorts,omitempty"`
IPProtocol int `json:"ipProtocol,omitempty"`
}
NATGatewayPacketFilterEntry is a single rule inside a packet filter. Entries are evaluated in order; the first matching entry determines the action taken on the packet.
type NATGatewayPacketFilterRequest ¶ added in v1.10.0
type NATGatewayPacketFilterRequest struct {
Description string `json:"description"`
Entries []NATGatewayPacketFilterEntry `json:"entries"`
}
NATGatewayPacketFilterRequest is the create/update payload for a packet filter on a NAT Gateway.
type NATGatewayPacketFilterSummary ¶ added in v1.10.0
type NATGatewayPacketFilterSummary struct {
ID int `json:"id"`
Description string `json:"description"`
}
NATGatewayPacketFilterSummary is the compact entry returned by the packet_filter_summaries endpoint.
type NATGatewayPrefixList ¶ added in v1.10.0
type NATGatewayPrefixList struct {
ID int `json:"id,omitempty"`
Description string `json:"description"`
AddressFamily string `json:"addressFamily"` // AddressFamilyIPv4 or AddressFamilyIPv6.
Entries []NATGatewayPrefixListEntry `json:"entries"`
}
NATGatewayPrefixList is the create/update/get payload for a prefix list on a NAT Gateway. The API returns the server-assigned ID on read.
type NATGatewayPrefixListEntry ¶ added in v1.10.0
type NATGatewayPrefixListEntry struct {
Action string `json:"action"` // PrefixListActionPermit or PrefixListActionDeny.
Prefix string `json:"prefix"`
Ge int `json:"ge,omitempty"`
Le int `json:"le,omitempty"`
}
NATGatewayPrefixListEntry is a single entry in a prefix list. Ge/Le are exposed as ints for ergonomics; the SDK converts to/from the API's string representation transparently.
type NATGatewayPrefixListSummary ¶ added in v1.10.0
type NATGatewayPrefixListSummary struct {
ID int `json:"id"`
Description string `json:"description"`
AddressFamily string `json:"addressFamily"`
}
NATGatewayPrefixListSummary is the compact entry returned by the prefix_list_summaries endpoint.
type NATGatewayPriceBookRequest ¶ added in v1.12.0
type NATGatewayPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
LocationID int `json:"locationId"`
Speed int `json:"speed"`
SessionCount int `json:"sessionCount"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
NATGatewayPriceBookRequest is a pricing request for a NAT Gateway.
type NATGatewayResponse ¶ added in v1.7.0
type NATGatewayResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data NATGateway `json:"data"`
}
NATGatewayResponse is the API response for a single NAT Gateway.
type NATGatewayRoute ¶ added in v1.10.0
type NATGatewayRoute struct {
IP *NATGatewayIPRoute
BGP *NATGatewayBGPRoute
}
NATGatewayRoute is a discriminated wrapper for looking-glass routes. The async operation endpoint returns a heterogeneous list of IP and BGP routes; exactly one of IP / BGP will be set per entry.
func (*NATGatewayRoute) UnmarshalJSON ¶ added in v1.10.0
func (r *NATGatewayRoute) UnmarshalJSON(b []byte) error
UnmarshalJSON distinguishes IP vs BGP routes based on which BGP-specific fields are present in the payload.
type NATGatewayRouteNextHop ¶ added in v1.10.0
type NATGatewayRouteNextHop struct {
IP string `json:"ip"`
VXC NATGatewayRouteVXCRef `json:"vxc"`
}
NATGatewayRouteNextHop describes the next hop for a diagnostics route.
type NATGatewayRouteVXCRef ¶ added in v1.10.0
NATGatewayRouteVXCRef identifies the VXC that carries a next-hop IP in a looking-glass response.
type NATGatewayService ¶ added in v1.6.0
type NATGatewayService interface {
// CreateNATGateway creates a new NAT Gateway resource.
CreateNATGateway(ctx context.Context, req *CreateNATGatewayRequest) (*NATGateway, error)
// ListNATGateways retrieves all NAT Gateways for the authenticated company.
ListNATGateways(ctx context.Context) ([]*NATGateway, error)
// GetNATGateway retrieves a NAT Gateway by its product UID.
GetNATGateway(ctx context.Context, productUID string) (*NATGateway, error)
// UpdateNATGateway updates a NAT Gateway by its product UID.
UpdateNATGateway(ctx context.Context, req *UpdateNATGatewayRequest) (*NATGateway, error)
// DeleteNATGateway deletes a NAT Gateway by its product UID.
DeleteNATGateway(ctx context.Context, productUID string) error
// ListNATGatewaySessions returns the speed/session-count availability matrix for NAT Gateways.
ListNATGatewaySessions(ctx context.Context) ([]*NATGatewaySession, error)
// GetNATGatewayTelemetry returns telemetry data for a NAT Gateway product.
GetNATGatewayTelemetry(ctx context.Context, req *GetNATGatewayTelemetryRequest) (*ServiceTelemetryResponse, error)
// ValidateNATGatewayOrder validates a NAT Gateway design via
// POST /v3/networkdesign/validate. The gateway must be in DESIGN state.
// Returns an order preview including pricing.
ValidateNATGatewayOrder(ctx context.Context, productUID string) (*NATGatewayValidateResult, error)
// BuyNATGateway purchases (provisions) a NAT Gateway design via
// POST /v3/networkdesign/buy. The gateway must be in DESIGN state;
// after a successful call it transitions through the normal
// DEPLOYABLE -> CONFIGURED -> LIVE lifecycle. Returns the provisioning
// service record.
BuyNATGateway(ctx context.Context, productUID string) (*NATGatewayBuyResult, error)
// ListNATGatewayPacketFilters returns all packet filter summaries for
// a NAT Gateway.
ListNATGatewayPacketFilters(ctx context.Context, productUID string) ([]*NATGatewayPacketFilterSummary, error)
// CreateNATGatewayPacketFilter creates a new packet filter on a NAT
// Gateway.
CreateNATGatewayPacketFilter(ctx context.Context, productUID string, req *NATGatewayPacketFilterRequest) (*NATGatewayPacketFilter, error)
// GetNATGatewayPacketFilter returns a packet filter by its numeric ID.
GetNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) (*NATGatewayPacketFilter, error)
// UpdateNATGatewayPacketFilter replaces a packet filter's description
// and entries.
UpdateNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int, req *NATGatewayPacketFilterRequest) (*NATGatewayPacketFilter, error)
// DeleteNATGatewayPacketFilter removes a packet filter from a NAT
// Gateway. Any VXC interfaces referencing the filter will be detached
// server-side.
DeleteNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) error
// ListNATGatewayPrefixLists returns all prefix list summaries for a
// NAT Gateway.
ListNATGatewayPrefixLists(ctx context.Context, productUID string) ([]*NATGatewayPrefixListSummary, error)
// CreateNATGatewayPrefixList creates a new prefix list on a NAT
// Gateway.
CreateNATGatewayPrefixList(ctx context.Context, productUID string, req *NATGatewayPrefixList) (*NATGatewayPrefixList, error)
// GetNATGatewayPrefixList returns a prefix list by its numeric ID.
GetNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) (*NATGatewayPrefixList, error)
// UpdateNATGatewayPrefixList replaces a prefix list's description,
// address family, and entries.
UpdateNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int, req *NATGatewayPrefixList) (*NATGatewayPrefixList, error)
// DeleteNATGatewayPrefixList removes a prefix list from a NAT Gateway.
DeleteNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) error
// ListNATGatewayIPRoutesAsync submits an IP routes diagnostics request
// and returns the operation ID to poll with
// GetNATGatewayDiagnosticsRoutes. The endpoint is rate-limited and
// intended for troubleshooting only. If ipAddress is empty, the
// response will include both IPv4 and IPv6 routes; otherwise the
// response is narrowed to routes matching the supplied address.
ListNATGatewayIPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
// ListNATGatewayBGPRoutesAsync submits a BGP routes diagnostics
// request and returns the operation ID to poll with
// GetNATGatewayDiagnosticsRoutes. Rate-limited and intended for
// troubleshooting only.
ListNATGatewayBGPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
// ListNATGatewayBGPNeighborRoutesAsync submits a BGP neighbor routes
// diagnostics request and returns the operation ID to poll with
// GetNATGatewayDiagnosticsRoutes.
ListNATGatewayBGPNeighborRoutesAsync(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) (string, error)
// GetNATGatewayDiagnosticsRoutes retrieves the routes for a prior
// asynchronous diagnostics request. Returns the heterogeneous slice
// of IP and/or BGP routes produced by the async operation.
GetNATGatewayDiagnosticsRoutes(ctx context.Context, productUID, operationID string) ([]*NATGatewayRoute, error)
// ListNATGatewayIPRoutes submits an IP routes diagnostics request and
// polls until the routes are available. The returned slice contains
// only IP routes extracted from the heterogeneous result.
ListNATGatewayIPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayIPRoute, error)
// ListNATGatewayBGPRoutes submits a BGP routes diagnostics request
// and polls until the routes are available.
ListNATGatewayBGPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayBGPRoute, error)
// ListNATGatewayBGPNeighborRoutes submits a BGP neighbor routes
// diagnostics request and polls until the routes are available.
ListNATGatewayBGPNeighborRoutes(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) ([]*NATGatewayBGPRoute, error)
}
NATGatewayService is an interface for interfacing with the NAT Gateway endpoints of the Megaport API.
type NATGatewayServiceOp ¶ added in v1.6.0
type NATGatewayServiceOp struct {
Client *Client
}
NATGatewayServiceOp handles communication with NAT Gateway methods of the Megaport API.
func NewNATGatewayService ¶ added in v1.6.0
func NewNATGatewayService(c *Client) *NATGatewayServiceOp
NewNATGatewayService creates a new instance of the NAT Gateway Service.
func (*NATGatewayServiceOp) BuyNATGateway ¶ added in v1.7.1
func (svc *NATGatewayServiceOp) BuyNATGateway(ctx context.Context, productUID string) (*NATGatewayBuyResult, error)
BuyNATGateway purchases a NAT Gateway design, kicking off provisioning. The returned result contains the initial provisioning service record.
func (*NATGatewayServiceOp) CreateNATGateway ¶ added in v1.7.0
func (svc *NATGatewayServiceOp) CreateNATGateway(ctx context.Context, req *CreateNATGatewayRequest) (*NATGateway, error)
CreateNATGateway creates a new NAT Gateway resource.
func (*NATGatewayServiceOp) CreateNATGatewayPacketFilter ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) CreateNATGatewayPacketFilter(ctx context.Context, productUID string, req *NATGatewayPacketFilterRequest) (*NATGatewayPacketFilter, error)
CreateNATGatewayPacketFilter creates a new packet filter on a NAT Gateway.
func (*NATGatewayServiceOp) CreateNATGatewayPrefixList ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) CreateNATGatewayPrefixList(ctx context.Context, productUID string, req *NATGatewayPrefixList) (*NATGatewayPrefixList, error)
CreateNATGatewayPrefixList creates a new prefix list on a NAT Gateway.
func (*NATGatewayServiceOp) DeleteNATGateway ¶ added in v1.7.0
func (svc *NATGatewayServiceOp) DeleteNATGateway(ctx context.Context, productUID string) error
DeleteNATGateway deletes a NAT Gateway by its product UID. It handles both lifecycle stages transparently:
- DESIGN-state designs that have never been purchased use DELETE /v3/products/nat_gateways/{uid} (the design-only endpoint). This hard-removes the record — the gateway disappears from list.
- Any non-DESIGN gateway (e.g. DEPLOYABLE / CONFIGURED / LIVE) is cancelled via the generic product action POST /v3/product/{uid}/action/CANCEL_NOW, matching the teardown path used for Ports, MCRs, MVEs, and VXCs. The record is retained rather than being hard-deleted, typically transitioning to DECOMMISSIONED / CANCELLED.
Callers do not need to inspect state themselves. The design endpoint returns 400 for non-DESIGN gateways, and CANCEL_NOW rolls back against DESIGN-state records — so a single unified endpoint is not available from the API side, and the SDK routes based on a pre-flight GET. Errors from the pre-flight GET (including 404 for an unknown UID) are wrapped with a "nat gateway delete: could not inspect lifecycle state" prefix but preserve the underlying error chain (use errors.Is / errors.As).
The routing is not atomic: if a DESIGN-state gateway transitions to DEPLOYABLE between the GET and the DELETE (e.g., another caller has just purchased it), the design endpoint will return 400. Retrying the delete will route through the provisioned path on the next attempt.
Unlike DeletePort / DeleteMCR / DeleteMVE, this method does not currently accept a SafeDelete (end-of-term cancellation) option — provisioned gateways are always cancelled immediately with DeleteNow: true.
func (*NATGatewayServiceOp) DeleteNATGatewayPacketFilter ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) DeleteNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) error
DeleteNATGatewayPacketFilter removes a packet filter from a NAT Gateway.
func (*NATGatewayServiceOp) DeleteNATGatewayPrefixList ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) DeleteNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) error
DeleteNATGatewayPrefixList removes a prefix list from a NAT Gateway.
func (*NATGatewayServiceOp) GetNATGateway ¶ added in v1.7.0
func (svc *NATGatewayServiceOp) GetNATGateway(ctx context.Context, productUID string) (*NATGateway, error)
GetNATGateway retrieves a NAT Gateway by its product UID.
func (*NATGatewayServiceOp) GetNATGatewayDiagnosticsRoutes ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) GetNATGatewayDiagnosticsRoutes(ctx context.Context, productUID, operationID string) ([]*NATGatewayRoute, error)
GetNATGatewayDiagnosticsRoutes fetches the routes for a prior async request.
func (*NATGatewayServiceOp) GetNATGatewayPacketFilter ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) GetNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int) (*NATGatewayPacketFilter, error)
GetNATGatewayPacketFilter returns a packet filter by its numeric ID.
func (*NATGatewayServiceOp) GetNATGatewayPrefixList ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) GetNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int) (*NATGatewayPrefixList, error)
GetNATGatewayPrefixList returns a prefix list by its numeric ID.
func (*NATGatewayServiceOp) GetNATGatewayTelemetry ¶ added in v1.6.0
func (svc *NATGatewayServiceOp) GetNATGatewayTelemetry(ctx context.Context, req *GetNATGatewayTelemetryRequest) (*ServiceTelemetryResponse, error)
GetNATGatewayTelemetry returns telemetry data for a NAT Gateway product.
func (*NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutes ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutes(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) ([]*NATGatewayBGPRoute, error)
ListNATGatewayBGPNeighborRoutes submits a BGP neighbor routes request and polls for results.
func (*NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutesAsync ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayBGPNeighborRoutesAsync(ctx context.Context, req *NATGatewayBGPNeighborRoutesRequest) (string, error)
ListNATGatewayBGPNeighborRoutesAsync submits a BGP neighbor routes diagnostics request.
func (*NATGatewayServiceOp) ListNATGatewayBGPRoutes ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayBGPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayBGPRoute, error)
ListNATGatewayBGPRoutes submits a BGP routes request and polls until results are available.
func (*NATGatewayServiceOp) ListNATGatewayBGPRoutesAsync ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayBGPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
ListNATGatewayBGPRoutesAsync submits a BGP routes diagnostics request.
func (*NATGatewayServiceOp) ListNATGatewayIPRoutes ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayIPRoutes(ctx context.Context, productUID, ipAddress string) ([]*NATGatewayIPRoute, error)
ListNATGatewayIPRoutes submits an IP routes request and polls until results are available.
func (*NATGatewayServiceOp) ListNATGatewayIPRoutesAsync ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayIPRoutesAsync(ctx context.Context, productUID, ipAddress string) (string, error)
ListNATGatewayIPRoutesAsync submits an IP routes diagnostics request.
func (*NATGatewayServiceOp) ListNATGatewayPacketFilters ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayPacketFilters(ctx context.Context, productUID string) ([]*NATGatewayPacketFilterSummary, error)
ListNATGatewayPacketFilters returns all packet filter summaries for a NAT Gateway.
func (*NATGatewayServiceOp) ListNATGatewayPrefixLists ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) ListNATGatewayPrefixLists(ctx context.Context, productUID string) ([]*NATGatewayPrefixListSummary, error)
ListNATGatewayPrefixLists returns all prefix list summaries for a NAT Gateway.
func (*NATGatewayServiceOp) ListNATGatewaySessions ¶ added in v1.6.0
func (svc *NATGatewayServiceOp) ListNATGatewaySessions(ctx context.Context) ([]*NATGatewaySession, error)
ListNATGatewaySessions returns the speed/session-count availability matrix for NAT Gateways.
func (*NATGatewayServiceOp) ListNATGateways ¶ added in v1.7.0
func (svc *NATGatewayServiceOp) ListNATGateways(ctx context.Context) ([]*NATGateway, error)
ListNATGateways retrieves all NAT Gateways for the authenticated company.
func (*NATGatewayServiceOp) UpdateNATGateway ¶ added in v1.7.0
func (svc *NATGatewayServiceOp) UpdateNATGateway(ctx context.Context, req *UpdateNATGatewayRequest) (*NATGateway, error)
UpdateNATGateway updates a NAT Gateway by its product UID.
func (*NATGatewayServiceOp) UpdateNATGatewayPacketFilter ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) UpdateNATGatewayPacketFilter(ctx context.Context, productUID string, packetFilterID int, req *NATGatewayPacketFilterRequest) (*NATGatewayPacketFilter, error)
UpdateNATGatewayPacketFilter replaces a packet filter's description and entries.
func (*NATGatewayServiceOp) UpdateNATGatewayPrefixList ¶ added in v1.10.0
func (svc *NATGatewayServiceOp) UpdateNATGatewayPrefixList(ctx context.Context, productUID string, prefixListID int, req *NATGatewayPrefixList) (*NATGatewayPrefixList, error)
UpdateNATGatewayPrefixList replaces a prefix list's description, address family, and entries.
func (*NATGatewayServiceOp) ValidateNATGatewayOrder ¶ added in v1.7.1
func (svc *NATGatewayServiceOp) ValidateNATGatewayOrder(ctx context.Context, productUID string) (*NATGatewayValidateResult, error)
ValidateNATGatewayOrder validates a NAT Gateway design without purchasing. The returned result includes a pricing preview.
type NATGatewaySession ¶ added in v1.6.0
type NATGatewaySession struct {
SessionCount []int `json:"sessionCount"`
SpeedMbps int `json:"speedMbps"`
}
NATGatewaySession represents a speed/session-count availability entry for NAT Gateways.
type NATGatewaySessionsResponse ¶ added in v1.6.0
type NATGatewaySessionsResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*NATGatewaySession `json:"data"`
}
NATGatewaySessionsResponse is the API response for listing NAT Gateway sessions.
type NATGatewaySpeedSessionResult ¶ added in v1.15.0
type NATGatewaySpeedSessionResult struct {
// Supported is true only if the speed exists AND the session count is
// valid at that speed.
Supported bool
// SpeedSupported is true if the speed appears in the matrix at all.
SpeedSupported bool
// SupportedSpeeds lists every speed in the matrix. Always complete.
SupportedSpeeds []int
// SessionsAtSpeed lists the session counts valid at the requested speed
// (nil if the speed is unsupported).
SessionsAtSpeed []int
}
NATGatewaySpeedSessionResult describes whether a speed/session pair is orderable according to a NAT Gateway availability matrix.
func NATGatewaySpeedSessionSupported ¶ added in v1.15.0
func NATGatewaySpeedSessionSupported(matrix []*NATGatewaySession, speed, sessionCount int) NATGatewaySpeedSessionResult
NATGatewaySpeedSessionSupported reports whether a speed/sessionCount pair is present in a NAT Gateway availability matrix obtained from ListNATGatewaySessions. It performs no network I/O; the caller supplies the matrix and validation happens locally.
type NATGatewayValidateResult ¶ added in v1.7.1
type NATGatewayValidateResult struct {
ProductUID string `json:"productUid"`
ProductType string `json:"productType"`
// Metro is the metro/city name returned by the API for the gateway's
// location (e.g. "Sydney"). The API ships this as a field literally
// named "string" in the JSON response, hence the unusual json tag.
Metro string `json:"string"`
Price NATGatewayOrderPrice `json:"price"`
}
NATGatewayValidateResult is a single entry returned by POST /v3/networkdesign/validate.
type OrderApproval ¶ added in v1.8.0
type OrderApproval struct {
UID string `json:"uid"`
ID int `json:"id"`
ReferenceID string `json:"referenceId"`
Status OrderApprovalStatus `json:"status"`
Type OrderApprovalType `json:"type"`
Active bool `json:"active"`
AcctName string `json:"acctName"`
AcctRef string `json:"acctRef"`
ApproverCompanyID int `json:"approverCompanyId"`
RequesterCompanyID int `json:"requesterCompanyId"`
ServiceID int `json:"serviceId"`
Comment string `json:"comment"`
CreateDate *Time `json:"createDate"`
Detail json.RawMessage `json:"detail"`
}
OrderApproval represents an order approval from the Megaport API.
type OrderApprovalActionRequest ¶ added in v1.8.0
type OrderApprovalActionRequest struct {
Comments string `json:"comments,omitempty"`
}
OrderApprovalActionRequest represents a request to approve, reject, or withdraw an order approval.
type OrderApprovalService ¶ added in v1.8.0
type OrderApprovalService interface {
// ListOrderApprovals lists order approval requests from the Megaport API.
ListOrderApprovals(ctx context.Context, req *ListOrderApprovalsRequest) (*ListOrderApprovalsResponse, error)
// ApproveOrderApproval approves a pending order approval request.
ApproveOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
// RejectOrderApproval rejects a pending order approval request.
RejectOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
// WithdrawOrderApproval withdraws own pending order approval request.
WithdrawOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
}
OrderApprovalService is an interface for interfacing with the Order Approval endpoints in the Megaport API.
type OrderApprovalServiceOp ¶ added in v1.8.0
type OrderApprovalServiceOp struct {
Client *Client
}
OrderApprovalServiceOp handles communication with the Order Approval related methods of the Megaport API.
func NewOrderApprovalService ¶ added in v1.8.0
func NewOrderApprovalService(c *Client) *OrderApprovalServiceOp
NewOrderApprovalService creates a new instance of the Order Approval Service.
func (*OrderApprovalServiceOp) ApproveOrderApproval ¶ added in v1.8.0
func (svc *OrderApprovalServiceOp) ApproveOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
ApproveOrderApproval approves a pending order approval request.
func (*OrderApprovalServiceOp) ListOrderApprovals ¶ added in v1.8.0
func (svc *OrderApprovalServiceOp) ListOrderApprovals(ctx context.Context, req *ListOrderApprovalsRequest) (*ListOrderApprovalsResponse, error)
ListOrderApprovals lists order approval requests from the Megaport API.
func (*OrderApprovalServiceOp) RejectOrderApproval ¶ added in v1.8.0
func (svc *OrderApprovalServiceOp) RejectOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
RejectOrderApproval rejects a pending order approval request.
func (*OrderApprovalServiceOp) WithdrawOrderApproval ¶ added in v1.8.0
func (svc *OrderApprovalServiceOp) WithdrawOrderApproval(ctx context.Context, orderApprovalUID string, req *OrderApprovalActionRequest) error
WithdrawOrderApproval withdraws own pending order approval request.
type OrderApprovalStatus ¶ added in v1.8.0
type OrderApprovalStatus string
OrderApprovalStatus represents the status of an order approval.
const ( OrderApprovalStatusPending OrderApprovalStatus = "PENDING" OrderApprovalStatusApproved OrderApprovalStatus = "APPROVED" OrderApprovalStatusRejected OrderApprovalStatus = "REJECTED" OrderApprovalStatusFailed OrderApprovalStatus = "FAILED" OrderApprovalStatusWithdrawn OrderApprovalStatus = "WITHDRAWN" OrderApprovalStatusExpired OrderApprovalStatus = "EXPIRED" )
type OrderApprovalType ¶ added in v1.8.0
type OrderApprovalType string
OrderApprovalType represents the type of an order approval.
const ( OrderApprovalTypeNewOrder OrderApprovalType = "NEW_ORDER" OrderApprovalTypeTermChange OrderApprovalType = "TERM_CHANGE" OrderApprovalTypeSpeedChange OrderApprovalType = "SPEED_CHANGE" )
type OrderValidFor ¶ added in v1.0.3
OrderValidFor represents the ValidFor input with the Megaport API using integer values
type OutageEvent ¶ added in v1.7.1
type OutageEvent struct {
// OutageID is a unique identifier for each outage event.
OutageID string `json:"outageId"`
// EventID is the ticket number against which a particular event is created.
EventID string `json:"eventId"`
// State is the current state of the event.
State string `json:"state"`
// StartTime is the event start time in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
StartTime string `json:"startTime"`
// EndTime is the event end time in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
EndTime string `json:"endTime"`
// Purpose is the reason why this event is created.
Purpose string `json:"purpose"`
// ServiceIDs is the list of services affected by the event, containing the short UUIDs of the services.
ServiceIDs []string `json:"services"`
// RootCause is the reason explaining why an outage happened. This field is present only when an outage is resolved.
RootCause string `json:"rootCause"`
// Resolution explains the solution taken to resolve the outage. Present when an outage is resolved.
Resolution string `json:"resolution"`
// MitigationActions explains the steps taken to avoid such outages in the future. Present for resolved outages.
MitigationActions string `json:"mitigationActions"`
// CreatedBy is the user who created the outage.
CreatedBy string `json:"createdBy"`
// CreatedDate is the date and time when an outage event is created, in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
CreatedDate string `json:"createdDate"`
// UpdatedDate is the date and time when an outage event is updated, in ISO 8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSX).
UpdatedDate string `json:"updatedDate"`
// Notices is the list of notices sent as an update for an ongoing outage.
Notices []string `json:"notices"`
}
OutageEvent represents an outage event returned by the Events API. The response may include optional fields depending on the event state and circumstances.
type OutageState ¶ added in v1.7.1
type OutageState string
type PaloAltoConfig ¶
type PaloAltoConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize,omitempty"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
AdminPasswordHash string `json:"adminPasswordHash,omitempty"`
AdminPassword string `json:"adminPassword,omitempty"`
LicenseData string `json:"licenseData,omitempty"`
}
PaloAltoConfig represents the configuration for a Palo Alto MVE.
type PartnerConfigInterface ¶
type PartnerConfigInterface struct {
Description string `json:"description,omitempty"`
InterfaceType string `json:"interfaceType,omitempty"` // InterfaceTypeSubInterface (default) or InterfaceTypeIPSecTunnel.
IpAddresses []string `json:"ipAddresses,omitempty"`
IpRoutes []IpRoute `json:"ipRoutes,omitempty"`
NatIpAddresses []string `json:"natIpAddresses,omitempty"`
Bfd BfdConfig `json:"bfd,omitempty"`
BgpConnections []BgpConnectionConfig `json:"bgpConnections,omitempty"`
VLAN int `json:"vlan,omitempty"`
IpMtu int `json:"ipMtu,omitempty"`
PacketFilterIn *int64 `json:"packetFilterIn,omitempty"` // NAT Gateway packet filter ID to apply to inbound packets.
PacketFilterOut *int64 `json:"packetFilterOut,omitempty"` // NAT Gateway packet filter ID to apply to outbound packets.
IpSecTunnelOptions *IPsecTunnelConfig `json:"ipSecTunnelOptions,omitempty"` // Requires InterfaceType to be InterfaceTypeIPSecTunnel.
}
PartnerConfigInterface represents the configuration of a partner interface.
type PartnerLookup ¶
type PartnerLookup struct {
Bandwidth int `json:"bandwidth"`
Bandwidths []int `json:"bandwidths"`
Megaports []PartnerLookupItem `json:"megaports"`
Peers []Peer `json:"peers"`
ResourceType string `json:"resource_type"`
ServiceKey string `json:"service_key"`
VLAN int `json:"vlan"`
}
PartnerLookup represents the response from the Partner Lookup API.
type PartnerLookupItem ¶
type PartnerLookupItem struct {
ID int `json:"port"`
Type string `json:"type"`
VXC int `json:"vxc"`
ProductID int `json:"productId"`
ProductUID string `json:"productUid"`
Name string `json:"name"`
ServiceID int `json:"nServiceId"`
Description string `json:"description"`
CompanyID int `json:"companyId"`
CompanyName string `json:"companyName"`
PortSpeed int `json:"portSpeed"`
LocationID int `json:"locationId"`
State string `json:"state"`
Country string `json:"country"`
}
PartnerLookupItem represents an item in the Partner Lookup response.
type PartnerMegaport ¶
type PartnerMegaport struct {
ConnectType string `json:"connectType"`
ProductUID string `json:"productUid"`
ProductName string `json:"title"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
DiversityZone string `json:"diversityZone"`
LocationId int `json:"locationId"`
Speed int `json:"speed"`
Rank int `json:"rank"`
VXCPermitted bool `json:"vxcPermitted"`
}
PartnerMegaport represents a Partner Megaport in the Megaport API.
type PartnerOrder ¶
type PartnerOrder struct {
PortID string `json:"productUid"`
AssociatedVXCs []PartnerOrderContents `json:"associatedVxcs"`
}
PartnerOrder represents the request to order a partner VXC from the Megaport Products API.
type PartnerOrderAzurePeeringConfig ¶
type PartnerOrderAzurePeeringConfig struct {
Type string `json:"type"`
PeerASN string `json:"peer_asn,omitempty"`
PrimarySubnet string `json:"primary_subnet,omitempty"`
SecondarySubnet string `json:"secondary_subnet,omitempty"`
Prefixes string `json:"prefixes,omitempty"`
VLAN int `json:"vlan,omitempty"`
}
PartnerOrderAzurePeeringConfig represents the configuration of an Azure peering partner.
type PartnerOrderContents ¶
type PartnerOrderContents struct {
Name string `json:"productName"`
RateLimit int `json:"rateLimit"`
AEnd VXCOrderEndpointConfiguration `json:"aEnd"`
BEnd VXCOrderEndpointConfiguration `json:"bEnd"`
}
PartnerOrderContents represents the configuration of a partner VXC to be ordered from the Megaport Products API.
type PartnerService ¶
type PartnerService interface {
// ListPartnerMegaports gets a list of all partner megaports in the Megaport Marketplace via the Megaport API.
ListPartnerMegaports(ctx context.Context) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByProductName filters a list of partner megaports by product name in the Megaport API.
FilterPartnerMegaportByProductName(ctx context.Context, partners []*PartnerMegaport, productName string, exactMatch bool) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByConnectType filters a list of partner megaports by connect type in the Megaport API.
FilterPartnerMegaportByConnectType(ctx context.Context, partners []*PartnerMegaport, connectType string, exactMatch bool) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByCompanyName filters a list of partner megaports by company name in the Megaport API.
FilterPartnerMegaportByCompanyName(ctx context.Context, partners []*PartnerMegaport, companyName string, exactMatch bool) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByLocationId filters a list of partner megaports by location ID in the Megaport API.
FilterPartnerMegaportByLocationId(ctx context.Context, partners []*PartnerMegaport, locationId int) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByDiversityZone filters a list of partner megaports by diversity zone in the Megaport API.
FilterPartnerMegaportByDiversityZone(ctx context.Context, partners []*PartnerMegaport, diversityZone string) ([]*PartnerMegaport, error)
// FilterPartnerMegaportByMetro filters a list of partner megaports by metro name, using the client's LocationService to resolve metro-to-location-ID mapping.
FilterPartnerMegaportByMetro(ctx context.Context, partners []*PartnerMegaport, metro string) ([]*PartnerMegaport, error)
}
PartnerService is an interface for interfacing with the Partner Port endpoints of the Megaport API.
type PartnerServiceOp ¶
type PartnerServiceOp struct {
Client *Client
}
PartnerServiceOp handles communication with Partner Port methods of the Megaport API.
func NewPartnerService ¶
func NewPartnerService(c *Client) *PartnerServiceOp
NewPartnerService creates a new instance of the PartnerService.
func (*PartnerServiceOp) FilterPartnerMegaportByCompanyName ¶
func (svc *PartnerServiceOp) FilterPartnerMegaportByCompanyName(ctx context.Context, partners []*PartnerMegaport, companyName string, exactMatch bool) ([]*PartnerMegaport, error)
FilterPartnerMegaportByCompanyName filters a list of partner megaports by company name in the Megaport API.
func (*PartnerServiceOp) FilterPartnerMegaportByConnectType ¶
func (svc *PartnerServiceOp) FilterPartnerMegaportByConnectType(ctx context.Context, partners []*PartnerMegaport, connectType string, exactMatch bool) ([]*PartnerMegaport, error)
FilterPartnerMegaportByConnectType filters a list of partner megaports by connect type in the Megaport API.
func (*PartnerServiceOp) FilterPartnerMegaportByDiversityZone ¶
func (svc *PartnerServiceOp) FilterPartnerMegaportByDiversityZone(ctx context.Context, partners []*PartnerMegaport, diversityZone string) ([]*PartnerMegaport, error)
FilterPartnerMegaportByDiversityZone filters a list of partner megaports by diversity zone in the Megaport API.
func (*PartnerServiceOp) FilterPartnerMegaportByLocationId ¶
func (svc *PartnerServiceOp) FilterPartnerMegaportByLocationId(ctx context.Context, partners []*PartnerMegaport, locationId int) ([]*PartnerMegaport, error)
FilterPartnerMegaportByLocationId filters a list of partner megaports by location ID in the Megaport API.
func (*PartnerServiceOp) FilterPartnerMegaportByMetro ¶ added in v1.12.0
func (svc *PartnerServiceOp) FilterPartnerMegaportByMetro(ctx context.Context, partners []*PartnerMegaport, metro string) ([]*PartnerMegaport, error)
FilterPartnerMegaportByMetro filters a list of partner megaports by metro name, using the client's LocationService to resolve which location IDs belong to the given metro. When metro is empty, all VXC-permitted partners are returned without calling the LocationService.
func (*PartnerServiceOp) FilterPartnerMegaportByProductName ¶
func (svc *PartnerServiceOp) FilterPartnerMegaportByProductName(ctx context.Context, partners []*PartnerMegaport, productName string, exactMatch bool) ([]*PartnerMegaport, error)
FilterPartnerMegaportByProductName filters a list of partner megaports by product name in the Megaport API.
func (*PartnerServiceOp) ListPartnerMegaports ¶
func (svc *PartnerServiceOp) ListPartnerMegaports(ctx context.Context) ([]*PartnerMegaport, error)
ListPartnerMegaports gets a list of all partner megaports in the Megaport Marketplace via the Megaport API.
type Peer ¶
type Peer struct {
PeerASN int `json:"peer_asn"`
Prefixes string `json:"prefixes"`
PrimarySubnet string `json:"primary_subnet"`
SecondarySubnet string `json:"secondary_subnet"`
Type string `json:"type"`
VLAN int `json:"vlan"`
}
Peer represents a VXC Peer.
type Port ¶
type Port struct {
ID int `json:"productId"`
UID string `json:"productUid"`
Name string `json:"productName"`
Type string `json:"productType"`
ProvisioningStatus string `json:"provisioningStatus"`
CreateDate *Time `json:"createDate"`
CreatedBy string `json:"createdBy"`
PortSpeed int `json:"portSpeed"`
TerminateDate *Time `json:"terminateDate"`
LiveDate *Time `json:"liveDate"`
Market string `json:"market"`
LocationID int `json:"locationId"`
UsageAlgorithm string `json:"usageAlgorithm"`
MarketplaceVisibility bool `json:"marketplaceVisibility"`
VXCPermitted bool `json:"vxcpermitted"`
VXCAutoApproval bool `json:"vxcAutoApproval"`
SecondaryName string `json:"secondaryName"`
LAGPrimary bool `json:"lagPrimary"`
LAGID int `json:"lagId"`
AggregationID int `json:"aggregationId"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
CostCentre string `json:"costCentre"`
ContractStartDate *Time `json:"contractStartDate"`
ContractEndDate *Time `json:"contractEndDate"`
ContractTermMonths int `json:"contractTermMonths"`
AttributeTags PortAttributeTags `json:"attributeTags"`
Virtual bool `json:"virtual"`
BuyoutPort bool `json:"buyoutPort"`
Locked bool `json:"locked"`
AdminLocked bool `json:"adminLocked"`
Cancelable bool `json:"cancelable"`
DiversityZone string `json:"diversityZone"`
VXCResources PortResources `json:"resources"`
LocationDetails *ProductLocationDetails `json:"locationDetail"`
LagCount int
LagPortUIDs []string
AssociatedVXCs []*VXC `json:"associatedVxcs"`
AssociatedIXs []*IX `json:"associatedIxs"`
}
Port represents a Megaport Port in the Megaport Port API.
func (*Port) GetAssociatedIXs ¶ added in v1.3.8
func (*Port) GetAssociatedVXCs ¶ added in v1.3.8
func (*Port) GetProvisioningStatus ¶ added in v1.3.3
type PortAttributeTags ¶
type PortAttributeTags struct {
TerminatedServiceDetails PortTerminatedServiceDetails `json:"terminatedServiceDetails"`
}
PortAttributes represents attributes associated with a Megaport Port.
type PortInterface ¶
type PortInterface struct {
Demarcation string `json:"demarcation"`
Description string `json:"description"`
ID int `json:"id"`
LOATemplate string `json:"loa_template"`
Media string `json:"media"`
Name string `json:"name"`
PortSpeed int `json:"port_speed"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Up int `json:"up"`
}
PortInterface represents the interface associated with a Megaport Port.
type PortOrder ¶
type PortOrder struct {
Name string `json:"productName"`
Term int `json:"term"`
ProductType string `json:"productType"`
PortSpeed int `json:"portSpeed"`
LocationID int `json:"locationId"`
CreateDate int64 `json:"createDate"`
Virtual bool `json:"virtual"`
Market string `json:"market"`
CostCentre string `json:"costCentre,omitempty"`
LagPortCount int `json:"lagPortCount,omitempty"`
MarketplaceVisibility bool `json:"marketplaceVisibility"`
Config PortOrderConfig `json:"config"`
PromoCode string `json:"promoCode,omitempty"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
}
PortOrder represents a Megaport Port Order from the Megaport Products API.
type PortOrderConfig ¶ added in v1.0.12
type PortOrderConfig struct {
DiversityZone string `json:"diversityZone,omitempty"`
}
type PortOrderConfirmation ¶
type PortOrderConfirmation struct {
TechnicalServiceUID string `json:"technicalServiceUid"`
}
PortOrderConfirmation represents a response from the Megaport Products API after ordering a port.
type PortOrderResponse ¶
type PortOrderResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []PortOrderConfirmation `json:"data"`
}
PortOrderResponse represents a response from the Megaport Products API after ordering a port.
type PortResources ¶
type PortResources struct {
Interface PortInterface `json:"interface"`
}
PortResources represents the resources associated with a Megaport Port.
type PortResourcesInterface ¶
type PortResourcesInterface struct {
Demarcation string `json:"demarcation"`
Description string `json:"description"`
ID int `json:"id"`
LOATemplate string `json:"loa_template"`
Media string `json:"media"`
Name string `json:"name"`
PortSpeed int `json:"port_speed"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Up int `json:"up"`
}
PortResourcesInterface represents the resources interface associated with a Megaport Port.
type PortResponse ¶
type PortResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data Port `json:"data"`
}
PortResponse represents a response from the Megaport Port API after querying a port.
type PortService ¶
type PortService interface {
// BuyPort buys a port from the Megaport Port API.
BuyPort(ctx context.Context, req *BuyPortRequest) (*BuyPortResponse, error)
// ValidatePortOrder validates a port order in the Megaport Products API.
ValidatePortOrder(ctx context.Context, req *BuyPortRequest) error
// ListPorts lists all ports in the Megaport Port API.
ListPorts(ctx context.Context) ([]*Port, error)
// GetPort gets a single port in the Megaport Port API.
GetPort(ctx context.Context, portId string) (*Port, error)
// ModifyPort modifies a port in the Megaport Port API.
ModifyPort(ctx context.Context, req *ModifyPortRequest) (*ModifyPortResponse, error)
// DeletePort deletes a port in the Megaport Port API.
// Note: Port products only support immediate deletion (CANCEL_NOW). Requests
// with DeleteNow=false are rejected with ErrPortCancelLaterNotAllowed.
DeletePort(ctx context.Context, req *DeletePortRequest) (*DeletePortResponse, error)
// RestorePort restores a port in the Megaport Port API.
RestorePort(ctx context.Context, portId string) (*RestorePortResponse, error)
// LockPort locks a port in the Megaport Port API.
LockPort(ctx context.Context, portId string) (*LockPortResponse, error)
// UnlockPort unlocks a port in the Megaport Port API.
UnlockPort(ctx context.Context, portId string) (*UnlockPortResponse, error)
// CheckPortVLANAvailability checks if a VLAN is available on a port in the Megaport Products API.
CheckPortVLANAvailability(ctx context.Context, portId string, vlan int) (bool, error)
// ListPortResourceTags lists the resource tags for a port in the Megaport Port API.
ListPortResourceTags(ctx context.Context, portID string) (map[string]string, error)
// UpdatePortResourceTags updates the resource tags for a port in the Megaport Port API.
UpdatePortResourceTags(ctx context.Context, portID string, tags map[string]string) error
}
PortService is an interface for interfacing with the Port endpoints of the Megaport API.
type PortServiceOp ¶
type PortServiceOp struct {
Client *Client
}
PortServiceOp handles communication with Port methods of the Megaport API.
func NewPortService ¶
func NewPortService(c *Client) *PortServiceOp
NewPortService creates a new instance of the Port Service.
func (*PortServiceOp) BuyPort ¶
func (svc *PortServiceOp) BuyPort(ctx context.Context, req *BuyPortRequest) (*BuyPortResponse, error)
BuyPort buys a port from the Megaport Port API.
func (*PortServiceOp) CheckPortVLANAvailability ¶ added in v1.2.3
func (*PortServiceOp) DeletePort ¶
func (svc *PortServiceOp) DeletePort(ctx context.Context, req *DeletePortRequest) (*DeletePortResponse, error)
DeletePort deletes a port in the Megaport Port API. Note: Port products only support immediate deletion (CANCEL_NOW). Requests with DeleteNow=false are rejected with ErrPortCancelLaterNotAllowed, and accepted requests always call the underlying API with DeleteNow=true.
func (*PortServiceOp) ListPortResourceTags ¶ added in v1.2.5
func (svc *PortServiceOp) ListPortResourceTags(ctx context.Context, portID string) (map[string]string, error)
ListPortResourceTags lists the resource tags for a port in the Megaport Port API.
func (*PortServiceOp) ListPorts ¶
func (svc *PortServiceOp) ListPorts(ctx context.Context) ([]*Port, error)
func (*PortServiceOp) LockPort ¶
func (svc *PortServiceOp) LockPort(ctx context.Context, portId string) (*LockPortResponse, error)
LockPort locks a port in the Megaport Port API.
func (*PortServiceOp) ModifyPort ¶
func (svc *PortServiceOp) ModifyPort(ctx context.Context, req *ModifyPortRequest) (*ModifyPortResponse, error)
ModifyPort modifies a port in the Megaport Port API.
func (*PortServiceOp) RestorePort ¶
func (svc *PortServiceOp) RestorePort(ctx context.Context, portId string) (*RestorePortResponse, error)
RestorePort restores a port in the Megaport Port API.
func (*PortServiceOp) UnlockPort ¶
func (svc *PortServiceOp) UnlockPort(ctx context.Context, portId string) (*UnlockPortResponse, error)
UnlockPort unlocks a port in the Megaport Port API.
func (*PortServiceOp) UpdatePortResourceTags ¶ added in v1.2.5
func (*PortServiceOp) ValidatePortOrder ¶ added in v1.0.15
func (svc *PortServiceOp) ValidatePortOrder(ctx context.Context, req *BuyPortRequest) error
type PortTerminatedServiceDetails ¶
type PortTerminatedServiceDetails struct {
Location PortTerminatedServiceDetailsLocation `json:"location"`
Interface PortTerminatedServiceDetailsInterface `json:"interface"`
Device string `json:"device"`
}
PortTerminatedServiceDetails represents terminated service details associated with a Megaport Port.
type PortTerminatedServiceDetailsInterface ¶
type PortTerminatedServiceDetailsInterface struct {
ResourceType string `json:"resource_type"`
Demarcation string `json:"demarcation"`
LOATemplate string `json:"loa_template"`
Media string `json:"media"`
PortSpeed int `json:"port_speed"`
ResourceName string `json:"resource_name"`
Up int `json:"up"`
Shutdown bool `json:"shutdown"`
}
PortTerminatedServiceDetailsInterface represents the interface of a terminated service associated with a Megaport Port.
type PortTerminatedServiceDetailsLocation ¶
type PortTerminatedServiceDetailsLocation struct {
ID int `json:"id"`
Name string `json:"name"`
SiteCode string `json:"site_code"`
}
PortTerminatedServiceDetailsLocation represents the location of a terminated service associated with a Megaport Port.
type PortVLANAvailabilityAPIResponse ¶ added in v1.2.3
type PrefixFilterList ¶
type PrefixFilterList struct {
Id int `json:"id"`
Description string `json:"description"`
AddressFamily string `json:"addressFamily"`
}
PrefixFilterList represents a prefix filter list associated with an MCR.
type PriceBookChargeReason ¶ added in v1.12.0
type PriceBookChargeReason string
PriceBookChargeReason is the reason for a charge element.
const ( PriceBookChargeReasonCore PriceBookChargeReason = "CORE" PriceBookChargeReasonCoreSurcharge PriceBookChargeReason = "CORE_SURCHARGE" PriceBookChargeReasonAddOn PriceBookChargeReason = "ADD_ON_CHARGE" )
type PriceBookDTO ¶ added in v1.12.0
type PriceBookDTO struct {
ProductType string `json:"productType"`
Currency string `json:"currency"`
MonthlyRate float64 `json:"monthlyRate"`
MonthlyRackRate float64 `json:"monthlyRackRate"`
Prices []*PriceBookPriceElement `json:"prices"`
Discounts []*PriceBookDiscountElement `json:"discounts"`
}
PriceBookDTO is the pricing response for a single product.
type PriceBookDiscountElement ¶ added in v1.12.0
type PriceBookDiscountElement struct {
DiscountReason DiscountReason `json:"discountReason"`
Amount float64 `json:"amount"`
DiscountDetails *DiscountDetails `json:"discountDetails,omitempty"`
}
PriceBookDiscountElement is a discount applied to the product.
type PriceBookPriceElement ¶ added in v1.12.0
type PriceBookPriceElement struct {
ChargeReason PriceBookChargeReason `json:"chargeReason"`
Frequency PricingFrequency `json:"frequency"`
Amount float64 `json:"amount"`
AddOnType string `json:"addOnType,omitempty"` // set when ChargeReason == ADD_ON_CHARGE
}
PriceBookPriceElement is a single price component in a pricing response.
type PriceBookRequest ¶ added in v1.12.0
type PriceBookRequest interface {
// contains filtered or unexported methods
}
PriceBookRequest is implemented by all product-specific pricing request types. Pass the concrete type directly to GetProductPricing.
type PricingFrequency ¶ added in v1.12.0
type PricingFrequency string
PricingFrequency is the billing frequency for a price element.
const ( PricingFrequencyOnce PricingFrequency = "ONCE" PricingFrequencyMonthly PricingFrequency = "MONTHLY" PricingFrequencyYearly PricingFrequency = "YEARLY" )
type PrismaConfig ¶ added in v1.2.2
type PrismaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
IONKey string `json:"ionKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}
PrismaConfig represents the configuration for a Palo Alto Prisma MVE.
type Product ¶ added in v1.3.3
type Product interface {
GetType() string
GetUID() string
GetProvisioningStatus() string
GetAssociatedVXCs() []*VXC
GetAssociatedIXs() []*IX
}
Product defines the common interface for all Megaport products
type ProductAddOnPriceBookRequest ¶ added in v1.12.0
type ProductAddOnPriceBookRequest struct {
AddOnType string `json:"addOnType"`
TunnelCount int `json:"tunnelCount,omitempty"`
CrossConnectRequested *bool `json:"crossConnectRequested,omitempty"`
}
ProductAddOnPriceBookRequest represents a product add-on for pricing requests. Set AddOnType to PricingAddOnTypeCrossConnect or PricingAddOnTypeIPSec and populate the relevant fields.
type ProductLocationDetails ¶ added in v1.0.2
type ProductLocationDetails struct {
Name string `json:"name"`
City string `json:"city"`
Metro string `json:"metro"`
Country string `json:"country"`
}
ProductLocationDetails represents the location details of a product.
type ProductService ¶
type ProductService interface {
// ExecuteOrder is responsible for executing an order for a product in the Megaport Products API.
ExecuteOrder(ctx context.Context, requestBody interface{}) (*[]byte, error)
// ListProducts retrieves a list of products from the Megaport Products API. It returns a slice of Product interfaces, which can be of different types (Port, MCR, MVE). The function handles the parsing of the response and unmarshals it into the appropriate product type based on the product type field.
ListProducts(ctx context.Context) ([]Product, error)
// ModifyProduct modifies a product in the Megaport Products API. The available fields to modify are Name, Cost Centre, Marketplace Visibility, Contract Term, ASN (MCR only), and Vnics (MVE only).
ModifyProduct(ctx context.Context, req *ModifyProductRequest) (*ModifyProductResponse, error)
// DeleteProduct is responsible for either scheduling a product for deletion "CANCEL" or deleting a product immediately "CANCEL_NOW" in the Megaport Products API.
DeleteProduct(ctx context.Context, req *DeleteProductRequest) (*DeleteProductResponse, error)
// RestoreProduct is responsible for restoring a product in the Megaport Products API. The product must be in a "CANCELLED" state to be restored.
RestoreProduct(ctx context.Context, productId string) (*RestoreProductResponse, error)
// ManageProductLock is responsible for locking or unlocking a product in the Megaport Products API.
ManageProductLock(ctx context.Context, req *ManageProductLockRequest) (*ManageProductLockResponse, error)
// ValidateProductOrder is responsible for validating an order for a product in the Megaport Products API.
ValidateProductOrder(ctx context.Context, requestBody interface{}) error
// ListProductResourceTags is responsible for retrieving the resource tags for a product in the Megaport Products API.
ListProductResourceTags(ctx context.Context, productID string) ([]ResourceTag, error)
// UpdateProductResourceTags is responsible for updating the resource tags for a product in the Megaport Products API.
UpdateProductResourceTags(ctx context.Context, productUID string, tagsReq *UpdateProductResourceTagsRequest) error
// GetProductType returns the type of the product based on the Product UID. If no product is found, it returns an error.
GetProductType(ctx context.Context, productUID string) (string, error)
// GetProductPricing fetches pricing for a product configuration.
GetProductPricing(ctx context.Context, req PriceBookRequest) (*PriceBookDTO, error)
// GetProductPricingForCompany fetches pricing scoped to a specific company.
GetProductPricingForCompany(ctx context.Context, req *GetProductPricingRequest) (*PriceBookDTO, error)
}
ProductService is an interface for interfacing with the Product endpoints of the Megaport API.
type ProductServiceOp ¶
type ProductServiceOp struct {
Client *Client
}
ProductServiceOp handles communication with Product methods of the Megaport API.
func NewProductService ¶
func NewProductService(c *Client) *ProductServiceOp
NewProductService creates a new instance of the Product Service.
func (*ProductServiceOp) DeleteProduct ¶
func (svc *ProductServiceOp) DeleteProduct(ctx context.Context, req *DeleteProductRequest) (*DeleteProductResponse, error)
DeleteProduct is responsible for either scheduling a product for deletion "CANCEL" or deleting a product immediately "CANCEL_NOW" in the Megaport Products API.
func (*ProductServiceOp) ExecuteOrder ¶
func (svc *ProductServiceOp) ExecuteOrder(ctx context.Context, requestBody interface{}) (*[]byte, error)
ExecuteOrder is responsible for executing an order for a product in the Megaport Products API.
func (*ProductServiceOp) GetProductPricing ¶ added in v1.12.0
func (svc *ProductServiceOp) GetProductPricing(ctx context.Context, req PriceBookRequest) (*PriceBookDTO, error)
GetProductPricing fetches pricing for a product configuration via POST /v4/pricebook/product.
func (*ProductServiceOp) GetProductPricingForCompany ¶ added in v1.12.0
func (svc *ProductServiceOp) GetProductPricingForCompany(ctx context.Context, pricingReq *GetProductPricingRequest) (*PriceBookDTO, error)
GetProductPricingForCompany fetches pricing scoped to a specific company. Use when pricing as a partner or reseller for another company.
func (*ProductServiceOp) GetProductType ¶ added in v1.3.5
GetProductType returns the type of the product based on the Product UID. If no product is found, it returns an error.
func (*ProductServiceOp) ListProductResourceTags ¶ added in v1.2.5
func (svc *ProductServiceOp) ListProductResourceTags(ctx context.Context, productUID string) ([]ResourceTag, error)
ListProductResourceTags is responsible for retrieving the resource tags for a product in the Megaport Products API.
func (*ProductServiceOp) ListProducts ¶ added in v1.3.3
func (svc *ProductServiceOp) ListProducts(ctx context.Context) ([]Product, error)
ListProducts retrieves a list of products from the Megaport Products API. It returns a slice of Product interfaces, which can be of different types (Port, MCR, MVE). The function handles the parsing of the response and unmarshals it into the appropriate product type based on the product type field. It also logs any errors encountered during the unmarshalling process.
func (*ProductServiceOp) ManageProductLock ¶
func (svc *ProductServiceOp) ManageProductLock(ctx context.Context, req *ManageProductLockRequest) (*ManageProductLockResponse, error)
ManageProductLock is responsible for locking or unlocking a product in the Megaport Products API.
func (*ProductServiceOp) ModifyProduct ¶
func (svc *ProductServiceOp) ModifyProduct(ctx context.Context, req *ModifyProductRequest) (*ModifyProductResponse, error)
ModifyProduct modifies a product in the Megaport Products API. The available fields to modify are Name, Cost Centre, Marketplace Visibility, Contract Term, ASN (MCR only), and Vnics (MVE only).
func (*ProductServiceOp) RestoreProduct ¶
func (svc *ProductServiceOp) RestoreProduct(ctx context.Context, productId string) (*RestoreProductResponse, error)
RestoreProduct is responsible for restoring a product in the Megaport Products API. The product must be in a "CANCELLED" state to be restored.
func (*ProductServiceOp) UpdateProductResourceTags ¶ added in v1.2.5
func (svc *ProductServiceOp) UpdateProductResourceTags(ctx context.Context, productUID string, tagsReq *UpdateProductResourceTagsRequest) error
UpdateProductResourceTags is responsible for updating the resource tags for a product in the Megaport Products API.
func (*ProductServiceOp) ValidateProductOrder ¶ added in v1.0.15
func (svc *ProductServiceOp) ValidateProductOrder(ctx context.Context, requestBody interface{}) error
ValidateProductOrder is responsible for validating an order for a product in the Megaport Products API.
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type ResourceTag ¶ added in v1.2.5
type RestoreMCRResponse ¶
type RestoreMCRResponse struct {
IsRestored bool
}
RestoreMCRequest represents a request to restore a deleted MCR
type RestorePortRequest ¶
type RestorePortRequest struct {
PortID string
}
RestorePortRequest represents a request to restore a port.
type RestorePortResponse ¶
type RestorePortResponse struct {
IsRestored bool
}
RestorePortResponse represents a response from restoring a port.
type RestoreProductRequest ¶
type RestoreProductRequest struct {
ProductID string
}
RestoreProductRequest represents a request to restore a product in the Megaport Products API.
type RestoreProductResponse ¶
type RestoreProductResponse struct{}
RestoreProductResponse represents a response from the Megaport Products API after restoring a product.
type RoundTripTime ¶ added in v1.5.0
type RoundTripTime struct {
SrcLocation int `json:"srcLocation"`
DstLocation int `json:"dstLocation"`
MedianRTT float64 `json:"medianRTT"`
}
RoundTripTime represents the median RTT (over a month) between two Megaport Locations
type RoundTripTimeResponse ¶ added in v1.5.0
type RoundTripTimeResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*RoundTripTime `json:"data"`
}
RoundTripTimeResponse represents the response from the Megaport Locations RTT API
type RouteProtocol ¶ added in v1.9.0
type RouteProtocol string
RouteProtocol represents the protocol type for a route.
const ( RouteProtocolBGP RouteProtocol = "BGP" RouteProtocolStatic RouteProtocol = "STATIC" RouteProtocolConnected RouteProtocol = "CONNECTED" RouteProtocolLocal RouteProtocol = "LOCAL" )
type ServiceKey ¶ added in v1.0.3
type ServiceKey struct {
Key string `json:"key"`
CreateDate *Time `json:"createDate"`
CompanyID int `json:"companyId"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
Description string `json:"description"`
ProductID int `json:"productId"`
ProductUID string `json:"productUid"`
ProductName string `json:"productName"`
VLAN int `json:"vlan"`
MaxSpeed int `json:"maxSpeed"`
PreApproved bool `json:"preApproved"`
SingleUse bool `json:"singleUse"`
LastUsed *Time `json:"lastUsed"`
Active bool `json:"active"`
ValidFor *ValidFor `json:"validFor"`
Expired bool `json:"expired"`
Valid bool `json:"valid"`
PromoCode string `json:"promoCode"`
}
type ServiceKeyService ¶ added in v1.0.3
type ServiceKeyService interface {
// CreateServiceKey creates a service key in the Megaport Service Key API.
CreateServiceKey(ctx context.Context, req *CreateServiceKeyRequest) (*CreateServiceKeyResponse, error)
// ListServiceKeys lists service keys in the Megaport Service Key API.
ListServiceKeys(ctx context.Context, req *ListServiceKeysRequest) (*ListServiceKeysResponse, error)
// UpdateServiceKey updates a service key in the Megaport Service Key API.
UpdateServiceKey(ctx context.Context, req *UpdateServiceKeyRequest) (*UpdateServiceKeyResponse, error)
// GetServiceKey gets a service key in the Megaport Service Key API.
GetServiceKey(ctx context.Context, keyId string) (*ServiceKey, error)
}
ServiceKeyService is an interface for interfacing with the Service Key endpoints in the Megaport Service Key API.
type ServiceKeyServiceOp ¶ added in v1.0.3
type ServiceKeyServiceOp struct {
Client *Client
}
ServiceKeyServiceOp handles communication with the Service Key related methods of the Megaport API.
func NewServiceKeyService ¶ added in v1.0.3
func NewServiceKeyService(c *Client) *ServiceKeyServiceOp
NewServiceKeyService creates a new instance of the Service Key Service.
func (*ServiceKeyServiceOp) CreateServiceKey ¶ added in v1.0.3
func (svc *ServiceKeyServiceOp) CreateServiceKey(ctx context.Context, req *CreateServiceKeyRequest) (*CreateServiceKeyResponse, error)
CreateServiceKey creates a service key in the Megaport Service Key API.
func (*ServiceKeyServiceOp) GetServiceKey ¶ added in v1.0.3
func (svc *ServiceKeyServiceOp) GetServiceKey(ctx context.Context, keyId string) (*ServiceKey, error)
func (*ServiceKeyServiceOp) ListServiceKeys ¶ added in v1.0.3
func (svc *ServiceKeyServiceOp) ListServiceKeys(ctx context.Context, req *ListServiceKeysRequest) (*ListServiceKeysResponse, error)
func (*ServiceKeyServiceOp) UpdateServiceKey ¶ added in v1.0.3
func (svc *ServiceKeyServiceOp) UpdateServiceKey(ctx context.Context, req *UpdateServiceKeyRequest) (*UpdateServiceKeyResponse, error)
type ServiceTelemetryResponse ¶ added in v1.6.0
type ServiceTelemetryResponse struct {
ServiceUID string `json:"serviceUid"`
Type string `json:"type"`
TimeFrame TelemetryTimeFrame `json:"timeFrame"`
Data []*TelemetryMetricData `json:"data"`
}
ServiceTelemetryResponse is the API response for service telemetry data. This response is NOT wrapped in the standard message/terms/data envelope.
type SetBillingMarketRequest ¶ added in v1.4.4
type SetBillingMarketRequest struct {
CurrencyEnum string `json:"currencyEnum"` // Billing currency (e.g., USD, AUD, etc.)
Language string `json:"language"` // Two-letter language code (e.g., "en")
BillingContactName string `json:"billingContactName"` // Name of the billing contact
BillingContactPhone string `json:"billingContactPhone"` // Phone number of the billing contact
BillingContactEmail string `json:"billingContactEmail"` // Email address of the billing contact
Address1 string `json:"address1"` // Physical address line 1
Address2 *string `json:"address2"` // Physical address line 2 (optional)
City string `json:"city"` // City for the billing contact
State string `json:"state"` // State or region
Postcode string `json:"postcode"` // Postal code
Country string `json:"country"` // Country code (e.g., "AU")
YourPONumber string `json:"yourPoNumber,omitempty"` // Optional PO number for tracking
TaxNumber string `json:"taxNumber,omitempty"` // Optional tax or VAT registration number
FirstPartyID int `json:"firstPartyId"` // ID for the billing market (see FIRST_PARTY_ID constants)
}
SetBillingMarketRequest represents the request body for setting a billing market in the Megaport API.
type SetBillingMarketResponse ¶ added in v1.4.4
type SetBillingMarketResponse struct {
SupplyID int `json:"supplyId"`
}
type SixwindVSRConfig ¶ added in v1.2.2
type SixwindVSRConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
}
VSRConfig represents the configuration for a 6WIND VSR MVE.
type TelemetryMetricData ¶ added in v1.6.0
type TelemetryMetricData struct {
Type string `json:"type"`
Subtype string `json:"subtype"`
Samples []TelemetrySample `json:"samples"`
Unit TelemetryUnit `json:"unit"`
}
TelemetryMetricData represents a single metric series in a telemetry response.
type TelemetrySample ¶ added in v1.6.0
TelemetrySample represents a single data point in a telemetry series. The API returns samples as [timestamp, value] tuples.
func (*TelemetrySample) UnmarshalJSON ¶ added in v1.6.0
func (s *TelemetrySample) UnmarshalJSON(data []byte) error
UnmarshalJSON handles the [int64, float64] tuple format from the API.
type TelemetryTimeFrame ¶ added in v1.6.0
TelemetryTimeFrame represents the time range of a telemetry response.
type TelemetryUnit ¶ added in v1.6.0
TelemetryUnit describes the unit of measurement for a telemetry metric.
type Time ¶
Time is a custom time type that allows for unmarshalling of Unix timestamps.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON unmarshals a Unix timestamp into a Time type.
type TokenProvider ¶ added in v1.4.7
type TokenProvider interface {
// GetToken returns the current valid access token.
// Implementations should handle token refresh if needed.
GetToken(ctx context.Context) (token string, err error)
}
TokenProvider is an interface for providing access tokens. This allows external systems (like a web portal) to manage token lifecycle.
type UnlockPortRequest ¶
type UnlockPortRequest struct {
PortID string
}
UnlockPortRequest represents a request to unlock a port.
type UnlockPortResponse ¶
type UnlockPortResponse struct {
IsUnlocking bool
}
UnlockPortResponse represents a response from unlocking a port.
type UpdateIXRequest ¶ added in v1.3.2
type UpdateIXRequest struct {
Name *string `json:"name,omitempty"` // Name of the IX
RateLimit *int `json:"rateLimit,omitempty"` // Rate limit in Mbps
CostCentre *string `json:"costCentre,omitempty"` // For invoicing purposes
VLAN *int `json:"vlan,omitempty"` // VLAN ID for the IX connection
MACAddress *string `json:"macAddress,omitempty"` // MAC address for the IX interface
ASN *int `json:"asn,omitempty"` // ASN (Autonomous System Number) - Be very careful about changing this
Password *string `json:"password,omitempty"` // BGP password
PublicGraph *bool `json:"publicGraph,omitempty"` // Whether the IX usage statistics are publicly viewable
ReverseDns *string `json:"reverseDns,omitempty"` // DNS lookup of a domain name from an IP address. You can change this value to enter a custom hostname for your IP address
AEndProductUid *string `json:"aEndProductUid,omitempty"` // Move the IX by changing the A-End of the IX. Provide the productUid of the new A-End
Shutdown *bool `json:"shutdown,omitempty"` // Shut down and re-enable the IX. Valid values are true (shut down) and false (enabled). If not provided, defaults to false (enabled)
WaitForUpdate bool // Client-side option to wait until IX is updated before returning
WaitForTime time.Duration // Maximum duration to wait for updating
}
UpdateIXRequest represents a request to update an existing IX
type UpdateNATGatewayRequest ¶ added in v1.7.0
type UpdateNATGatewayRequest struct {
ProductUID string `json:"-"` // path parameter, not serialized
AutoRenewTerm bool `json:"autoRenewTerm"`
Config NATGatewayNetworkConfig `json:"config"`
LocationID int `json:"locationId"`
ProductName string `json:"productName"`
PromoCode string `json:"promoCode,omitempty"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
ServiceLevelReference string `json:"serviceLevelReference,omitempty"`
Speed int `json:"speed"`
Term int `json:"term"`
}
UpdateNATGatewayRequest represents a request to update a NAT Gateway.
type UpdateProductResourceTagsRequest ¶ added in v1.2.5
type UpdateProductResourceTagsRequest struct {
ResourceTags []ResourceTag `json:"resourceTags"`
}
type UpdateServiceKeyRequest ¶ added in v1.0.3
type UpdateServiceKeyRequest struct {
Key string `json:"key"`
ProductUID string `json:"productUid,omitempty"` // The Product UID for the service key. API can take either UID or ID.
ProductID int `json:"productId,omitempty"` // The Product ID for the service key. API can take either UID or ID.
SingleUse bool `json:"singleUse"` // Determines whether the service key is single-use or multi-use. Valid values are true (single-use) and false (multi-use). With a multi-use key, the customer that you share the key with can request multiple connections using that key.
Active bool `json:"active"` // Determines whether the service key is available for use. Valid values are true if you want the key to be available right away and false if you don’t want the key to be available right away.
OrderValidFor *OrderValidFor `json:"validFor,omitempty"` // The range of dates for which the service key is valid.
ValidFor *ValidFor
}
UpdateServiceKeyRequest represents a request to update a service key in the Megaport Service Key API.
type UpdateServiceKeyResponse ¶ added in v1.0.3
type UpdateServiceKeyResponse struct {
IsUpdated bool
}
UpdateServiceKeyResponse represents a response from updating a service key in the Megaport Service Key API.
type UpdateUserRequest ¶ added in v1.4.5
type UpdateUserRequest struct {
// NotificationEnabled indicates whether the user should receive notifications.
NotificationEnabled *bool `json:"notificationEnabled,omitempty"`
// Position defines the role of the user within the organization.
// Use the UserPosition type constants for standard roles (e.g., USER_POSITION_COMPANY_ADMIN).
// For more information on roles, see Add / invite user to company.
Position *string `json:"position,omitempty"`
// CompanyId is the unique identifier of the company to which the user belongs.
// This ID is used to associate the user with a specific company.
CompanyId *int `json:"companyId,omitempty"`
// Newsletter indicates whether the user has opted into receiving the newsletter.
Newsletter *bool `json:"newsletter,omitempty"`
// Promotions indicates whether the user has opted into receiving promotional communications.
Promotions *bool `json:"promotions,omitempty"`
// FirstName is the user's first name.
FirstName *string `json:"firstName,omitempty"`
// LastName is the user's last name.
LastName *string `json:"lastName,omitempty"`
// Phone is the user's primary phone number.
Phone *string `json:"phone,omitempty"`
// ChannelManager indicates whether the user is a channel manager.
// This field is used to specify the channel manager associated with the user.
ChannelManager *bool `json:"channelManager,omitempty"`
// Active indicates whether the user account is active.
// Set to true if the user is active or false to define the user as inactive.
Active *bool `json:"active,omitempty"`
// SecurityRoles defines the array of security roles assigned to the user.
// Examples include "companyAdmin", "technicalContact".
SecurityRoles *[]string `json:"securityRoles,omitempty"`
// Email is the email address of the user.
Email *string `json:"email,omitempty"`
}
UpdateUserRequest represents the request body for updating an existing user. Only include the attributes that you want to update.
func (*UpdateUserRequest) Validate ¶ added in v1.4.5
func (req *UpdateUserRequest) Validate() error
Validate validates the UpdateUserRequest according to the Megaport API requirements
type UpdateVXCRequest ¶
type UpdateVXCRequest struct {
AEndVLAN *int // A unique VLAN ID for this connection. Values can range from 2 to 4093. If this value is 0, the system allocates a valid VLAN. If the value is -1, the system untags the VLAN and sets it to null.
BEndVLAN *int // A unique VLAN ID for this connection. Values can range from 2 to 4093. If this value is 0, the system allocates a valid VLAN. If the value is -1, the system untags the VLAN and sets it to null.
AEndProductUID *string // When moving a VXC, this is the new A-End for the connection.
BEndProductUID *string // When moving a VXC, this is the new B-End for the connection.
RateLimit *int // A new speed for the connection.
Name *string // Customer name for the connection - this name appears in the Portal.
CostCentre *string // A customer reference number to be included in billing information and invoices. Also known as the Service Level Reference (SLR).
Term *int
Shutdown *bool // Temporarily shut down and re-enable the VXC. Valid values are true (shut down) and false (enabled). If not provided, it defaults to false (enabled).
AEndInnerVLAN *int
BEndInnerVLAN *int
AVnicIndex *int // When moving a VXC for an MVE, this is the new A-End vNIC for the connection.
BVnicIndex *int // When moving a VXC for an MVE, this is the new B-End vNIC for the connection.
IsApproved *bool // Define whether the VXC is approved or rejected via the Megaport Marketplace. Set to true (Approved) or false (Rejected).
AEndPartnerConfig VXCPartnerConfiguration
BEndPartnerConfig VXCPartnerConfiguration
WaitForUpdate bool // Wait until the VXC updates before returning
WaitForTime time.Duration // How long to wait for the VXC to update if WaitForUpdate is true (default is 5 minutes)
}
UpdateVXCRequest represents a request to update a VXC in the Megaport VXC API.
type UpdateVXCResponse ¶
type UpdateVXCResponse struct {
}
UpdateVXCResponse represents a response from updating a VXC in the Megaport VXC API.
type User ¶ added in v1.4.5
type User struct {
Salutation string `json:"salutation"`
Position string `json:"position"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Phone string `json:"phone"`
Mobile string `json:"mobile"`
Email string `json:"email"`
PartyId int `json:"partyId"`
PersonId int `json:"personId"` // Used in list responses instead of partyId
Username string `json:"username"`
Description string `json:"description"`
Active bool `json:"active"`
UID string `json:"uid"`
PersonUid string `json:"personUid"` // Alternative UID field in list responses
Emails []UserEmail `json:"emails"`
SalesforceId string `json:"salesforceId"`
ChannelManager bool `json:"channelManager"`
RequireTotp bool `json:"requireTotp"`
NotificationEnabled bool `json:"notificationEnabled"`
SecurityRoles []string `json:"securityRoles"`
FeatureFlags []string `json:"featureFlags"`
Newsletter bool `json:"newsletter"`
Promotions bool `json:"promotions"`
MfaEnabled bool `json:"mfaEnabled"`
ConfirmationPending bool `json:"confirmationPending"`
InvitationPending bool `json:"invitationPending"`
Name string `json:"name"`
ReceivesChildNotifications bool `json:"receivesChildNotifications"`
// Additional fields from list API response
CompanyId int `json:"companyId"`
EmploymentId int `json:"employmentId"`
PositionId int `json:"positionId"`
PersonAltId string `json:"personAltId"`
EmploymentType string `json:"employmentType"`
CompanyName string `json:"companyName"`
}
type UserActivity ¶ added in v1.4.5
type UserActivity struct {
// LoginName is the display name of the user who performed the activity.
LoginName string `json:"loginName"`
// PersonId is the unique identifier for the user (person).
PersonId int `json:"personId"`
// Description provides details about the activity performed.
Description string `json:"description"`
// Name is the type or name of the activity (e.g., "Login").
Name string `json:"name"`
// CreateDate is the timestamp when the activity occurred, parsed as a Time type.
CreateDate Time `json:"createDate"`
// UserType indicates the type of user (e.g., "USER").
UserType string `json:"userType"`
}
type UserManagementService ¶ added in v1.4.5
type UserManagementService interface {
// CreateUser creates a new user in the Megaport system.
CreateUser(ctx context.Context, req *CreateUserRequest) (*CreateUserResponse, error)
// GetUser retrieves a user by their employee ID.
GetUser(ctx context.Context, employeeID int) (*User, error)
// ListCompanyUsers retrieves a list of all users in the company.
ListCompanyUsers(ctx context.Context) ([]*User, error)
// UpdateUser updates an existing user in the Megaport system.
UpdateUser(ctx context.Context, employeeID int, req *UpdateUserRequest) error
// DeleteUser deletes a user by their employee ID.
DeleteUser(ctx context.Context, employeeID int) error
// DeactivateUser deactivates a user by their employee ID.
DeactivateUser(ctx context.Context, employeeID int) error
// GetUserActivity retrieves the activity of a user based on their person ID or UID.
GetUserActivity(ctx context.Context, req *GetUserActivityRequest) ([]*UserActivity, error)
}
UserManagementService is an interface that defines methods for managing users in the Megaport API.
func NewUserManagementService ¶ added in v1.4.5
func NewUserManagementService(client *Client) UserManagementService
type UserManagementServiceOp ¶ added in v1.4.5
type UserManagementServiceOp struct {
// contains filtered or unexported fields
}
func (*UserManagementServiceOp) CreateUser ¶ added in v1.4.5
func (svc *UserManagementServiceOp) CreateUser(ctx context.Context, req *CreateUserRequest) (*CreateUserResponse, error)
CreateUser creates a new user in the Megaport system.
func (*UserManagementServiceOp) DeactivateUser ¶ added in v1.4.5
func (svc *UserManagementServiceOp) DeactivateUser(ctx context.Context, employeeID int) error
func (*UserManagementServiceOp) DeleteUser ¶ added in v1.4.5
func (svc *UserManagementServiceOp) DeleteUser(ctx context.Context, employeeID int) error
func (*UserManagementServiceOp) GetUserActivity ¶ added in v1.4.5
func (svc *UserManagementServiceOp) GetUserActivity(ctx context.Context, req *GetUserActivityRequest) ([]*UserActivity, error)
GetUserActivity retrieves a log of user activity in the Megaport Portal. It can be filtered by person ID/UID and/or company ID/UID using the request parameters.
func (*UserManagementServiceOp) ListCompanyUsers ¶ added in v1.4.5
func (svc *UserManagementServiceOp) ListCompanyUsers(ctx context.Context) ([]*User, error)
func (*UserManagementServiceOp) UpdateUser ¶ added in v1.4.5
func (svc *UserManagementServiceOp) UpdateUser(ctx context.Context, employeeID int, req *UpdateUserRequest) error
type UserPosition ¶ added in v1.4.5
type UserPosition string
const ( // USER_POSITION_COMPANY_ADMIN represents a Company Admin user. // Company Admin users have access to all user privileges. // We recommend limiting the number of Company Admin users to only those who require full access, but defining at least two for redundancy. USER_POSITION_COMPANY_ADMIN UserPosition = "Company Admin" // USER_POSITION_TECHNICAL_ADMIN represents a Technical Admin user. // This role is for technical users who know how to create and approve orders. USER_POSITION_TECHNICAL_ADMIN UserPosition = "Technical Admin" // USER_POSITION_TECHNICAL_CONTACT represents a Technical Contact user. // This role is for technical users who know how to design and modify services but don't have the authority to approve orders. USER_POSITION_TECHNICAL_CONTACT UserPosition = "Technical Contact" // USER_POSITION_FINANCE represents a Finance user. // Finance users should have a financial responsibility within the organization while also understanding the consequences of their actions if they delete or approve services. USER_POSITION_FINANCE UserPosition = "Finance" // USER_POSITION_FINANCIAL_CONTACT represents a Financial Contact user. // This user role is similar to the Finance role without the ability to place and approve orders, delete services, or administer service keys. USER_POSITION_FINANCIAL_CONTACT UserPosition = "Financial Contact" // USER_POSITION_READ_ONLY represents a Read Only user. // Read Only is the most restrictive role. Note that a Read Only user can view service details which you may want to keep secure and private. USER_POSITION_READ_ONLY UserPosition = "Read Only" )
UserPosition constants for known Megaport user roles.
func (UserPosition) IsValid ¶ added in v1.4.5
func (p UserPosition) IsValid() bool
IsValid checks if the UserPosition is one of the valid predefined positions
func (UserPosition) ValidPositions ¶ added in v1.4.5
func (p UserPosition) ValidPositions() string
ValidPositions returns a string listing all valid UserPosition values
type VLLConfig ¶
type VLLConfig struct {
AEndVLAN int `json:"a_vlan"`
BEndVLAN int `json:"b_vlan"`
Description string `json:"description"`
ID int `json:"id"`
Name string `json:"name"`
RateLimitMBPS int `json:"rate_limit_mbps"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Shutdown bool `json:"shutdown"`
// contains filtered or unexported fields
}
VLLConfig represents the configuration of a VLL.
func (*VLLConfig) UnmarshalJSON ¶ added in v1.0.10
we need to have a custom unmarshal function because the API returns an "[]" (empty array) when the VXC is decommissioned, which will break the regular unmarhsal.
type VXC ¶
type VXC struct {
ID int `json:"productId"`
UID string `json:"productUid"`
ServiceID int `json:"nServiceId"`
Name string `json:"productName"`
Type string `json:"productType"`
RateLimit int `json:"rateLimit"`
DistanceBand string `json:"distanceBand"`
ProvisioningStatus string `json:"provisioningStatus"`
AEndConfiguration VXCEndConfiguration `json:"aEnd"`
BEndConfiguration VXCEndConfiguration `json:"bEnd"`
SecondaryName string `json:"secondaryName"`
UsageAlgorithm string `json:"usageAlgorithm"`
CreatedBy string `json:"createdBy"`
LiveDate *Time `json:"liveDate"`
CreateDate *Time `json:"createDate"`
Resources *VXCResources `json:"resources"`
VXCApproval *VXCApproval `json:"vxcApproval"`
Shutdown bool `json:"shutdown"`
ContractStartDate *Time `json:"contractStartDate"`
ContractEndDate *Time `json:"contractEndDate"`
ContractTermMonths int `json:"contractTermMonths"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
CostCentre string `json:"costCentre"`
Locked bool `json:"locked"`
AdminLocked bool `json:"adminLocked"`
AttributeTags map[string]string `json:"attributeTags"`
Cancelable bool `json:"cancelable"`
}
VXC represents a Virtual Cross Connect in the Megaport VXC API.
type VXCApproval ¶
type VXCApproval struct {
Status string `json:"status"`
Message string `json:"message"`
UID string `json:"uid"`
Type string `json:"type"`
NewSpeed int `json:"newSpeed"`
}
VXCApproval represents the approval status of a VXC.
type VXCEndConfiguration ¶
type VXCEndConfiguration struct {
OwnerUID string `json:"ownerUid"`
UID string `json:"productUid"`
Name string `json:"productName"`
LocationID int `json:"locationId"`
Location string `json:"location"`
VLAN int `json:"vlan"`
InnerVLAN int `json:"innerVlan"`
NetworkInterfaceIndex int `json:"vNicIndex"`
SecondaryName string `json:"secondaryName"`
LocationDetails *ProductLocationDetails `json:"locationDetail"`
}
VXCEndConfiguration represents the configuration of an endpoint of a VXC.
type VXCOrder ¶
type VXCOrder struct {
AssociatedVXCs []VXCOrderConfiguration `json:"associatedVxcs"`
PortID string `json:"productUid"`
}
VXCOrder represents the request to order a VXC from the Megaport Products API.
type VXCOrderAEndPartnerConfig
deprecated
type VXCOrderAEndPartnerConfig struct {
VXCPartnerConfiguration `json:"-"`
Interfaces []PartnerConfigInterface `json:"interfaces,omitempty"`
}
VXCOrderAEndPartnerConfig represents the configuration of a VXC A-End partner.
Deprecated: Use VXCOrderVrouterPartnerConfig instead.
type VXCOrderConfiguration ¶
type VXCOrderConfiguration struct {
Name string `json:"productName"`
ServiceKey string `json:"serviceKey,omitempty"`
PromoCode string `json:"promoCode,omitempty"`
RateLimit int `json:"rateLimit"`
Term int `json:"term"`
Shutdown bool `json:"shutdown"`
CostCentre string `json:"costCentre,omitempty"`
AEnd VXCOrderEndpointConfiguration `json:"aEnd"`
BEnd VXCOrderEndpointConfiguration `json:"bEnd"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
}
VXCOrderConfiguration represents the configuration of a VXC to be ordered from the Megaport Products API.
type VXCOrderConfirmation ¶
type VXCOrderConfirmation struct {
TechnicalServiceUID string `json:"vxcJTechnicalServiceUid"`
}
VXCOrderConfirmation represents the confirmation of a VXC order from the Megaport Products API.
type VXCOrderEndpointConfiguration ¶
type VXCOrderEndpointConfiguration struct {
ProductUID string `json:"productUid,omitempty"`
VLAN int `json:"vlan,omitempty"`
DiversityZone string `json:"diversityZone,omitempty"`
PartnerConfig VXCPartnerConfiguration `json:"partnerConfig,omitempty"`
*VXCOrderMVEConfig
}
VXCOrderEndpointConfiguration represents the configuration of an endpoint of a VXC to be ordered from the Megaport Products API.
type VXCOrderMVEConfig ¶
type VXCOrderMVEConfig struct {
InnerVLAN int `json:"innerVlan,omitempty"`
NetworkInterfaceIndex int `json:"vNicIndex"`
}
VXCOrderMVEConfig represents the configuration of a VXC endpoint for MVE.
type VXCOrderVrouterPartnerConfig ¶ added in v1.0.9
type VXCOrderVrouterPartnerConfig struct {
VXCPartnerConfiguration `json:"-"`
Interfaces []PartnerConfigInterface `json:"interfaces,omitempty"`
}
VXCOrderVrouterPartnerConfig represents the configuration of a VXC Vrouter Configuration partner.
type VXCPartnerConfigAWS ¶
type VXCPartnerConfigAWS struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
Type string `json:"type"`
OwnerAccount string `json:"ownerAccount"`
ASN int `json:"asn,omitempty"`
AmazonASN int `json:"amazonAsn,omitempty"`
AuthKey string `json:"authKey,omitempty"`
Prefixes string `json:"prefixes,omitempty"`
CustomerIPAddress string `json:"customerIpAddress,omitempty"`
AmazonIPAddress string `json:"amazonIpAddress,omitempty"`
ConnectionName string `json:"name,omitempty"`
}
VXCPartnerConfigAWS represents the configuration of a VXC partner for AWS Virtual Interface.
type VXCPartnerConfigAzure ¶
type VXCPartnerConfigAzure struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
ServiceKey string `json:"serviceKey"`
Peers []PartnerOrderAzurePeeringConfig `json:"peers"`
}
VXCPartnerConfigAzure represents the configuration of a VXC partner for Azure ExpressRoute.
type VXCPartnerConfigGoogle ¶
type VXCPartnerConfigGoogle struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
PairingKey string `json:"pairingKey"`
}
VXCPartnerConfigGoogle represents the configuration of a VXC partner for Google Cloud Interconnect.
type VXCPartnerConfigIBM ¶ added in v1.2.3
type VXCPartnerConfigIBM struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
AccountID string `json:"account_id"` // Customer's IBM Acount ID. 32 Hexadecimal Characters. REQUIRED
CustomerASN int `json:"customer_asn"` // Customer's ASN. Valid ranges: 1-64495, 64999, 131072-4199999999, 4201000000-4201064511. Required unless the connection at the other end of the VXC is an MCR.
Name string `json:"name"` // Description of this connection for identification purposes. Max 100 characters from 0-9 a-z A-Z / - _ , Defaults to "MEGAPORT".
CustomerIPAddress string `json:"customer_ip_address"` // IPv4 network address including subnet mask. Default is /30 assigned from 169.254.0.0/16.
ProviderIPAddress string `json:"provider_ip_address"` // IPv4 network address including subnet mask. Default is /30 assigned from 169.254.0.0/16. Must be in the same subnet as customer_ip_address.
}
VXCPartnerConfigIBM represents the configuration of a VXC partner for IBM Cloud Direct Link.
type VXCPartnerConfigOracle ¶
type VXCPartnerConfigOracle struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
VirtualCircuitId string `json:"virtualCircuitId"`
}
VXCPartnerConfigOracle represents the configuration of a VXC partner for Oracle Cloud Infrastructure FastConnect.
type VXCPartnerConfigTransit ¶ added in v1.0.4
type VXCPartnerConfigTransit struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
}
type VXCPartnerConfiguration ¶
type VXCPartnerConfiguration interface {
IsParnerConfiguration()
}
VXCPartnerConfiguration represents the configuration of a VXC partner.
type VXCPriceBookRequest ¶ added in v1.12.0
type VXCPriceBookRequest struct {
Currency string `json:"currency,omitempty"`
ALocationID int `json:"aLocationId"`
BLocationID int `json:"bLocationId"`
Speed int `json:"speed"`
AEndProductType string `json:"aEndProductType,omitempty"`
ConnectType string `json:"connectType,omitempty"`
Term int `json:"term,omitempty"`
ProductUID string `json:"productUid,omitempty"`
BuyoutPort bool `json:"buyoutPort,omitempty"`
AddOns []*ProductAddOnPriceBookRequest `json:"addOns,omitempty"`
}
VXCPriceBookRequest is a pricing request for a VXC.
type VXCResources ¶
type VXCResources struct {
Interface []*PortInterface `json:"interface"`
VirtualRouter *VirtualRouter `json:"virtual_router"`
CSPConnection *CSPConnection `json:"csp_connection"`
VLL *VLLConfig `json:"vll"`
}
VXCResources represents the resources associated with a VXC.
func (*VXCResources) UnmarshalJSON ¶ added in v1.0.10
func (w *VXCResources) UnmarshalJSON(data []byte) error
we need to have a custom unmarshal function because the API returns an "[]" (empty array) for vll when the VXC is decommissioned, which will break the regular unmarhsal.
type VXCService ¶
type VXCService interface {
// BuyVXC buys a VXC from the Megaport VXC API.
BuyVXC(ctx context.Context, req *BuyVXCRequest) (*BuyVXCResponse, error)
// ValidateVXCOrder validates a VXC order in the Megaport Products API.
ValidateVXCOrder(ctx context.Context, req *BuyVXCRequest) error
// ListVXCs lists all VXCs in the Megaport VXC API.
ListVXCs(ctx context.Context, req *ListVXCsRequest) ([]*VXC, error)
// GetVXC gets details about a single VXC from the Megaport VXC API.
GetVXC(ctx context.Context, id string) (*VXC, error)
// DeleteVXC deletes a VXC in the Megaport VXC API.
DeleteVXC(ctx context.Context, id string, req *DeleteVXCRequest) error
// UpdateVXC updates a VXC in the Megaport VXC API.
UpdateVXC(ctx context.Context, id string, req *UpdateVXCRequest) (*VXC, error)
// LookupPartnerPorts looks up available partner ports in the Megaport VXC API.
LookupPartnerPorts(ctx context.Context, req *LookupPartnerPortsRequest) (*LookupPartnerPortsResponse, error)
// ListPartnerPorts lists available partner ports in the Megaport VXC API.
ListPartnerPorts(ctx context.Context, req *ListPartnerPortsRequest) (*ListPartnerPortsResponse, error)
// ListVXCResourceTags lists the resource tags for a VXC in the Megaport Products API.
ListVXCResourceTags(ctx context.Context, vxcID string) (map[string]string, error)
// UpdateVXCResourceTags updates the resource tags for a VXC in the Megaport Products API.
UpdateVXCResourceTags(ctx context.Context, vxcID string, tags map[string]string) error
}
VXCService is an interface for interfacing with the VXC endpoints in the Megaport VXC API.
type VXCServiceOp ¶
type VXCServiceOp struct {
Client *Client
}
VXCServiceOp handles communication with the VXC related methods of the Megaport API.
func NewVXCService ¶
func NewVXCService(c *Client) *VXCServiceOp
NewVXCService creates a new instance of the VXC Service.
func (*VXCServiceOp) BuyVXC ¶
func (svc *VXCServiceOp) BuyVXC(ctx context.Context, req *BuyVXCRequest) (*BuyVXCResponse, error)
BuyVXC buys a VXC from the Megaport VXC API.
func (*VXCServiceOp) DeleteVXC ¶
func (svc *VXCServiceOp) DeleteVXC(ctx context.Context, id string, req *DeleteVXCRequest) error
DeleteVXC deletes a VXC in the Megaport VXC API. Note: Transit VXCs (Megaport Internet) only support immediate deletion (CANCEL_NOW). Attempting to schedule deletion (DeleteNow=false) for Transit VXCs will return an error. When DeleteNow is false, an additional GetVXC call is made to check for Transit VXC status.
func (*VXCServiceOp) ListPartnerPorts ¶ added in v1.0.11
func (svc *VXCServiceOp) ListPartnerPorts(ctx context.Context, req *ListPartnerPortsRequest) (*ListPartnerPortsResponse, error)
ListPartnerPorts lists available partner ports in the Megaport VXC API.
func (*VXCServiceOp) ListVXCResourceTags ¶ added in v1.2.5
func (svc *VXCServiceOp) ListVXCResourceTags(ctx context.Context, vxcID string) (map[string]string, error)
ListVXCResourceTags lists the resource tags for a VXC in the Megaport Products API.
func (*VXCServiceOp) ListVXCs ¶ added in v1.3.8
func (svc *VXCServiceOp) ListVXCs(ctx context.Context, req *ListVXCsRequest) ([]*VXC, error)
ListVXCs lists all VXCs in the Megaport VXC API.
func (*VXCServiceOp) LookupPartnerPorts ¶
func (svc *VXCServiceOp) LookupPartnerPorts(ctx context.Context, req *LookupPartnerPortsRequest) (*LookupPartnerPortsResponse, error)
LookupPartnerPorts looks up available partner ports in the Megaport VXC API.
func (*VXCServiceOp) UpdateVXC ¶
func (svc *VXCServiceOp) UpdateVXC(ctx context.Context, id string, req *UpdateVXCRequest) (*VXC, error)
UpdateVXC updates a VXC in the Megaport VXC API.
func (*VXCServiceOp) UpdateVXCResourceTags ¶ added in v1.2.5
func (svc *VXCServiceOp) UpdateVXCResourceTags(ctx context.Context, vxcID string, tags map[string]string) error
UpdateVXCResourceTags updates the resource tags for a VXC in the Megaport Products API.
func (*VXCServiceOp) ValidateVXCOrder ¶ added in v1.0.15
func (svc *VXCServiceOp) ValidateVXCOrder(ctx context.Context, req *BuyVXCRequest) error
ValidateVXCOrder validates a VXC order in the Megaport VXC API.
type VXCUpdate ¶
type VXCUpdate struct {
Name string `json:"name,omitempty"`
RateLimit *int `json:"rateLimit,omitempty"` // A new speed for the connection in MBPS.
CostCentre *string `json:"costCentre,omitempty"` // A customer reference number to be included in billing information and invoices. Also known as the Service Level Reference (SLR).
Shutdown *bool `json:"shutdown,omitempty"` // Temporarily shut down and re-enable the VXC. Valid values are true (shut down) and false (enabled). If not provided, it defaults to false (enabled).
AEndVLAN *int `json:"aEndVlan,omitempty"`
BEndVLAN *int `json:"bEndVlan,omitempty"`
AEndInnerVLAN *int `json:"aEndInnerVlan,omitempty"`
BEndInnerVLAN *int `json:"bEndInnerVlan,omitempty"`
AEndProductUID string `json:"aEndProductUid,omitempty"` // When moving a VXC, this is the new A-End for the connection.
BEndProductUID string `json:"bEndProductUid,omitempty"` // When moving a VXC, this is the new B-End for the connection.
Term *int `json:"term,omitempty"`
IsApproved *bool `json:"isApproved,omitempty"` // Define whether the VXC is approved or rejected via the Megaport Marketplace. Set to true (Approved) or false (Rejected).
AVnicIndex *int `json:"aVnicIndex,omitempty"` // When moving a VXC for an MVE, this is the new A-End vNIC for the connection.
BVnicIndex *int `json:"bVnicIndex,omitempty"` // When moving a VXC for an MVE, this is the new B-End vNIC for the connection.
AEndPartnerConfig VXCPartnerConfiguration `json:"aEndConfig,omitempty"`
BEndPartnerConfig VXCPartnerConfiguration `json:"bEndConfig,omitempty"`
}
VXCUpdate represents the fields that can be updated on a VXC.
type ValidFor ¶ added in v1.0.3
type ValidFor struct {
StartTime *Time `json:"start"` // Parsed for Megaport API
EndTime *Time `json:"end"` // Parsed for Megaport API
}
ValidFor represents the valid times for the service key
type VendorConfig ¶
type VendorConfig interface {
IsVendorConfig()
}
VendorConfig is an interface for MVE vendor configuration.
type VersaConfig ¶
type VersaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
DirectorAddress string `json:"directorAddress,omitempty"`
ControllerAddress string `json:"controllerAddress,omitempty"`
LocalAuth string `json:"localAuth,omitempty"`
RemoteAuth string `json:"remoteAuth,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
}
VersaConfig represents the configuration for a Versa MVE.
type VirtualRouter ¶
type VirtualRouter struct {
MCRAsn int `json:"mcrAsn"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Speed int `json:"speed"`
BGPShutdownDefault bool `json:"bgpShutdownDefault"`
}
VirtualRouter represents the configuration of a virtual router.
type VmwareConfig ¶
type VmwareConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
VcoAddress string `json:"vcoAddress,omitempty"`
VcoActivationCode string `json:"vcoActivationCode,omitempty"`
}
VmwareConfig represents the configuration for a VMware MVE.
Source Files
¶
- billing_markets.go
- client.go
- company_types.go
- errors.go
- events.go
- ix.go
- ix_types.go
- location.go
- location_legacy.go
- managed_account.go
- mcr.go
- mcr_looking_glass.go
- mcr_looking_glass_types.go
- mcr_types.go
- megaport.go
- mve.go
- mve_types.go
- nat_gateway.go
- nat_gateway_diagnostics.go
- nat_gateway_packet_filters.go
- nat_gateway_prefix_lists.go
- nat_gateway_types.go
- nat_gateway_validation.go
- order_approvals.go
- partner.go
- partner_types.go
- port.go
- port_types.go
- pricing_types.go
- product.go
- service_keys.go
- shared_types.go
- user_management.go
- user_management_types.go
- vxc.go
- vxc_types.go