equinix / metal-cli

Official Equinix Metal CLI
https://deploy.equinix.com/labs/metal-cli
MIT License
59 stars 46 forks source link

provide simpler --termination-time interface #127

Open andy-v-h opened 3 years ago

andy-v-h commented 3 years ago

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.

displague commented 3 years ago

This could benefit from the thinking that went into https://github.com/equinix/docker-machine-driver-metal/pull/59#discussion_r618735678

displague commented 3 years ago

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.

colemickens commented 3 years ago

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?

colemickens commented 3 years ago

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)"