gtm

package
v8.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Overview

Package gtm provides access to the Akamai GTM V1_4 APIs

See: https://techdocs.akamai.com/gtm/reference/api

Index

Constants

This section is empty.

Variables

View Source
var (
	// MapDefaultDC is a default Datacenter ID for Maps
	MapDefaultDC = 5400
	// Ipv4DefaultDC is a default Datacenter ID for IPv4
	Ipv4DefaultDC = 5401
	// Ipv6DefaultDC is a default Datacenter ID for IPv6
	Ipv6DefaultDC = 5402
)
View Source
var (
	// ErrNotFound used when status code is 404 Not Found
	ErrNotFound = errors.New("404 Not Found")
)

Functions

This section is empty.

Types

type ASAssignment

type ASAssignment struct {
	DatacenterBase
	ASNumbers []int64 `json:"asNumbers"`
}

ASAssignment represents a GTM as map 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 (*ASMap) Validate

func (a *ASMap) Validate() error

Validate validates ASMap

type ASMapList

type ASMapList struct {
	ASMapItems []*ASMap `json:"items"`
}

ASMapList represents the returned GTM ASMap List body

type ASMapResponse

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

ASMapResponse contains a response after creating or updating ASMap

type ASMaps

type ASMaps interface {
	// ListASMaps retrieves all AsMaps.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-as-maps
	ListASMaps(context.Context, string) ([]*ASMap, error)
	// GetASMap retrieves a AsMap with the given name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-as-map
	GetASMap(context.Context, string, string) (*ASMap, error)
	// CreateASMap creates the datacenter identified by the receiver argument in the specified domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-as-map
	CreateASMap(context.Context, *ASMap, string) (*ASMapResponse, error)
	// DeleteASMap deletes the datacenter identified by the receiver argument from the domain specified.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-as-map
	DeleteASMap(context.Context, *ASMap, string) (*ResponseStatus, error)
	// UpdateASMap updates the datacenter identified in the receiver argument in the provided domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-as-map
	UpdateASMap(context.Context, *ASMap, string) (*ResponseStatus, error)
}

ASMaps contains operations available on a ASmap resource.

type CIDRAssignment

type CIDRAssignment struct {
	DatacenterBase
	Blocks []string `json:"blocks"`
}

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 (*CIDRMap) Validate

func (c *CIDRMap) Validate() error

Validate validates CIDRMap

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"`
}

CIDRMapResponse contains a response after creating or updating CIDRMap

type CIDRMaps

type CIDRMaps interface {
	// ListCIDRMaps retrieves all CIDRMaps.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-cidr-maps
	ListCIDRMaps(context.Context, string) ([]*CIDRMap, error)
	// GetCIDRMap retrieves a CIDRMap with the given name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-cidr-map
	GetCIDRMap(context.Context, string, string) (*CIDRMap, error)
	// CreateCIDRMap creates the datacenter identified by the receiver argument in the specified domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-cidr-map
	CreateCIDRMap(context.Context, *CIDRMap, string) (*CIDRMapResponse, error)
	// DeleteCIDRMap deletes the datacenter identified by the receiver argument from the domain specified.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-cidr-maps
	DeleteCIDRMap(context.Context, *CIDRMap, string) (*ResponseStatus, error)
	// UpdateCIDRMap updates the datacenter identified in the receiver argument in the provided domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-cidr-map
	UpdateCIDRMap(context.Context, *CIDRMap, string) (*ResponseStatus, error)
}

CIDRMaps contains operations available on a CIDR map resource.

type ClientFunc

type ClientFunc func(sess session.Session, opts ...Option) GTM

ClientFunc is a gtm client new method, this can used for mocking

type Datacenter

