Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add Import / Export support to Targets #91

Open
zvikazend opened this issue Jun 27, 2016 · 0 comments
Open

add Import / Export support to Targets #91

zvikazend opened this issue Jun 27, 2016 · 0 comments

Comments

@zvikazend
Copy link
Contributor

Seems I'm setting up the same targets in multiple work machines, so I figured we might help admins to use a resource file, especially with automations. Let's over-architect this tiny feature into a monster! :)

Special usage

Mass-Update: export all targets, modify the exported resource, then import with override.
Flush and Load: first do a removeAllTargets to wipe the list, and then importTargets so we only have fresh target metadata

New Commands

importTargets

read resource file (according to output, csv, json, xml) into the ~/.zsapi.ini

Flags (Mandatory)

--targetsFile=/path/to/targets/file

Extra Flags

2 options to resolve conflicts with target names:
--prefer=old|new: where "old" will new target data and keep local, and "new" will override from import resource
...or...
--duplicates=keep|override: same as old|new
--format=json|xml|kv|auto (not sure what fits here, yet)
--hash=passkey: protect sensitive data with a hash - wrong hash will break format and fail operation
--backupFile=/path/to/targetsFileBackup: allow to backup before messing up the local targets

Return data

Imported targets list, reflecting which target was flushed/overwritten

exportTargets

drop targets to resource file, format is the normal output format

Flags (Mandatory)

--targetsFile=/path/to/targets/file

Extra Flags

--targetMatch='pattern*'|'target1,target55': If used, will only export selected targets. If not used, will export all targets
--hash=passkey: protect sensitive data with a hash - wrong hash will break format and fail operation
--output-format=json|xml|kv|auto

Return data

Exported targets list

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant