github.com/akamai/AkamaiOPEN-edgegrid-golang/v2@v2.17.0/pkg/edgeworkers/edgeworkers.go (about) 1 package edgeworkers 2 3 import ( 4 "errors" 5 6 "github.com/akamai/AkamaiOPEN-edgegrid-golang/v2/pkg/session" 7 ) 8 9 var ( 10 // ErrStructValidation is returned when given struct validation failed 11 ErrStructValidation = errors.New("struct validation") 12 ) 13 14 type ( 15 // Edgeworkers is the api interface for EdgeWorkers and EdgeKV 16 Edgeworkers interface { 17 Activations 18 Contracts 19 Deactivations 20 EdgeKVAccessTokens 21 EdgeKVInitialize 22 EdgeKVItems 23 EdgeKVNamespaces 24 EdgeWorkerIDs 25 EdgeWorkerVersions 26 PermissionGroups 27 Properties 28 Reports 29 ResourceTiers 30 SecureTokens 31 Validations 32 } 33 34 edgeworkers struct { 35 session.Session 36 } 37 38 // Option defines an Edgeworkers option 39 Option func(*edgeworkers) 40 41 // ClientFunc is a Edgeworkers client new method, this can be used for mocking 42 ClientFunc func(sess session.Session, opts ...Option) Edgeworkers 43 ) 44 45 // Client returns a new edgeworkers Client instance with the specified controller 46 func Client(sess session.Session, opts ...Option) Edgeworkers { 47 e := &edgeworkers{ 48 Session: sess, 49 } 50 51 for _, opt := range opts { 52 opt(e) 53 } 54 return e 55 }