diff --git a/go.mod b/go.mod index 305ee40b..d197908b 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/gophercloud/gophercloud/v2 v2.3.0 github.com/gophercloud/utils/v2 v2.0.0-20241209100706-e3a3b7c07d26 github.com/olekukonko/tablewriter v0.0.5 - github.com/sapcc/go-api-declarations v1.13.1 - github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b + github.com/sapcc/go-api-declarations v1.13.2 + github.com/sapcc/go-bits v0.0.0-20241218093949-097cd3204f32 github.com/sapcc/gophercloud-sapcc/v2 v2.0.2 github.com/spf13/cobra v1.8.1 ) diff --git a/go.sum b/go.sum index 70cafcca..2ec4b6f4 100644 --- a/go.sum +++ b/go.sum @@ -51,10 +51,10 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sapcc/go-api-declarations v1.13.1 h1:rovCnLscnoZaIZPWhohSYHzwwYjOnCPsRw3zwtu4tLI= -github.com/sapcc/go-api-declarations v1.13.1/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= -github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b h1:cM4EQms/mIYmB9/ZhxsbVHpINlDBAAf/PZ/ymXiiLXo= -github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b/go.mod h1:DrcK3N8lISMoxhS+e3pnrSyRZl83OGyNJdohpk9hjHo= +github.com/sapcc/go-api-declarations v1.13.2 h1:dPYYsjwKGObSAm6+K+dYCiLQWunYuWkywlZnuXfjsmk= +github.com/sapcc/go-api-declarations v1.13.2/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= +github.com/sapcc/go-bits v0.0.0-20241218093949-097cd3204f32 h1:sgH927I2gZFRAweadTfEwNGQBYJ2liSzM8euo98uQSU= +github.com/sapcc/go-bits v0.0.0-20241218093949-097cd3204f32/go.mod h1:hhH7PgcPklzzJdx1zMhv3KiMEnoCZV+pnapPRcgI7wk= github.com/sapcc/gophercloud-sapcc/v2 v2.0.2 h1:SxLVKQqm759bFYl4iDVU2ELys6fcLpsUqMtxv0s2Z6M= github.com/sapcc/gophercloud-sapcc/v2 v2.0.2/go.mod h1:c+guCOMR8/sGXDus5VEVrjQ7pdmT7JEQaInJWysbBzQ= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= diff --git a/vendor/github.com/sapcc/go-api-declarations/liquid/availability_zone.go b/vendor/github.com/sapcc/go-api-declarations/liquid/availability_zone.go index 662d3d2b..b876f024 100644 --- a/vendor/github.com/sapcc/go-api-declarations/liquid/availability_zone.go +++ b/vendor/github.com/sapcc/go-api-declarations/liquid/availability_zone.go @@ -19,6 +19,8 @@ package liquid +import "slices" + // AvailabilityZone is the name of an availability zone. // Some special values are enumerated below. type AvailabilityZone string @@ -35,3 +37,14 @@ const ( func InAnyAZ[T any](value T) map[AvailabilityZone]*T { return map[AvailabilityZone]*T{AvailabilityZoneAny: &value} } + +// NormalizeAZ takes an AZ name as reported by an OpenStack service and safely casts it into the AvailabilityZone type. +// If the provided raw value is not equal to any of the AZs known to Limes (from the second list), AvailabilityZoneUnknown will be returned. +func NormalizeAZ(rawAZ string, allAZs []AvailabilityZone) AvailabilityZone { + az := AvailabilityZone(rawAZ) + if slices.Contains(allAZs, az) { + return az + } else { + return AvailabilityZoneUnknown + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 56359b45..dd76c0ad 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -91,7 +91,7 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# github.com/sapcc/go-api-declarations v1.13.1 +# github.com/sapcc/go-api-declarations v1.13.2 ## explicit; go 1.21 github.com/sapcc/go-api-declarations/bininfo github.com/sapcc/go-api-declarations/cadf @@ -100,7 +100,7 @@ github.com/sapcc/go-api-declarations/limes github.com/sapcc/go-api-declarations/limes/rates github.com/sapcc/go-api-declarations/limes/resources github.com/sapcc/go-api-declarations/liquid -# github.com/sapcc/go-bits v0.0.0-20241212142854-05ca4ed3590b +# github.com/sapcc/go-bits v0.0.0-20241218093949-097cd3204f32 ## explicit; go 1.23 github.com/sapcc/go-bits/gophercloudext github.com/sapcc/go-bits/gopherpolicy