github.com/akamai/AkamaiOPEN-edgegrid-golang/v2@v2.17.0/pkg/hapi/hapi.go (about) 1 // Package hapi provides access to the Akamai Edge Hostnames APIs 2 package hapi 3 4 import ( 5 "errors" 6 7 "github.com/akamai/AkamaiOPEN-edgegrid-golang/v2/pkg/session" 8 ) 9 10 var ( 11 // ErrStructValidation is returned when given struct validation failed 12 ErrStructValidation = errors.New("struct validation") 13 ) 14 15 type ( 16 // HAPI is the hapi api interface 17 HAPI interface { 18 EdgeHostnames 19 } 20 21 hapi struct { 22 session.Session 23 } 24 25 // Option defines a HAPI option 26 Option func(*hapi) 27 28 // ClientFunc is a hapi client new method, this can be used for mocking 29 ClientFunc func(sess session.Session, opts ...Option) HAPI 30 ) 31 32 // Client returns a new hapi Client instance with the specified controller 33 func Client(sess session.Session, opts ...Option) HAPI { 34 h := &hapi{ 35 Session: sess, 36 } 37 38 for _, opt := range opts { 39 opt(h) 40 } 41 return h 42 }