fix(observability): remove invalid fields match and match_regex from main route in alert_config (#915)
* fix: remove invalid `match` and `match_regex` from main route in alert_config - deprecated `match` and `match_regex` in child routes - add new `matchers` field
This commit is contained in:
parent
433efa001c
commit
65c6106ea9
9 changed files with 157 additions and 111 deletions
|
|
@ -68,8 +68,6 @@ func fixtureRouteModel() basetypes.ObjectValue {
|
|||
}),
|
||||
"group_interval": types.StringValue("1m"),
|
||||
"group_wait": types.StringValue("1m"),
|
||||
"match": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"match_regex": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"receiver": types.StringValue("name"),
|
||||
"repeat_interval": types.StringValue("1m"),
|
||||
// "routes": types.ListNull(getRouteListType()),
|
||||
|
|
@ -79,10 +77,14 @@ func fixtureRouteModel() basetypes.ObjectValue {
|
|||
types.StringValue("label1"),
|
||||
types.StringValue("label2"),
|
||||
}),
|
||||
"group_interval": types.StringValue("1m"),
|
||||
"group_wait": types.StringValue("1m"),
|
||||
"match": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"match_regex": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"group_interval": types.StringValue("1m"),
|
||||
"group_wait": types.StringValue("1m"),
|
||||
"match": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"match_regex": types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")}),
|
||||
"matchers": types.ListValueMust(types.StringType, []attr.Value{
|
||||
types.StringValue("matcher1"),
|
||||
types.StringValue("matcher2"),
|
||||
}),
|
||||
"receiver": types.StringValue("name"),
|
||||
"repeat_interval": types.StringValue("1m"),
|
||||
}),
|
||||
|
|
@ -95,8 +97,6 @@ func fixtureNullRouteModel() basetypes.ObjectValue {
|
|||
"group_by": types.ListNull(types.StringType),
|
||||
"group_interval": types.StringNull(),
|
||||
"group_wait": types.StringNull(),
|
||||
"match": types.MapNull(types.StringType),
|
||||
"match_regex": types.MapNull(types.StringType),
|
||||
"receiver": types.StringNull(),
|
||||
"repeat_interval": types.StringNull(),
|
||||
"routes": types.ListNull(getRouteListType()),
|
||||
|
|
@ -171,8 +171,6 @@ func fixtureRoutePayload() *observability.UpdateAlertConfigsPayloadRoute {
|
|||
GroupBy: utils.Ptr([]string{"label1", "label2"}),
|
||||
GroupInterval: utils.Ptr("1m"),
|
||||
GroupWait: utils.Ptr("1m"),
|
||||
Match: &map[string]interface{}{"key": "value"},
|
||||
MatchRe: &map[string]interface{}{"key": "value"},
|
||||
Receiver: utils.Ptr("name"),
|
||||
RepeatInterval: utils.Ptr("1m"),
|
||||
Routes: &[]observability.UpdateAlertConfigsPayloadRouteRoutesInner{
|
||||
|
|
@ -182,6 +180,7 @@ func fixtureRoutePayload() *observability.UpdateAlertConfigsPayloadRoute {
|
|||
GroupWait: utils.Ptr("1m"),
|
||||
Match: &map[string]interface{}{"key": "value"},
|
||||
MatchRe: &map[string]interface{}{"key": "value"},
|
||||
Matchers: &[]string{"matcher1", "matcher2"},
|
||||
Receiver: utils.Ptr("name"),
|
||||
RepeatInterval: utils.Ptr("1m"),
|
||||
},
|
||||
|
|
@ -246,6 +245,7 @@ func fixtureRouteResponse() *observability.Route {
|
|||
GroupWait: utils.Ptr("1m"),
|
||||
Match: &map[string]string{"key": "value"},
|
||||
MatchRe: &map[string]string{"key": "value"},
|
||||
Matchers: &[]string{"matcher1", "matcher2"},
|
||||
Receiver: utils.Ptr("name"),
|
||||
RepeatInterval: utils.Ptr("1m"),
|
||||
Routes: &[]observability.RouteSerializer{
|
||||
|
|
@ -255,6 +255,7 @@ func fixtureRouteResponse() *observability.Route {
|
|||
GroupWait: utils.Ptr("1m"),
|
||||
Match: &map[string]string{"key": "value"},
|
||||
MatchRe: &map[string]string{"key": "value"},
|
||||
Matchers: &[]string{"matcher1", "matcher2"},
|
||||
Receiver: utils.Ptr("name"),
|
||||
RepeatInterval: utils.Ptr("1m"),
|
||||
},
|
||||
|
|
@ -300,13 +301,21 @@ func fixtureRouteAttributeSchema(route *schema.ListNestedAttribute, isDatasource
|
|||
},
|
||||
},
|
||||
"match": schema.MapAttribute{
|
||||
Description: routeDescriptions["match"],
|
||||
Optional: !isDatasource,
|
||||
Computed: isDatasource,
|
||||
ElementType: types.StringType,
|
||||
Description: routeDescriptions["match"],
|
||||
DeprecationMessage: "Use `matchers` in the `routes` instead.",
|
||||
Optional: !isDatasource,
|
||||
Computed: isDatasource,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"match_regex": schema.MapAttribute{
|
||||
Description: routeDescriptions["match_regex"],
|
||||
Description: routeDescriptions["match_regex"],
|
||||
DeprecationMessage: "Use `matchers` in the `routes` instead.",
|
||||
Optional: !isDatasource,
|
||||
Computed: isDatasource,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"matchers": schema.ListAttribute{
|
||||
Description: routeDescriptions["matchers"],
|
||||
Optional: !isDatasource,
|
||||
Computed: isDatasource,
|
||||
ElementType: types.StringType,
|
||||
|
|
@ -1484,6 +1493,7 @@ func TestGetRouteListTypeAux(t *testing.T) {
|
|||
"group_wait": types.StringType,
|
||||
"match": types.MapType{ElemType: types.StringType},
|
||||
"match_regex": types.MapType{ElemType: types.StringType},
|
||||
"matchers": types.ListType{ElemType: types.StringType},
|
||||
"receiver": types.StringType,
|
||||
"repeat_interval": types.StringType,
|
||||
},
|
||||
|
|
@ -1500,6 +1510,7 @@ func TestGetRouteListTypeAux(t *testing.T) {
|
|||
"group_wait": types.StringType,
|
||||
"match": types.MapType{ElemType: types.StringType},
|
||||
"match_regex": types.MapType{ElemType: types.StringType},
|
||||
"matchers": types.ListType{ElemType: types.StringType},
|
||||
"receiver": types.StringType,
|
||||
"repeat_interval": types.StringType,
|
||||
"routes": types.ListType{ElemType: types.ObjectType{AttrTypes: map[string]attr.Type{
|
||||
|
|
@ -1508,6 +1519,7 @@ func TestGetRouteListTypeAux(t *testing.T) {
|
|||
"group_wait": types.StringType,
|
||||
"match": types.MapType{ElemType: types.StringType},
|
||||
"match_regex": types.MapType{ElemType: types.StringType},
|
||||
"matchers": types.ListType{ElemType: types.StringType},
|
||||
"receiver": types.StringType,
|
||||
"repeat_interval": types.StringType,
|
||||
}}},
|
||||
|
|
@ -1525,6 +1537,7 @@ func TestGetRouteListTypeAux(t *testing.T) {
|
|||
"group_wait": types.StringType,
|
||||
"match": types.MapType{ElemType: types.StringType},
|
||||
"match_regex": types.MapType{ElemType: types.StringType},
|
||||
"matchers": types.ListType{ElemType: types.StringType},
|
||||
"receiver": types.StringType,
|
||||
"repeat_interval": types.StringType,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue