metal-cli
metal-cli copied to clipboard
provide simpler --termination-time interface
What problem are you facing?
Having to do date math is cumbersome in a shell. While there are versions of date
that attempt to make it easier to add 2 hours to now
, it's not the most automation-friendly when you might have a different version of date
. Or one might try a perl
one-liner to manipulate a timestamp.
How could the Equinix Metal CLI help solve this problem?
the addition of a --ttl
flag that accepts an int64
for seconds would be far easier to build automation around.
This could benefit from the thinking that went into https://github.com/equinix/docker-machine-driver-metal/pull/59#discussion_r618735678
I was flipping through kong
docs as I'm considering how we could benefit from a move from kingpin
/ viper
in this project to kong
. Kong appears to support Parse and ParseDuration out of the box for timestamp fields.
For now some documentation about what format it's even expecting would be good. The params aren't even documented here https://metal.equinix.com/developers/api/devices/ so I can't really tell what I'm doing. Is it a UTC time? Is the CLI going to convert it? etc?
Actually, from an old script, seems like I was using something like this (again, may depend on the 'date' you have):
loc="ams1"; plan="c2.large.arm"; os="nixos_19_03"; price="0.5"; duration="6 hour";
termtime="$(TZ=UTC date --date="${duration}" --iso-8601=seconds)"