github.com/Axway/agent-sdk@v1.1.101/pkg/watchmanager/config.go (about)

     1  package watchmanager
     2  
     3  import (
     4  	"errors"
     5  )
     6  
     7  // Config - represents the config for watch service connection
     8  type Config struct {
     9  	Host        string
    10  	Port        uint32
    11  	TenantID    string
    12  	TokenGetter TokenGetter
    13  	UserAgent   string
    14  }
    15  
    16  func (c *Config) validateCfg() error {
    17  	if c == nil {
    18  		return errors.New("watch config not initialized")
    19  	}
    20  
    21  	if c.Host == "" {
    22  		return errors.New("invalid watch config: watch service host not specified")
    23  	}
    24  
    25  	if c.TenantID == "" {
    26  		return errors.New("invalid watch config: organization ID is not specified")
    27  	}
    28  
    29  	if c.TokenGetter == nil {
    30  		return errors.New("invalid watch config: token getter not configured")
    31  	}
    32  	return nil
    33  }