Skip to content

Commit

Permalink
add document
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyeqf committed Feb 8, 2023
1 parent 958417e commit bc99cb0
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 15 deletions.
8 changes: 4 additions & 4 deletions internal/services/sentinel/sentinel_alert_rule_anomaly.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type AnomalyRuleRequiredDataConnectorModel struct {
}

type AnomalyRuleMultiSelectModel struct {
SupportValues []string `tfschema:"support_values"`
SupportValues []string `tfschema:"supported_values"`
Values []string `tfschema:"values"`
Name string `tfschema:"name"`
Description string `tfschema:"description"`
Expand All @@ -38,7 +38,7 @@ func AnomalyRuleMultiSelectSchema() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Computed: true,
},
"support_values": {
"supported_values": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &schema.Schema{
Expand Down Expand Up @@ -89,7 +89,7 @@ func flattenSentinelAlertRuleAnomalyMultiSelect(input *[]azuresdkhacks.AnomalySe
type AnomalyRuleSingleSelectModel struct {
Name string `tfschema:"name"`
Description string `tfschema:"description"`
SupportValues []string `tfschema:"support_values"`
SupportValues []string `tfschema:"supported_values"`
Value string `tfschema:"value"`
}

Expand All @@ -107,7 +107,7 @@ func AnomalyRuleSingleSelectSchema() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Computed: true,
},
"support_values": {
"supported_values": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &schema.Schema{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type AlertRuleAnomalyBuiltInModel struct {
ThresholdObservation []AnomalyRuleThresholdModel `tfschema:"threshold_observation"`
MultiSelectObservation []AnomalyRuleMultiSelectModel `tfschema:"multi_select_observation"`
SingleSelectObservation []AnomalyRuleSingleSelectModel `tfschema:"single_select_observation"`
PrioritizedObservation []AnomalyRulePriorityModel `tfschema:"prioritized_observation"`
PrioritizedObservation []AnomalyRulePriorityModel `tfschema:"prioritized_exclude_observation"`
}

type AlertRuleAnomalyBuiltInResource struct{}
Expand Down Expand Up @@ -156,10 +156,10 @@ func (r AlertRuleAnomalyBuiltInResource) Attributes() map[string]*schema.Schema
Type: pluginsdk.TypeString,
},
},
"multi_select_observation": AnomalyRuleMultiSelectSchema(),
"single_select_observation": AnomalyRuleSingleSelectSchema(),
"prioritized_observation": AnomalyRulePrioritySchema(),
"threshold_observation": AnomalyRuleThresholdSchema(),
"multi_select_observation": AnomalyRuleMultiSelectSchema(),
"single_select_observation": AnomalyRuleSingleSelectSchema(),
"prioritized_exclude_observation": AnomalyRulePrioritySchema(),
"threshold_observation": AnomalyRuleThresholdSchema(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type AlertRuleAnomalyDataSourceModel struct {
ThresholdObservation []AnomalyRuleThresholdModel `tfschema:"threshold_observation"`
MultiSelectObservation []AnomalyRuleMultiSelectModel `tfschema:"multi_select_observation"`
SingleSelectObservation []AnomalyRuleSingleSelectModel `tfschema:"single_select_observation"`
PrioritizedObservation []AnomalyRulePriorityModel `tfschema:"prioritized_observation"`
PrioritizedObservation []AnomalyRulePriorityModel `tfschema:"prioritized_exclude_observation"`
}

type AlertRuleAnomalyDataSource struct{}
Expand Down Expand Up @@ -138,10 +138,10 @@ func (a AlertRuleAnomalyDataSource) Attributes() map[string]*schema.Schema {
Type: pluginsdk.TypeString,
},
},
"multi_select_observation": AnomalyRuleMultiSelectSchema(),
"single_select_observation": AnomalyRuleSingleSelectSchema(),
"prioritized_observation": AnomalyRulePrioritySchema(),
"threshold_observation": AnomalyRuleThresholdSchema(),
"multi_select_observation": AnomalyRuleMultiSelectSchema(),
"single_select_observation": AnomalyRuleSingleSelectSchema(),
"prioritized_exclude_observation": AnomalyRulePrioritySchema(),
"threshold_observation": AnomalyRuleThresholdSchema(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestAccSentinelAlertRuleAnomalyDataSource_basicWithPrioritized(t *testing.T
check.That(data.ResourceName).Key("settings_definition_id").Exists(),
check.That(data.ResourceName).Key("tactics.#").HasValue("2"),
check.That(data.ResourceName).Key("techniques.#").HasValue("2"),
check.That(data.ResourceName).Key("prioritized_observation.#").HasValue("2"),
check.That(data.ResourceName).Key("prioritized_exclude_observation.#").HasValue("2"),
),
},
})
Expand Down
58 changes: 58 additions & 0 deletions website/docs/d/sentinel_alert_rule_anomaly.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `techniques` - A list of techniques of attacks by which to classify the rule.

