github.com/akamai/AkamaiOPEN-edgegrid-golang/v4@v4.1.0/pkg/edgeworkers/edgeworkers.go (about) 1 // Package edgeworkers provides access to the Akamai EdgeWorkers and EdgeKV APIs 2 package edgeworkers 3 4 import ( 5 "errors" 6 7 "github.com/akamai/AkamaiOPEN-edgegrid-golang/v4/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 // Edgeworkers is the api interface for EdgeWorkers and EdgeKV 17 Edgeworkers interface { 18 Activations 19 Contracts 20 Deactivations 21 EdgeKVAccessTokens 22 EdgeKVInitialize 23 EdgeKVItems 24 EdgeKVNamespaces 25 EdgeWorkerIDs 26 EdgeWorkerVersions 27 PermissionGroups 28 Properties 29 Reports 30 ResourceTiers 31 SecureTokens 32 Validations 33 } 34 35 edgeworkers struct { 36 session.Session 37 } 38 39 // Option defines an Edgeworkers option 40 Option func(*edgeworkers) 41 42 // ClientFunc is a Edgeworkers client new method, this can be used for mocking 43 ClientFunc func(sess session.Session, opts ...Option) Edgeworkers 44 ) 45 46 // Client returns a new edgeworkers Client instance with the specified controller 47 func Client(sess session.Session, opts ...Option) Edgeworkers { 48 e := &edgeworkers{ 49 Session: sess, 50 } 51 52 for _, opt := range opts { 53 opt(e) 54 } 55 return e 56 }