Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorMessageFunc = function.New(&function.Spec{ Description: ` Given a reference to a step, error_message will return a string containing the first error message, if any. If there were no errors, it will return an empty string. This is useful for simple step primitives.`, Params: []function.Parameter{ { Name: "step", Type: cty.DynamicPseudoType, AllowUnknown: true, AllowDynamicType: true, AllowNull: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { if len(args) == 0 { return cty.StringVal(""), nil } val := args[0] valueMap := val.AsValueMap() if valueMap == nil { return cty.StringVal(""), nil } if valueMap["errors"].IsNull() { return cty.StringVal(""), nil } errors := valueMap["errors"].AsValueSlice() if len(errors) == 0 { return cty.StringVal(""), nil } firstError := errors[0] firstErrorMap := firstError.AsValueMap() return firstErrorMap[schema.AttributeTypeMessage], nil }, })
error_message: Given a reference to a step, error_message will return a string containing the first error message, if any. If there were no errors, it will return an empty string. This is useful for simple step primitives.
View Source
var IsErrorFunc = function.New(&function.Spec{ Description: `Given a reference to a step, is_error returns a boolean true if there are 1 or more errors, or false it there are no errors.`, Params: []function.Parameter{ { Name: "step", Type: cty.DynamicPseudoType, AllowUnknown: true, AllowDynamicType: true, AllowNull: true, }, }, Type: function.StaticReturnType(cty.Bool), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { val := args[0] valueMap := val.AsValueMap() if valueMap == nil { return cty.True, nil } if valueMap["errors"].IsNull() { return cty.False, nil } return cty.True, nil }, })
is_error: Given a reference to a step, is_error returns a boolean true if there are 1 or more errors, or false it there are no errors.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.