newrelic-cli icon indicating copy to clipboard operation
newrelic-cli copied to clipboard

fix(entity): refactor search command to convert params to query similar to TF

Open pranav-new-relic opened this issue 1 year ago • 1 comments

[WIP - incomplete solution, testing needed]

The aim of this code change: move away from GetEntitySearchWithContext to GetEntitySearchByQueryWithContext in the newrelic entity search command in the CLI, in order to

  • make it work similar to how it does in the newrelic_entity data source in Terraform; convert all specified parameters into a query and then retrieve the entity via the query, instead of building an input with all parameters.
  • fix an issue recently reported, in which the SERVICE type has been deprecated, owing to which the older method now throws an error as SERVICE is no longer an accepted type.

Update: This can fix 1292 as it would allow type/domain/other parameters to be fluid, and not confined to the values listed in their respective datatypes. 1292 describes the exact same issue (that was recently reported) mentioned above, with the SERVICE type, which seems to be appearing with types not listed in the API under type.

pranav-new-relic avatar Jul 28 '23 18:07 pranav-new-relic

Codecov Report

Merging #1490 (1e715e1) into main (fa29755) will decrease coverage by 0.04%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1490      +/-   ##
==========================================
- Coverage   47.85%   47.81%   -0.04%     
==========================================
  Files         122      122              
  Lines        7435     7441       +6     
==========================================
  Hits         3558     3558              
- Misses       3736     3742       +6     
  Partials      141      141              
Files Changed Coverage Δ
internal/entities/command_search.go 10.97% <0.00%> (-0.87%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Jul 28 '23 18:07 codecov[bot]