Skip to content

Commit 59ea231

Browse files
committed
adding back description field in rules in steering policies after service side fix
1 parent aedf539 commit 59ea231

File tree

6 files changed

+36
-25
lines changed

6 files changed

+36
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## 3.15.1 (Unreleased)
2+
3+
### Added
4+
- Adding description property to rules in Steering Policies in DNS
5+
26
## 3.15.0 (February 12, 2019)
37

48
### Added

oci/dns_steering_policy_resource.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,13 @@ func DnsSteeringPolicyResource() *schema.Resource {
222222
Computed: true,
223223
ForceNew: true,
224224
},
225-
/* @CODEGEN description is removed because the service does not return and there is a diff on every apply if specified
226225
"description": {
227226
Type: schema.TypeString,
228227
Optional: true,
229228
Computed: true,
230-
ForceNew: true,
229+
ForceNew: true,
231230
},
232-
*/
231+
233232
// Computed
234233
},
235234
},
@@ -1062,6 +1061,10 @@ func SteeringPolicyRuleToMap(obj oci_dns.SteeringPolicyRule) map[string]interfac
10621061
return nil
10631062
}
10641063

1064+
if obj.GetDescription() != nil {
1065+
result["description"] = *obj.GetDescription()
1066+
}
1067+
10651068
return result
10661069
}
10671070

