util

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetEnv = os.Getenv

used in tests

Functions

func CheckConverionToAttrValue added in v0.6.0

func CheckConverionToAttrValue(t *testing.T, dt datasource.DataSource, attributeName string, attributeValue types.List)

Check conversion to attr.Value it should catch cases when e.g. the func under test returns types.List{}

func IsCurrentApmPlanEmpty

func IsCurrentApmPlanEmpty(res *models.ApmResourceInfo) bool

IsCurrentApmPlanEmpty checks the apm resource current plan is empty.

func IsCurrentEsPlanEmpty

func IsCurrentEsPlanEmpty(res *models.ElasticsearchResourceInfo) bool

IsCurrentEsPlanEmpty checks that the elasticsearch resource current plan is empty.

func IsCurrentEssPlanEmpty

func IsCurrentEssPlanEmpty(res *models.EnterpriseSearchResourceInfo) bool

IsCurrentEssPlanEmpty checks the enterprise search resource current plan is empty.

func IsCurrentIntegrationsServerPlanEmpty added in v0.4.0

func IsCurrentIntegrationsServerPlanEmpty(res *models.IntegrationsServerResourceInfo) bool

IsCurrentIntegrationsServerPlanEmpty checks the IntegrationsServer resource current plan is empty.

func IsCurrentKibanaPlanEmpty

func IsCurrentKibanaPlanEmpty(res *models.KibanaResourceInfo) bool

IsCurrentKibanaPlanEmpty checks the kibana resource current plan is empty.

func MemoryToState

func MemoryToState(mem int32) string

MemoryToState parses a megabyte int notation to a gigabyte notation.

func MultiGetenvOrDefault added in v0.6.0

func MultiGetenvOrDefault(keys []string, defaultValue string) string

MultiGetenvOrDefault returns the value of the first environment variable in the given list that has a non-empty value. If none of the environment variables have a value, the default value is returned.

func NewResourceData

func NewResourceData(t *testing.T, params ResDataParams) *schema.ResourceData

NewResourceData creates a ResourceData from a raw configuration map and schema.

func StringListAsType added in v0.6.0

func StringListAsType(in []string) types.List

func StringMapAsType added in v0.6.0

func StringMapAsType(in map[string]string) types.Map

func StringToBool added in v0.6.0

func StringToBool(str string) (bool, error)

func TrafficFilterNotFound

func TrafficFilterNotFound(err error) bool

TrafficFilterNotFound returns true when the error is a 404 or 403.

Types

type ResDataParams

type ResDataParams struct {
	// ID to set for the resource.
	ID string

	// The resource's schema.
	Schema map[string]*schema.Schema

	// The current resource state, to simulate a create or a case where no
	// previous state has been persisted, only State should be specified.
	State map[string]interface{}

	// The desired resource configuration, this is useful to simulate "update"
	// changes on a given resource.
	Change map[string]interface{}
}

ResDataParams holds the raw configuration for NewResourceData to consume

func (ResDataParams) Validate

func (params ResDataParams) Validate() error

Validate the parameters

type ResourceKind added in v0.6.0

type ResourceKind int
const (
	ApmResourceKind ResourceKind = iota
	ElasticsearchResourceKind
	EnterpriseSearchResourceKind
	IntegrationsServerResourceKind
	KibanaResourceKind
)

func (ResourceKind) Name added in v0.6.0

func (rk ResourceKind) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL