provider

package
v2.4.0-pre0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MPL-2.0 Imports: 23 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ValidationMonotonicIncreasing = "increasing"
	ValidationMonotonicDecreasing = "decreasing"
)

Variables

View Source
var ScriptCRONParser = cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.DowOptional | cron.Descriptor)

Functions

func ExternalAuthAccessTokenEnvironmentVariable

func ExternalAuthAccessTokenEnvironmentVariable(id string) string

func IsPrebuildEnvironmentVariable added in v2.4.0

func IsPrebuildEnvironmentVariable() string

func New

func New() *schema.Provider

New returns a new Terraform provider.

func ParameterEnvironmentVariable

func ParameterEnvironmentVariable(name string) string

ParameterEnvironmentVariable returns the environment variable to specify for a parameter by it's name. It's hashed because spaces and special characters can be used in parameter names that may not be valid in env vars.

func ValidateFormType added in v2.4.0

func ValidateFormType(paramType OptionType, optionCount int, specifiedFormType ParameterFormType) (OptionType, ParameterFormType, error)

ValidateFormType handles the truth table for the valid set of `type` and `form_type` options. The OptionType is also returned because it is possible the 'type' of the 'value' & 'default' fields is different from the 'type' of the options. The use case is when using multi-select. The options are 'string' and the value is 'list(string)'.

Types

type Option

type Option struct {
	Name        string
	Description string
	Value       string
	Icon        string
}

type OptionType added in v2.4.0

type OptionType = string

OptionType is a type of option that can be used in the 'type' argument of a parameter. These should match types as defined in terraform:

https://developer.hashicorp.com/terraform/language/expressions/types

The value have to be string literals, as type constraint keywords are not supported in providers.

const (
	OptionTypeString     OptionType = "string"
	OptionTypeNumber     OptionType = "number"
	OptionTypeBoolean    OptionType = "bool"
	OptionTypeListString OptionType = "list(string)"
)

func OptionTypes added in v2.4.0

func OptionTypes() []OptionType

type Parameter

type Parameter struct {
	Value       string
	Name        string
	DisplayName string `mapstructure:"display_name"`
	Description string
	Type        OptionType
	FormType    ParameterFormType
	Mutable     bool
	Default     string
	Icon        string
	Option      []Option
	Validation  []Validation
	Optional    bool
	Order       int
	Ephemeral   bool
}

type ParameterFormType added in v2.4.0

type ParameterFormType string

ParameterFormType is the list of supported form types for display in the Coder "create workspace" form. These form types are functional as well as cosmetic. Refer to `formTypeTruthTable` for the allowed pairings. For example, "multi-select" has the type "list(string)" but the option values are "string".

const (
	ParameterFormTypeDefault     ParameterFormType = ""
	ParameterFormTypeRadio       ParameterFormType = "radio"
	ParameterFormTypeSlider      ParameterFormType = "slider"
	ParameterFormTypeInput       ParameterFormType = "input"
	ParameterFormTypeDropdown    ParameterFormType = "dropdown"
	ParameterFormTypeCheckbox    ParameterFormType = "checkbox"
	ParameterFormTypeSwitch      ParameterFormType = "switch"
	ParameterFormTypeMultiSelect ParameterFormType = "multi-select"
	ParameterFormTypeTagSelect   ParameterFormType = "tag-select"
	ParameterFormTypeTextArea    ParameterFormType = "textarea"
	ParameterFormTypeError       ParameterFormType = "error"
)

func ParameterFormTypes added in v2.4.0

func ParameterFormTypes() []ParameterFormType

ParameterFormTypes should be kept in sync with the enum list above.

type Validation

type Validation struct {
	Min         int
	MinDisabled bool `mapstructure:"min_disabled"`
	Max         int
	MaxDisabled bool `mapstructure:"max_disabled"`

	Monotonic string

	Regex string
	Error string
}

func (*Validation) Valid

func (v *Validation) Valid(typ OptionType, value string) error

type WorkspacePrebuild added in v2.4.0

type WorkspacePrebuild struct {
	Instances int `mapstructure:"instances"`
}

type WorkspacePreset added in v2.1.3

type WorkspacePreset struct {
	Name       string            `mapstructure:"name"`
	Parameters map[string]string `mapstructure:"parameters"`
	// There should always be only one prebuild block, but Terraform's type system
	// still parses them as a slice, so we need to handle it as such. We could use
	// an anonymous type and rd.Get to avoid a slice here, but that would not be possible
	// for utilities that parse our terraform output using this type. To remain compatible
	// with those cases, we use a slice here.
	Prebuilds []WorkspacePrebuild `mapstructure:"prebuilds"`
}

type WorkspaceTags

type WorkspaceTags struct {
	Tags map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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