configgtm

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Akamai Config GTM (Global Traffic Management)

A golang package that talks to the Akamai OPEN Config GTM API.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config contains the Akamai OPEN Edgegrid API credentials
	// for automatic signing of requests
	Config edgegrid.Config
)

Functions

func Init

func Init(config edgegrid.Config)

Init sets the GTM edgegrid Config

func IsConfigGTMError

func IsConfigGTMError(e error) bool

Types

type AsAssignment

type AsAssignment struct {
	DatacenterBase
	AsNumbers []int64 `json:"asNumbers,omitempty"`
}

AsAssignment represents a GTM asmap assignment structure

type AsMap

type AsMap struct {
	DefaultDatacenter *DatacenterBase `json:"defaultDatacenter"`
	Assignments       []*AsAssignment `json:"assignments,omitempty"`
	Name              string          `json:"name"`
	Links             []*Link         `json:"links,omitempty"`
}

AsMap represents a GTM AsMap

func GetAsMap

func GetAsMap(name, domainName string) (*AsMap, error)

GetAsMap retrieves a asMap with the given name.

func NewAsMap

func NewAsMap(name string) *AsMap

NewAsMap creates a new asMap

func (*AsMap) Create

func (as *AsMap) Create(domainName string) (*AsMapResponse, error)

Create asMap in provided domain

func (*AsMap) Delete

func (as *AsMap) Delete(domainName string) (*ResponseStatus, error)

Delete AsMap method

func (*AsMap) NewAssignment

func (as *AsMap) NewAssignment(dcID int, nickname string) *AsAssignment

Instantiate new Assignment struct

func (*AsMap) NewDefaultDatacenter

func (as *AsMap) NewDefaultDatacenter(dcID int) *DatacenterBase

Instantiate new Default Datacenter Struct

func (*AsMap) Update

func (as *AsMap) Update(domainName string) (*ResponseStatus, error)

Update AsMap in given domain

type AsMapResponse