type Datacenter struct {
	City                          string      `json:"city,omitempty"`
	CloneOf                       int         `json:"cloneOf,omitempty"`
	CloudServerHostHeaderOverride bool        `json:"cloudServerHostHeaderOverride"`
	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

type DatacenterBase

type DatacenterBase struct {
	Nickname     string `json:"nickname,omitempty"`
	DatacenterID int    `json:"datacenterId"`
}

DatacenterBase is a placeholder for default Datacenter

type DatacenterList

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

DatacenterList contains a list of Datacenters

type DatacenterResponse

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

DatacenterResponse contains a response after creating or updating Datacenter

type Datacenters

type Datacenters interface {
	// ListDatacenters retrieves all Datacenters.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-datacenters
	ListDatacenters(context.Context, string) ([]*Datacenter, error)
	// GetDatacenter retrieves a Datacenter with the given name. NOTE: Id arg is int!
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-datacenter
	GetDatacenter(context.Context, int, string) (*Datacenter, error)
	// CreateDatacenter creates the datacenter identified by the receiver argument in the specified domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/post-datacenter
	CreateDatacenter(context.Context, *Datacenter, string) (*DatacenterResponse, error)
	// DeleteDatacenter deletes the datacenter identified by the receiver argument from the domain specified.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-datacenter
	DeleteDatacenter(context.Context, *Datacenter, string) (*ResponseStatus, error)
	// UpdateDatacenter updates the datacenter identified in the receiver argument in the provided domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-datacenter
	UpdateDatacenter(context.Context, *Datacenter, string) (*ResponseStatus, error)
	// CreateMapsDefaultDatacenter creates Default Datacenter for Maps.
	CreateMapsDefaultDatacenter(context.Context, string) (*Datacenter, error)
	// CreateIPv4DefaultDatacenter creates Default Datacenter for IPv4 Selector.
	CreateIPv4DefaultDatacenter(context.Context, string) (*Datacenter, error)
	// CreateIPv6DefaultDatacenter creates Default Datacenter for IPv6 Selector.
	CreateIPv6DefaultDatacenter(context.Context, string) (*Datacenter, error)
}

Datacenters contains operations available on a Datacenter resource.

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,omitempty"`
	PingInterval                 int             `json:"pingInterval,omitempty"`
	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      float64         `json:"defaultHealthMultiplier,omitempty"`
	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"`
	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"`
	EndUserMappingEnabled        bool            `json:"endUserMappingEnabled"`
	SignAndServe                 bool            `json:"signAndServe"`
	SignAndServeAlgorithm        *string         `json:"signAndServeAlgorithm"`
}

The Domain data structure represents a GTM domain

func (*Domain) Validate

func (d *Domain) Validate() error

Validate validates Domain

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"`
	LastModifiedBy        string  `json:"lastModifiedBy"`
	ChangeID              string  `json:"changeId"`
	ActivationState       string  `json:"activationState"`
	ModificationComments  string  `json:"modificationComments"`
	SignAndServe          bool    `json:"signAndServe"`
	SignAndServeAlgorithm string  `json:"signAndServeAlgorithm"`
	DeleteRequestID       string  `json:"deleteRequestId"`
}

DomainItem is a DomainsList item

type DomainResponse

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

DomainResponse contains a response after creating or updating Domain

type Domains

type Domains interface {
	// NullFieldMap retrieves map of null fields.
	NullFieldMap(context.Context, *Domain) (*NullFieldMapStruct, error)
	// GetDomainStatus retrieves current status for the given domain name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-status-current
	GetDomainStatus(context.Context, string) (*ResponseStatus, error)
	// ListDomains retrieves all Domains.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-domains
	ListDomains(context.Context) ([]*DomainItem, error)
	// GetDomain retrieves a Domain with the given domain name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-domain
	GetDomain(context.Context, string) (*Domain, error)
	// CreateDomain creates domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/post-domain
	CreateDomain(context.Context, *Domain, map[string]string) (*DomainResponse, error)
	// DeleteDomain is a method applied to a domain object resulting in removal.
	//
	// See: ** Not Supported by API **
	DeleteDomain(context.Context, *Domain) (*ResponseStatus, error)
	// UpdateDomain is a method applied to a domain object resulting in an update.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-domain
	UpdateDomain(context.Context, *Domain, map[string]string) (*ResponseStatus, error)
}

Domains contains operations available on a Domain resource.

type DomainsList

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

DomainsList contains a list of domain items

type Error

type Error struct {
	Type          string  `json:"type"`
	Title         string  `json:"title"`
	Detail        string  `json:"detail"`
	Instance      string  `json:"instance,omitempty"`
	BehaviorName  string  `json:"behaviorName,omitempty"`
	ErrorLocation string  `json:"errorLocation,omitempty"`
	StatusCode    int     `json:"-"`
	Errors        []Error `json:"errors"`
}

Error is a gtm error interface

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

Is handles error comparisons

type GTM

GTM is the gtm api interface

func Client

func Client(sess session.Session, opts ...Option) GTM

Client returns a new dns Client instance with the specified controller

