github.com/akamai/AkamaiOPEN-edgegrid-golang/v8@v8.1.0/pkg/datastream/ds.go (about)

     1  // Package datastream provides access to the Akamai DataStream APIs
     2  //
     3  // See: https://techdocs.akamai.com/datastream2/reference/api
     4  package datastream
     5  
     6  import (
     7  	"errors"
     8  
     9  	"github.com/akamai/AkamaiOPEN-edgegrid-golang/v8/pkg/session"
    10  )
    11  
    12  var (
    13  	// ErrStructValidation is returned when given struct validation failed
    14  	ErrStructValidation = errors.New("struct validation")
    15  )
    16  
    17  type (
    18  	// DS is the ds api interface
    19  	DS interface {
    20  		Activation
    21  		Properties
    22  		Stream
    23  	}
    24  
    25  	ds struct {
    26  		session.Session
    27  	}
    28  
    29  	// Option defines a DS option
    30  	Option func(*ds)
    31  
    32  	// ClientFunc is a ds client new method, this can be used for mocking
    33  	ClientFunc func(sess session.Session, ops ...Option) DS
    34  )
    35  
    36  // Client returns a new ds Client instance with the specified controller
    37  func Client(sess session.Session, opts ...Option) DS {
    38  	c := &ds{
    39  		Session: sess,
    40  	}
    41  
    42  	for _, opt := range opts {
    43  		opt(c)
    44  	}
    45  	return c
    46  }
    47  
    48  // DelimiterTypePtr returns the address of the DelimiterType
    49  func DelimiterTypePtr(d DelimiterType) *DelimiterType {
    50  	return &d
    51  }