github.com/akamai/AkamaiOPEN-edgegrid-golang/v8@v8.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/v8/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  		Groups
    28  		PermissionGroups
    29  		Properties
    30  		Reports
    31  		ResourceTiers
    32  		SecureTokens
    33  		Validations
    34  	}
    35  
    36  	edgeworkers struct {
    37  		session.Session
    38  	}
    39  
    40  	// Option defines an Edgeworkers option
    41  	Option func(*edgeworkers)
    42  
    43  	// ClientFunc is a Edgeworkers client new method, this can be used for mocking
    44  	ClientFunc func(sess session.Session, opts ...Option) Edgeworkers
    45  )
    46  
    47  // Client returns a new edgeworkers Client instance with the specified controller
    48  func Client(sess session.Session, opts ...Option) Edgeworkers {
    49  	e := &edgeworkers{
    50  		Session: sess,
    51  	}
    52  
    53  	for _, opt := range opts {
    54  		opt(e)
    55  	}
    56  	return e
    57  }