Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientPrivateKey ¶
type ClientPrivateKey struct {
*rsa.PrivateKey
}
func LoadClientPrivateKeyFromFile ¶
func LoadClientPrivateKeyFromFile(path string) (pk ClientPrivateKey, err error)
Loads a RSA private key from file, base64 decrypts the PEM, parses and returns an rsa.PrivateKey struct
func (*ClientPrivateKey) Sign ¶
func (pk *ClientPrivateKey) Sign(data []byte) (signed []byte, err error)
SHA256 hashes an array of bytes and signs it with the current private key
func (*ClientPrivateKey) SignatureForRequest ¶
func (pk *ClientPrivateKey) SignatureForRequest(time, httpMethod, httpUrl string) (signedBase64 string, err error)
Signs a request signature with the current private key
type ClientPrivateKeySigner ¶
type SystemClient ¶
type SystemClient struct {
Config map[string]interface{}
ConfigPath string
HttpClient http.Client
ClientKey ClientPrivateKey
ClientKeyPath string
SystemKey string
}
func NewSystemClient ¶
func NewSystemClient(configPath, clientKeyPath string) (client SystemClient, err error)
Returns a new system client with the loaded configuration file + client key, ready to sign and send API requests
func (*SystemClient) AssociateGroup ¶
func (c *SystemClient) AssociateGroup(groupId string) (result string, err error)
func (*SystemClient) Do ¶
func (c *SystemClient) Do(endpoint, httpMethod, body string) (resp *http.Response, err error)
Sends an API request to the endpoint specified for the system key
func (*SystemClient) LoadConfig ¶
func (c *SystemClient) LoadConfig() (err error)
Loads the jcagent.conf file from disk or wherever the systemClient is configured for
func (*SystemClient) LoadPrivateKey ¶
func (c *SystemClient) LoadPrivateKey() (err error)
Loads the client.key file from disk or wherever the systemClient is configured for
Click to show internal directories.
Click to hide internal directories.