gtm

package
v7.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

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 (
	// ErrBadRequest is returned when a required parameter is missing
	ErrBadRequest = errors.New("missing argument")
	// ErrNotFound used when status code is 404 Not Found
	ErrNotFound = errors.New("404 Not Found")
)
View Source
var (
	// ErrStructValidation is returned returned when given struct validation failed
	ErrStructValidation = errors.New("struct validation")
)

Functions

This section is empty.

Types

type ASMaps

type ASMaps interface {
	// NewAsMap creates a new AsMap object.
	NewAsMap(context.Context, string) *AsMap
	// NewASAssignment instantiates new Assignment struct.
	NewASAssignment(context.Context, *AsMap, int, string) *AsAssignment
	// 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 AsAssignment

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

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

func (asm *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 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 (cidr *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 {
	// NewCidrMap creates a new CidrMap object.
	NewCidrMap(context.Context, string) *CidrMap
	// NewCidrAssignment instantiates new Assignment struct.
	NewCidrAssignment(context.Context, *CidrMap, int, string) *CidrAssignment
	// ListCidrMaps retreieves 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 Cidrmap 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

func NewDatacenterBase

func NewDatacenterBase() *DatacenterBase

NewDatacenterBase returns a new DatacenterBase structure

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 {
	// NewDatacenterResponse instantiates a new DatacenterResponse structure.
	NewDatacenterResponse(context.Context) *DatacenterResponse
	// NewDatacenter creates a new Datacenter object.
	NewDatacenter(context.Context) *Datacenter
	// 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"`
}

The Domain data structure represents a GTM domain

func (*Domain) Validate

func (dom *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)
	// NewDomain is a utility function that creates a new Domain object.
	NewDomain(context.Context, string, string) *Domain
	// GetDomainStatus retrieves current status for the given domainname.
	//
	// 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:"-"`
}

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 (geo *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 {
	// NewGeoMap creates a new GeoMap object.
	NewGeoMap(context.Context, string) *GeoMap
	// NewGeoAssignment instantiates new Assignment struct.
	NewGeoAssignment(context.Context, *GeoMap, int, string) *GeoAssignment
	// 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"`
	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"`
	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"`
}

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

func (*LivenessTest) NewHttpHeader

func (lt *LivenessTest) NewHttpHeader() *HttpHeader

NewHttpHeader is a method applied to a livenesstest object that instantiates an HttpHeader object.

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

func NewLoadObject

func NewLoadObject() *LoadObject

NewLoadObject returns a new LoadObject structure

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, rsrc *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, rsrc *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, rsrc 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) NewASAssignment

func (p *Mock) NewASAssignment(ctx context.Context, as *AsMap, a int, b string) *AsAssignment

func (*Mock) NewAsMap

func (p *Mock) NewAsMap(ctx context.Context, mname string) *AsMap

func (*Mock) NewCidrAssignment

func (p *Mock) NewCidrAssignment(ctx context.Context, as *CidrMap, a int, b string) *CidrAssignment

func (*Mock) NewCidrMap

func (p *Mock) NewCidrMap(ctx context.Context, mname string) *CidrMap

func (*Mock) NewDatacenter

func (p *Mock) NewDatacenter(ctx context.Context) *Datacenter

func (*Mock) NewDatacenterResponse

func (p *Mock) NewDatacenterResponse(ctx context.Context) *DatacenterResponse

func (*Mock) NewDomain

func (p *Mock) NewDomain(ctx context.Context, _ string, _ string) *Domain

func (*Mock) NewGeoAssignment

func (p *Mock) NewGeoAssignment(ctx context.Context, as *GeoMap, a int, b string) *GeoAssignment

func (*Mock) NewGeoMap

func (p *Mock) NewGeoMap(ctx context.Context, mname string) *GeoMap

func (*Mock) NewLivenessTest

func (p *Mock) NewLivenessTest(ctx context.Context, a string, b string, c int, d float32) *LivenessTest

func (*Mock) NewProperty

func (p *Mock) NewProperty(ctx context.Context, prop string) *Property

func (*Mock) NewResource

func (p *Mock) NewResource(ctx context.Context, rname string) *Resource

func (*Mock) NewResourceInstance

func (p *Mock) NewResourceInstance(ctx context.Context, ri *Resource, a int) *ResourceInstance

func (*Mock) NewStaticRRSet

func (p *Mock) NewStaticRRSet(ctx context.Context) *StaticRRSet

func (*Mock) NewTrafficTarget

func (p *Mock) NewTrafficTarget(ctx context.Context) *TrafficTarget

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, rsrc *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 {
	// NewTrafficTarget is a method applied to a property object that instantiates a TrafficTarget object.
	NewTrafficTarget(context.Context) *TrafficTarget
	// NewStaticRRSet is a method applied to a property object that instantiates a StaticRRSet object.
	NewStaticRRSet(context.Context) *StaticRRSet
	// NewLivenessTest is a method applied to a property object that instantiates a LivenessTest object.
	NewLivenessTest(context.Context, string, string, int, float32) *LivenessTest
	// NewProperty creates a new Property object.
	NewProperty(context.Context, string) *Property
	// ListProperties retreieves 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 (prop *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 (rsrc *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 {
	// NewResourceInstance instantiates a new ResourceInstance.
	NewResourceInstance(context.Context, *Resource, int) *ResourceInstance
	// NewResource creates a new Resource object.
	NewResource(context.Context, string) *Resource
	// ListResources retreieves 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

func NewResponseStatus

func NewResponseStatus() *ResponseStatus

NewResponseStatus returns a new ResponseStatus struct

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

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