Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chriskuech
Last active September 17, 2019 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskuech/55cd9e534141b3459117511701a84986 to your computer and use it in GitHub Desktop.
Save chriskuech/55cd9e534141b3459117511701a84986 to your computer and use it in GitHub Desktop.
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"
@mmascolino
Copy link

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

@chriskuech
Copy link
Author

Thanks!

@mmascolino
Copy link

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