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 PtrTo[T any](v T) *T
- type APIMCRPrefixFilterList
- type APIMCRPrefixFilterListEntry
- type APIMCRPrefixFilterListResponse
- type AWSVXCOrder
- type AWSVXCOrderConfiguration
- type AccessTokenResponse
- type ArubaConfig
- type AssociatedIXOrder
- type AuthInfo
- type AviatrixConfig
- type BfdConfig
- type BgpConnectionConfig
- 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 interface{}) (*http.Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) SetOnRequestCompleted(rc RequestCompletionCallback)
- type ClientOpt
- func WithBaseURL(bu 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 WithUserAgent(ua string) ClientOpt
- type CompanyEnablement
- type Country
- type CountryInnerResponse
- type CountryResponse
- type CreateMCRPrefixFilterListAPIResponse
- type CreateMCRPrefixFilterListRequest
- type CreateMCRPrefixFilterListResponse
- type CreateServiceKeyAPIResponse
- type CreateServiceKeyAPIResponseData
- type CreateServiceKeyRequest
- type CreateServiceKeyResponse
- type DeleteIXRequest
- type DeleteMCRPrefixFilterListResponse
- type DeleteMCRRequest
- type DeleteMCRResponse
- type DeleteMVERequest
- type DeleteMVEResponse
- type DeletePortRequest
- type DeletePortResponse
- type DeleteProductRequest
- type DeleteProductResponse
- type DeleteVXCRequest
- type DeleteVXCResponse
- type Environment
- type ErrorResponse
- type FortinetConfig
- type GetPortRequest
- type GetServiceKeyAPIResponse
- type IX
- type IXBGPConnection
- type IXIPAddress
- type IXInterface
- type IXLocationDetail
- type IXOrder
- type IXResources
- type IXResponse
- 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) 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 ListMCRPrefixFilterListResponse
- type ListPartnerPortsRequest
- type ListPartnerPortsResponse
- type ListServiceKeysAPIResponse
- type ListServiceKeysRequest
- type ListServiceKeysResponse
- type Location
- type LocationMVE
- type LocationMVEDetails
- type LocationProducts
- type LocationResponse
- type LocationService
- type LocationServiceOp
- func (svc *LocationServiceOp) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error)
- func (svc *LocationServiceOp) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*Location) []*Location
- func (svc *LocationServiceOp) GetLocationByID(ctx context.Context, locationID int) (*Location, error)
- func (svc *LocationServiceOp) GetLocationByName(ctx context.Context, locationName string) (*Location, error)
- func (svc *LocationServiceOp) GetLocationByNameFuzzy(ctx context.Context, search string) ([]*Location, 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)
- func (svc *LocationServiceOp) ListMarketCodes(ctx context.Context) ([]string, error)
- type LockPortRequest
- type LockPortResponse
- type LookupPartnerPortsRequest
- type LookupPartnerPortsResponse
- type MCR
- type MCROrder
- type MCROrderConfig
- type MCROrderConfirmation
- type MCROrderResponse
- type MCRPrefixFilterList
- type MCRPrefixListEntry
- type MCRResources
- type MCRResponse
- 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)
- 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) 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) UpdateMCRResourceTags(ctx context.Context, mcrID string, tags map[string]string) error
- func (svc *MCRServiceOp) ValidateMCROrder(ctx context.Context, req *BuyMCRRequest) error
- type MCRVirtualRouter
- type MVE
- type MVEConfig
- type MVEImage
- type MVEImageAPIResponse
- type MVEImageAPIResponseData
- type MVEInstanceSize
- type MVENetworkInterface
- type MVEOrderConfig
- type MVEOrderConfirmation
- type MVEOrderResponse
- type MVEResources
- type MVEResponse
- 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) 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 MVESizeAPIResponse
- type MVEVirtualMachine
- type MVEVirtualMachineImage
- type ManageProductLockRequest
- type ManageProductLockResponse
- type ManagedAccount
- type ManagedAccountAPIResponse
- type ManagedAccountListAPIResponse
- 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 MerakiConfig
- type ModifyMCRPrefixFilterListResponse
- type ModifyMCRRequest
- type ModifyMCRResponse
- type ModifyMVERequest
- type ModifyMVEResponse
- type ModifyPortRequest
- type ModifyPortResponse
- type ModifyProductRequest
- type ModifyProductResponse
- type OrderValidFor
- type PaloAltoConfig
- type ParsedProductsResponse
- type PartnerConfigInterface
- type PartnerLookup
- type PartnerLookupItem
- type PartnerLookupResponse
- type PartnerMegaport
- type PartnerMegaportResponse
- 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) 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 PrismaConfig
- 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) ListProductResourceTags(ctx context.Context, productUID string) ([]ResourceTag, 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 ResourceTagsResponse
- type ResourceTagsResponseData
- type RestoreMCRResponse
- type RestorePortRequest
- type RestorePortResponse
- type RestoreProductRequest
- type RestoreProductResponse
- 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 SixwindVSRConfig
- type Time
- type UnlockPortRequest
- type UnlockPortResponse
- type UpdateIXRequest
- type UpdateProductResourceTagsRequest
- type UpdateServiceKeyRequest
- type UpdateServiceKeyResponse
- type UpdateVXCRequest
- type UpdateVXCResponse
- type VLLConfig
- type VXC
- type VXCApproval
- type VXCEndConfiguration
- type VXCOrder
- type VXCOrderAEndPartnerConfig
- type VXCOrderConfiguration
- type VXCOrderConfirmation
- type VXCOrderEndpointConfiguration
- type VXCOrderMVEConfig
- type VXCOrderResponse
- type VXCOrderVrouterPartnerConfig
- type VXCPartnerConfigAWS
- type VXCPartnerConfigAzure
- type VXCPartnerConfigGoogle
- type VXCPartnerConfigIBM
- type VXCPartnerConfigOracle
- type VXCPartnerConfigTransit
- type VXCPartnerConfiguration
- type VXCResources
- type VXCResponse
- 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) 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 ( SERVICE_CONFIGURED = "CONFIGURED" // The CONFIGURED service state. SERVICE_LIVE = "LIVE" // The LIVE service state. // Product types PRODUCT_MEGAPORT = "megaport" PRODUCT_VXC = "vxc" PRODUCT_MCR = "mcr2" PRODUCT_MVE = "mve" PRODUCT_IX = "ix" // 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" )
const PARTNER_AWS string = "AWS"
const PARTNER_AZURE string = "AZURE"
Partner Providers
const PARTNER_GOOGLE string = "GOOGLE"
const PARTNER_OCI string = "ORACLE"
Variables ¶
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 ErrInvalidTerm = errors.New("invalid term, valid values are 1, 12, 24, and 36")
ErrInvalidTerm is returned for an invalid product term
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 ErrLocationNotFound = errors.New("unable to find location")
ErrLocationNotFound is returned when a location can't be found
var ErrMCRInvalidPortSpeed = errors.New("invalid port speed, valid speeds are 1000, 2500, 5000, and 10000")
ErrMCRInvalidPortSpeed is returned for an invalid MCR port speed
var ErrManagedAccountNotFound = errors.New("managed account not found")
ErrManagedAccountNotFound is returned when a managed account can't be found
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 ErrPortAlreadyLocked = errors.New("that port is already locked, cannot lock")
ErrPortAlreadyLocked is returned when a port is already locked
var ErrPortNotLocked = errors.New("that port not locked, cannot unlock")
ErrPortNotLocked is returned when a port is not locked
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 ( // SERVICE_STATE_READY is a list of service states that are considered ready for use. SERVICE_STATE_READY = []string{SERVICE_CONFIGURED, SERVICE_LIVE} )
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.
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 APIMCRPrefixFilterListResponse ¶ added in v1.0.6
type APIMCRPrefixFilterListResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *APIMCRPrefixFilterList `json:"data"` }
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 AccessTokenResponse ¶
type AccessTokenResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token,omitempty"` Error string `json:"error"` }
AccessTokenResponse is the response structure for the Login method containing the access token and expiration time.
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"` AccountKey string `json:"accountKey"` SystemTag string `json:"systemTag"` }
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 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"` CloudInit string `json:"cloudInit"` }
AviatrixConfig represents the configuration for an Aviatrix Secure Edge MVE.
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 }
BgpConnectionConfig represents the configuration of a BGP connection.
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 ResourceTags map[string]string `json:"resourceTags,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) }
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"` AdminSSHPublicKey string `json:"adminSshPublicKey"` SSHPublicKey string `json:"sshPublicKey"` CloudInit string `json:"cloudInit"` FMCIPAddress string `json:"fmcIpAddress"` FMCRegistrationKey string `json:"fmcRegistrationKey"` FMCNatID string `json:"fmcNatId"` }
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 // ManagedAccountService provides methods for interacting with the Managed Accounts API ManagedAccountService ManagedAccountService // IXService provides methods for interacting with the IX API IXService IXService 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.
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 interface{}) (*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) SetOnRequestCompleted ¶
func (c *Client) SetOnRequestCompleted(rc RequestCompletionCallback)
SetOnRequestCompleted sets the Megaport API request completion callback
type ClientOpt ¶
ClientOpt are options for New.
func WithBaseURL ¶
WithBaseURL is a client option for setting the base URL.
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 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 CountryInnerResponse ¶
type CountryInnerResponse struct { Countries []*Country `json:"countries"` NetworkRegion string `json:"networkRegion"` }
CountriesInnerResponse represents the inner response from the Megaport Network Regions API.
type CountryResponse ¶
type CountryResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*CountryInnerResponse `json:"data"` }
CountryResponse represents the response from the Megaport Network Regions API.
type CreateMCRPrefixFilterListAPIResponse ¶ added in v1.0.3
type CreateMCRPrefixFilterListAPIResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *APIMCRPrefixFilterList `json:"data"` }
CreateMCRPrefixFilterListResponse represents a response from the Megaport MCR API after creating a prefix filter list.
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 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 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 ¶
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
}
DeleteMVERequest represents a request to delete an MVE
type DeleteMVEResponse ¶
type DeleteMVEResponse struct {
IsDeleted bool
}
DeleteMVEResponse represents a response from deleting an MVE
type DeletePortRequest ¶
DeletePortRequest represents a request to delete a port.
type DeletePortResponse ¶
type DeletePortResponse struct {
IsDeleting bool
}
DeletePortResponse represents a response from deleting a port.
type DeleteProductRequest ¶
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 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 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"` SSHPublicKey string `json:"sshPublicKey"` LicenseData string `json:"licenseData"` }
FortinetConfig represents the configuration for a Fortinet MVE.
type GetPortRequest ¶
type GetPortRequest struct {
PortID string
}
GetPortRequest represents a request to get a port.
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 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 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 IXResponse ¶ added in v1.3.2
type IXResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data IX `json:"data"` }
IXResponse represents a response from the Megaport IX API after querying 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 }
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) 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 ListMCRPrefixFilterListResponse ¶ added in v1.0.6
type ListMCRPrefixFilterListResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*PrefixFilterList `json:"data"` }
ListMCRPrefixFilterListResponse represents a response from the Megaport MCR API after querying an MCR's prefix filter list.
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 Location ¶
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.
type LocationMVE ¶
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.
type LocationMVEDetails ¶
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.
type LocationProducts ¶
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 represent the products available at a location in the Megaport API.
type LocationResponse ¶
type LocationResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*Location `json:"data"` }
LocationsResponse represents the response from the Megaport Locations API.
type LocationService ¶
type LocationService interface { // ListLocations returns a list of all locations in the Megaport Locations API. ListLocations(ctx context.Context) ([]*Location, error) // GetLocationByID returns a location by its ID in the Megaport Locations API. GetLocationByID(ctx context.Context, locationID int) (*Location, error) // GetLocationByName returns a location by its name in the Megaport Locations API. GetLocationByName(ctx context.Context, locationName string) (*Location, error) // GetLocationByNameFuzzy returns a location by its name in the Megaport Locations API using fuzzy search. GetLocationByNameFuzzy(ctx context.Context, search string) ([]*Location, error) // 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) // FilterLocationsByMarketCode filters locations by market code in the Megaport Locations API. FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error) // FilterLocationsByMcrAvailability filters locations by MCR availability in the Megaport Locations API. 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 ¶
func (svc *LocationServiceOp) FilterLocationsByMarketCode(ctx context.Context, marketCode string, locations []*Location) ([]*Location, error)
FilterLocationsByMarketCode filters locations by market code in the Megaport Locations API.
func (*LocationServiceOp) FilterLocationsByMcrAvailability ¶
func (svc *LocationServiceOp) FilterLocationsByMcrAvailability(ctx context.Context, mcrAvailable bool, locations []*Location) []*Location
FilterLocationsByMcrAvailability filters locations by MCR availability in the Megaport Locations API.
func (*LocationServiceOp) GetLocationByID ¶
func (svc *LocationServiceOp) GetLocationByID(ctx context.Context, locationID int) (*Location, error)
GetLocationByID returns a location by its ID in the Megaport Locations API.
func (*LocationServiceOp) GetLocationByName ¶
func (svc *LocationServiceOp) GetLocationByName(ctx context.Context, locationName string) (*Location, error)
GetLocationByName returns a location by its name in the Megaport Locations API.
func (*LocationServiceOp) GetLocationByNameFuzzy ¶
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.
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 ¶
func (svc *LocationServiceOp) ListLocations(ctx context.Context) ([]*Location, error)
ListLocations returns a list of all locations in the Megaport Locations API.
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 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 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"` LocationDetails *ProductLocationDetails `json:"locationDetail"` }
MCR represents a Megaport Cloud Router in the Megaport MCR API.
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"` Config MCROrderConfig `json:"config"` 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 MCROrderResponse ¶
type MCROrderResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*MCROrderConfirmation `json:"data"` }
MCROrdersResponse represents a response from the Megaport Products API after ordering 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 MCRResources ¶
type MCRResources struct { Interface PortInterface `json:"interface"` VirtualRouter MCRVirtualRouter `json:"virtual_router"` }
MCRResources represents the resources associated with an MCR.
type MCRResponse ¶
type MCRResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *MCR `json:"data"` }
MCRResponse represents a response from the Megaport MCR API after querying 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 // 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 // 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.
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 ¶
func (svc *MCRServiceOp) GetMCRPrefixFilterLists(ctx context.Context, mcrId string) ([]*PrefixFilterList, error)
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) 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) 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) ValidateMCROrder ¶ added in v1.0.15
func (svc *MCRServiceOp) ValidateMCROrder(ctx context.Context, req *BuyMCRRequest) error
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"` ResourceTags []map[string]string `json:"resourceTags,omitempty"` }
MVE represents a Megaport Virtual Edge from the Megaport MVE API.
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"` Vendor string `json:"vendor"` VendorDescription string `json:"vendorDescription"` ReleaseImage bool `json:"releaseImage"` ProductCode string `json:"productCode"` }
MVEImage represents details for an MVE image, including image ID, version, product, and vendor.
type MVEImageAPIResponse ¶ 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.
type MVEImageAPIResponseData ¶ added in v1.0.3
type MVEImageAPIResponseData struct {
Images []*MVEImage `json:"mveImages"`
}
MVEImageAPIResponseData represents the data in an MVE image response.
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 MVEOrderResponse ¶
type MVEOrderResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*MVEOrderConfirmation `json:"data"` }
MVEOrderResponse represents the response to an MVE order request.
type MVEResources ¶
type MVEResources struct { Interface *PortInterface `json:"interface"` VirtualMachines []*MVEVirtualMachine `json:"virtual_machine"` }
MVEResources represents the resources associated with an MVE.
type MVEResponse ¶
type MVEResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *MVE `json:"data"` }
MVEResponse represents the response to an MVE request.
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 // 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.
func (*MVEServiceOp) ListMVEResourceTags ¶ added in v1.2.5
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 MVESizeAPIResponse ¶ added in v1.0.3
type MVESizeAPIResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*MVESize `json:"data"` }
MVESizeAPIResponse represents the response to an MVE size request, returning a list of currently available MVE sizes and details for each size.
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 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 ManagedAccountAPIResponse ¶ added in v1.2.3
type ManagedAccountAPIResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *ManagedAccount `json:"data"` }
type ManagedAccountListAPIResponse ¶ added in v1.2.3
type ManagedAccountListAPIResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*ManagedAccount `json:"data"` }
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 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"` }
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 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) }
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 *bool CostCentre string ContractTermMonths *int // Contract term in months WaitForUpdate bool // Wait until the MCVEupdates 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,omitempty"` MarketplaceVisibility *bool `json:"marketplaceVisibility,omitempty"` ContractTermMonths int `json:"term,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 OrderValidFor ¶ added in v1.0.3
OrderValidFor represents the ValidFor input with the Megaport API using integer values
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"` LicenseData string `json:"licenseData,omitempty"` }
PaloAltoConfig represents the configuration for a Palo Alto MVE.
type ParsedProductsResponse ¶
type ParsedProductsResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []interface{} `json:"data"` }
ParsedProductsResponse represents a response from the Megaport Products API prior to parsing the response.
type PartnerConfigInterface ¶
type PartnerConfigInterface struct { 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"` }
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 PartnerLookupResponse ¶
type PartnerLookupResponse struct { Message string `json:"message"` Data PartnerLookup `json:"data"` Terms string `json:"terms"` }
PartnerLookupResponse represents a response from the Megaport API after looking up a Partner Megaport.
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 PartnerMegaportResponse ¶
type PartnerMegaportResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []*PartnerMegaport `json:"data"` }
PartnerMegaportResponse represents a response from the Megaport API after querying a Partner Megaport.
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, exactMatch bool) ([]*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, exactMatch bool) ([]*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) 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 }
Port represents a Megaport Port in the Megaport Port API.
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. 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.
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)
ListPorts lists all ports in the Megaport Port API.
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 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"` IONKey string `json:"ionKey"` SecretKey string `json:"secretKey"` }
PrismaConfig represents the configuration for a Palo Alto Prisma MVE.
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) // ModifyProduct modifies a product in the Megaport Products API. The available fields to modify are Name, Cost Centre, and Marketplace Visibility. 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 }
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) 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) 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, and Marketplace Visibility.
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 ResourceTagsResponse ¶ added in v1.2.5
type ResourceTagsResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data *ResourceTagsResponseData `json:"data"` }
ResourceTagsResponse represents a response from the Megaport Products API after retrieving the resource tags for a product.
type ResourceTagsResponseData ¶ added in v1.2.5
type ResourceTagsResponseData struct {
ResourceTags []ResourceTag `json:"resourceTags"`
}
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 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 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"` SSHPublicKey string `json:"sshPublicKey"` }
VSRConfig represents the configuration for a 6WIND VSR MVE.
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 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 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 UpdateVXCRequest ¶
type UpdateVXCRequest struct { AEndVLAN *int BEndVLAN *int AEndProductUID *string BEndProductUID *string RateLimit *int Name *string CostCentre *string Term *int Shutdown *bool AEndInnerVLAN *int BEndInnerVLAN *int 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 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 ¶
type VXCOrderAEndPartnerConfig struct { VXCPartnerConfiguration `json:"-"` Interfaces []PartnerConfigInterface `json:"interfaces,omitempty"` }
DEPRECATED - Use VXCOrderVrouterPartnerConfig instead VXCOrderAEndPartnerConfig represents the configuration of a VXC A-End partner.
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 VXCOrderResponse ¶
type VXCOrderResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data []VXCOrderConfirmation `json:"data"` }
VXCOrderResponse represents the response from the VXC Order API.
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 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 VXCResponse ¶
type VXCResponse struct { Message string `json:"message"` Terms string `json:"terms"` Data VXC `json:"data"` }
VXCResponse represents the response from the VXC API.
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 // 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.
func (*VXCServiceOp) ListPartnerPorts ¶ added in v1.0.11
func (svc *VXCServiceOp) ListPartnerPorts(ctx context.Context, req *ListPartnerPortsRequest) (*ListPartnerPortsResponse, error)
LookupPartnerPorts looks up 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) 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"` CostCentre string `json:"costCentre,omitempty"` Shutdown *bool `json:"shutdown,omitempty"` 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"` BEndProductUID string `json:"bEndProductUid,omitempty"` Term *int `json:"term,omitempty"` 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"` ControllerAddress string `json:"controllerAddress"` LocalAuth string `json:"localAuth"` RemoteAuth string `json:"remoteAuth"` SerialNumber string `json:"serialNumber"` }
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"` SSHPublicKey string `json:"sshPublicKey"` VcoAddress string `json:"vcoAddress"` VcoActivationCode string `json:"vcoActivationCode"` }
VmwareConfig represents the configuration for a VMware MVE.