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

     1  package datastream
     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  	// DS is the ds api interface
    16  	DS interface {
    17  		Activation
    18  		Properties
    19  		Stream
    20  	}
    21  
    22  	ds struct {
    23  		session.Session
    24  	}
    25  
    26  	// Option defines a DS option
    27  	Option func(*ds)
    28  
    29  	// ClientFunc is a ds client new method, this can be used for mocking
    30  	ClientFunc func(sess session.Session, ops ...Option) DS
    31  )
    32  
    33  // Client returns a new ds Client instance with the specified controller
    34  func Client(sess session.Session, opts ...Option) DS {
    35  	c := &ds{
    36  		Session: sess,
    37  	}
    38  
    39  	for _, opt := range opts {
    40  		opt(c)
    41  	}
    42  	return c
    43  }
    44  
    45  // DelimiterTypePtr returns the address of the DelimiterType
    46  func DelimiterTypePtr(d DelimiterType) *DelimiterType {
    47  	return &d
    48  }