func ConnectEnv() (*Credentials, error) {
	nodeIP, ok := os.LookupEnv("rubrik_cdm_node_ip")
	if ok != true {
		return nil, errors.New("The `rubrik_cdm_node_ip` environment variable is not present")
	}
	apiTokenFound := true
	apiToken, ok := os.LookupEnv("rubrik_cdm_token")
	if ok != true {
		apiTokenFound = false
	}
	var client *Credentials
	if apiTokenFound == false {
		username, ok := os.LookupEnv("rubrik_cdm_username")
		if ok != true {
			return nil, errors.New("The `rubrik_cdm_username` or `rubrik_cdm_token` environment variable is not present")
		}
		password, ok := os.LookupEnv("rubrik_cdm_password")
		if ok != true {
			return nil, errors.New("The `rubrik_cdm_password` or `rubrik_cdm_token` environment variable is not present")
		}
		client = &Credentials{
			NodeIP:   nodeIP,
			Username: username,
			Password: password,
		}
	} else {
		client = &Credentials{
			NodeIP:   nodeIP,
			APIToken: apiToken,
		}
	}
	return client, nil
}
ConnectEnv is the preferred method to initialize a new API client by attempting to read the
following environment variables:

rubrik_cdm_node_ip

rubrik_cdm_token

rubrik_cdm_username

rubrik_cdm_password

rubrik_cdm_token will always take precedence over rubrik_cdm_username and rubrik_cdm_password
package rubrikcdm
import (
	"bytes"
	"crypto/tls"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"os"
	"reflect"
	"sort"
	"time"
)
type encoding int
const (
	encodePath encoding = 1 + iota
	encodePathSegment
	encodeQueryComponent
)
type Credentials struct {
	NodeIP   string
	Username string
	Password string
	APIToken string
}
func Connect(nodeIP, username, password string, apiToken ...string) *Credentials {
	client := &Credentials{
		NodeIP:   nodeIP,
		Username: username,
		Password: password,
	}
	return client
}
func ConnectAPIToken(nodeIP, apiToken string) *Credentials {
	client := &Credentials{
		NodeIP:   nodeIP,
		APIToken: apiToken,
	}
	return client
}