Skip to content

Collect additional GTM objects #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions gtm.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,67 @@ type GTMWideIP struct {
Pools *[]GTMWideIPPool `json:"pools,omitempty"`
}

// GTMServer represents a GTM server
type GTMServer struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Datacenter string `json:"datacenter,omitempty"`
Enabled bool `json:"enabled,omitempty"`
ExposeRouteDomains string `json:"exposeRouteDomains,omitempty"`
IqAllowPath string `json:"iqAllowPath,omitempty"`
IqAllowServiceCheck string `json:"iqAllowServiceCheck,omitempty"`
IqAllowSnmp string `json:"iqAllowSnmp,omitempty"`
LimitCpuUsage int `json:"limitCpuUsage,omitempty"`
LimitCpuUsageStatus string `json:"limitCpuUsageStatus,omitempty"`
LimitMaxBps int `json:"limitMaxBps,omitempty"`
LimitMaxBpsStatus string `json:"limitMaxBpsStatus,omitempty"`
LimitMaxConnections int `json:"limitMaxConnections,omitempty"`
LimitMaxConnectionsStatus string `json:"limitMaxConnectionsStatus,omitempty"`
LimitMaxPps int `json:"limitMaxPps,omitempty"`
LimitMaxPpsStatus string `json:"limitMaxPpsStatus,omitempty"`
LimitMemAvail int `json:"limitMemAvail,omitempty"`
LimitMemAvailStatus string `json:"limitMemAvailStatus,omitempty"`
LinkDiscovery string `json:"linkDiscovery,omitempty"`
ProberPool string `json:"proberPool,omitempty"`
Product string `json:"product,omitempty"`
VirtualServerDiscovery string `json:"virtualServerDiscovery,omitempty"`
Addresses []struct {
Name string `json:"name,omitempty"`
DeviceName string `json:"deviceName,omitempty"`
Translation string `json:"translation,omitempty"`
} `json:"addresses,omitempty"`
}

// GTMServers represents a collection of GTMServers
type GTMServers struct {
Items []GTMServer `json:"items,omitempty"`
}

// GTMVirtualServer represents a VirtualServer assigned to a GTM Server.
type GTMVirtualServer struct {
Name string `json:"name,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Destination string `json:"destination,omitempty"`
Enabled bool `json:"enabled,omitempty"`
LimitMaxBps int `json:"limitMaxBps,omitempty"`
LimitMaxBpsStatus string `json:"limitMaxBpsStatus,omitempty"`
LimitMaxConnections int `json:"limitMaxConnections,omitempty"`
LimitMaxConnectionsStatus string `json:"limitMaxConnectionsStatus,omitempty"`
LimitMaxPps int `json:"limitMaxPps,omitempty"`
LimitMaxPpsStatus string `json:"limitMaxPpsStatus,omitempty"`
Monitor string `json:"monitor,omitempty"`
TranslationAddress string `json:"translationAddress,omitempty"`
TranslationPort int `json:"translationPort,omitempty"`
}

// GTMVirtualServers represents a collection of GTM VirtualServers assigned to a GTM Server.
type GTMVirtualServers struct {
Items []GTMVirtualServer `json:"items,omitempty"`
}

// GTMWideIPPool Pool Structure
type GTMWideIPPool struct {
Name string `json:"name,omitempty"`
Expand All @@ -58,6 +119,28 @@ type GTMWideIPPool struct {
} `json:"nameReference,omitempty"`
}

// GTMServers returns a list of GTM servers.
func (b *BigIP) GTMServers() (*GTMServers, error) {
var out GTMServers
err, _ := b.getForEntity(&out, uriGtm, uriGtmServer)
if err != nil {
return nil, err
}

return &out, nil
}

// GetGTMServerVirtualServers returns a list of all Virtual Servers assigned to a GTM server.
func (b *BigIP) GetGTMServerVirtualServers(fullPath string) (*GTMVirtualServers, error) {
var out GTMVirtualServers
err, _ := b.getForEntity(&out, uriGtm, uriGtmServer, fullPath, uriGtmVirtualServer)
if err != nil {
return nil, err
}

return &out, nil
}

// GetGTMWideIPs returns a list of all WideIps for a provided type
func (b *BigIP) GetGTMWideIPs(recordType GTMType) (*GTMWideIPs, error) {
var w GTMWideIPs
Expand Down
72 changes: 37 additions & 35 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,43 @@ import (
)

const (
uriClientSSL = "client-ssl"
uriDatagroup = "data-group"
uriHttp = "http"
uriHttpCompression = "http-compression"
uriIRule = "rule"
uriInternal = "internal"
uriLtm = "ltm"
uriMonitor = "monitor"
uriNode = "node"
uriOneConnect = "one-connect"
uriPolicy = "policy"
uriPool = "pool"
uriPoolMember = "members"
uriProfile = "profile"
uriRules = "rules"
uriServerSSL = "server-ssl"
uriSnatPool = "snatpool"
uriTcp = "tcp"
uriUdp = "udp"
uriVirtual = "virtual"
uriVirtualAddress = "virtual-address"
uriGtm = "gtm"
uriWideIp = "wideip"
uriARecord = "a"
uriAAAARecord = "aaaa"
uriCNameRecord = "cname"
uriMXRecord = "mx"
uriNaptrRecord = "naptr"
uriSrvRecord = "srv"
uriPoolMembers = "members"
ENABLED = "enable"
DISABLED = "disable"
CONTEXT_SERVER = "serverside"
CONTEXT_CLIENT = "clientside"
CONTEXT_ALL = "all"
uriClientSSL = "client-ssl"
uriDatagroup = "data-group"
uriHttp = "http"
uriHttpCompression = "http-compression"
uriIRule = "rule"
uriInternal = "internal"
uriLtm = "ltm"
uriMonitor = "monitor"
uriNode = "node"
uriOneConnect = "one-connect"
uriPolicy = "policy"
uriPool = "pool"
uriPoolMember = "members"
uriProfile = "profile"
uriRules = "rules"
uriServerSSL = "server-ssl"
uriSnatPool = "snatpool"
uriTcp = "tcp"
uriUdp = "udp"
uriVirtual = "virtual"
uriVirtualAddress = "virtual-address"
uriGtm = "gtm"
uriGtmServer = "server"
uriGtmVirtualServer = "virtual-servers"
uriWideIp = "wideip"
uriARecord = "a"
uriAAAARecord = "aaaa"
uriCNameRecord = "cname"
uriMXRecord = "mx"
uriNaptrRecord = "naptr"
uriSrvRecord = "srv"
uriPoolMembers = "members"
ENABLED = "enable"
DISABLED = "disable"
CONTEXT_SERVER = "serverside"
CONTEXT_CLIENT = "clientside"
CONTEXT_ALL = "all"

// Newer policy APIs have a draft-publish workflow that this library does not support.
policyVersionSuffix = "?ver=11.5.1"
Expand Down