From c0ce0abb415ca77d8fc968f723601fc9cb91c20e Mon Sep 17 00:00:00 2001 From: Konstantin Tikhonov Date: Mon, 11 Dec 2023 18:07:36 -0800 Subject: [PATCH] Addressed review comments --- docs/data-sources/dataset.md | 13 +++++------ docs/data-sources/monitor.md | 37 ++++++++++++++----------------- docs/resources/monitor.md | 6 ++--- observe/data_source_dataset.go | 3 +-- observe/data_source_monitor.go | 3 +-- observe/descriptions/monitor.yaml | 8 +++++++ observe/resource_monitor.go | 16 ++++++++----- 7 files changed, 45 insertions(+), 41 deletions(-) diff --git a/docs/data-sources/dataset.md b/docs/data-sources/dataset.md index 876cbf3b..5e9078d7 100644 --- a/docs/data-sources/dataset.md +++ b/docs/data-sources/dataset.md @@ -22,9 +22,6 @@ Fetches metadata for an existing Observe dataset. One of `name` or `id` must be set. - `name` (String) Dataset name. Must be unique within workspace. One of `name` or `id` must be set. If `name` is provided, `workspace` must be set. -- `stage` (Block List) A stage processes an input according to the provided pipeline. If no -input is provided, a stage will implicitly follow on from the result of -its predecessor. (see [below for nested schema](#nestedblock--stage)) - `workspace` (String) OID of the workspace this object is contained in. ### Read-Only @@ -41,15 +38,13 @@ should be used when referring to this object in terraform manifests. - `path_cost` (Number) Path cost incurred by this dataset when computing graph link. Increasing this value will reduce the preference for using this dataset when computing paths between two datasets. +- `stage` (Block List) A stage processes an input according to the provided pipeline. If no +input is provided, a stage will implicitly follow on from the result of +its predecessor. (see [below for nested schema](#nestedblock--stage)) ### Nested Schema for `stage` -Optional: - -- `output_stage` (Boolean) A boolean flag used to specify the output stage. Should be used only for -a stage preceding the last stage. The last stage is an output stage by default. - Read-Only: - `alias` (String) The stage alias is the label by which subsequent stages can refer to the @@ -58,4 +53,6 @@ results of this stage. the stage pipeline. It must refer to a label contained in `inputs`, or a previous stage `alias`. The stage input can be omitted if `inputs` contains a single element. +- `output_stage` (Boolean) A boolean flag used to specify the output stage. Should be used only for +a stage preceding the last stage. The last stage is an output stage by default. - `pipeline` (String) An OPAL snippet defining a transformation on the selected input. diff --git a/docs/data-sources/monitor.md b/docs/data-sources/monitor.md index b62cd3e4..d5d21eb3 100644 --- a/docs/data-sources/monitor.md +++ b/docs/data-sources/monitor.md @@ -22,9 +22,6 @@ One of `id` or `name` must be provided - `name` (String) Monitor name. Must be unique within workspace. One of `name` or `id` must be set. If `name` is provided, `workspace` must be set. - `rule` (Block List) (see [below for nested schema](#nestedblock--rule)) -- `stage` (Block List) A stage processes an input according to the provided pipeline. If no -input is provided, a stage will implicitly follow on from the result of -its predecessor. (see [below for nested schema](#nestedblock--stage)) - `workspace` (String) OID of the workspace this object is contained in. ### Read-Only @@ -40,6 +37,9 @@ stage pipelines. - `notification_spec` (Block List) (see [below for nested schema](#nestedblock--notification_spec)) - `oid` (String) OID (Observe ID) for this object. This is the canonical identifier that should be used when referring to this object in terraform manifests. +- `stage` (Block List) A stage processes an input according to the provided pipeline. If no +input is provided, a stage will implicitly follow on from the result of +its predecessor. (see [below for nested schema](#nestedblock--stage)) ### Nested Schema for `rule` @@ -126,13 +126,20 @@ Read-Only: - -### Nested Schema for `stage` + +### Nested Schema for `notification_spec` -Optional: +Read-Only: -- `output_stage` (Boolean) A boolean flag used to specify the output stage. Should be used only for -a stage preceding the last stage. The last stage is an output stage by default. +- `importance` (String) +- `merge` (String) +- `notify_on_close` (Boolean) +- `notify_on_reminder` (Boolean) +- `reminder_frequency` (String) + + + +### Nested Schema for `stage` Read-Only: @@ -142,16 +149,6 @@ results of this stage. the stage pipeline. It must refer to a label contained in `inputs`, or a previous stage `alias`. The stage input can be omitted if `inputs` contains a single element. +- `output_stage` (Boolean) A boolean flag used to specify the output stage. Should be used only for +a stage preceding the last stage. The last stage is an output stage by default. - `pipeline` (String) An OPAL snippet defining a transformation on the selected input. - - - -### Nested Schema for `notification_spec` - -Read-Only: - -- `importance` (String) -- `merge` (String) -- `notify_on_close` (Boolean) -- `notify_on_reminder` (Boolean) -- `reminder_frequency` (String) diff --git a/docs/resources/monitor.md b/docs/resources/monitor.md index 3d8b18e8..82fe2828 100644 --- a/docs/resources/monitor.md +++ b/docs/resources/monitor.md @@ -121,9 +121,9 @@ Required: Optional: - `compare_values` (List of Number) -- `expression_summary` (String) -- `log_stage_index` (Number) -- `source_log_dataset_id` (String) +- `expression_summary` (String) Short summary or comment of how the data for monitor is queried. +- `log_stage_index` (Number) An index of the stage that is used to generate logs for preview. This is usually a stage before aggregation. +- `source_log_dataset_id` (String) ID of the dataset that contains logs for preview. diff --git a/observe/data_source_dataset.go b/observe/data_source_dataset.go index 18793b7d..88630d78 100644 --- a/observe/data_source_dataset.go +++ b/observe/data_source_dataset.go @@ -107,8 +107,7 @@ func dataSourceDataset() *schema.Resource { }, "output_stage": { Type: schema.TypeBool, - Default: false, - Optional: true, + Computed: true, Description: descriptions.Get("transform", "schema", "stage", "output_stage"), }, }, diff --git a/observe/data_source_monitor.go b/observe/data_source_monitor.go index 8bb38678..d156d69c 100644 --- a/observe/data_source_monitor.go +++ b/observe/data_source_monitor.go @@ -105,8 +105,7 @@ func dataSourceMonitor() *schema.Resource { }, "output_stage": { Type: schema.TypeBool, - Default: false, - Optional: true, + Computed: true, Description: descriptions.Get("transform", "schema", "stage", "output_stage"), }, }, diff --git a/observe/descriptions/monitor.yaml b/observe/descriptions/monitor.yaml index f7310859..d1e6c1e4 100644 --- a/observe/descriptions/monitor.yaml +++ b/observe/descriptions/monitor.yaml @@ -26,3 +26,11 @@ schema: Whether notification reminders are enabled for this monitor. To enable them, set `reminder_frequency`. notify_on_close: | Enables a final update when a monitor notification is closed (no longer triggered). + rule: + log: + expression_summary: | + Short summary or comment of how the data for monitor is queried. + log_stage_index: | + An index of the stage that is used to generate logs for preview. This is usually a stage before aggregation. + source_log_dataset_id: | + ID of the dataset that contains logs for preview. \ No newline at end of file diff --git a/observe/resource_monitor.go b/observe/resource_monitor.go index 51b2eaf8..c95ffea5 100644 --- a/observe/resource_monitor.go +++ b/observe/resource_monitor.go @@ -374,16 +374,20 @@ func resourceMonitor() *schema.Resource { ValidateDiagFunc: validateTimeDuration, }, "expression_summary": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: descriptions.Get("monitor", "schema", "rule", "log", "expression_summary"), }, "log_stage_index": { - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + Description: descriptions.Get("monitor", "schema", "rule", "log", "log_stage_index"), }, "source_log_dataset_id": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: descriptions.Get("monitor", "schema", "rule", "log", "source_log_dataset_id"), + ValidateDiagFunc: validateOID(oid.TypeDataset), }, }, },