type GeoAssignment

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

GeoAssignment 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 (*GeoMap) Validate

func (m *GeoMap) Validate() error

Validate validates GeoMap

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"`
}

GeoMapResponse contains a response after creating or updating GeoMap

type GeoMaps

type GeoMaps interface {
	// ListGeoMaps retrieves all GeoMaps.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-geographic-maps
	ListGeoMaps(context.Context, string) ([]*GeoMap, error)
	// GetGeoMap retrieves a GeoMap with the given name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-geographic-map
	GetGeoMap(context.Context, string, string) (*GeoMap, error)
	// CreateGeoMap creates the datacenter identified by the receiver argument in the specified domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-geographic-map
	CreateGeoMap(context.Context, *GeoMap, string) (*GeoMapResponse, error)
	// DeleteGeoMap deletes the datacenter identified by the receiver argument from the domain specified.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-geographic-map
	DeleteGeoMap(context.Context, *GeoMap, string) (*ResponseStatus, error)
	// UpdateGeoMap updates the datacenter identified in the receiver argument in the provided domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-geographic-map
	UpdateGeoMap(context.Context, *GeoMap, string) (*ResponseStatus, error)
}

GeoMaps contains operations available on a GeoMap resource.

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HTTPHeader struct contains HTTP headers to send if the testObjectProtocol is http or https

type Link struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

Link is Probably THE most common type

type LivenessTest

type LivenessTest struct {
	Name                          string        `json:"name"`
	ErrorPenalty                  float64       `json:"errorPenalty,omitempty"`
	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"`
	HTTPMethod                    *string       `json:"httpMethod"`
	HTTPRequestBody               *string       `json:"httpRequestBody"`
	Disabled                      bool          `json:"disabled"`
	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"`
	Pre2023SecurityPosture        bool          `json:"pre2023SecurityPosture"`
	DisableNonstandardPortWarning bool          `json:"disableNonstandardPortWarning"`
	HTTPHeaders                   []*HTTPHeader `json:"httpHeaders,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"`
	AlternateCACertificates       []string      `json:"alternateCACertificates"`
}

LivenessTest contains configuration of liveness tests to determine whether your servers respond to requests

type LoadObject

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

LoadObject contains information about the load reporting interface

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) CreateASMap

func (p *Mock) CreateASMap(ctx context.Context, asMap *ASMap, domain string) (*ASMapResponse, error)

func (*Mock) CreateCIDRMap

func (p *Mock) CreateCIDRMap(ctx context.Context, cidr *CIDRMap, domain string) (*CIDRMapResponse, error)

func (*Mock) CreateDatacenter

func (p *Mock) CreateDatacenter(ctx context.Context, dc *Datacenter, domain string) (*DatacenterResponse, error)

func (*Mock) CreateDomain

func (p *Mock) CreateDomain(ctx context.Context, domain *Domain, queryArgs map[string]string) (*DomainResponse, error)

func (*Mock) CreateGeoMap

func (p *Mock) CreateGeoMap(ctx context.Context, geo *GeoMap, domain string) (*GeoMapResponse, error)

func (*Mock) CreateIPv4DefaultDatacenter

func (p *Mock) CreateIPv4DefaultDatacenter(ctx context.Context, domain string) (*Datacenter, error)

func (*Mock) CreateIPv6DefaultDatacenter

func (p *Mock) CreateIPv6DefaultDatacenter(ctx context.Context, domain string) (*Datacenter, error)

func (*Mock) CreateMapsDefaultDatacenter

func (p *Mock) CreateMapsDefaultDatacenter(ctx context.Context, domainName string) (*Datacenter, error)

func (*Mock) CreateProperty

func (p *Mock) CreateProperty(ctx context.Context, prop *Property, domain string) (*PropertyResponse, error)

func (*Mock) CreateResource

func (p *Mock) CreateResource(ctx context.Context, resource *Resource, domain string) (*ResourceResponse, error)

func (*Mock) DeleteASMap

func (p *Mock) DeleteASMap(ctx context.Context, asMap *ASMap, domain string) (*ResponseStatus, error)

func (*Mock) DeleteCIDRMap

func (p *Mock) DeleteCIDRMap(ctx context.Context, cidr *CIDRMap, domain string) (*ResponseStatus, error)

func (*Mock) DeleteDatacenter

func (p *Mock) DeleteDatacenter(ctx context.Context, dc *Datacenter, domain string) (*ResponseStatus, error)

