From d01f1f723de5978a6ba2ca88b0a0a2086f87c5b9 Mon Sep 17 00:00:00 2001
From: Daniel Corbett <38925638+daniel-corbett@users.noreply.github.com>
Date: Wed, 27 Sep 2023 19:20:21 -0400
Subject: [PATCH] MINOR: add new comparison operators (>=, <=) (#199)
This commit adds the new comparison operators greaterEqual and
lesserEqual to the documentation. It also expands the rule validation
to support the new value type (valueInt).
---
docs/resources/corp_rule.md | 12 ++++++------
docs/resources/site_rule.md | 12 ++++++------
provider/lib.go | 2 +-
provider/resource_corp_rule.go | 6 +++---
provider/resource_site_rule.go | 6 +++---
5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/docs/resources/corp_rule.md b/docs/resources/corp_rule.md
index e63e3bb..2038c3b 100644
--- a/docs/resources/corp_rule.md
+++ b/docs/resources/corp_rule.md
@@ -89,10 +89,10 @@ Optional:
- `conditions` (Block Set, Max: 10) Conditions (see [below for nested schema](#nestedblock--conditions--conditions))
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.signalsciences.net/using-signal-sciences/features/rules/#request-fields)
@@ -106,10 +106,10 @@ Optional:
- `conditions` (Block Set, Max: 10) Conditions (see [below for nested schema](#nestedblock--conditions--conditions--conditions))
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.fastly.com/signalsciences/using-signal-sciences/rules/defining-rule-conditions/#fields)
@@ -122,10 +122,10 @@ Required:
Optional:
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.fastly.com/signalsciences/using-signal-sciences/rules/defining-rule-conditions/#fields)
## Import
diff --git a/docs/resources/site_rule.md b/docs/resources/site_rule.md
index 2aa6c31..deb0a21 100644
--- a/docs/resources/site_rule.md
+++ b/docs/resources/site_rule.md
@@ -198,10 +198,10 @@ Optional:
- `conditions` (Block Set, Max: 10) Conditions (see [below for nested schema](#nestedblock--conditions--conditions))
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.fastly.com/signalsciences/using-signal-sciences/rules/defining-rule-conditions/#fields)
@@ -215,10 +215,10 @@ Optional:
- `conditions` (Block Set, Max: 10) Conditions (see [below for nested schema](#nestedblock--conditions--conditions--conditions))
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.fastly.com/signalsciences/using-signal-sciences/rules/defining-rule-conditions/#fields)
@@ -231,10 +231,10 @@ Required:
Optional:
- `field` (String) types:
- - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueIp, signalType, value)
+ - single - (scheme, method, path, useragent, domain, ip, responseCode, agentname, paramname, paramvalue, country, name, valueString, valueInt, valueIp, signalType, value)
- multival - (signal, requestHeader, queryParameter, postParameter, requestCookie, responseHeader)
- `group_operator` (String) type: group, multival - Conditions that must be matched when evaluating the request (all, any)
-- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
+- `operator` (String) type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)
- `value` (String) type: single - See request fields (https://docs.fastly.com/signalsciences/using-signal-sciences/rules/defining-rule-conditions/#fields)
diff --git a/provider/lib.go b/provider/lib.go
index 8c02b09..63357b5 100644
--- a/provider/lib.go
+++ b/provider/lib.go
@@ -525,7 +525,7 @@ var siteImporter = schema.ResourceImporter{
var KnownSingleConditionFields = []string{
"scheme", "method", "path", "useragent", "domain", "ip", "responseCode", "agentname",
- "paramname", "paramvalue", "country", "name", "valueString", "valueIp", "signalType",
+ "paramname", "paramvalue", "country", "name", "valueString", "valueInt", "valueIp", "signalType",
"value",
}
diff --git a/provider/resource_corp_rule.go b/provider/resource_corp_rule.go
index 480def2..88a61de 100644
--- a/provider/resource_corp_rule.go
+++ b/provider/resource_corp_rule.go
@@ -90,7 +90,7 @@ func resourceCorpRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)",
Optional: true,
},
"group_operator": {
@@ -124,7 +124,7 @@ func resourceCorpRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)",
Optional: true,
},
"group_operator": {
@@ -157,7 +157,7 @@ func resourceCorpRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, inList, notInList)",
Optional: true,
},
"group_operator": {
diff --git a/provider/resource_site_rule.go b/provider/resource_site_rule.go
index dd90610..4c2272b 100644
--- a/provider/resource_site_rule.go
+++ b/provider/resource_site_rule.go
@@ -106,7 +106,7 @@ func resourceSiteRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
Optional: true,
},
"group_operator": {
@@ -139,7 +139,7 @@ func resourceSiteRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
Optional: true,
},
"group_operator": {
@@ -172,7 +172,7 @@ func resourceSiteRule() *schema.Resource {
},
"operator": {
Type: schema.TypeString,
- Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
+ Description: "type: single - (equals, doesNotEqual, contains, doesNotContain, greaterEqual, lesserEqual, like, notLike, exists, doesNotExist, matches, doesNotMatch, inList, notInList)",
Optional: true,
},
"group_operator": {