* `multi_select_observation` - A list of `multi_select_observation` blocks as defined below.

* `single_select_observation` - A list of `single_select_observation` blocks as defined below.

* `prioritized_exclude_observation` - A list of `prioritized_exclude_observation` blocks as defined below.

* `threshold_observation` - A list of `threshold_observation` blocks as defined below.

---

A `required_data_connector` block exports the following:
Expand All @@ -93,6 +101,56 @@ A `required_data_connector` block exports the following:

* `data_types` - A list of data types of the required Data Connector.

---

A `multi_select_observation` block exports the following:

* `name` - The name of the multi select observation.

* `description` - The description of the multi select observation.

* `supported_values` - A list of supported values of the multi select observation.

* `values` - A list of values of the single select observation.

---

A `single_select_observation` block exports the following:

* `name` - The name of the single select observation.

* `description` - The description of the single select observation.

* `supported_values` - A list of supported values of the single select observation.

* `value` - The value of the multi select observation.

---

A `prioritized_exclude_observation` block exports the following:

* `name` - The name of the prioritized exclude observation.

* `description` - The description of the prioritized exclude observation.

* `prioritize` - The prioritized value per `description`.

* `exclude` - The excluded value per `description`.

---

A `threshold_observation` block exports the following:

* `name` - The name of the threshold observation.

* `description` - The description of the threshold observation.

* `max` - The max value of the threshold observation.

* `min` - The min value of the threshold observation.

* `value` - The value of the threshold observation.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down
59 changes: 59 additions & 0 deletions website/docs/r/sentinel_alert_rule_anomaly_built_in.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `customizable_observations` - The customizable observations of the Built-in Anomaly Alert Rule.

* `multi_select_observation` - A list of `multi_select_observation` blocks as defined below.

* `single_select_observation` - A list of `single_select_observation` blocks as defined below.

* `prioritized_exclude_observation` - A list of `prioritized_exclude_observation` blocks as defined below.

* `threshold_observation` - A list of `threshold_observation` blocks as defined below.

---

A `required_data_connector` block exports the following:
Expand All @@ -98,6 +106,57 @@ A `required_data_connector` block exports the following:

* `data_types` - A list of data types of the required Data Connector.


---

A `multi_select_observation` block exports the following:

* `name` - The name of the multi select observation.

* `description` - The description of the multi select observation.

* `supported_values` - A list of supported values of the multi select observation.

* `values` - A list of values of the single select observation.

---

A `single_select_observation` block exports the following:

* `name` - The name of the single select observation.

* `description` - The description of the single select observation.

* `supported_values` - A list of supported values of the single select observation.

* `value` - The value of the multi select observation.

---

A `prioritized_exclude_observation` block exports the following:

* `name` - The name of the prioritized exclude observation.

* `description` - The description of the prioritized exclude observation.

* `prioritize` - The prioritized value per `description`.

* `exclude` - The excluded value per `description`.

---

A `threshold_observation` block exports the following:

* `name` - The name of the threshold observation.

* `description` - The description of the threshold observation.

* `max` - The max value of the threshold observation.

* `min` - The min value of the threshold observation.

* `value` - The value of the threshold observation.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down

0 comments on commit bc99cb0

Please sign in to comment.