type AsMapResponse struct {
	Resource *AsMap          `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

type CidrAssignment

type CidrAssignment struct {
	DatacenterBase
	Blocks []string `json:"blocks,omitempty"`
}

CidrAssignment represents a GTM cidr assignment element

type CidrMap

type CidrMap struct {
	DefaultDatacenter *DatacenterBase   `json:"defaultDatacenter"`
	Assignments       []*CidrAssignment `json:"assignments,omitempty"`
	Name              string            `json:"name"`
	Links             []*Link           `json:"links,omitempty"`
}

CidrMap represents a GTM cidrMap element

func GetCidrMap

func GetCidrMap(name, domainName string) (*CidrMap, error)

GetCidrMap retrieves a CidrMap with the given name.

func ListCidrMaps

func ListCidrMaps(domainName string) ([]*CidrMap, error)

ListCidrMap retreieves all CidrMaps

func NewCidrMap

func NewCidrMap(name string) *CidrMap

NewCidrMap creates a new CidrMap object

func (*CidrMap) Create

func (cidr *CidrMap) Create(domainName string) (*CidrMapResponse, error)

Create CidrMap in provided domain

func (*CidrMap) Delete

func (cidr *CidrMap) Delete(domainName string) (*ResponseStatus, error)

Delete CidrMap method

func (*CidrMap) NewAssignment

func (cidr *CidrMap) NewAssignment(dcid int, nickname string) *CidrAssignment

Instantiate new Assignment struct

func (*CidrMap) NewDefaultDatacenter

func (cidr *CidrMap) NewDefaultDatacenter(dcid int) *DatacenterBase

Instantiate new Default Datacenter Struct

func (*CidrMap) Update

func (cidr *CidrMap) Update(domainName string) (*ResponseStatus, error)

Update CidrMap in given domain

type CidrMapList

type CidrMapList struct {
	CidrMapItems []*CidrMap `json:"items"`
}

CidrMapList represents a GTM returned cidrmap list body

type CidrMapResponse

type CidrMapResponse struct {
	Resource *CidrMap        `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

type CommonError

type CommonError struct {
	// contains filtered or unexported fields
}

func (CommonError) Error

func (e CommonError) Error() string

func (CommonError) FailedToSave

func (CommonError) FailedToSave() bool

func (CommonError) GetItem

func (e CommonError) GetItem(itemName string) interface{}

func (CommonError) Network

func (e CommonError) Network() bool

func (CommonError) NotFound

func (e CommonError) NotFound() bool

func (CommonError) SetItem

func (e CommonError) SetItem(itemName string, itemVal interface{})

func (CommonError) ValidationFailed

func (e CommonError) ValidationFailed() bool

type ConfigGTMError

type ConfigGTMError interface {
	error
	Network() bool
	NotFound() bool
	FailedToSave() bool
	ValidationFailed() bool
}

type Datacenter

type Datacenter struct {
	City                       string      `json:"city,omitempty"`
	CloneOf                    int         `json:"cloneOf,omitempty"`
	CloudServerTargeting       bool        `json:"cloudServerTargeting"`
	Continent                  string      `json:"continent,omitempty"`
	Country                    string      `json:"country,omitempty"`
	DefaultLoadObject          *LoadObject `json:"defaultLoadObject,omitempty"`
	Latitude                   float64     `json:"latitude,omitempty"`
	Links                      []*Link     `json:"links,omitempty"`
	Longitude                  float64     `json:"longitude,omitempty"`
	Nickname                   string      `json:"nickname,omitempty"`
	PingInterval               int         `json:"pingInterval,omitempty"`
	PingPacketSize             int         `json:"pingPacketSize,omitempty"`
	DatacenterId               int         `json:"datacenterId,omitempty"`
	ScorePenalty               int         `json:"scorePenalty,omitempty"`
	ServermonitorLivenessCount int         `json:"servermonitorLivenessCount,omitempty"`
	ServermonitorLoadCount     int         `json:"servermonitorLoadCount,omitempty"`
	ServermonitorPool          string      `json:"servermonitorPool,omitempty"`
	StateOrProvince            string      `json:"stateOrProvince,omitempty"`
	Virtual                    bool        `json:"virtual"`
}

Datacenter represents a GTM datacenter

func GetDatacenter

func GetDatacenter(dcID int, domainName string) (*Datacenter, error)

GetDatacenter retrieves a Datacenter with the given name. NOTE: Id arg is int!

func ListDatacenters

func ListDatacenters(domainName string) ([]*Datacenter, error)

ListDatacenters retreieves all Datacenters

func NewDatacenter

func NewDatacenter() *Datacenter

NewDatacenter creates a new Datacenter object

func (*Datacenter) Create

func (dc *Datacenter) Create(domainName string) (*DatacenterResponse, error)

Create the datacenter identified by the receiver argument in the specified domain.

func (*Datacenter) Delete

func (dc *Datacenter) Delete(domainName string) (*ResponseStatus, error)

Delete the datacenter identified by the receiver argument from the domain specified.

func (*Datacenter) Update

func (dc *Datacenter) Update(domainName string) (*ResponseStatus, error)

Update the datacenter identified in the receiver argument in the provided domain.

type DatacenterBase

type DatacenterBase struct {
	Nickname     string `json:"nickname"`
	DatacenterId int    `json:"datacenterId"`
}

func NewDatacenterBase

func NewDatacenterBase() *DatacenterBase

NewDatacenterBase returns a new DatacenterBase structure

type DatacenterList

type DatacenterList struct {
	DatacenterItems []*Datacenter `json:"items"`
}

type DatacenterResponse

type DatacenterResponse struct {
	Status   *ResponseStatus `json:"status"`
	Resource *Datacenter     `json:"resource"`
}

func NewDatacenterResponse

func NewDatacenterResponse() *DatacenterResponse

NewDatacenterResponse instantiates a new DatacenterResponse structure

type Domain

type Domain struct {
	Name                         string          `json:"name"`
	Type                         string          `json:"type"`
	AsMaps                       []*AsMap        `json:"asMaps,omitempty"`
	Resources                    []*Resource     `json:"resources,omitempty"`
	DefaultUnreachableThreshold  float32         `json:"defaultUnreachableThreshold,omitempty"`
	EmailNotificationList        []string        `json:"emailNotificationList,omitempty"`
	MinPingableRegionFraction    float32         `json:"minPingableRegionFraction,omitempty"`
	DefaultTimeoutPenalty        int             `json:"defaultTimeoutPenalty,omitempty"`
	Datacenters                  []*Datacenter   `json:"datacenters,omitempty"`
	ServermonitorLivenessCount   int             `json:"servermonitorLivenessCount,omitempty"`
	RoundRobinPrefix             string          `json:"roundRobinPrefix,omitempty"`
	ServermonitorLoadCount       int             `json:"servermonitorLoadCount"`
	PingInterval                 int             `json:"pingInterval"`
	MaxTTL                       int64           `json:"maxTTL,omitempty"`
	LoadImbalancePercentage      float64         `json:"loadImbalancePercentage,omitempty"`
	DefaultHealthMax             float64         `json:"defaultHealthMax,omitempty"`
	LastModified                 string          `json:"lastModified,omitempty"`
	Status                       *ResponseStatus `json:"status,omitempty"`
	MapUpdateInterval            int             `json:"mapUpdateInterval,omitempty"`
	MaxProperties                int             `json:"maxProperties,omitempty"`
	MaxResources                 int             `json:"maxResources,omitempty"`
	DefaultSslClientPrivateKey   string          `json:"defaultSslClientPrivateKey,omitempty"`
	DefaultErrorPenalty          int             `json:"defaultErrorPenalty,omitempty"`
	Links                        []*Link         `json:"links,omitempty"`
	Properties                   []*Property     `json:"properties,omitempty"`
	MaxTestTimeout               float64         `json:"maxTestTimeout,omitempty"`
	CnameCoalescingEnabled       bool            `json:"cnameCoalescingEnabled"`
	DefaultHealthMultiplier      int             `json:"defaultHealthMultiplier"`
	ServermonitorPool            string          `json:"servermonitorPool,omitempty"`
	LoadFeedback                 bool            `json:"loadFeedback"`
	MinTTL                       int64           `json:"minTTL,omitempty"`
	GeographicMaps               []*GeoMap       `json:"geographicMaps,omitempty"`
	CidrMaps                     []*CidrMap      `json:"cidrMaps,omitempty"`
	DefaultMaxUnreachablePenalty int             `json:"defaultMaxUnreachablePenalty,omitempty"`
	DefaultHealthThreshold       float64         `json:"defaultHealthThreshold,omitempty"`
	LastModifiedBy               string          `json:"lastModifiedBy,omitempty"`
	ModificationComments         string          `json:"modificationComments,omitempty"`
	MinTestInterval              int             `json:"minTestInterval,omitempty"`
	PingPacketSize               int             `json:"pingPacketSize,omitempty"`
	DefaultSslClientCertificate  string          `json:"defaultSslClientCertificate,omitempty"`
}

The Domain data structure represents a GTM domain

func GetDomain

func GetDomain(domainName string) (*Domain, error)

GetDomain retrieves a Domain with the given domainname.

func NewDomain

func NewDomain(domainName, domainType string) *Domain

NewDomain is a utility function that creates a new Domain object.

func (*Domain) Create

func (domain *Domain) Create(queryArgs map[string]string) (*DomainResponse, error)

Create is a method applied to a domain object resulting in creation.

func (*Domain) Delete added in v0.9.3

func (domain *Domain) Delete() (*ResponseStatus, error)

Delete is a method applied to a domain object resulting in removal.

func (*Domain) Update

func (domain *Domain) Update(queryArgs map[string]string) (*ResponseStatus, error)

Update is a method applied to a domain object resulting in an update.

type DomainItem

type DomainItem struct {
	AcgId        string  `json:"acgId"`
	LastModified string  `json:"lastModified"`
	Links        []*Link `json:"links"`
	Name         string  `json:"name"`
	Status       string  `json:"status"`
}

DomainItem is a DomainsList item

func ListDomains

func ListDomains() ([]*DomainItem, error)

ListDomains retrieves all Domains.

type DomainResponse

type DomainResponse struct {
	Resource *Domain         `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

Response structs by Entity Type

type DomainsList

type DomainsList struct {
	DomainItems []*DomainItem `json:"items"`
}

type GeoAssignment

type GeoAssignment struct {
	DatacenterBase
	Countries []string `json:"countries,omitempty"`
}

GeoAssigment represents a GTM geo assignment element

type GeoMap

type GeoMap struct {
	DefaultDatacenter *DatacenterBase  `json:"defaultDatacenter"`
	Assignments       []*GeoAssignment `json:"assignments,omitempty"`
	Name              string           `json:"name"`
	Links             []*Link          `json:"links,omitempty"`
}

GeoMap represents a GTM GeoMap

func GetGeoMap

func GetGeoMap(name, domainName string) (*GeoMap, error)

GetGeoMap retrieves a GeoMap with the given name.

func ListGeoMaps

func ListGeoMaps(domainName string) ([]*GeoMap, error)

ListGeoMap retreieves all GeoMaps

func NewGeoMap

func NewGeoMap(name string) *GeoMap

NewGeoMap creates a new GeoMap object

func (*GeoMap) Create

func (geo *GeoMap) Create(domainName string) (*GeoMapResponse, error)

Create GeoMap in provided domain

func (*GeoMap) Delete

func (geo *GeoMap) Delete(domainName string) (*ResponseStatus, error)

Delete GeoMap method

func (*GeoMap) NewAssignment

func (geo *GeoMap) NewAssignment(dcID int, nickname string) *GeoAssignment

Instantiate new Assignment struct

func (*GeoMap) NewDefaultDatacenter

func (geo *GeoMap) NewDefaultDatacenter(dcID int) *DatacenterBase

Instantiate new Default Datacenter Struct

func (*GeoMap) Update

func (geo *GeoMap) Update(domainName string) (*ResponseStatus, error)

Update GeoMap in given domain

type GeoMapList

type GeoMapList struct {
	GeoMapItems []*GeoMap `json:"items"`
}

GeoMapList represents the returned GTM GeoMap List body

type GeoMapResponse

type GeoMapResponse struct {
	Resource *GeoMap         `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}
type Link struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

Probably THE most common type

type LivenessTest

type LivenessTest struct {
	Name                          string  `json:"name"`
	ErrorPenalty                  float64 `json:"errorPenalty"`
	PeerCertificateVerification   bool    `json:"peerCertificateVerification"`
	TestInterval                  int     `json:"testInterval,omitempty"`
	TestObject                    string  `json:"testObject,omitempty"`
	Links                         []*Link `json:"links,omitempty"`
	RequestString                 string  `json:"requestString,omitempty"`
	ResponseString                string  `json:"responseString,omitempty"`
	HttpError3xx                  bool    `json:"httpError3xx"`
	HttpError4xx                  bool    `json:"httpError4xx"`
	HttpError5xx                  bool    `json:"httpError5xx"`
	TestObjectProtocol            string  `json:"testObjectProtocol,omitempty"`
	TestObjectPassword            string  `json:"testObjectPassword,omitempty"`
	TestObjectPort                int     `json:"testObjectPort,omitempty"`
	SslClientPrivateKey           string  `json:"sslClientPrivateKey,omitempty"`
	SslClientCertificate          string  `json:"sslClientCertificate,omitempty"`
	DisableNonstandardPortWarning bool    `json:"disableNonstandardPortWarning"`
	HostHeader                    string  `json:"hostHeader,omitempty"`
	TestObjectUsername            string  `json:"testObjectUsername,omitempty"`
	TestTimeout                   float32 `json:"testTimeout,omitempty"`
	TimeoutPenalty                float64 `json:"timeoutPenalty,omitempty"`
	AnswersRequired               bool    `json:"answersRequired"`
	ResourceType                  string  `json:"resourceType,omitempty"`
	RecursionRequested            bool    `json:"recursionRequested"`
}

type LoadObject

type LoadObject struct {
	LoadObject     string   `json:"loadObject,omitempty"`
	LoadObjectPort int      `json:"loadObjectPort,omitempty"`
	LoadServers    []string `json:"loadServers,omitempty"`
}

func NewLoadObject

func NewLoadObject() *LoadObject

NewLoadObject returns a new LoadObject structure

type MxRecord

type MxRecord struct {
	Exchange   string `json:"exchange,omitempty"`
	Preference int    `json:"preference,omitempty"`
}

MxRecord struc

type Property

type Property struct {
	Name                    string           `json:"name"`
	Type                    string           `json:"type"`
	Ipv6                    bool             `json:"ipv6"`
	ScoreAggregationType    string           `json:"scoreAggregationType,omitempty"`
	StickinessBonusPercent  int              `json:"stickinessBonusPercentage,omitempty"`
	StickinessBonusConstant int              `json:"stickinessBonusConstant,omitempty"`
	HealthThreshold         float64          `json:"healthThreshold,omitempty"`
	UseComputedTargets      bool             `json:"useComputedTargets"`
	BackupIp                string           `json:"backupIp,omitempty"`
	BalanceByDownloadScore  bool             `json:"balanceByDownloadScore"`
	StaticTTL               int              `json:"staticTTL,omitempty"`
	LastModified            string           `json:"lastModified,omitempty"`
	UnreachableThreshold    float64          `json:"unreachableThreshold,omitempty"`
	HealthMultiplier        float64          `json:"healthMultiplier,omitempty"`
	DynamicTTL              int              `json:"dynamicTTL,omitempty"`
	MaxUnreachablePenalty   int              `json:"maxUnreachablePenalty,omitempty"`
	MapName                 string           `json:"mapName,omitempty"`
	HandoutLimit            int              `json:"handoutLimit,omitempty"`
	HandoutMode             string           `json:"handoutMode,omitempty"`
	FailoverDelay           int              `json:"failoverDelay,omitempty"`
	BackupCName             string           `json:"backupCName,omitempty"`
	FailbackDelay           int              `json:"failbackDelay,omitempty"`
	LoadImbalancePercentage float64          `json:"loadImbalancePercentage,omitempty"`
	HealthMax               float64          `json:"healthMax,omitempty"`
	GhostDemandReporting    bool             `json:"ghostDemandReporting"`
	Comments                string           `json:"comments,omitempty"`
	CName                   string           `json:"cname,omitempty"`
	WeightedHashBitsForIPv4 int              `json:"weightedHashBitsForIPv4,omitempty"`
	WeightedHashBitsForIPv6 int              `json:"weightedHashBitsForIPv6,omitempty"`
	TrafficTargets          []*TrafficTarget `json:"trafficTargets,omitempty"`
	MxRecords               []*MxRecord      `json:"mxRecords,omitempty"`
	Links                   []*Link          `json:"links,omitempty"`
	LivenessTests           []*LivenessTest  `json:"livenessTests,omitempty"`
}

Property represents a GTM property

func GetProperty

func GetProperty(name, domainName string) (*Property, error)

GetProperty retrieves a Property with the given name.

func ListProperties

func ListProperties(domainName string) ([]*Property, error)

ListProperties retreieves all Properties for the provided domainName.

func NewProperty

func NewProperty(name string) *Property

NewProperty creates a new Property object.

func (*Property) Create

func (property *Property) Create(domainName string) (*PropertyResponse, error)

Create the property in the receiver argument in the specified domain.

func (*Property) Delete

func (property *Property) Delete(domainName string) (*ResponseStatus, error)

Delete the property identified by the receiver argument from the domain provided.

func (*Property) NewLivenessTest

func (prop *Property) NewLivenessTest(name string, objproto string, interval int, timeout float32) *LivenessTest

NewLivenessTest is a method applied to a property object that instantiates a LivenessTest object.

func (*Property) NewMxRecord

func (prop *Property) NewMxRecord() *MxRecord

NewMxRecord is a method applied to a property object that instantiates an MxRecord object.

func (*Property) NewTrafficTarget

func (prop *Property) NewTrafficTarget() *TrafficTarget

NewTrafficTarget is a method applied to a property object that instantiates a TrafficTarget object.

func (*Property) Update

func (property *Property) Update(domainName string) (*ResponseStatus, error)

Update the property in the receiver argument in the specified domain.

type PropertyList

type PropertyList struct {
	PropertyItems []*Property `json:"items"`
}

type PropertyResponse

type PropertyResponse struct {
	Resource *Property       `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

type Resource

type Resource struct {
	Type                        string              `json:"type"`
	HostHeader                  string              `json:"hostHeader,omitempty"`
	LeastSquaresDecay           float64             `json:"leastSquaresDecay,omitempty"`
	Description                 string              `json:"description,omitempty"`
	LeaderString                string              `json:"leaderString,omitempty"`
	ConstrainedProperty         string              `json:"constrainedProperty,omitempty"`
	ResourceInstances           []*ResourceInstance `json:"resourceInstances,omitempty"`
	AggregationType             string              `json:"aggregationType,omitempty"`
	Links                       []*Link             `json:"links,omitempty"`
	LoadImbalancePercentage     float64             `json:"loadImbalancePercentage,omitempty"`
	UpperBound                  int                 `json:"upperBound,omitempty"`
	Name                        string              `json:"name"`
	MaxUMultiplicativeIncrement float64             `json:"maxUMultiplicativeIncrement,omitempty"`
	DecayRate                   float64             `json:"decayRate,omitempty"`
}

Resource represents a GTM resource

func GetResource

func GetResource(name, domainName string) (*Resource, error)

GetResource retrieves a Resource with the given name in the specified domain.

func ListResources

func ListResources(domainName string) ([]*Resource, error)

ListResources retreieves all Resources in the specified domain.

func NewResource

func NewResource(name string) *Resource

NewResource creates a new Resource object.

func (*Resource) Create

func (rsrc *Resource) Create(domainName string) (*ResourceResponse, error)

Create the resource identified by the receiver argument in the specified domain.

func (*Resource) Delete

func (rsrc *Resource) Delete(domainName string) (*ResponseStatus, error)

Delete the resource identified in the receiver argument from the specified domain.

func (*Resource) NewResourceInstance

func (rsrc *Resource) NewResourceInstance(dcID int) *ResourceInstance

NewResourceInstance instantiates a new ResourceInstance.

func (*Resource) Update

func (rsrc *Resource) Update(domainName string) (*ResponseStatus, error)

Update the resourceidentified in the receiver argument in the specified domain.

type ResourceInstance

type ResourceInstance struct {
	DatacenterId         int  `json:"datacenterId"`
	UseDefaultLoadObject bool `json:"useDefaultLoadObject"`
	LoadObject
}

ResourceInstance

type ResourceList

type ResourceList struct {
	ResourceItems []*Resource `json:"items"`
}

ResourceList is the structure returned by List Resources

type ResourceResponse

type ResourceResponse struct {
	Resource *Resource       `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

type ResponseBody

type ResponseBody struct {
	Resource interface{}     `json:"resource"`
	Status   *ResponseStatus `json:"status"`
}

Generic response structs

type ResponseStatus

type ResponseStatus struct {
	ChangeId              string  `json:"changeId,omitempty"`
	Links                 *[]Link `json:"links,omitempty"`
	Message               string  `json:"message,omitempty"`
	PassingValidation     bool    `json:"passingValidation,omitempty"`
	PropagationStatus     string  `json:"propagationStatus,omitempty"`
	PropagationStatusDate string  `json:"propagationStatusDate,omitempty"`
}

response Status is returned on Create, Update or Delete operations for all entity types

func GetDomainStatus

func GetDomainStatus(domainName string) (*ResponseStatus, error)

GetStatus retrieves current status for the given domainname.

func NewResponseStatus

func NewResponseStatus() *ResponseStatus

NewResponseStatus returns a new ResponseStatus struct

type TrafficTarget

type TrafficTarget struct {
	DatacenterId int      `json:"datacenterId"`
	Enabled      bool     `json:"enabled"`
	Weight       float64  `json:"weight,omitempty"`
	Servers      []string `json:"servers,omitempty"`
	Name         string   `json:"name,omitempty"`
	HandoutCName string   `json:"handoutCName,omitempty"`
}

TrafficTarget struc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL