[FR] [DAC] Add support for Kibana spaces with names that do not match identifiers #4208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Issue link(s):
#4207
Summary - What I changed
When using the Kibana bulk actions API for DaC features with non-default spaces, the API call needs to use the identifier to correctly specify the correct space to push/pull rules from. However, the check to determine whether or not a space exists is done with the name rather than the identifier.
This PR updates the Kibana space id to be what is checked when determining if the space exists.
See the Kibana API Docs for an example return of what this code is parsing to see that both
id
andname
are provided.How To Test
E.g.
python -m detection_rules kibana --space Test-space --ignore-ssl-errors true import-rules -o
If the import is successful, then the fix is successfully applied.
Checklist
bug
,enhancement
,schema
,Rule: New
,Rule: Deprecation
,Rule: Tuning
,Hunt: New
, orHunt: Tuning
so guidelines can be generatedmeta:rapid-merge
label if planning to merge within 24 hoursContributor checklist