Skip to content

Commit

Permalink
patch - adding data_mode_type for data_table (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrNovo committed Mar 14, 2024
1 parent cf02210 commit 4a4aa5f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions coralogix/resource_coralogix_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ type DataTableModel struct {
RowStyle types.String `tfsdk:"row_style"`
Columns types.List `tfsdk:"columns"` //DataTableColumnModel
OrderBy *OrderByModel `tfsdk:"order_by"`
DataModeType types.String `tfsdk:"data_mode_type"`
}

type DataTableQueryLogsModel struct {
Expand Down Expand Up @@ -1246,6 +1247,15 @@ func (r *DashboardResource) Schema(_ context.Context, req resource.SchemaRequest
},
Optional: true,
},
"data_mode_type": schema.StringAttribute{
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf(dashboardValidDataModeTypes...),
},
Default: stringdefault.StaticString("unspecified"),
MarkdownDescription: fmt.Sprintf("The data mode type. Can be one of %q.", dashboardValidDataModeTypes),
},
},
Validators: []validator.Object{
objectvalidator.ExactlyOneOf(
Expand Down Expand Up @@ -4351,6 +4361,7 @@ func expandDataTable(ctx context.Context, table *DataTableModel) (*dashboards.Wi
RowStyle: dashboardRowStyleSchemaToProto[table.RowStyle.ValueString()],
Columns: columns,
OrderBy: expandOrderBy(table.OrderBy),
DataModeType: dashboardSchemaToProtoDataModeType[table.DataModeType.ValueString()],
},
},
}, nil
Expand Down Expand Up @@ -5849,6 +5860,7 @@ func widgetModelAttr() map[string]attr.Type {
"order_direction": types.StringType,
},
},
"data_mode_type": types.StringType,
},
},
"gauge": types.ObjectType{
Expand Down Expand Up @@ -6954,6 +6966,7 @@ func flattenLineChartQueryDefinition(ctx context.Context, definition *dashboards
ScaleType: types.StringValue(dashboardProtoToSchemaScaleType[definition.GetScaleType()]),
Name: wrapperspbStringToTypeString(definition.GetName()),
IsVisible: wrapperspbBoolToTypeBool(definition.GetIsVisible()),
ColorScheme: wrapperspbStringToTypeString(definition.GetColorScheme()),
Resolution: resolution,
DataModeType: types.StringValue(dashboardProtoToSchemaDataModeType[definition.GetDataModeType()]),
}, nil
Expand Down Expand Up @@ -7418,6 +7431,7 @@ func flattenDataTable(ctx context.Context, table *dashboards.DataTable) (*Widget
RowStyle: types.StringValue(dashboardRowStyleProtoToSchema[table.GetRowStyle()]),
Columns: columns,
OrderBy: flattenOrderBy(table.GetOrderBy()),
DataModeType: types.StringValue(dashboardProtoToSchemaDataModeType[table.GetDataModeType()]),
},
}, nil
}
Expand Down
3 changes: 2 additions & 1 deletion docs/data-sources/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Read-Only:

- `color_scheme` (String) The color scheme. Can be one of classic, severity, cold, negative, green, red, blue.
- `colors_by` (String)
- `data_mode_type` (String)
- `data_mode_type` (String) The data mode type. Can be one of ["unspecified" "archive"].
- `group_name_template` (String)
- `max_bars_per_chart` (Number)
- `query` (Attributes) (see [below for nested schema](#nestedatt--layout--sections--rows--widgets--definition--pie_chart--query))
Expand Down Expand Up @@ -562,6 +562,7 @@ Read-Only:
Read-Only:

- `columns` (Attributes List) (see [below for nested schema](#nestedatt--layout--sections--rows--widgets--definition--pie_chart--columns))
- `data_mode_type` (String)
- `order_by` (Attributes) (see [below for nested schema](#nestedatt--layout--sections--rows--widgets--definition--pie_chart--order_by))
- `query` (Attributes) (see [below for nested schema](#nestedatt--layout--sections--rows--widgets--definition--pie_chart--query))
- `results_per_page` (Number) The number of results to display per page.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ Required:
Optional:

- `columns` (Attributes List) (see [below for nested schema](#nestedatt--layout--sections--rows--id--definition--pie_chart--columns))
- `data_mode_type` (String) The data mode type. Can be one of ["unspecified" "archive"].
- `order_by` (Attributes) (see [below for nested schema](#nestedatt--layout--sections--rows--id--definition--pie_chart--order_by))

<a id="nestedatt--layout--sections--rows--id--definition--pie_chart--query"></a>
Expand Down

0 comments on commit 4a4aa5f

Please sign in to comment.