metal-cli icon indicating copy to clipboard operation
metal-cli copied to clipboard

provide simpler --termination-time interface

Open andy-v-h opened this issue 3 years ago • 4 comments

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.

andy-v-h avatar Jun 02 '21 15:06 andy-v-h

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

displague avatar Jun 02 '21 19:06 displague

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.

displague avatar Jun 22 '21 17:06 displague

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 avatar Sep 19 '21 06:09 colemickens

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

colemickens avatar Sep 19 '21 06:09 colemickens