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

     1  // Package iam provides access to the Akamai Property APIs
     2  package iam
     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  	// IAM is the IAM api interface
    17  	IAM interface {
    18  		BlockedProperties
    19  		Groups
    20  		Roles
    21  		Support
    22  		UserLock
    23  		UserPassword
    24  		Users
    25  	}
    26  
    27  	iam struct {
    28  		session.Session
    29  	}
    30  
    31  	// Option defines a IAM option
    32  	Option func(*iam)
    33  
    34  	// ClientFunc is an IAM client new method, this can be used for mocking
    35  	ClientFunc func(sess session.Session, opts ...Option) IAM
    36  )
    37  
    38  // Client returns a new IAM Client instance with the specified controller
    39  func Client(sess session.Session, opts ...Option) IAM {
    40  	p := &iam{
    41  		Session: sess,
    42  	}
    43  
    44  	for _, opt := range opts {
    45  		opt(p)
    46  	}
    47  	return p
    48  }