Documentation ¶
Index ¶
- Constants
- Variables
- func BrokersFromModelList(Brokers List, dd diag.Diagnostics) ([]map[string]any, diag.Diagnostics)
- func BrokersToModelList(elementType attr.Type, brokers []interface{}) List
- func FindKey[K comparable, V comparable](m map[K]V, value V) K
- func GetAttributeValue[T any](m map[string]attr.Value, name string) T
- func GetAttributesByLevel(level int) map[string]schema.Attribute
- func GetChildExpressionGroupTypeByLevel(level int) attr.Type
- func KafkaDestinationSASLToModel(types map[string]attr.Type, user_config map[string]interface{}) basetypes.ObjectValue
- func MapAnyFillMissingValues(attrs map[string]attr.Type, values map[string]any, optional_fields []string) map[string]attr.Value
- func MapAnyToMapValues(values map[string]any) map[string]attr.Value
- func MapKeys[K comparable, V any](m map[K]V) []K
- func MapValuesToMapAny(obj interface{}, dd *diag.Diagnostics) map[string]any
- func PopulateMissingMapValues(attrs map[string]attr.Type, result map[string]attr.Value)
- func PrintJSON(label string, obj any)
- func SetOptionalAttributeStringFromMap(target map[string]attr.Value, source map[string]any, names ...string)
- func SetOptionalStringFromAttributeMap(target map[string]any, attr_source_map map[string]attr.Value, names ...string)
- func SliceToStringListValue[T any](s []T) List
- func StringListValueToStringSlice(list List) []string
- func ToAttrTypes(attributes map[string]schema.Attribute) map[string]attr.Type
- func UnwindConditionalToModel(component map[string]any) ObjectValue
Constants ¶
const VRL_PARSER_APACHE = "apache_log"
const VRL_PARSER_CEF = "cef_log"
const VRL_PARSER_CSV = "csv_row"
const VRL_PARSER_GROK = "grok_parser"
const VRL_PARSER_KEY_VALUE = "key_value_log"
const VRL_PARSER_NGINX = "nginx_log"
const VRL_PARSER_REGEX = "regex_parser"
const VRL_PARSER_TIMESTAMP = "timestamp_parser"
Variables ¶
var APACHE_LOG_FORMATS = append(NGINX_LOG_FORMATS, "common")
var EncryptionAlgorithms = []string{
"AES-256-CFB",
"AES-192-CFB",
"AES-128-CFB",
"AES-256-OFB",
"AES-192-OFB",
"AES-128-OFB",
"AES-256-CTR",
"AES-192-CTR",
"AES-128-CTR",
"AES-256-CBC-PKCS7",
"AES-192-CBC-PKCS7",
"AES-128-CBC-PKCS7",
"AES-256-CBC-ANSIX923",
"AES-192-CBC-ANSIX923",
"AES-128-CBC-ANSIX923",
"AES-256-CBC-ISO7816",
"AES-192-CBC-ISO7816",
"AES-128-CBC-ISO7816",
"AES-256-CBC-ISO10126",
"AES-192-CBC-ISO10126",
"AES-128-CBC-ISO10126",
}
var ExpressionAttributes = map[string]schema.Attribute{ "field": schema.StringAttribute{ Required: true, Description: "The field path whose value will be used in the comparison", Validators: []validator.String{ stringvalidator.LengthAtLeast(1), }, }, "operator": schema.StringAttribute{ Required: true, Description: "The comparison operator", Validators: []validator.String{ stringvalidator.OneOf(Operators...), }, }, "value_string": schema.StringAttribute{ Optional: true, Description: "The operand to compare the field value with, when the value is a string", Validators: []validator.String{ stringvalidator.LengthAtLeast(1), stringvalidator.ConflictsWith( path.MatchRelative().AtParent().AtName("value_number"), ), }, }, "value_number": schema.Float64Attribute{ Optional: true, Description: "The operand to compare the field value with, when the value is a number", }, }
var ExpressionListAttribute = schema.ListNestedAttribute{ Optional: true, Description: "Defines a list of expressions for field comparisons", NestedObject: schema.NestedAttributeObject{ Attributes: ExpressionAttributes, }, Validators: []validator.List{ listvalidator.SizeAtLeast(1), listvalidator.ConflictsWith( path.MatchRelative().AtParent().AtName("expressions_group"), ), }, }
var ExpressionTypes = map[string]attr.Type{
"field": StringType{},
"operator": StringType{},
"value_number": Float64Type{},
"value_string": StringType{},
}
var LimitExceedAction = []string{
"drop_tag",
"drop_event",
}
var LogicalOperationAttribute = schema.StringAttribute{ Optional: true, Computed: true, Description: "The logical operation (AND/OR) to be applied to the list of conditionals", Validators: []validator.String{ stringvalidator.OneOf("AND", "OR"), }, }
var MAX_NESTED_LEVELS = 5
var MetricKind = []string{
"incremental",
"absolute",
}
var MetricType = []string{
"counter",
"sum",
"gauge",
}
var NGINX_LOG_FORMATS = []string{"combined", "error"}
var NestedExpressionAttribute = schema.NestedAttributeObject{ Attributes: ExpressionAttributes, }
var OPTIONAL_FIELDS_BY_PARSER = map[string][]string{
"apache_log": {"timestamp_format", "custom_timestamp_format"},
"csv_row": {"field_names"},
"key_value_log": {"field_delimiter", "key_delimiter"},
"nginx_log": {"timestamp_format", "custom_timestamp_format"},
"timestamp_parser": {"custom_format"},
}
var Operators = []string{
"contains",
"ends_with",
"equal",
"exists",
"greater",
"greater_or_equal",
"is_array",
"is_boolean",
"is_empty",
"is_ip_in_cidr_range",
"is_metric",
"is_null",
"is_number",
"is_object",
"is_string",
"less",
"less_or_equal",
"not_contains",
"not_equal",
"not_exists",
"not_regex_match",
"regex_match",
"starts_with",
}
var ParentConditionalAttribute = schema.SingleNestedAttribute{ Optional: true, Description: "A group of expressions (optionally nested) joined by a logical operator", Attributes: map[string]schema.Attribute{ "expressions": ExpressionListAttribute, "expressions_group": schema.ListNestedAttribute{ Optional: true, Description: "A group of expressions joined by a logical operator", NestedObject: getChildExpressionGroupAttributes(0), }, "logical_operation": LogicalOperationAttribute, }, }
var ReduceMergeStrategies = []string{
"array",
"shortest_array",
"longest_array",
"flat_unique",
"concat",
"concat_newline",
"concat_raw",
"discard",
"retain",
"min",
"max",
"sum",
}
var TagCardinalityMode = []string{
"exact",
"probabilistic",
}
var VRL_PARSERS = map[string]string{
"apache_log": "parse_apache_log",
"aws_alb_log": "parse_aws_alb_log",
"aws_cloudwatch_log": "parse_aws_cloudwatch_log_subscription_message",
"aws_vpc_flow_log": "parse_aws_vpc_flow_log",
"cef_log": "parse_cef",
"common_log": "parse_common_log",
"csv_row": "parse_csv",
"glog": "parse_glog",
"grok_parser": "parse_grok",
"int_parser": "parse_int",
"json_parser": "parse_json",
"key_value_log": "parse_key_value",
"klog": "parse_klog",
"linux_authorization_log": "parse_linux_authorization",
"nginx_log": "parse_nginx_log",
"querystring_parser": "parse_query_string",
"regex_parser": "parse_regex",
"syslog": "parse_syslog",
"timestamp_parser": "parse_timestamp",
"token_parser": "parse_tokens",
"url_parser": "parse_url",
"user_agent_parser": "parse_user_agent",
}
var VRL_PARSERS_WITH_REQUIRED_OPTIONS = []string{
"apache_log",
"grok_parser",
"regex_parser",
"nginx_log",
"timestamp_parser",
}
Functions ¶
func BrokersFromModelList ¶
func BrokersFromModelList(Brokers List, dd diag.Diagnostics) ([]map[string]any, diag.Diagnostics)
Kafka-specific functions, shared between multiple types
func BrokersToModelList ¶
func FindKey ¶
func FindKey[K comparable, V comparable](m map[K]V, value V) K
Returns the key for a given map, panicking when not found
func GetAttributeValue ¶
Gets a known attribute value from an attribute map and casts it to the provided type.
func MapAnyFillMissingValues ¶
func MapAnyFillMissingValues(attrs map[string]attr.Type, values map[string]any, optional_fields []string) map[string]attr.Value
Make a complete map of values, using a null-equivalent for any missing fields
func MapAnyToMapValues ¶
This function can help with taking an object from an API response and translating it into a basetype object from the terraform-plugin-framework
func MapKeys ¶
func MapKeys[K comparable, V any](m map[K]V) []K
Returns the keys of the provided map
func MapValuesToMapAny ¶
func MapValuesToMapAny(obj interface{}, dd *diag.Diagnostics) map[string]any
This function can receive a terraform object (as defined in their basetypes) and return a regular map[string]any object that can be used in `Component` such that it can be used in an API call.
func SetOptionalAttributeStringFromMap ¶
func SetOptionalAttributeStringFromMap(target map[string]attr.Value, source map[string]any, names ...string)
Sets one or more optional string attributes from a source map
func SetOptionalStringFromAttributeMap ¶
func SetOptionalStringFromAttributeMap(target map[string]any, attr_source_map map[string]attr.Value, names ...string)
Sets one or more optional string values from a attribute map into a target map
func SliceToStringListValue ¶
func SliceToStringListValue[T any](s []T) List
func StringListValueToStringSlice ¶
func StringListValueToStringSlice(list List) []string
func ToAttrTypes ¶
Given a map of schema (resource, data, etc) attributes, returns the attribute types
func UnwindConditionalToModel ¶ added in v1.0.4
Types ¶
This section is empty.