Go programming language SDK (Beta) for VMC. NSX-T and vSphere services will be added soon.
vSphere Automation SDK Beta for GO language.
This document describes the vSphere Automation GO SDK services(client-bindings), that use the vSphere Automation
GO client library. Currently, vSphere Automation Go SDK supports VMC and NSX-T. Support for vSphere(vCenter) will be added soon.
This document will walk you through setting up the SDK to start writing your Sample.
GO111MODULE environment variable is recommended to be set as
auto: if all the Go projects in your development environment are not compatible with Go Modules.
on: if all your projects are compatible with Go Modules.
GOPATH environment variable is required to be set only if “GO111MODULE” is set to “auto”.
Start with creating Go Module by executing the command
go mod init sample
Executing this command will create go.mod file in current directory, as shown below
module sample
go 1.17
Note
You can directly start writing your sample.go file by importing the required Go Modules.
For VMC services import
github.com/vmware/vsphere-automation-sdk-go/services/vmc
For NSX-T services import
github.com/vmware/vsphere-automation-sdk-go/services/nsxt
You can refer to the below code excerpt.
package main
import (
"fmt"
"os"
vmc "github.com/vmware/vsphere-automation-sdk-go/services/vmc"
.
.
.
Note
If you are using IDE to develop and want to use auto-completion, navigation and other such features for fast and easy development, just write all your imports with “_“ (underscore) as alias as shown below
package main
import (
_ "github.com/vmware/vsphere-automation-sdk-go/services/vmc"
)
and then execute below command in the directory with the go.mod file
go test
OR
go build
This will fetch all the dependency modules and your IDE code-related features will start working.
The API documentation can be accessed from here:
Any bugs or other issues should be filed with appropriate tags, within GitHub by way of the repository’s Issue Tracker.
This project contains auto-generated code, therefore code contributions will not be accepted. However, vsphere-automation-sdk-go team welcomes issue reports and we will do our best to ensure that future population of repository will contain a fix.
Board members are volunteers from the SDK community and VMware staff members.
Members:
vsphere-automation-sdk-go is available under the BSD-2 license.