diff --git a/go.mod b/go.mod index 5fb7e7ad..ffdd4813 100644 --- a/go.mod +++ b/go.mod @@ -10,9 +10,9 @@ require ( github.com/gorilla/mux v1.8.0 github.com/prometheus/client_golang v1.17.0 github.com/rs/cors v1.10.1 - github.com/sapcc/go-api-declarations v1.9.0 - github.com/sapcc/go-bits v0.0.0-20231025110038-7e644a44c112 - github.com/sapcc/gophercloud-sapcc v0.0.0-20231026032203-a84c0e0b876c + github.com/sapcc/go-api-declarations v1.10.3 + github.com/sapcc/go-bits v0.0.0-20231102041756-024a91cb6958 + github.com/sapcc/gophercloud-sapcc v0.0.0-20231102102650-abba1a38cc7d go.uber.org/automaxprocs v1.5.3 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 445e2007..d9176742 100644 --- a/go.sum +++ b/go.sum @@ -151,12 +151,12 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/sapcc/go-api-declarations v1.9.0 h1:IUCIo9gn6z6FnNY3DX5jaKb0Read2TlkcZQLXOSqCh8= -github.com/sapcc/go-api-declarations v1.9.0/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= -github.com/sapcc/go-bits v0.0.0-20231025110038-7e644a44c112 h1:BdPiGuN3Ht3W3TiZ+sjMYxic90ypqsO/DB2Z7YUeloQ= -github.com/sapcc/go-bits v0.0.0-20231025110038-7e644a44c112/go.mod h1:rfuD6L3QHx0JhZHGX8zEMPczStM25iI+GBKvCmWvLhk= -github.com/sapcc/gophercloud-sapcc v0.0.0-20231026032203-a84c0e0b876c h1:TAkW5yutkfFFrIehPDgYoIZyVzUM9UMMa6nxZbRyTHY= -github.com/sapcc/gophercloud-sapcc v0.0.0-20231026032203-a84c0e0b876c/go.mod h1:/3oIVy9wFbZaFM4qwkZkRYIOPTRmfpQExXvMCvHxNi4= +github.com/sapcc/go-api-declarations v1.10.3 h1:wFnq1Qx1Uv0G4F0AWT+9E4N/8n77Lm3buUpT9rFm/QY= +github.com/sapcc/go-api-declarations v1.10.3/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI= +github.com/sapcc/go-bits v0.0.0-20231102041756-024a91cb6958 h1:vRZqEQ84nmEv3EvgWc4loFzhweI7jehAJA7/pUPbhkM= +github.com/sapcc/go-bits v0.0.0-20231102041756-024a91cb6958/go.mod h1:j2BzxKE93wKhy7LLBwxeYQBDJcrw6EWZdXWUhjE3rHU= +github.com/sapcc/gophercloud-sapcc v0.0.0-20231102102650-abba1a38cc7d h1:UCJwrOVZh5bTBgbF3NFXp0ZZ9FHh8wY10t5PLEJDUSw= +github.com/sapcc/gophercloud-sapcc v0.0.0-20231102102650-abba1a38cc7d/go.mod h1:qAV7hbyjJ5ob/tKyP5jQxUf+YkezQwZOKSDuqrwTaIc= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= diff --git a/vendor/github.com/sapcc/go-api-declarations/limes/resources/metadata.go b/vendor/github.com/sapcc/go-api-declarations/limes/resources/metadata.go index 47f6804f..0119f129 100644 --- a/vendor/github.com/sapcc/go-api-declarations/limes/resources/metadata.go +++ b/vendor/github.com/sapcc/go-api-declarations/limes/resources/metadata.go @@ -88,6 +88,7 @@ const ( // The domain quota cannot be edited and is always reported equal to the // projects quota. CentralizedQuotaDistribution QuotaDistributionModel = "centralized" + // ^ NOTE: When removing this, also consider removing DefaultQuota from ProjectResourceReport. ) // CommitmentConfiguration describes how commitments are configured for a given resource. diff --git a/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_cluster.go b/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_cluster.go index a5da9c68..952d8c60 100644 --- a/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_cluster.go +++ b/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_cluster.go @@ -48,15 +48,18 @@ type ClusterServiceReport struct { type ClusterResourceReport struct { //Several fields are pointers to values to enable precise control over which fields are rendered in output. ResourceInfo - QuotaDistributionModel QuotaDistributionModel `json:"quota_distribution_model,omitempty"` - Capacity *uint64 `json:"capacity,omitempty"` - RawCapacity *uint64 `json:"raw_capacity,omitempty"` - CapacityPerAZ ClusterAvailabilityZoneReports `json:"per_availability_zone,omitempty"` - DomainsQuota *uint64 `json:"domains_quota,omitempty"` - Usage uint64 `json:"usage"` - BurstUsage uint64 `json:"burst_usage,omitempty"` - PhysicalUsage *uint64 `json:"physical_usage,omitempty"` - Subcapacities json.RawMessage `json:"subcapacities,omitempty"` + QuotaDistributionModel QuotaDistributionModel `json:"quota_distribution_model,omitempty"` + Capacity *uint64 `json:"capacity,omitempty"` + RawCapacity *uint64 `json:"raw_capacity,omitempty"` + //PerAZ is only rendered by Limes when the v2 API feature preview is enabled. + //In this case, CapacityPerAZ will be omitted. + PerAZ ClusterAZResourceReports `json:"per_az,omitempty"` + CapacityPerAZ ClusterAvailabilityZoneReports `json:"per_availability_zone,omitempty"` + DomainsQuota *uint64 `json:"domains_quota,omitempty"` + Usage uint64 `json:"usage"` + BurstUsage uint64 `json:"burst_usage,omitempty"` + PhysicalUsage *uint64 `json:"physical_usage,omitempty"` + Subcapacities json.RawMessage `json:"subcapacities,omitempty"` } // ClusterAvailabilityZoneReport is a substructure of ClusterResourceReport containing @@ -68,6 +71,22 @@ type ClusterAvailabilityZoneReport struct { Usage uint64 `json:"usage,omitempty"` } +// ClusterAZResourceReport is a substructure of ClusterResourceReport containing +// capacity and usage data for a single resource in an availability zone. +// +// This type is part of the v2 API feature preview. +type ClusterAZResourceReport struct { + Capacity uint64 `json:"capacity"` + RawCapacity uint64 `json:"raw_capacity,omitempty"` + //Usage is what the backend reports. This is only shown if the backend does indeed report a summarized cluster-wide usage level. + Usage *uint64 `json:"usage,omitempty"` + //ProjectsUsage is the aggregate of the usage across all projects, as reported by the backend on the project level. + ProjectsUsage uint64 `json:"projects_usage,omitempty"` + //PhysicalUsage is collected per project and then aggregated, same as ProjectsUsage. + PhysicalUsage *uint64 `json:"physical_usage,omitempty"` + Subcapacities json.RawMessage `json:"subcapacities,omitempty"` +} + // ClusterServiceReports provides fast lookup of services by service type, but // serializes to JSON as a list. type ClusterServiceReports map[string]*ClusterServiceReport @@ -79,3 +98,7 @@ type ClusterResourceReports map[string]*ClusterResourceReport // ClusterAvailabilityZoneReports provides fast lookup of availability zones // using a map, but serializes to JSON as a list. type ClusterAvailabilityZoneReports map[limes.AvailabilityZone]*ClusterAvailabilityZoneReport + +// ClusterAZResourceReport is a substructure of ClusterResourceReport that breaks +// down capacity and usage data for a single resource by availability zone. +type ClusterAZResourceReports map[limes.AvailabilityZone]*ClusterAZResourceReport diff --git a/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_project.go b/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_project.go index c60aae0c..6568c6cb 100644 --- a/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_project.go +++ b/vendor/github.com/sapcc/go-api-declarations/limes/resources/report_project.go @@ -55,20 +55,37 @@ type ProjectResourceReport struct { ResourceInfo QuotaDistributionModel QuotaDistributionModel `json:"quota_distribution_model,omitempty"` CommitmentConfig *CommitmentConfiguration `json:"commitment_config,omitempty"` - Quota *uint64 `json:"quota,omitempty"` - DefaultQuota *uint64 `json:"default_quota,omitempty"` - UsableQuota *uint64 `json:"usable_quota,omitempty"` - Usage uint64 `json:"usage"` - BurstUsage uint64 `json:"burst_usage,omitempty"` - PhysicalUsage *uint64 `json:"physical_usage,omitempty"` - BackendQuota *int64 `json:"backend_quota,omitempty"` - Subresources json.RawMessage `json:"subresources,omitempty"` - Scaling *ScalingBehavior `json:"scales_with,omitempty"` + //PerAZ is only rendered by Limes when the v2 API feature preview is enabled. + PerAZ ProjectAZResourceReports `json:"per_az,omitempty"` + Quota *uint64 `json:"quota,omitempty"` + DefaultQuota *uint64 `json:"default_quota,omitempty"` + UsableQuota *uint64 `json:"usable_quota,omitempty"` + Usage uint64 `json:"usage"` + BurstUsage uint64 `json:"burst_usage,omitempty"` + PhysicalUsage *uint64 `json:"physical_usage,omitempty"` + BackendQuota *int64 `json:"backend_quota,omitempty"` + Subresources json.RawMessage `json:"subresources,omitempty"` + Scaling *ScalingBehavior `json:"scales_with,omitempty"` //Annotations may contain arbitrary metadata that was configured for this //resource in this scope by Limes' operator. Annotations map[string]any `json:"annotations,omitempty"` } +// ProjectAZResourceReport is a substructure of ProjectResourceReport containing +// quota and usage data for a single resource in an availability zone. +// +// This type is part of the v2 API feature preview. +type ProjectAZResourceReport struct { + Quota *uint64 `json:"quota,omitempty"` + // The keys for the Committed map must be commitment durations as accepted + // by func ParseCommitmentDuration. We cannot use type CommitmentDuration + // directly here because Go does not allow struct types as map keys. + Committed map[string]uint64 `json:"committed,omitempty"` + Usage uint64 `json:"usage"` + PhysicalUsage *uint64 `json:"physical_usage,omitempty"` + Subresources json.RawMessage `json:"subresources,omitempty"` +} + // ProjectServiceReports provides fast lookup of services using a map, but serializes // to JSON as a list. type ProjectServiceReports map[string]*ProjectServiceReport @@ -76,3 +93,7 @@ type ProjectServiceReports map[string]*ProjectServiceReport // ProjectResourceReports provides fast lookup of resources using a map, but serializes // to JSON as a list. type ProjectResourceReports map[string]*ProjectResourceReport + +// ProjectAZResourceReport is a substructure of ProjectResourceReport that breaks +// down quota and usage data for a single resource by availability zone. +type ProjectAZResourceReports map[limes.AvailabilityZone]*ProjectAZResourceReport diff --git a/vendor/modules.txt b/vendor/modules.txt index cc14c4eb..5f9bc070 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -119,7 +119,7 @@ github.com/rabbitmq/amqp091-go # github.com/rs/cors v1.10.1 ## explicit; go 1.13 github.com/rs/cors -# github.com/sapcc/go-api-declarations v1.9.0 +# github.com/sapcc/go-api-declarations v1.10.3 ## explicit; go 1.21 github.com/sapcc/go-api-declarations/bininfo github.com/sapcc/go-api-declarations/cadf @@ -127,7 +127,7 @@ github.com/sapcc/go-api-declarations/castellum github.com/sapcc/go-api-declarations/internal/marshal github.com/sapcc/go-api-declarations/limes github.com/sapcc/go-api-declarations/limes/resources -# github.com/sapcc/go-bits v0.0.0-20231025110038-7e644a44c112 +# github.com/sapcc/go-bits v0.0.0-20231102041756-024a91cb6958 ## explicit; go 1.21 github.com/sapcc/go-bits/assert github.com/sapcc/go-bits/audittools @@ -147,7 +147,7 @@ github.com/sapcc/go-bits/promquery github.com/sapcc/go-bits/regexpext github.com/sapcc/go-bits/respondwith github.com/sapcc/go-bits/sqlext -# github.com/sapcc/gophercloud-sapcc v0.0.0-20231026032203-a84c0e0b876c +# github.com/sapcc/gophercloud-sapcc v0.0.0-20231102102650-abba1a38cc7d ## explicit; go 1.21 github.com/sapcc/gophercloud-sapcc/clients github.com/sapcc/gophercloud-sapcc/resources/v1/projects