]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/zclconf/go-cty/cty/function/argument.go
Merge branch 'fix_read_test' of github.com:alexandreFre/terraform-provider-statuscake
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / zclconf / go-cty / cty / function / argument.go
CommitLineData
15c0b25d
AP
1package function
2
3import (
4 "github.com/zclconf/go-cty/cty"
5)
6
7// Parameter represents a parameter to a function.
8type Parameter struct {
9 // Name is an optional name for the argument. This package ignores this
10 // value, but callers may use it for documentation, etc.
11 Name string
12
13 // A type that any argument for this parameter must conform to.
14 // cty.DynamicPseudoType can be used, either at top-level or nested
15 // in a parameterized type, to indicate that any type should be
16 // permitted, to allow the definition of type-generic functions.
17 Type cty.Type
18
19 // If AllowNull is set then null values may be passed into this
20 // argument's slot in both the type-check function and the implementation
21 // function. If not set, such values are rejected by the built-in
22 // checking rules.
23 AllowNull bool
24
25 // If AllowUnknown is set then unknown values may be passed into this
26 // argument's slot in the implementation function. If not set, any
27 // unknown values will cause the function to immediately return
28 // an unkonwn value without calling the implementation function, thus
29 // freeing the function implementer from dealing with this case.
30 AllowUnknown bool
31
32 // If AllowDynamicType is set then DynamicVal may be passed into this
33 // argument's slot in the implementation function. If not set, any
34 // dynamic values will cause the function to immediately return
35 // DynamicVal value without calling the implementation function, thus
36 // freeing the function implementer from dealing with this case.
37 //
38 // Note that DynamicVal is also unknown, so in order to receive dynamic
39 // *values* it is also necessary to set AllowUnknown.
40 //
41 // However, it is valid to set AllowDynamicType without AllowUnknown, in
42 // which case a dynamic value may be passed to the type checking function
43 // but will not make it to the *implementation* function. Instead, an
44 // unknown value of the type returned by the type-check function will be
45 // returned. This is suggested for functions that have a static return
46 // type since it allows the return value to be typed even if the input
47 // values are not, thus improving the type-check accuracy of derived
48 // values.
49 AllowDynamicType bool
50}