Skip to content
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

Implement map function #72

Open
qinqon opened this issue Dec 18, 2021 · 0 comments
Open

Implement map function #72

qinqon opened this issue Dec 18, 2021 · 0 comments
Labels
kind/enhancement New feature or request

Comments

@qinqon
Copy link
Member

qinqon commented Dec 18, 2021

Sometimes is needed to convert one list into other, usually this is done with map function that convert each list item into different one.

For example constructing port field for all the ethernet interfaces:

Cature
ethernet-ifaces: interfaces.type==ethernet

DesiredState

without JSON

port: "{{ capture.ethernet-ifaces.interfaces -> .name }}"

with JSON (it allos to add more fields to the returned item

port: "{{ capture.ethernet-ifaces.interfaces -> { "name": .name } }}"

This should convert the list of interfaces into a list of bridge/bond ports, if more than one attribute is needed json can be used.

@qinqon qinqon added the kind/enhancement New feature or request label Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant