Last active
September 17, 2019 11:56
-
-
Save chriskuech/55cd9e534141b3459117511701a84986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cluster { | |
[ValidatePattern("^[A-z]+$")] | |
[string] $Service | |
[ValidateSet("TEST", "STAGE", "CANARY", "PROD")] | |
[string] $FlightingRing | |
[ValidateSet("EastUS", "WestUS", "NorthEurope")] | |
[string] $Region | |
[ValidateRange(0, 255)] | |
[int] $Index | |
Cluster([string] $id) { | |
$this.Service, $this.FlightingRing, $this.Region, $this.Index = $id -split "-" | |
} | |
} | |
[Cluster]"MyService-PROD-EastUS-2" |
Thanks!
you're welcome...your article on POSH classes was very helpful in my efforts at work yesterday.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apparently the github UI makes submitting a pull request hard for gist's...so the line:
$this.Service, $this.FlightingRing, $this.Region, $this.Index -split "-"
should be
$this.Service, $this.FlightingRing, $this.Region, $this.Index = $id -split "-"