-
Notifications
You must be signed in to change notification settings - Fork 2
Home
This is the GoLang API wrapper for Pulse Secure Virtual Traffic Manager (vTM). Starting from version 0.4 the API has been heavily redesigned. This wiki page refers to the new (and current) design of the API. For proper use of API release 0.3.x (not supported any more) please refer to this wiki page. This wiki page refers to the API version 0.4.2.
For any information related with the Pulse Secure vTM resources and attributes please refer to the official Pulse Secure Virtual Traffic Manager REST API Guide consistent with your server release.
- Resources for any CRUD operation can be defined either as structs (for a subset of all resources supported by the 3.8 version of the REST API Server) or as maps, hence basically CRUD operations on any resource is supported.
- Any PulsevTM REST API Server version is supported. A specific version can be passed at connection time. If no version is specified, the API wrapper connects to the PulsevTM REST API Server, retrieves the list of all supported versions and use the highest available one.
- Support for all resource types, including information and statistics resources.
The following is the list of the resources managed by the API as structs (but any resource can be managed as map as well). The list is a limited subset of all the resources exposed by the Pulse vTM REST API Server and, moreover, for some of them the set of defined attributes is far from being complete (though representing the minimal subset that provides most of the resource usage).
The schema is bond to version 3.8 of the Pulse vTM REST API Server. The schema is not going to be upgraded to current and future releases of the Brocade vTM REST API Server schema. All schema resources can be found under the api/model/3.8
folder.
Resource Name | Resource URI | Create | Read | Update | Delete |
---|---|---|---|---|---|
DNS Zone | dns_server/zones | Y | Y | Y | Y |
DNS Zone File | dns_server/zone_files | Y | Y | Y | Y |
GLB Service | glb_services | Y | Y | Y | Y |
Location | locations | Y | Y | Y | Y |
Monitor | monitors | Y | Y | Y | Y |
Pool | pools | Y | Y | Y | Y |
Rule | rules | Y | Y | Y | Y |
SSL Key Pair | ssl/server_keys | Y | Y | Y | Y |
Traffic IP Group | traffic_ip_groups | Y | Y | Y | Y |
Traffic Manager | traffic_managers | Y | Y | Y | Y |
User Authenticator | user_authenticators | Y | Y | Y | Y |
User Group | user_groups | Y | Y | Y | Y |
Virtual Server | virtual_servers | Y | Y | Y | Y |
import("github.com/sky-uk/go-pulse-vtm/api")
The Connect API returns a client object or an error in case of issues. The APIVersion parameter can be used to specify a server API version to use; in case it is not provided, the list of available API versions is retrieved from the server and the highest available is used. Custom headers can be passed at connection time, if not passed the content type is anyhow set to "application/json"
headers := make(map[string]string)
// set your custom headers...
params := Params{
APIVersion: "3.8",
Server: server,
Username: username,
Password: password,
IgnoreSSL: true,
Debug: true,
Headers: headers,
}
client, err := api.Connect(params)
All API return an error or nil in case of success.
The Set API is provided to both create and update a configuration resource. The last input paramenter is a pointer to a map (or struct) where the new created/updated resource is provided back.
err := client.Set(<resource type>,<resource name>, <resource profile as map/struct>, <pointer to map/struct>)
profile := make(map[string]interface{})
updatedRes := make(map[string]interface{})
name := "new_virtual_server_8347"
// fill the profile...
//...
err = client.Set("virtual_servers", name, profile, &updatedRes)
err := client.GetByName(<resource type>, <resource name>, <pointer to map/struct>)
err := client.GetByURL(<resource type>, <resource url>, <pointer to map/struct>)
err := client.Delete(<resource type>, <resource name>)
The GetAllResourceTypes
returns the list of all resource types
types, err := client.GetAllResourceTypes()
The GetAllResources
API returns a list of maps containing names/urls of all
resources of the provided type.
objs, err := client.GetAllResources(<resource type>)
The GetInformation
API returns the information section for the passed server name
info, err := client.GetInformation(<server name>)
The GetStatistics
API returns all the statistics resources for a server node name
stats, err := client.GetStatistics(<server name>)
The GetState
API returns the current state for the passed server node name
state, err := client.GetState(<server name>)
As resources are hierarchically organized as a tree, the next functions are provided to help browse the tree content.
client.WorkWithConfigurationResources()
client.WorkWithStatus()
The TraverseTree
function traverses the tree of resources starting from the given root. It returns a map with all resources found keyed by their url.
err = client.TraverseTree(<root path>, <pointer to map>)
Traversing all information resources:
// get a client...
client, err := api.Connect(...)
client.WorkWithStatus()
resources := make(map[string]interface{})
err = client.TraverseTree(client.RootPath, resources)
if err != nil {
t.Fatal("Error traversing tree: ", err)
}
for url := range resources {
log.Println("Found Resource URL: ", url)
}