func createCertPool(path string, extensions map[string]struct{}) (*x509.CertPool, error) {
	_, err := os.Stat(path)
	if err != nil {
		return nil, errors.Wrap(err, "unable to load certificates")
	}
	caFiles, err := ioutil.ReadDir(path)
	if err != nil {
		return nil, err
	}
	certPool := x509.NewCertPool()
	loadedCerts := 0
	for _, cert := range caFiles {
		if cert.IsDir() {
			continue
		}
		if _, ok := extensions[filepath.Ext(cert.Name())]; !ok {
			continue
		}
		pem, err := ioutil.ReadFile(filepath.Join(path, cert.Name()))
		if err != nil {
			continue
		}
		if certPool.AppendCertsFromPEM(pem) {
			loadedCerts++
		}
	}
	if loadedCerts == 0 {
		return nil, errors.New("no certificates were able to be successfully loaded")
	}
	return certPool, nil
}
createCertPool will attempt to load certificates into a certificate pool from a given directory.
Only files with an extension contained in the extension map are considered.
This function ignores any files that cannot be read successfully or cannot be added to the certPool
successfully.
package realis
import (
	"crypto/x509"
	"io/ioutil"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"github.com/paypal/gorealis/gen-go/apache/aurora"
	"github.com/pkg/errors"
)
const apiPath = "/api"
var ActiveStates = make(map[aurora.ScheduleStatus]bool)
var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool)
var LiveStates = make(map[aurora.ScheduleStatus]bool)
var TerminalStates = make(map[aurora.ScheduleStatus]bool)
var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
func TerminalUpdateStates() []aurora.JobUpdateStatus {
	return []aurora.JobUpdateStatus{
		aurora.JobUpdateStatus_ROLLED_FORWARD,
		aurora.JobUpdateStatus_ROLLED_BACK,
		aurora.JobUpdateStatus_ABORTED,
		aurora.JobUpdateStatus_ERROR,
		aurora.JobUpdateStatus_FAILED,
	}
}
var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
func init() {
	for _, status := range aurora.ACTIVE_STATES {
		ActiveStates[status] = true
	}
	for _, status := range aurora.SLAVE_ASSIGNED_STATES {
		SlaveAssignedStates[status] = true
	}
	for _, status := range aurora.LIVE_STATES {
		LiveStates[status] = true
	}
	for _, status := range aurora.TERMINAL_STATES {
		TerminalStates[status] = true
	}
	for _, status := range aurora.ACTIVE_JOB_UPDATE_STATES {
		ActiveJobUpdateStates[status] = true
	}
	for _, status := range aurora.AWAITNG_PULSE_JOB_UPDATE_STATES {
		AwaitingPulseJobUpdateStates[status] = true
	}
}