oci/dns_steering_policy_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var (
7676
"rule_type": Representation{repType: Required, create: `FILTER`},
7777
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesFilterRuleTypeRepresentation},
7878
"default_answer_data": RepresentationGroup{Optional, steeringPolicyRulesDefaultAnswerDataFilterRuleTypeRepresentation},
79-
//"description": Representation{repType: Optional, create: `filter description`},
79+
"description": Representation{repType: Optional, create: `filter description`},
8080
}
8181
steeringPolicyRulesCasesFilterRuleTypeRepresentation = map[string]interface{}{
8282
"answer_data": RepresentationGroup{Optional, steeringPolicyRulesCasesAnswerDataFilterRuleTypeRepresentation},
@@ -91,9 +91,9 @@ var (
9191
"should_keep": Representation{repType: Optional, create: `false`},
9292
}
9393
steeringPolicyRulesHealthRuleTypeRepresentation = map[string]interface{}{
94-
"rule_type": Representation{repType: Required, create: `HEALTH`},
95-
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesHealthRuleTypeRepresentation},
96-
//"description": Representation{repType: Optional, create: `health description`},
94+
"rule_type": Representation{repType: Required, create: `HEALTH`},
95+
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesHealthRuleTypeRepresentation},
96+
"description": Representation{repType: Optional, create: `health description`},
9797
}
9898
steeringPolicyRulesCasesHealthRuleTypeRepresentation = map[string]interface{}{
9999
"case_condition": Representation{repType: Optional, create: `query.client.address in (subnet '198.51.100.0/24')`},
@@ -102,7 +102,7 @@ var (
102102
"rule_type": Representation{repType: Required, create: `LIMIT`},
103103
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesLimitRuleTypeRepresentation},
104104
"default_count": Representation{repType: Optional, create: `10`},
105-
//"description": Representation{repType: Optional, create: `limit description`},
105+
"description": Representation{repType: Optional, create: `limit description`},
106106
}
107107
steeringPolicyRulesCasesLimitRuleTypeRepresentation = map[string]interface{}{
108108
"case_condition": Representation{repType: Optional, create: `query.client.address in (subnet '198.51.100.0/24')`},
@@ -112,7 +112,7 @@ var (
112112
"rule_type": Representation{repType: Required, create: `PRIORITY`},
113113
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesPriorityRuleTypeRepresentation},
114114
"default_answer_data": RepresentationGroup{Optional, steeringPolicyRulesDefaultAnswerDataPriorityRuleTypeRepresentation},
115-
//"description": Representation{repType: Optional, create: `priority description`},
115+
"description": Representation{repType: Optional, create: `priority description`},
116116
}
117117
steeringPolicyRulesCasesPriorityRuleTypeRepresentation = map[string]interface{}{
118118
"answer_data": RepresentationGroup{Optional, steeringPolicyRulesCasesAnswerDataPriorityRuleTypeRepresentation},
@@ -130,7 +130,7 @@ var (
130130
"rule_type": Representation{repType: Required, create: `WEIGHTED`},
131131
"cases": RepresentationGroup{Optional, steeringPolicyRulesCasesWeightedRuleTypeRepresentation},
132132
"default_answer_data": RepresentationGroup{Optional, steeringPolicyRulesDefaultAnswerDataWeightedRuleTypeRepresentation},
133-
//"description": Representation{repType: Optional, create: `weighted description`},
133+
"description": Representation{repType: Optional, create: `weighted description`},
134134
}
135135
steeringPolicyRulesCasesWeightedRuleTypeRepresentation = map[string]interface{}{
136136
"answer_data": RepresentationGroup{Optional, steeringPolicyRulesCasesAnswerDataWeightedRuleTypeRepresentation},
@@ -214,17 +214,17 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
214214
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.#", "1"),
215215
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
216216
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.0.should_keep", "false"),
217-
//resource.TestCheckResourceAttr(resourceName, "rules.0.description", "filter description"),
217+
resource.TestCheckResourceAttr(resourceName, "rules.0.description", "filter description"),
218218
resource.TestCheckResourceAttr(resourceName, "rules.0.rule_type", "FILTER"),
219219
resource.TestCheckResourceAttr(resourceName, "rules.1.cases.#", "1"),
220220
resource.TestCheckResourceAttr(resourceName, "rules.1.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
221-
//resource.TestCheckResourceAttr(resourceName, "rules.1.description", "health description"),
221+
resource.TestCheckResourceAttr(resourceName, "rules.1.description", "health description"),
222222
resource.TestCheckResourceAttr(resourceName, "rules.1.rule_type", "HEALTH"),
223223
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.#", "1"),
224224
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
225225
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.0.count", "10"),
226226
resource.TestCheckResourceAttr(resourceName, "rules.2.default_count", "10"),
227-
//resource.TestCheckResourceAttr(resourceName, "rules.2.description", "limit description"),
227+
resource.TestCheckResourceAttr(resourceName, "rules.2.description", "limit description"),
228228
resource.TestCheckResourceAttr(resourceName, "rules.2.rule_type", "LIMIT"),
229229
resource.TestCheckResourceAttr(resourceName, "rules.3.cases.#", "1"),
230230
resource.TestCheckResourceAttr(resourceName, "rules.3.cases.0.answer_data.#", "1"),
@@ -234,7 +234,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
234234
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.#", "1"),
235235
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
236236
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.0.value", "10"),
237-
//resource.TestCheckResourceAttr(resourceName, "rules.3.description", "priority description"),
237+
resource.TestCheckResourceAttr(resourceName, "rules.3.description", "priority description"),
238238
resource.TestCheckResourceAttr(resourceName, "rules.3.rule_type", "PRIORITY"),
239239
resource.TestCheckResourceAttr(resourceName, "rules.4.cases.#", "1"),
240240
resource.TestCheckResourceAttr(resourceName, "rules.4.cases.0.answer_data.#", "1"),
@@ -244,7 +244,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
244244
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.#", "1"),
245245
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
246246
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.0.value", "10"),
247-
//resource.TestCheckResourceAttr(resourceName, "rules.4.description", "weighted description"),
247+
resource.TestCheckResourceAttr(resourceName, "rules.4.description", "weighted description"),
248248
resource.TestCheckResourceAttr(resourceName, "rules.4.rule_type", "WEIGHTED"),
249249
resource.TestCheckResourceAttr(resourceName, "template", "CUSTOM"),
250250
resource.TestCheckResourceAttr(resourceName, "ttl", "10"),
@@ -282,17 +282,17 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
282282
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.#", "1"),
283283
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
284284
resource.TestCheckResourceAttr(resourceName, "rules.0.default_answer_data.0.should_keep", "false"),
285-
//resource.TestCheckResourceAttr(resourceName, "rules.0.description", "filter description"),
285+
resource.TestCheckResourceAttr(resourceName, "rules.0.description", "filter description"),
286286
resource.TestCheckResourceAttr(resourceName, "rules.0.rule_type", "FILTER"),
287287
resource.TestCheckResourceAttr(resourceName, "rules.1.cases.#", "1"),
288288
resource.TestCheckResourceAttr(resourceName, "rules.1.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
289-
//resource.TestCheckResourceAttr(resourceName, "rules.1.description", "health description"),
289+
resource.TestCheckResourceAttr(resourceName, "rules.1.description", "health description"),
290290
resource.TestCheckResourceAttr(resourceName, "rules.1.rule_type", "HEALTH"),
291291
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.#", "1"),
292292
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
293293
resource.TestCheckResourceAttr(resourceName, "rules.2.cases.0.count", "10"),
294294
resource.TestCheckResourceAttr(resourceName, "rules.2.default_count", "10"),
295-
//resource.TestCheckResourceAttr(resourceName, "rules.2.description", "limit description"),
295+
resource.TestCheckResourceAttr(resourceName, "rules.2.description", "limit description"),
296296
resource.TestCheckResourceAttr(resourceName, "rules.2.rule_type", "LIMIT"),
297297
resource.TestCheckResourceAttr(resourceName, "rules.3.cases.#", "1"),
298298
resource.TestCheckResourceAttr(resourceName, "rules.3.cases.0.answer_data.#", "1"),
@@ -302,7 +302,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
302302
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.#", "1"),
303303
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
304304
resource.TestCheckResourceAttr(resourceName, "rules.3.default_answer_data.0.value", "10"),
305-
//resource.TestCheckResourceAttr(resourceName, "rules.3.description", "priority description"),
305+
resource.TestCheckResourceAttr(resourceName, "rules.3.description", "priority description"),
306306
resource.TestCheckResourceAttr(resourceName, "rules.3.rule_type", "PRIORITY"),
307307
resource.TestCheckResourceAttr(resourceName, "rules.4.cases.#", "1"),
308308
resource.TestCheckResourceAttr(resourceName, "rules.4.cases.0.answer_data.#", "1"),
@@ -312,7 +312,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
312312
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.#", "1"),
313313
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
314314
resource.TestCheckResourceAttr(resourceName, "rules.4.default_answer_data.0.value", "10"),
315-
//resource.TestCheckResourceAttr(resourceName, "rules.4.description", "weighted description"),
315+
resource.TestCheckResourceAttr(resourceName, "rules.4.description", "weighted description"),
316316
resource.TestCheckResourceAttr(resourceName, "rules.4.rule_type", "WEIGHTED"),
317317
resource.TestCheckResourceAttr(resourceName, "template", "CUSTOM"),
318318
resource.TestCheckResourceAttr(resourceName, "ttl", "11"),
@@ -399,17 +399,17 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
399399
resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.default_answer_data.#", "1"),
400400
resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
401401
resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.default_answer_data.0.should_keep", "false"),
402-
//resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.description", "filter description"),
402+
resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.description", "filter description"),
403403
resource.TestCheckResourceAttr(singularDatasourceName, "rules.0.rule_type", "FILTER"),
404404
resource.TestCheckResourceAttr(singularDatasourceName, "rules.1.cases.#", "1"),
405405
resource.TestCheckResourceAttr(singularDatasourceName, "rules.1.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
406-
//resource.TestCheckResourceAttr(singularDatasourceName, "rules.1.description", "health description"),
406+
resource.TestCheckResourceAttr(singularDatasourceName, "rules.1.description", "health description"),
407407
resource.TestCheckResourceAttr(singularDatasourceName, "rules.1.rule_type", "HEALTH"),
408408
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.cases.#", "1"),
409409
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.cases.0.case_condition", "query.client.address in (subnet '198.51.100.0/24')"),
410410
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.cases.0.count", "10"),
411411
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.default_count", "10"),
412-
//resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.description", "limit description"),
412+
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.description", "limit description"),
413413
resource.TestCheckResourceAttr(singularDatasourceName, "rules.2.rule_type", "LIMIT"),
414414
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.cases.#", "1"),
415415
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.cases.0.answer_data.#", "1"),
@@ -419,7 +419,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
419419
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.default_answer_data.#", "1"),
420420
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
421421
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.default_answer_data.0.value", "10"),
422-
//resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.description", "priority description"),
422+
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.description", "priority description"),
423423
resource.TestCheckResourceAttr(singularDatasourceName, "rules.3.rule_type", "PRIORITY"),
424424
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.cases.#", "1"),
425425
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.cases.0.answer_data.#", "1"),
@@ -429,7 +429,7 @@ func TestDnsSteeringPolicyResource_basic(t *testing.T) {
429429
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.default_answer_data.#", "1"),
430430
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.default_answer_data.0.answer_condition", "answer.name == 'sampler'"),
431431
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.default_answer_data.0.value", "10"),
432-
//resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.description", "weighted description"),
432+
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.description", "weighted description"),
433433
resource.TestCheckResourceAttr(singularDatasourceName, "rules.4.rule_type", "WEIGHTED"),
434434
resource.TestCheckResourceAttr(singularDatasourceName, "template", "CUSTOM"),
435435
resource.TestCheckResourceAttr(singularDatasourceName, "ttl", "11"),

website/docs/d/dns_steering_policies.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ The following attributes are exported:
8383
* `should_keep` - Keep the answer if the value is `true`.
8484
* `value` -
8585
* `default_count` - Defines a default count if `cases` is not defined for the rule or a matching case does not define `count`. `defaultCount` is **not** applied if `cases` is defined and there are no matching cases.
86+
* `description` - Your description of the rule's purpose and/or behavior.
8687
* `rule_type` - The type of a rule determines its sorting/filtering behavior.
8788
* FILTER rules filter the list of answers (e.g., to remove those with hosts that are down for maintenance). Answers remain if and only if their associated data is `true`.
8889
* HEALTH rules remove answers from the list if their `rdata` matches a target in the health check monitor referenced by the steering policy and the target is reported down.

website/docs/d/dns_steering_policy.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The following attributes are exported:
5959
* `should_keep` - Keep the answer if the value is `true`.
6060
* `value` -
6161
* `default_count` - Defines a default count if `cases` is not defined for the rule or a matching case does not define `count`. `defaultCount` is **not** applied if `cases` is defined and there are no matching cases.
62+
* `description` - Your description of the rule's purpose and/or behavior.
6263
* `rule_type` - The type of a rule determines its sorting/filtering behavior.
6364
* FILTER rules filter the list of answers (e.g., to remove those with hosts that are down for maintenance). Answers remain if and only if their associated data is `true`.
6465
* HEALTH rules remove answers from the list if their `rdata` matches a target in the health check monitor referenced by the steering policy and the target is reported down.

website/docs/r/dns_steering_policy.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ The following arguments are supported:
9999
* `should_keep` - (Applicable when rule_type=FILTER) Keep the answer if the value is `true`.
100100
* `value` - (Required when rule_type=PRIORITY | WEIGHTED)
101101
* `default_count` - (Applicable when rule_type=LIMIT) Defines a default count if `cases` is not defined for the rule or a matching case does not define `count`. `defaultCount` is **not** applied if `cases` is defined and there are no matching cases.
102+
* `description` - (Optional) Your description of the rule's purpose and/or behavior.
102103
* `rule_type` - (Required) The type of a rule determines its sorting/filtering behavior.
103104
* FILTER rules filter the list of answers (e.g., to remove those with hosts that are down for maintenance). Answers remain if and only if their associated data is `true`.
104105
* HEALTH rules remove answers from the list if their `rdata` matches a target in the health check monitor referenced by the steering policy and the target is reported down.
@@ -151,6 +152,7 @@ The following attributes are exported:
151152
* `should_keep` - Keep the answer if the value is `true`.
152153
* `value` -
153154
* `default_count` - Defines a default count if `cases` is not defined for the rule or a matching case does not define `count`. `defaultCount` is **not** applied if `cases` is defined and there are no matching cases.
155+
* `description` - Your description of the rule's purpose and/or behavior.
154156
* `rule_type` - The type of a rule determines its sorting/filtering behavior.
155157
* FILTER rules filter the list of answers (e.g., to remove those with hosts that are down for maintenance). Answers remain if and only if their associated data is `true`.
156158
* HEALTH rules remove answers from the list if their `rdata` matches a target in the health check monitor referenced by the steering policy and the target is reported down.

0 commit comments

Comments
 (0)