# README

test_cfg

import "github.com/SuperBuker/terraform-provider-dns-he-net/test_cfg"

Index

func generateSubDomains

func generateSubDomains(template string, bound int, count int) []string

func init

func init()

type AccountCfg

AccountCfg contains the configuration for the account to use for testing. The account configuration can be loaded from a JSON file or from the DHN_ environment variables.

type AccountCfg struct {
    User     string `json:"user" env:"DNSHENET_USER"`
    Password string `json:"password" env:"DNSHENET_PASSWD"`
    OTP      string `json:"otp" env:"DNSHENET_OTP"`
    ID       string `json:"id" env:"DNSHENET_ACCOUNT_ID"`
}

func (AccountCfg) Auth

func (c AccountCfg) Auth(store_type auth.AuthStore) (auth.Auth, error)

Auth returns an auth.Auth instance for the account configuration.

func (AccountCfg) ProviderConfig

func (c AccountCfg) ProviderConfig(store_type string) string

ProviderConfig is a shared configuration to combine with the actual test configuration so the dns.he.net client is properly configured.

func (*AccountCfg) loadENV

func (c *AccountCfg) loadENV() error

loadENV loads the account configuration from the environment variables.

type DataSoucesTestCfg

type DataSoucesTestCfg struct {
    Account    AccountCfg           `json:"account"`
    Zone       ZoneCfg              `json:"zone"`
    ZonesCount uint                 `json:"zones_count"`
    Records    map[string]RecordCfg `json:"records"`
}

type RecordCfg

type RecordCfg struct {
    ID     uint   `json:"id"`
    Domain string `json:"domain"`
    Data   string `json:"data"`
    TTL    uint   `json:"ttl"`
}

type ResourceTestCfg

type ResourceTestCfg struct {
    Account AccountCfg `json:"account"`
    Zone    ZoneCfg    `json:"zone"`
}

type TestCfg

type TestCfg struct {
    DataSouces DataSoucesTestCfg `json:"datasources"`
    Resources  ResourceTestCfg   `json:"resources"`
}
var (
    // Config is a shared configuration to combine with the actual
    // test configuration so the dns.he.net client is properly configured.
    Config TestCfg
)

func (*TestCfg) Load

func (c *TestCfg) Load(path string) error

Load loads the test configuration from the JSON file.

type ZoneCfg

type ZoneCfg struct {
    ID   uint   `json:"id"`
    Name string `json:"name"`
}

func (ZoneCfg) RandSubs

func (c ZoneCfg) RandSubs(prefix string, bound int, count int) []string

func (ZoneCfg) Sub

func (c ZoneCfg) Sub(subdomain string) string

type uniqueRand

type uniqueRand struct {
    bound     uint
    generated map[int]struct{}
}

func newUniqueRand

func newUniqueRand(bound uint) *uniqueRand

func (*uniqueRand) Int

func (u *uniqueRand) Int() int

Generated by gomarkdoc