Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.48k stars 4.81k forks source link

[KeyVault] - Consider providing a type for ISO8601 durations #25003

Closed maorleger closed 1 year ago

maorleger commented 3 years ago

Key Rotation at the service level has and will continue to use to ISO8601 durations. Currently we use strings to represent these; however, this can be a source of confusion and errors as developers must author them by hand.

To alleviate such issues, consider (along with your language architects) whether it makes sense to provide a structure that can convert to and from ISO8601 durations. Initial thoughts on the API (in TS):

class Duration {
  static parse(input: string): Duration
  toISOString(): string

  years?: number
  months?: number
  weeks?: number 
  hours?: number
  minutes?: number
  seconds?: number
}

Duration.parse("P3Y6M4DT12H30M5S").toISOString() => "P3Y6M4DT12H30M5S"

But of course this will change per language, and some languages might not want this in which case feel free to close the issue.

heaths commented 2 years ago

After discussion, we'll not be doing this for .NET in time for the next release but will consider it in the future. For now, we'll keep the property type a string.

heaths commented 1 year ago

There's been enough push back on this I'm closing. We can always revisit if we get enough customer demand.