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

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