Documentation
¶
Index ¶
- Constants
- func CtyValueString(val cty.Value) (string, error)
- func CtyValueStringDefault(def string, val cty.Value) string
- func DiagnosticCode(diag *hcl.Diagnostic, code string) *hcl.Diagnostic
- func SetDiagnosticExtra(diag *hcl.Diagnostic, extra DiagnosticExtra)
- func SortParameters(lists []Parameter)
- type DiagnosticExtra
- type DiagnosticSeverityString
- type Diagnostics
- type FriendlyDiagnostic
- type HCLString
- type NullHCLString
- type Parameter
- type ParameterData
- type ParameterOption
- type ParameterStyling
- type ParameterType
- type ParameterValidation
- type Tag
- type TagBlock
- type TagBlocks
- type Tags
- type WorkspaceOwner
- type WorkspaceOwnerRBACRole
Constants ¶
const ( BlockTypeParameter = "coder_parameter" BlockTypeWorkspaceTag = "coder_workspace_tag" ValidationMonotonicIncreasing = "increasing" ValidationMonotonicDecreasing = "decreasing" )
@typescript-ignore BlockTypeParameter @typescript-ignore BlockTypeWorkspaceTag
const ( // DiagnosticCodeRequired is used when a parameter value is `null`, but // the parameter is required. DiagnosticCodeRequired = "required" )
const (
UnknownStringValue = ""
)
Variables ¶
This section is empty.
Functions ¶
func CtyValueString ¶
CtyValueString converts a cty.Value to a string. It supports only primitive types - bool, number, and string. As a special case, it also supports map[string]interface{} with key "value".
func CtyValueStringDefault ¶ added in v1.0.0
func DiagnosticCode ¶ added in v1.0.0
func DiagnosticCode(diag *hcl.Diagnostic, code string) *hcl.Diagnostic
func SetDiagnosticExtra ¶ added in v1.0.0
func SetDiagnosticExtra(diag *hcl.Diagnostic, extra DiagnosticExtra)
func SortParameters ¶
func SortParameters(lists []Parameter)
Types ¶
type DiagnosticExtra ¶ added in v1.0.0
type DiagnosticExtra struct {
Code string `json:"code"`
// If there was a previous extra, store it here for unwrapping.
Wrapped any
}
func ExtractDiagnosticExtra ¶ added in v1.0.0
func ExtractDiagnosticExtra(diag *hcl.Diagnostic) DiagnosticExtra
func (DiagnosticExtra) UnwrapDiagnosticExtra ¶ added in v1.0.0
func (e DiagnosticExtra) UnwrapDiagnosticExtra() interface{}
type DiagnosticSeverityString ¶
type DiagnosticSeverityString string
const ( DiagnosticSeverityError DiagnosticSeverityString = "error" DiagnosticSeverityWarning DiagnosticSeverityString = "warning" )
type Diagnostics ¶
type Diagnostics hcl.Diagnostics
Diagnostics is a JSON friendly form of hcl.Diagnostics. Data is lost when doing a json marshal.
func (Diagnostics) FriendlyDiagnostics ¶ added in v1.0.0
func (d Diagnostics) FriendlyDiagnostics() []FriendlyDiagnostic
func (Diagnostics) MarshalJSON ¶
func (d Diagnostics) MarshalJSON() ([]byte, error)
func (*Diagnostics) UnmarshalJSON ¶ added in v1.0.0
func (d *Diagnostics) UnmarshalJSON(data []byte) error
type FriendlyDiagnostic ¶
type FriendlyDiagnostic struct {
Severity DiagnosticSeverityString `json:"severity"`
Summary string `json:"summary"`
Detail string `json:"detail"`
Extra DiagnosticExtra `json:"extra"`
}
type HCLString ¶
type HCLString struct {
Value cty.Value
// ValueDiags are any diagnostics that occurred
// while evaluating the value
ValueDiags hcl.Diagnostics
// ValueExp is the underlying source expression
ValueExpr hcl.Expression
// Source is the literal hcl text that was parsed.
// This is a best effort, it may not be available.
Source *string
}
@typescript-ignore HCLString
func NullString ¶ added in v1.0.0
func NullString() HCLString
func StringLiteral ¶
func (HCLString) AsString ¶
AsString is a safe function. It will always return a string. The caller should check if this value is Valid and known before calling this function.
func (HCLString) MarshalJSON ¶
func (HCLString) NullHCLString ¶ added in v1.0.0
func (s HCLString) NullHCLString() NullHCLString
func (*HCLString) UnmarshalJSON ¶
type NullHCLString ¶
type Parameter ¶
type Parameter struct {
ParameterData
// Value is not immediately cast into a string.
// Value is not required at template import, so defer
// casting to a string until it is absolutely necessary.
Value HCLString `json:"value"`
// Diagnostics is used to store any errors that occur during parsing
// of the parameter.
Diagnostics Diagnostics `json:"diagnostics"`
}
type ParameterData ¶
type ParameterData struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Type ParameterType `json:"type"`
FormType provider.ParameterFormType `json:"form_type"`
Styling ParameterStyling `json:"styling"`
Mutable bool `json:"mutable"`
DefaultValue HCLString `json:"default_value"`
Icon string `json:"icon"`
Options []*ParameterOption `json:"options"`
Validations []*ParameterValidation `json:"validations"`
Required bool `json:"required"`
// legacy_variable_name was removed (= 14)
Order int64 `json:"order"`
Ephemeral bool `json:"ephemeral"`
// Unexported fields, not always available.
Source *terraform.Block `json:"-"`
}
func (*ParameterData) CtyType ¶
func (r *ParameterData) CtyType() (cty.Type, error)
CtyType returns the cty.Type for the ParameterData. A fixed set of types are supported.
func (*ParameterData) Valid ¶ added in v1.0.0
func (r *ParameterData) Valid(value HCLString) hcl.Diagnostics
type ParameterOption ¶
type ParameterStyling ¶ added in v1.0.0
type ParameterType ¶
type ParameterType provider.OptionType
TODO: Just use the provider type directly.
const ( ParameterTypeString ParameterType = "string" ParameterTypeNumber ParameterType = "number" ParameterTypeBoolean ParameterType = "bool" ParameterTypeListString ParameterType = "list(string)" )
func (ParameterType) Valid ¶
func (t ParameterType) Valid() error
type ParameterValidation ¶
type TagBlocks ¶
type TagBlocks []TagBlock
@typescript-ignore TagBlocks
func (TagBlocks) UnusableTags ¶
type WorkspaceOwner ¶
type WorkspaceOwner struct {
ID string `json:"id" cty:"id"`
Name string `json:"name" cty:"name"`
FullName string `json:"full_name" cty:"full_name"`
Email string `json:"email" cty:"email"`
SSHPublicKey string `json:"ssh_public_key" cty:"ssh_public_key"`
// SSHPrivateKey is intentionally omitted for now, due to the security risk
// that exposing it poses.
// SSHPrivateKey string `json:"ssh_private_key" cty:"ssh_private_key"`
Groups []string `json:"groups" cty:"groups"`
// SessionToken is intentionally omitted for now, due to the security risk
// that exposing it poses.
// SessionToken string `json:"session_token" cty:"session_token"`
// OIDCAccessToken is intentionally omitted for now, due to the security risk
// that exposing it poses.
// OIDCAccessToken string `json:"oidc_access_token" cty:"oidc_access_token"`
LoginType string `json:"login_type" cty:"login_type"`
RBACRoles []WorkspaceOwnerRBACRole `json:"rbac_roles" cty:"rbac_roles"`
}
func (*WorkspaceOwner) ToCtyValue ¶
func (o *WorkspaceOwner) ToCtyValue() (cty.Value, error)