megaport / megaportgo Goto Github PK
View Code? Open in Web Editor NEWGo library for integrating with the Megaport API
License: Mozilla Public License 2.0
Go library for integrating with the Megaport API
License: Mozilla Public License 2.0
Will this library be extended to include support for other non-terraform related APIs such as telemetry or log data?
I was interested in finding (or writing) a megaport exporter for Prometheus and was hoping that the library exposed those API methods.
It looks like X-Auth token support, used by the current megaportgo (and terraform provider), will be disabled on September 30 2023.
Is there a plan to implement oauth2 before then?
When provisioning a VXC circuit for Azure we regularly encounter timeouts requiring us to re-run our automation before it is completely provisioned. We would like the ability to specify a longer timeout than the hard-coded 15 minutes.
I'd propose adding a second function that accepts a context.Context
that can be configured by the caller for an arbitrary timeout based on the caller's needs. I've also added a pollFrequency
to specify how frequently it queries for the VxcDetails, currently hard-coded to 30 seconds.
func (v *VXC) WaitForVXCProvisioningCtx(ctx context.Context, pollFrequency time.Duration, vxcId string) (bool, error) { ...}
and
func (v *VXC) WaitForVXCUpdatedCtx(
ctx context.Context, pollFrequency time.Duration, id string, name string, rateLimit int, aEndVLAN int, bEndVLAN int,
) (bool, error) { ... }
The existing functions can be modified to simply create a context with a 15 minute timeout and call the new functions, preserving the API and current behavior for existing users.
// WaitForVXCProvisioning waits up to 15 minutes for the VXC to reach the "LIVE" status.
// See WaitForVXCProvisioningCtx
func (v *VXC) WaitForVXCProvisioning(vxcId string) (bool, error) {
ctx, cancelFunc := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancelFunc()
return v.WaitForVXCProvisioningCtx(ctx, 30*time.Second, vxcId)
}
PR to follow.
A corresponding change will be proposed for the terraform-provider-megaport
project to call the new APIs.
It would be nice to be able to get the list of ports with a simple function call.
Will submit a pair of PRs here shortly to add this functionality.
This is a required change to support a feature enhancement for this issue on the terraform provider: megaport/terraform-provider-megaport#4
Currently, megaportgo picks the first location in the returned list and there is no way to specify the interconnect port location.
vxc.go
depends on github.com/hashicorp/terraform-plugin-sdk/helper/schema
for reasons which are not clear to me.
I propose moving the MarshallMcrAEndConfig
function to the downstream project terraform-provider-megaport.
I have written a couple of fairly trivial patches to both projects to make this happen.
Will submit PRs shortly. If this is undesirable for some reason please let me know.
Removing the dependency on terraform was not simply an aesthetic issue for me. I am in the process of generating a pulumi module from the megaport terraform module. Conflicting versions of terraform were causing difficulty for me and correcting them was made more difficult by the fact that this project also depends on terraform.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.