-
Notifications
You must be signed in to change notification settings - Fork 108
Add URL support to data_view field_formats #812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Adds support for `urlTemplate` and `labelTemplate` to data_views.field_formats - Amends API request build process to account for when some/any data_views.field_formats.attributes aren't passed in
💚 CLA has been signed |
internal/kibana/data_view/schema.go
Outdated
@@ -334,8 +340,15 @@ func dataViewFromResponse(resp data_views.DataViewResponseObjectDataView) apiDat | |||
|
|||
if params, ok := formatMap["params"]; ok { | |||
if paramsMap, ok := params.(map[string]interface{}); ok { | |||
fieldFormatParams := apiFieldFormatParams{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're never setting apiFormat.Params = &fieldFormatParams
here and so the params are always nil (this is causing the current test failures).
internal/kibana/data_view/schema.go
Outdated
Pattern string `tfsdk:"pattern" json:"pattern,omitempty"` | ||
Urltemplate string `tfsdk:"urltemplate" json:"urlTemplate,omitempty"` | ||
Labeltemplate string `tfsdk:"labeltemplate" json:"labelTemplate,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should potentially be *string
since they're optional in the schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what I was missing! Thanks for the assist. Changes made and pushed.
Co-authored-by: Toby Brain <[email protected]>
Co-authored-by: Toby Brain <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for taking the time to add this in to the provider!
* origin/main: fix package policy secrets (#821) chore(deps): update codecov/codecov-action digest to b9fd7d1 (#815) Bump release memory Switch to golang 1.23.2 in release Bump release memory Prepare release v0.11.8 (#810) Add key_id as an explicit attribute (#789) standalone-output resource (#811) Add URL support to data_view field_formats (#812) migrate fleet integration_policy to framework, fix secret churn (#797) Allow mappings to be unknown to support mappings defined in index templates (#803)
This PR adds support for the
urlTemplate
andlabelTemplate
attributes when specifying a field in a Data View as type URL, as well as adding functionality to account for when any availablefield_formats.params.attributes
don't exist.By specifying that all fields in
apiFieldFormatParams
are optional, other custom field format types (colour, key/value, etc.) can be added much easier.