@opensoha/contracts 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/auth/catalog_generated.go +2 -2
  2. package/auth/gateway_permissions_test.go +48 -0
  3. package/auth/permission-catalog.json +300 -1
  4. package/compat/consumer-revisions.json +1 -1
  5. package/compat/json-schema-ecosystem-0.1.0.json +1 -1
  6. package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
  7. package/fixtures/openapi/KubernetesAgentActionCheck/invalid/unproven-state.json +6 -0
  8. package/fixtures/openapi/KubernetesAgentActionCheck/valid/configured-denied.json +9 -0
  9. package/fixtures/openapi/KubernetesAgentActionProfile/invalid/wildcard.json +1 -0
  10. package/fixtures/openapi/KubernetesAgentActionProfile/valid/workbench.json +1 -0
  11. package/fixtures/openapi/KubernetesClusterRegistrationRequest/invalid/action-profile.json +3 -0
  12. package/fixtures/openapi/KubernetesClusterRegistrationRequest/valid/action-profile.json +5 -0
  13. package/fixtures/openapi/KubernetesNodeListEnvelope/invalid/condition-status-boolean.json +17 -0
  14. package/fixtures/openapi/KubernetesNodeListEnvelope/invalid/taint-effect-missing.json +16 -0
  15. package/fixtures/openapi/KubernetesNodeListEnvelope/valid/legacy-fields-absent.json +11 -0
  16. package/fixtures/openapi/KubernetesNodeListEnvelope/valid/no-taints.json +13 -0
  17. package/fixtures/openapi/KubernetesNodeListEnvelope/valid/ready-cordoned-tainted.json +28 -0
  18. package/fixtures/openapi/KubernetesNodeListEnvelope/valid/unknown-fields-null.json +13 -0
  19. package/fixtures/openapi/KubernetesTopologyCoverage/invalid/empty-as-success.json +5 -0
  20. package/fixtures/openapi/KubernetesTopologyCoverage/valid/not-installed.json +6 -0
  21. package/fixtures/openapi/KubernetesTopologyGraphEdge/invalid/negative-weight.json +8 -0
  22. package/fixtures/openapi/KubernetesTopologyGraphEdge/valid/zero-weight.json +20 -0
  23. package/fixtures/openapi/KubernetesTopologyGraphNode/invalid/fake-flow-kind.json +42 -0
  24. package/fixtures/openapi/KubernetesTopologyGraphNode/valid/rule.json +42 -0
  25. package/fixtures/openapi/KubernetesTopologySnapshot/invalid/raw-source-field.json +33 -0
  26. package/fixtures/openapi/KubernetesTopologySnapshot/valid/projected-source.json +32 -0
  27. package/fixtures/openapi/KubernetesTopologySnapshotRequest/invalid/arbitrary-gvr.json +8 -0
  28. package/fixtures/openapi/KubernetesTopologySnapshotRequest/valid/bounded-sources.json +11 -0
  29. package/fixtures/openapi/KubernetesTopologySourceQuery/invalid/cluster-namespace.json +4 -0
  30. package/fixtures/openapi/KubernetesTopologySourceQuery/valid/all-namespaces.json +4 -0
  31. package/fixtures/openapi/ResourceMonitoringPanel/invalid/unknown-quality.json +7 -0
  32. package/fixtures/openapi/ResourceMonitoringPanel/valid/not-collected.json +7 -0
  33. package/fixtures/openapi/ResourceMonitoringPoint/invalid/string-zero.json +4 -0
  34. package/fixtures/openapi/ResourceMonitoringPoint/valid/missing.json +4 -0
  35. package/fixtures/openapi/ResourceMonitoringPoint/valid/zero.json +4 -0
  36. package/fixtures/openapi/ResourceMonitoringView/invalid/raw-query.json +12 -0
  37. package/fixtures/openapi/ResourceMonitoringView/valid/unconfigured.json +12 -0
  38. package/gen/go/sohaapi/client.go +1 -1
  39. package/gen/go/sohaapi/kubernetes_monitoring_test.go +67 -0
  40. package/gen/go/sohaapi/types.go +1265 -228
  41. package/gen/ts/sohaapi/index.ts +1116 -1
  42. package/openapi/soha-api.json +2497 -302
  43. package/openapi/soha-api.yaml +732 -3
  44. package/openapi/spec_generated.go +3 -3
  45. package/openapi/spec_test.go +34 -0
  46. package/package.json +1 -1
  47. package/resource/agent_access.go +12 -0
  48. package/resource/agent_profiles.go +62 -0
  49. package/resource/agent_profiles_test.go +36 -0
  50. package/resource/kubernetes_kinds.go +73 -0
  51. package/resource/kubernetes_kinds_test.go +38 -0
  52. package/resource/models.go +23 -14
  53. package/resource/network_topology.go +166 -0
  54. package/resource/network_topology_projection.go +208 -0
  55. package/resource/network_topology_projection_test.go +53 -0
  56. package/resource/network_topology_test.go +51 -0
  57. package/resource/network_topology_validation.go +29 -0
  58. package/resource/node_drain.go +34 -0
  59. package/resource/resource_monitoring.go +99 -0
  60. package/resource/runtime/network_topology.go +232 -0
  61. package/resource/runtime/network_topology_test.go +62 -0
  62. package/resource/runtime/node_drain.go +124 -0
  63. package/resource/runtime/node_drain_test.go +95 -0
  64. package/resource/runtime/resource_edit.go +128 -0
  65. package/resource/runtime/resource_edit_test.go +183 -0
  66. package/resource/runtime/resource_monitoring.go +243 -0
  67. package/resource/runtime/resource_monitoring_test.go +88 -0