func (*Mock) DeleteDomain

func (p *Mock) DeleteDomain(ctx context.Context, domain *Domain) (*ResponseStatus, error)

func (*Mock) DeleteGeoMap

func (p *Mock) DeleteGeoMap(ctx context.Context, geo *GeoMap, domain string) (*ResponseStatus, error)

func (*Mock) DeleteProperty

func (p *Mock) DeleteProperty(ctx context.Context, prop *Property, domain string) (*ResponseStatus, error)

func (*Mock) DeleteResource

func (p *Mock) DeleteResource(ctx context.Context, resource *Resource, domain string) (*ResponseStatus, error)

func (*Mock) GetASMap

func (p *Mock) GetASMap(ctx context.Context, asMap string, domain string) (*ASMap, error)

func (*Mock) GetCIDRMap

func (p *Mock) GetCIDRMap(ctx context.Context, cidr string, domain string) (*CIDRMap, error)

func (*Mock) GetDatacenter

func (p *Mock) GetDatacenter(ctx context.Context, dcID int, domain string) (*Datacenter, error)

func (*Mock) GetDomain

func (p *Mock) GetDomain(ctx context.Context, domain string) (*Domain, error)

func (*Mock) GetDomainStatus

func (p *Mock) GetDomainStatus(ctx context.Context, domain string) (*ResponseStatus, error)

func (*Mock) GetGeoMap

func (p *Mock) GetGeoMap(ctx context.Context, geo string, domain string) (*GeoMap, error)

func (*Mock) GetProperty

func (p *Mock) GetProperty(ctx context.Context, prop string, domain string) (*Property, error)

func (*Mock) GetResource

func (p *Mock) GetResource(ctx context.Context, resource string, domain string) (*Resource, error)

func (*Mock) ListASMaps

func (p *Mock) ListASMaps(ctx context.Context, domain string) ([]*ASMap, error)

func (*Mock) ListCIDRMaps

func (p *Mock) ListCIDRMaps(ctx context.Context, domain string) ([]*CIDRMap, error)

func (*Mock) ListDatacenters

func (p *Mock) ListDatacenters(ctx context.Context, domain string) ([]*Datacenter, error)

func (*Mock) ListDomains

func (p *Mock) ListDomains(ctx context.Context) ([]*DomainItem, error)

func (*Mock) ListGeoMaps

func (p *Mock) ListGeoMaps(ctx context.Context, domain string) ([]*GeoMap, error)

func (*Mock) ListProperties

func (p *Mock) ListProperties(ctx context.Context, domain string) ([]*Property, error)

func (*Mock) ListResources

func (p *Mock) ListResources(ctx context.Context, domain string) ([]*Resource, error)

func (*Mock) NullFieldMap

func (p *Mock) NullFieldMap(ctx context.Context, domain *Domain) (*NullFieldMapStruct, error)

func (*Mock) UpdateASMap

func (p *Mock) UpdateASMap(ctx context.Context, asMap *ASMap, domain string) (*ResponseStatus, error)

func (*Mock) UpdateCIDRMap

func (p *Mock) UpdateCIDRMap(ctx context.Context, cidr *CIDRMap, domain string) (*ResponseStatus, error)

func (*Mock) UpdateDatacenter

func (p *Mock) UpdateDatacenter(ctx context.Context, dc *Datacenter, domain string) (*ResponseStatus, error)

func (*Mock) UpdateDomain

func (p *Mock) UpdateDomain(ctx context.Context, domain *Domain, queryArgs map[string]string) (*ResponseStatus, error)

func (*Mock) UpdateGeoMap

func (p *Mock) UpdateGeoMap(ctx context.Context, geo *GeoMap, domain string) (*ResponseStatus, error)

func (*Mock) UpdateProperty

func (p *Mock) UpdateProperty(ctx context.Context, prop *Property, domain string) (*ResponseStatus, error)

func (*Mock) UpdateResource

func (p *Mock) UpdateResource(ctx context.Context, resource *Resource, domain string) (*ResponseStatus, error)

type NullFieldMapStruct

