Equinix Network Edge (NE) client library written in Go.
Equinix Network Edge client library was written in Go for purpose of managing NE resources from Terraform provider plugin.
Library gives possibility to manage virtual network devices and associated network services.
NOTE: Scope of this library is limited to needs of Terraform provider plugin and it is not providing full capabilities of Equinix Network Edge API
-
Add ne-go module to import statement. In below example, Equinix
oauth2-go
module is imported as wellimport ( "github.com/equinix/oauth2-go" "github.com/equinix/ne-go" )
-
Define baseURL that will be used in all REST API requests
baseURL := "https://api.equinix.com"
-
Create oAuth configuration and oAuth enabled
http.Client
authConfig := oauth2.Config{ ClientID: "someClientId", ClientSecret: "someSecret", BaseURL: baseURL} ctx := context.Background() authClient := authConfig.New(ctx)
-
Create NE REST client with a given
baseURL
and oauth'shttp.Client
var neClient ne.Client = ne.NewClient(ctx, baseURL, authClient)
-
Use NE client to perform some operation i.e. get device details
device, err := neClient.GetDevice("existingDeviceUUID") if err != nil { log.Printf("Error while fetching device - %v", err) } else { log.Printf("Retrieved device - %+v", device) }