@@ -0,0 +1,42 @@
1
+ {
2
+ "id": "rule:route-uid:0",
3
+ "type": "rule",
4
+ "label": "api /",
5
+ "provider": "traefik",
6
+ "protocol": "HTTP",
7
+ "resolutionState": "resolved",
8
+ "resource": {
9
+ "clusterId": "cluster-a",
10
+ "apiVersion": "traefik.io/v1alpha1",
11
+ "kind": "IngressRoute",
12
+ "name": "api",
13
+ "namespace": "team-a",
14
+ "scopeMode": "namespace",
15
+ "uid": "route-uid",
16
+ "resourceVersion": "7"
17
+ },
18
+ "rule": {
19
+ "index": 0,
20
+ "matchGroups": [
21
+ [
22
+ {
23
+ "type": "host",
24
+ "operator": "exact",
25
+ "value": "api.example.test"
26
+ },
27
+ {
28
+ "type": "path",
29
+ "operator": "prefix",
30
+ "value": "/"
31
+ }
32
+ ]
33
+ ],
34
+ "tlsMode": "terminate"
35
+ },
36
+ "properties": [
37
+ {
38
+ "name": "source",
39
+ "value": "configuration"
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "version": "v1",
3
+ "sources": [
4
+ {
5
+ "coverage": {
6
+ "provider": "traefik",
7
+ "sourceId": "traefik.ingressroutes",
8
+ "state": "available",
9
+ "namespace": "team-a",
10
+ "supportedKinds": [
11
+ "IngressRoute"
12
+ ],
13
+ "observedAt": "2026-10-19T02:00:00Z"
14
+ },
15
+ "objects": [
16
+ {
17
+ "resource": {
18
+ "clusterId": "cluster-a",
19
+ "apiVersion": "traefik.io/v1alpha1",
20
+ "kind": "IngressRoute",
21
+ "name": "api",
22
+ "namespace": "team-a",
23
+ "scopeMode": "namespace",
24
+ "uid": "route-uid",
25
+ "resourceVersion": "7"
26
+ },
27
+ "content": "{}",
28
+ "originalManifest": "secret configuration must not cross the snapshot contract"
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "version": "v1",
3
+ "sources": [
4
+ {
5
+ "coverage": {
6
+ "provider": "traefik",
7
+ "sourceId": "traefik.ingressroutes",
8
+ "state": "available",
9
+ "namespace": "team-a",
10
+ "supportedKinds": [
11
+ "IngressRoute"
12
+ ],
13
+ "observedAt": "2026-10-19T02:00:00Z"
14
+ },
15
+ "objects": [
16
+ {
17
+ "resource": {
18
+ "clusterId": "cluster-a",
19
+ "apiVersion": "traefik.io/v1alpha1",
20
+ "kind": "IngressRoute",
21
+ "name": "api",
22
+ "namespace": "team-a",
23
+ "scopeMode": "namespace",
24
+ "uid": "route-uid",
25
+ "resourceVersion": "7"
26
+ },
27
+ "content": "{\"spec\": {\"routes\": [{\"match\": \"Host(`api.example.test`)\", \"services\": [{\"name\": \"api\", \"port\": 80}]}]}}"
28
+ }
29
+ ]
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "queries": [
3
+ {
4
+ "sourceId": "kubernetes.secrets",
5
+ "resource": "secrets"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "queries": [
3
+ {
4
+ "sourceId": "traefik.ingressroutes",
5
+ "namespace": "team-a"
6
+ },
7
+ {
8
+ "sourceId": "kubernetes.ingressclasses"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "sourceId": "kubernetes.ingressclasses",
3
+ "namespace": "team-a"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "sourceId": "traefik.ingressroutes",
3
+ "namespace": ""
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "key": "conntrack.entries",
3
+ "label": "Conntrack",
4
+ "unit": "count",
5
+ "quality": "unknown",
6
+ "series": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "key": "conntrack.entries",
3
+ "label": "Conntrack",
4
+ "unit": "count",
5
+ "quality": "not_collected",
6
+ "series": []
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "timestamp": "2026-10-19T00:00:00Z",
3
+ "value": "0"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "timestamp": "2026-10-19T00:00:00Z",
3
+ "value": null
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "timestamp": "2026-10-19T00:00:00Z",
3
+ "value": 0
4
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "clusterId": "c",
3
+ "view": "raw",
4
+ "from": "2026-10-18T23:00:00Z",
5
+ "to": "2026-10-19T00:00:00Z",
6
+ "stepSeconds": 60,
7
+ "generatedAt": "2026-10-19T00:00:00Z",
8
+ "snapshotQuality": "partial",
9
+ "unscheduledPendingPods": null,
10
+ "nodes": [],
11
+ "panels": []
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "clusterId": "c",
3
+ "view": "overview",
4
+ "from": "2026-10-18T23:00:00Z",
5
+ "to": "2026-10-19T00:00:00Z",
6
+ "stepSeconds": 60,
7
+ "generatedAt": "2026-10-19T00:00:00Z",
8
+ "snapshotQuality": "partial",
9
+ "unscheduledPendingPods": null,
10
+ "nodes": [],
11
+ "panels": []
12
+ }
@@ -16,7 +16,7 @@ import (
16
16
  "time"
17
17
  )
18
18
 
19
- const defaultUserAgent = "opensoha-contracts/0.1.24"
19
+ const defaultUserAgent = "opensoha-contracts/0.1.25"
20
20
 
21
21
  type Client struct {
22
22
  BaseURL string
@@ -0,0 +1,67 @@
1
+ package sohaapi
2
+
3
+ import (
4
+ "encoding/json"
5
+ "strings"
6
+ "testing"
7
+ )
8
+
9
+ func TestMonitoringDTOsKeepNullAndZeroDistinct(t *testing.T) {
10
+ var nullPoint, zeroPoint ResourceMonitoringPoint
11
+ if err := json.Unmarshal([]byte(`{"value":null}`), &nullPoint); err != nil {
12
+ t.Fatal(err)
13
+ }
14
+ if err := json.Unmarshal([]byte(`{"value":0}`), &zeroPoint); err != nil {
15
+ t.Fatal(err)
16
+ }
17
+ if nullPoint.Value != nil || zeroPoint.Value == nil || *zeroPoint.Value != 0 {
18
+ t.Fatal("null sample became zero")
19
+ }
20
+ var quantity ResourceMonitoringQuantity
21
+ if err := json.Unmarshal([]byte(`{"cpuCores":null,"memoryBytes":0,"podSlots":null}`), &quantity); err != nil {
22
+ t.Fatal(err)
23
+ }
24
+ if quantity.CPUCores != nil || quantity.MemoryBytes == nil || *quantity.MemoryBytes != 0 {
25
+ t.Fatal("nullable capacity lost")
26
+ }
27
+ zero := int64(0)
28
+ edge := KubernetesTopologyGraphEdge{Weight: &zero}
29
+ raw, err := json.Marshal(edge)
30
+ if err != nil || !strings.Contains(string(raw), `"weight":0`) {
31
+ t.Fatalf("zero weight omitted: %s %v", raw, err)
32
+ }
33
+ }
34
+ func TestPublishedCacheEnumNamesRemainSourceCompatible(t *testing.T) {
35
+ values := []string{
36
+ string(LLMCallLogCacheStatusBypass), string(LLMCallLogCacheStatusHit), string(LLMCallLogCacheStatusMiss), string(LLMCallLogCacheStatusStaleHit), string(LLMCallLogCacheStatusWrite), string(LLMCallLogCacheStatusWriteSkipped),
37
+ string(CreateAIGatewayAnthropicMessageParamsXSohaCacheModeBypass),
38
+ string(CreateAIGatewayCohereRerankParamsXSohaCacheModeBypass),
39
+ string(CreateAIGatewayGeminiGenerateContentParamsXSohaCacheModeBypass),
40
+ string(CreateAIGatewayGeminiInteractionsParamsXSohaCacheModeBypass),
41
+ string(CreateAIGatewayGeminiStreamGenerateContentParamsXSohaCacheModeBypass),
42
+ string(CreateAIGatewayOpenAIAudioSpeechParamsXSohaCacheModeBypass),
43
+ string(CreateAIGatewayOpenAIAudioTranscriptionParamsXSohaCacheModeBypass),
44
+ string(CreateAIGatewayOpenAIAudioTranslationParamsXSohaCacheModeBypass),
45
+ string(CreateAIGatewayOpenAIChatCompletionParamsXSohaCacheModeBypass),
46
+ string(CreateAIGatewayOpenAICompatibleProviderAudioSpeechParamsXSohaCacheModeBypass),
47
+ string(CreateAIGatewayOpenAICompatibleProviderAudioTranscriptionParamsXSohaCacheModeBypass),
48
+ string(CreateAIGatewayOpenAICompatibleProviderAudioTranslationParamsXSohaCacheModeBypass),
49
+ string(CreateAIGatewayOpenAICompatibleProviderChatCompletionParamsXSohaCacheModeBypass),
50
+ string(CreateAIGatewayOpenAICompatibleProviderEmbeddingParamsXSohaCacheModeBypass),
51
+ string(CreateAIGatewayOpenAICompatibleProviderImageEditParamsXSohaCacheModeBypass),
52
+ string(CreateAIGatewayOpenAICompatibleProviderImageGenerationParamsXSohaCacheModeBypass),
53
+ string(CreateAIGatewayOpenAICompatibleProviderImageVariationParamsXSohaCacheModeBypass),
54
+ string(CreateAIGatewayOpenAICompatibleProviderResponseParamsXSohaCacheModeBypass),
55
+ string(CreateAIGatewayOpenAIEmbeddingParamsXSohaCacheModeBypass),
56
+ string(CreateAIGatewayOpenAIImageEditParamsXSohaCacheModeBypass),
57
+ string(CreateAIGatewayOpenAIImageGenerationParamsXSohaCacheModeBypass),
58
+ string(CreateAIGatewayOpenAIImageVariationParamsXSohaCacheModeBypass),
59
+ string(CreateAIGatewayOpenAIResponseParamsXSohaCacheModeBypass),
60
+ string(SohaCacheModeHeaderBypass),
61
+ }
62
+ for _, value := range values {
63
+ if value == "" {
64
+ t.Fatal("empty published enum")
65
+ }
66
+ }
67
+ }