type NullFieldMapStruct struct {
	Domain      NullPerObjectAttributeStruct            // entry is domain
	Properties  map[string]NullPerObjectAttributeStruct // entries are properties
	Datacenters map[string]NullPerObjectAttributeStruct // entries are datacenters
	Resources   map[string]NullPerObjectAttributeStruct // entries are resources
	CidrMaps    map[string]NullPerObjectAttributeStruct // entries are cidrmaps
	GeoMaps     map[string]NullPerObjectAttributeStruct // entries are geomaps
	AsMaps      map[string]NullPerObjectAttributeStruct // entries are asmaps
}

NullFieldMapStruct returned null Objects structure

type NullPerObjectAttributeStruct

type NullPerObjectAttributeStruct struct {
	CoreObjectFields  map[string]string
	ChildObjectFields map[string]interface{} // NullObjectAttributeStruct
}

NullPerObjectAttributeStruct represents core and child null object attributes

type ObjectMap

type ObjectMap map[string]interface{}

ObjectMap represents ObjectMap datatype

type Option

type Option func(*gtm)

Option defines a GTM option

type Properties

type Properties interface {
	// ListProperties retrieves all Properties for the provided domainName.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-properties
	ListProperties(context.Context, string) ([]*Property, error)
	// GetProperty retrieves a Property with the given domain and property names.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-property
	GetProperty(context.Context, string, string) (*Property, error)
	// CreateProperty creates property.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-property
	CreateProperty(context.Context, *Property, string) (*PropertyResponse, error)
	// DeleteProperty is a method applied to a property object resulting in removal.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-property
	DeleteProperty(context.Context, *Property, string) (*ResponseStatus, error)
	// UpdateProperty is a method applied to a property object resulting in an update.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-property
	UpdateProperty(context.Context, *Property, string) (*ResponseStatus, error)
}

Properties contains operations available on a Property resource.

type Property

type Property struct {
	Name                      string           `json:"name"`
	Type                      string           `json:"type"`
	IPv6                      bool             `json:"ipv6"`
	ScoreAggregationType      string           `json:"scoreAggregationType"`
	StickinessBonusPercentage 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"`
	StaticRRSets              []*StaticRRSet   `json:"staticRRSets,omitempty"`
	LastModified              string           `json:"lastModified"`
	UnreachableThreshold      float64          `json:"unreachableThreshold,omitempty"`
	MinLiveFraction           float64          `json:"minLiveFraction,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"`
	HandoutMode               string           `json:"handoutMode"`
	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"`
	Links                     []*Link          `json:"links,omitempty"`
	LivenessTests             []*LivenessTest  `json:"livenessTests,omitempty"`
}

Property represents a GTM property

func (*Property) Validate

func (p *Property) Validate() error

Validate validates Property

type PropertyList

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

PropertyList contains a list of property items

type PropertyResponse

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

PropertyResponse contains a response after creating or updating Property

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 (*Resource) Validate

func (r *Resource) Validate() error

Validate validates Resource

type ResourceInstance

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

ResourceInstance contains information about the resources that constrain the properties within the data center

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"`
}

ResourceResponse contains a response after creating or updating Resource

type Resources

type Resources interface {
	// ListResources retrieves all Resources
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-resources
	ListResources(context.Context, string) ([]*Resource, error)
	// GetResource retrieves a Resource with the given name.
	//
	// See: https://techdocs.akamai.com/gtm/reference/get-resource
	GetResource(context.Context, string, string) (*Resource, error)
	// CreateResource creates the datacenter identified by the receiver argument in the specified domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-resource
	CreateResource(context.Context, *Resource, string) (*ResourceResponse, error)
	// DeleteResource deletes the datacenter identified by the receiver argument from the domain specified.
	//
	// See: https://techdocs.akamai.com/gtm/reference/delete-resource
	DeleteResource(context.Context, *Resource, string) (*ResponseStatus, error)
	// UpdateResource updates the datacenter identified in the receiver argument in the provided domain.
	//
	// See: https://techdocs.akamai.com/gtm/reference/put-resource
	UpdateResource(context.Context, *Resource, string) (*ResponseStatus, error)
}

Resources contains operations available on a Resource resource.

type ResponseBody

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

ResponseBody is a generic response struct

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"`
}

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

type StaticRRSet

type StaticRRSet struct {
	Type  string   `json:"type"`
	TTL   int      `json:"ttl"`
	Rdata []string `json:"rdata"`
}

StaticRRSet contains static recordset

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"`
	Precedence   *int     `json:"precedence,omitempty"`
}

TrafficTarget struct contains information about where to direct data center traffic

Jump to

Keyboard shortcuts

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