@opensoha/contracts 0.1.5 → 0.1.6
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.
- package/COMPATIBILITY.md +13 -0
- package/README.md +6 -0
- package/auth/catalog_generated.go +17 -0
- package/auth/catalog_test.go +53 -0
- package/auth/permission-catalog.json +10991 -0
- package/auth/permission-catalog.schema.json +74 -0
- package/compat/json-schema-ecosystem-0.1.0.json +1 -1
- package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
- package/fixtures/json-schema/permission-catalog/invalid/missing-action.json +18 -0
- package/fixtures/json-schema/permission-catalog/valid/minimal.json +19 -0
- package/fixtures/openapi/AccessRoleInput/invalid/missing-permissions.json +4 -0
- package/fixtures/openapi/AccessRoleInput/valid/granular-vm-operator.json +10 -0
- package/fixtures/openapi/AuthorizationDecision/invalid/missing-reason.json +7 -0
- package/fixtures/openapi/AuthorizationDecision/valid/deny-vm-delete.json +16 -0
- package/fixtures/openapi/PermissionCatalogEnvelope/invalid/invalid-hash.json +8 -0
- package/fixtures/openapi/PermissionCatalogEnvelope/valid/minimal.json +22 -0
- package/gen/go/sohaapi/client.go +1 -1
- package/gen/go/sohaapi/types.go +187 -0
- package/gen/ts/sohaapi/index.ts +320 -0
- package/openapi/soha-api.json +670 -1
- package/openapi/soha-api.yaml +253 -1
- package/openapi/spec_generated.go +3 -3
- package/package.json +7 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://contracts.opensoha.dev/auth/permission-catalog.schema.json",
|
|
4
|
+
"title": "OpenSoha Permission Catalog",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "catalogVersion", "contentHash", "permissions"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "authorization.opensoha.io/v1" },
|
|
10
|
+
"catalogVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
|
|
11
|
+
"contentHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
12
|
+
"permissions": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": { "$ref": "#/$defs/permission" }
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"$defs": {
|
|
19
|
+
"permission": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"required": [
|
|
23
|
+
"key",
|
|
24
|
+
"domain",
|
|
25
|
+
"resource",
|
|
26
|
+
"action",
|
|
27
|
+
"displayName",
|
|
28
|
+
"riskLevel",
|
|
29
|
+
"scopeKinds",
|
|
30
|
+
"approvalPolicy",
|
|
31
|
+
"status",
|
|
32
|
+
"assignable"
|
|
33
|
+
],
|
|
34
|
+
"properties": {
|
|
35
|
+
"key": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"pattern": "^[a-z][a-z0-9_-]*(?:\\.[a-z][a-z0-9_-]*)+$"
|
|
38
|
+
},
|
|
39
|
+
"domain": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" },
|
|
40
|
+
"resource": { "type": "string", "pattern": "^[a-z][a-z0-9_.-]*$" },
|
|
41
|
+
"action": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" },
|
|
42
|
+
"displayName": { "type": "string", "minLength": 1 },
|
|
43
|
+
"riskLevel": { "type": "string", "enum": ["read", "mutate", "execute", "high"] },
|
|
44
|
+
"scopeKinds": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"minItems": 1,
|
|
47
|
+
"uniqueItems": true,
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["tenant", "workspace", "cluster", "namespace", "project", "resource", "owner"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"approvalPolicy": { "type": "string", "enum": ["never", "eligible", "required"] },
|
|
54
|
+
"status": { "type": "string", "enum": ["active", "legacy"] },
|
|
55
|
+
"assignable": { "type": "boolean" },
|
|
56
|
+
"legacyAliases": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"uniqueItems": true,
|
|
59
|
+
"items": { "type": "string", "minLength": 1 }
|
|
60
|
+
},
|
|
61
|
+
"legacyCapabilities": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"uniqueItems": true,
|
|
64
|
+
"items": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" }
|
|
65
|
+
},
|
|
66
|
+
"replacedBy": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"uniqueItems": true,
|
|
69
|
+
"items": { "type": "string", "minLength": 1 }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "authorization.opensoha.io/v1",
|
|
3
|
+
"catalogVersion": "1.0.0",
|
|
4
|
+
"contentHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
5
|
+
"permissions": [
|
|
6
|
+
{
|
|
7
|
+
"key": "virtualization.vms.view",
|
|
8
|
+
"domain": "virtualization",
|
|
9
|
+
"resource": "vms",
|
|
10
|
+
"displayName": "View virtual machines",
|
|
11
|
+
"riskLevel": "read",
|
|
12
|
+
"scopeKinds": ["workspace", "resource"],
|
|
13
|
+
"approvalPolicy": "never",
|
|
14
|
+
"status": "active",
|
|
15
|
+
"assignable": true
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "authorization.opensoha.io/v1",
|
|
3
|
+
"catalogVersion": "1.0.0",
|
|
4
|
+
"contentHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
5
|
+
"permissions": [
|
|
6
|
+
{
|
|
7
|
+
"key": "virtualization.vms.view",
|
|
8
|
+
"domain": "virtualization",
|
|
9
|
+
"resource": "vms",
|
|
10
|
+
"action": "view",
|
|
11
|
+
"displayName": "View virtual machines",
|
|
12
|
+
"riskLevel": "read",
|
|
13
|
+
"scopeKinds": ["workspace", "resource"],
|
|
14
|
+
"approvalPolicy": "never",
|
|
15
|
+
"status": "active",
|
|
16
|
+
"assignable": true
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"status": "deny",
|
|
3
|
+
"permissionKey": "virtualization.vms.delete",
|
|
4
|
+
"action": "delete",
|
|
5
|
+
"resource": {
|
|
6
|
+
"type": "virtualization.vm",
|
|
7
|
+
"id": "vm-01",
|
|
8
|
+
"workspaceId": "default"
|
|
9
|
+
},
|
|
10
|
+
"effectiveScope": {
|
|
11
|
+
"workspaceIds": ["default"]
|
|
12
|
+
},
|
|
13
|
+
"reasonCode": "missing_permission",
|
|
14
|
+
"policyVersion": "authorization.opensoha.io/v1",
|
|
15
|
+
"allowedActions": ["view", "create", "resize"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"data": {
|
|
3
|
+
"schemaVersion": "authorization.opensoha.io/v1",
|
|
4
|
+
"catalogVersion": "1.0.0",
|
|
5
|
+
"contentHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
6
|
+
"permissions": [
|
|
7
|
+
{
|
|
8
|
+
"key": "virtualization.vms.resize",
|
|
9
|
+
"domain": "virtualization",
|
|
10
|
+
"resource": "vms",
|
|
11
|
+
"action": "resize",
|
|
12
|
+
"displayName": "Resize virtual machines",
|
|
13
|
+
"riskLevel": "mutate",
|
|
14
|
+
"scopeKinds": ["workspace", "resource"],
|
|
15
|
+
"approvalPolicy": "never",
|
|
16
|
+
"status": "active",
|
|
17
|
+
"assignable": true,
|
|
18
|
+
"legacyAliases": ["virtualization.vms.manage"]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
package/gen/go/sohaapi/client.go
CHANGED
package/gen/go/sohaapi/types.go
CHANGED
|
@@ -3837,6 +3837,102 @@ func (e OpenAIModelsResponseObject) Valid() bool {
|
|
|
3837
3837
|
}
|
|
3838
3838
|
}
|
|
3839
3839
|
|
|
3840
|
+
// Defines values for PermissionApprovalPolicy.
|
|
3841
|
+
const (
|
|
3842
|
+
PermissionApprovalPolicyEligible PermissionApprovalPolicy = "eligible"
|
|
3843
|
+
PermissionApprovalPolicyNever PermissionApprovalPolicy = "never"
|
|
3844
|
+
PermissionApprovalPolicyRequired PermissionApprovalPolicy = "required"
|
|
3845
|
+
)
|
|
3846
|
+
|
|
3847
|
+
// Valid indicates whether the value is a known member of the PermissionApprovalPolicy enum.
|
|
3848
|
+
func (e PermissionApprovalPolicy) Valid() bool {
|
|
3849
|
+
switch e {
|
|
3850
|
+
case PermissionApprovalPolicyEligible:
|
|
3851
|
+
return true
|
|
3852
|
+
case PermissionApprovalPolicyNever:
|
|
3853
|
+
return true
|
|
3854
|
+
case PermissionApprovalPolicyRequired:
|
|
3855
|
+
return true
|
|
3856
|
+
default:
|
|
3857
|
+
return false
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
// Defines values for PermissionRiskLevel.
|
|
3862
|
+
const (
|
|
3863
|
+
PermissionRiskLevelExecute PermissionRiskLevel = "execute"
|
|
3864
|
+
PermissionRiskLevelHigh PermissionRiskLevel = "high"
|
|
3865
|
+
PermissionRiskLevelMutate PermissionRiskLevel = "mutate"
|
|
3866
|
+
PermissionRiskLevelRead PermissionRiskLevel = "read"
|
|
3867
|
+
)
|
|
3868
|
+
|
|
3869
|
+
// Valid indicates whether the value is a known member of the PermissionRiskLevel enum.
|
|
3870
|
+
func (e PermissionRiskLevel) Valid() bool {
|
|
3871
|
+
switch e {
|
|
3872
|
+
case PermissionRiskLevelExecute:
|
|
3873
|
+
return true
|
|
3874
|
+
case PermissionRiskLevelHigh:
|
|
3875
|
+
return true
|
|
3876
|
+
case PermissionRiskLevelMutate:
|
|
3877
|
+
return true
|
|
3878
|
+
case PermissionRiskLevelRead:
|
|
3879
|
+
return true
|
|
3880
|
+
default:
|
|
3881
|
+
return false
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
// Defines values for PermissionScopeKind.
|
|
3886
|
+
const (
|
|
3887
|
+
PermissionScopeKindCluster PermissionScopeKind = "cluster"
|
|
3888
|
+
PermissionScopeKindNamespace PermissionScopeKind = "namespace"
|
|
3889
|
+
PermissionScopeKindOwner PermissionScopeKind = "owner"
|
|
3890
|
+
PermissionScopeKindProject PermissionScopeKind = "project"
|
|
3891
|
+
PermissionScopeKindResource PermissionScopeKind = "resource"
|
|
3892
|
+
PermissionScopeKindTenant PermissionScopeKind = "tenant"
|
|
3893
|
+
PermissionScopeKindWorkspace PermissionScopeKind = "workspace"
|
|
3894
|
+
)
|
|
3895
|
+
|
|
3896
|
+
// Valid indicates whether the value is a known member of the PermissionScopeKind enum.
|
|
3897
|
+
func (e PermissionScopeKind) Valid() bool {
|
|
3898
|
+
switch e {
|
|
3899
|
+
case PermissionScopeKindCluster:
|
|
3900
|
+
return true
|
|
3901
|
+
case PermissionScopeKindNamespace:
|
|
3902
|
+
return true
|
|
3903
|
+
case PermissionScopeKindOwner:
|
|
3904
|
+
return true
|
|
3905
|
+
case PermissionScopeKindProject:
|
|
3906
|
+
return true
|
|
3907
|
+
case PermissionScopeKindResource:
|
|
3908
|
+
return true
|
|
3909
|
+
case PermissionScopeKindTenant:
|
|
3910
|
+
return true
|
|
3911
|
+
case PermissionScopeKindWorkspace:
|
|
3912
|
+
return true
|
|
3913
|
+
default:
|
|
3914
|
+
return false
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
// Defines values for PermissionStatus.
|
|
3919
|
+
const (
|
|
3920
|
+
PermissionStatusActive PermissionStatus = "active"
|
|
3921
|
+
PermissionStatusLegacy PermissionStatus = "legacy"
|
|
3922
|
+
)
|
|
3923
|
+
|
|
3924
|
+
// Valid indicates whether the value is a known member of the PermissionStatus enum.
|
|
3925
|
+
func (e PermissionStatus) Valid() bool {
|
|
3926
|
+
switch e {
|
|
3927
|
+
case PermissionStatusActive:
|
|
3928
|
+
return true
|
|
3929
|
+
case PermissionStatusLegacy:
|
|
3930
|
+
return true
|
|
3931
|
+
default:
|
|
3932
|
+
return false
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3840
3936
|
// Defines values for PluginComputeContainerRuntimeProviderResourceKinds.
|
|
3841
3937
|
const (
|
|
3842
3938
|
PluginComputeContainerRuntimeResourceKindContainer PluginComputeContainerRuntimeProviderResourceKinds = "container"
|
|
@@ -6306,6 +6402,44 @@ type AIWorkbenchModelSettings struct {
|
|
|
6306
6402
|
Enabled bool `json:"enabled"`
|
|
6307
6403
|
}
|
|
6308
6404
|
|
|
6405
|
+
// AccessRole defines model for AccessRole.
|
|
6406
|
+
type AccessRole struct {
|
|
6407
|
+
// Capabilities Legacy role-global action aliases retained only for migration.
|
|
6408
|
+
// Deprecated: this property has been marked as deprecated upstream, but no `x-deprecated-reason` was set
|
|
6409
|
+
Capabilities []string `json:"capabilities"`
|
|
6410
|
+
ID string `json:"id"`
|
|
6411
|
+
Name string `json:"name"`
|
|
6412
|
+
PermissionKeys []string `json:"permissionKeys"`
|
|
6413
|
+
Scope string `json:"scope"`
|
|
6414
|
+
UserCount int `json:"userCount"`
|
|
6415
|
+
}
|
|
6416
|
+
|
|
6417
|
+
// AccessRoleDeleteResult defines model for AccessRoleDeleteResult.
|
|
6418
|
+
type AccessRoleDeleteResult struct {
|
|
6419
|
+
Status string `json:"status"`
|
|
6420
|
+
}
|
|
6421
|
+
|
|
6422
|
+
// AccessRoleEnvelope defines model for AccessRoleEnvelope.
|
|
6423
|
+
type AccessRoleEnvelope struct {
|
|
6424
|
+
Data AccessRole `json:"data"`
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
// AccessRoleInput defines model for AccessRoleInput.
|
|
6428
|
+
type AccessRoleInput struct {
|
|
6429
|
+
// Capabilities Legacy role-global action aliases; new role editors must send an empty array.
|
|
6430
|
+
// Deprecated: this property has been marked as deprecated upstream, but no `x-deprecated-reason` was set
|
|
6431
|
+
Capabilities []string `json:"capabilities,omitempty"`
|
|
6432
|
+
ID string `json:"id,omitempty"`
|
|
6433
|
+
Name string `json:"name"`
|
|
6434
|
+
PermissionKeys []string `json:"permissionKeys"`
|
|
6435
|
+
Scope string `json:"scope"`
|
|
6436
|
+
}
|
|
6437
|
+
|
|
6438
|
+
// AccessRoleListEnvelope defines model for AccessRoleListEnvelope.
|
|
6439
|
+
type AccessRoleListEnvelope struct {
|
|
6440
|
+
Items []AccessRole `json:"items"`
|
|
6441
|
+
}
|
|
6442
|
+
|
|
6309
6443
|
// AgentProviderCatalog defines model for AgentProviderCatalog.
|
|
6310
6444
|
type AgentProviderCatalog struct {
|
|
6311
6445
|
CreatedAt time.Time `json:"createdAt"`
|
|
@@ -12139,6 +12273,50 @@ type PasswordLoginRequest struct {
|
|
|
12139
12273
|
Password string `json:"password"`
|
|
12140
12274
|
}
|
|
12141
12275
|
|
|
12276
|
+
// PermissionApprovalPolicy defines model for PermissionApprovalPolicy.
|
|
12277
|
+
type PermissionApprovalPolicy string
|
|
12278
|
+
|
|
12279
|
+
// PermissionCatalog defines model for PermissionCatalog.
|
|
12280
|
+
type PermissionCatalog struct {
|
|
12281
|
+
CatalogVersion string `json:"catalogVersion"`
|
|
12282
|
+
ContentHash string `json:"contentHash"`
|
|
12283
|
+
Permissions []PermissionDefinition `json:"permissions"`
|
|
12284
|
+
SchemaVersion string `json:"schemaVersion"`
|
|
12285
|
+
}
|
|
12286
|
+
|
|
12287
|
+
// PermissionCatalogEnvelope defines model for PermissionCatalogEnvelope.
|
|
12288
|
+
type PermissionCatalogEnvelope struct {
|
|
12289
|
+
Data PermissionCatalog `json:"data"`
|
|
12290
|
+
}
|
|
12291
|
+
|
|
12292
|
+
// PermissionDefinition defines model for PermissionDefinition.
|
|
12293
|
+
type PermissionDefinition struct {
|
|
12294
|
+
Action string `json:"action"`
|
|
12295
|
+
ApprovalPolicy PermissionApprovalPolicy `json:"approvalPolicy"`
|
|
12296
|
+
Assignable bool `json:"assignable"`
|
|
12297
|
+
DisplayName string `json:"displayName"`
|
|
12298
|
+
Domain string `json:"domain"`
|
|
12299
|
+
Key string `json:"key"`
|
|
12300
|
+
LegacyAliases []string `json:"legacyAliases,omitempty"`
|
|
12301
|
+
|
|
12302
|
+
// LegacyCapabilities Migration-only role-global action aliases accepted by this exact permission.
|
|
12303
|
+
LegacyCapabilities []string `json:"legacyCapabilities,omitempty"`
|
|
12304
|
+
ReplacedBy []string `json:"replacedBy,omitempty"`
|
|
12305
|
+
Resource string `json:"resource"`
|
|
12306
|
+
RiskLevel PermissionRiskLevel `json:"riskLevel"`
|
|
12307
|
+
ScopeKinds []PermissionScopeKind `json:"scopeKinds"`
|
|
12308
|
+
Status PermissionStatus `json:"status"`
|
|
12309
|
+
}
|
|
12310
|
+
|
|
12311
|
+
// PermissionRiskLevel defines model for PermissionRiskLevel.
|
|
12312
|
+
type PermissionRiskLevel string
|
|
12313
|
+
|
|
12314
|
+
// PermissionScopeKind defines model for PermissionScopeKind.
|
|
12315
|
+
type PermissionScopeKind string
|
|
12316
|
+
|
|
12317
|
+
// PermissionStatus defines model for PermissionStatus.
|
|
12318
|
+
type PermissionStatus string
|
|
12319
|
+
|
|
12142
12320
|
// PersonalAccessToken defines model for PersonalAccessToken.
|
|
12143
12321
|
type PersonalAccessToken struct {
|
|
12144
12322
|
CreatedAt time.Time `json:"createdAt"`
|
|
@@ -14036,6 +14214,9 @@ type AIEnvironmentLeaseID = string
|
|
|
14036
14214
|
// AIMemoryID defines model for AIMemoryID.
|
|
14037
14215
|
type AIMemoryID = string
|
|
14038
14216
|
|
|
14217
|
+
// AccessRoleID defines model for AccessRoleID.
|
|
14218
|
+
type AccessRoleID = string
|
|
14219
|
+
|
|
14039
14220
|
// AgentProviderRolloutAction defines model for AgentProviderRolloutAction.
|
|
14040
14221
|
type AgentProviderRolloutAction string
|
|
14041
14222
|
|
|
@@ -15105,6 +15286,12 @@ type CreateVirtualMachineParams struct {
|
|
|
15105
15286
|
IdempotencyKey IdempotencyKey `json:"Idempotency-Key"`
|
|
15106
15287
|
}
|
|
15107
15288
|
|
|
15289
|
+
// CreateAccessRoleJSONRequestBody defines body for CreateAccessRole for application/json ContentType.
|
|
15290
|
+
type CreateAccessRoleJSONRequestBody = AccessRoleInput
|
|
15291
|
+
|
|
15292
|
+
// UpdateAccessRoleJSONRequestBody defines body for UpdateAccessRole for application/json ContentType.
|
|
15293
|
+
type UpdateAccessRoleJSONRequestBody = AccessRoleInput
|
|
15294
|
+
|
|
15108
15295
|
// DecideAIGatewayApprovalRequestJSONRequestBody defines body for DecideAIGatewayApprovalRequest for application/json ContentType.
|
|
15109
15296
|
type DecideAIGatewayApprovalRequestJSONRequestBody = ApprovalDecisionInput
|
|
15110
15297
|
|