github.com/akamai/AkamaiOPEN-edgegrid-golang/v8@v8.1.0/pkg/gtm/gtm.go (about) 1 // Package gtm provides access to the Akamai GTM V1_4 APIs 2 // 3 // See: https://techdocs.akamai.com/gtm/reference/api 4 package gtm 5 6 import ( 7 "net/http" 8 9 "github.com/akamai/AkamaiOPEN-edgegrid-golang/v8/pkg/session" 10 ) 11 12 type ( 13 // GTM is the gtm api interface 14 GTM interface { 15 Domains 16 Properties 17 Datacenters 18 Resources 19 ASMaps 20 GeoMaps 21 CIDRMaps 22 } 23 24 gtm struct { 25 session.Session 26 } 27 28 // Option defines a GTM option 29 Option func(*gtm) 30 31 // ClientFunc is a gtm client new method, this can used for mocking 32 ClientFunc func(sess session.Session, opts ...Option) GTM 33 ) 34 35 // Client returns a new dns Client instance with the specified controller 36 func Client(sess session.Session, opts ...Option) GTM { 37 p := >m{ 38 Session: sess, 39 } 40 41 for _, opt := range opts { 42 opt(p) 43 } 44 return p 45 } 46 47 // Exec overrides the session.Exec to add dns options 48 func (g *gtm) Exec(r *http.Request, out interface{}, in ...interface{}) (*http.Response, error) { 49 return g.Session.Exec(r, out, in...) 50 }