Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4cdbf93
Boot Services
majst01 Jun 7, 2025
a2d18bd
Add required machine service endpoint
majst01 Jun 8, 2025
dac3f0f
Merge main
majst01 Jun 15, 2025
7cebfa2
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Jun 17, 2025
1acf70c
Tenant Tests
majst01 Jun 18, 2025
2beb57a
Merge main
majst01 Jun 18, 2025
619093a
Merge main
majst01 Jun 18, 2025
ffca5af
Update deps
majst01 Jun 23, 2025
31d74c5
Merge main
majst01 Jul 10, 2025
cda11eb
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Jul 10, 2025
f9409a4
Merge main
majst01 Jul 10, 2025
cbf5240
Validation
majst01 Jul 15, 2025
382e137
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Jul 16, 2025
e05f55a
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Jul 17, 2025
c7215a3
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Aug 1, 2025
6456f5b
Merge main
majst01 Aug 1, 2025
9568803
Merge main
majst01 Aug 11, 2025
54e7db0
Merge main
majst01 Aug 11, 2025
86b43eb
merge main
majst01 Aug 11, 2025
b0a6cc9
Update deps
majst01 Aug 16, 2025
f739b94
Merge main
majst01 Aug 19, 2025
0ffd5e1
Merge main
majst01 Aug 22, 2025
7ad501d
Merge main
majst01 Sep 2, 2025
c25abef
Merge main
majst01 Sep 2, 2025
d731d72
xMerge branch 'main' of https://github.com/metal-stack/api into boot-…
majst01 Sep 2, 2025
aed443a
Add event service
majst01 Sep 2, 2025
76b300f
Pass partition with dhcp request
majst01 Sep 3, 2025
eeb8f8f
No _id
majst01 Sep 3, 2025
f9b69b1
pixie requires lower go version
majst01 Sep 3, 2025
09308f7
Machine and Infra Roles
majst01 Sep 4, 2025
6b6b09c
Fix and simplify generation of servicepermissions
majst01 Sep 4, 2025
9ae58eb
WTF
majst01 Sep 4, 2025
724a154
Back to go-1.25
majst01 Sep 5, 2025
0796323
lower rights
majst01 Sep 5, 2025
e47e774
Return the machine allocation as wait response
majst01 Sep 6, 2025
7052ad1
Less priviledges
majst01 Sep 6, 2025
6dce6fb
Even simpler
majst01 Sep 8, 2025
baf5c60
Shift
majst01 Sep 10, 2025
edea371
Merge main
majst01 Sep 10, 2025
a52e233
merge main
majst01 Sep 16, 2025
1980910
Merge main
majst01 Sep 19, 2025
afb6472
Fix test
majst01 Oct 6, 2025
613fca0
Fix test
majst01 Oct 6, 2025
537c9d4
Merge main
majst01 Oct 10, 2025
88404c2
Merge main
majst01 Oct 14, 2025
cbd1c24
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Oct 15, 2025
454830f
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Oct 16, 2025
e5f2601
Merge main
majst01 Oct 16, 2025
9e7b833
Merge branch 'main' of https://github.com/metal-stack/api into boot-s…
majst01 Oct 23, 2025
efbc5de
Updates
majst01 Oct 27, 2025
d284713
Merge main
majst01 Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,046 changes: 1,043 additions & 3 deletions doc/index.html

Large diffs are not rendered by default.

41 changes: 16 additions & 25 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func servicePermissions(root string) (*permissions.ServicePermissions, error) {
roles = permissions.Roles{
Admin: permissions.Admin{},
Infra: permissions.Infra{},
Machine: permissions.Machine{},
Tenant: permissions.Tenant{},
Project: permissions.Project{},
}
Expand All @@ -114,6 +115,7 @@ func servicePermissions(root string) (*permissions.ServicePermissions, error) {
Self: map[string]bool{},
Admin: map[string]bool{},
Infra: map[string]bool{},
Machine: map[string]bool{},
Tenant: map[string]bool{},
Project: map[string]bool{},
}
Expand Down Expand Up @@ -142,40 +144,23 @@ func servicePermissions(root string) (*permissions.ServicePermissions, error) {
continue
}
auditable[methodName] = true

switch role := *methodOpt.IdentifierValue; role {
// Tenant
switch *methodOpt.IdentifierValue {
case v1.TenantRole_TENANT_ROLE_OWNER.String():
roles.Tenant[v1.TenantRole_TENANT_ROLE_OWNER.String()] = append(roles.Tenant[v1.TenantRole_TENANT_ROLE_OWNER.String()], methodName)
visibility.Tenant[methodName] = true
case v1.TenantRole_TENANT_ROLE_EDITOR.String():
roles.Tenant[v1.TenantRole_TENANT_ROLE_EDITOR.String()] = append(roles.Tenant[v1.TenantRole_TENANT_ROLE_EDITOR.String()], methodName)
visibility.Tenant[methodName] = true
case v1.TenantRole_TENANT_ROLE_VIEWER.String():
roles.Tenant[v1.TenantRole_TENANT_ROLE_VIEWER.String()] = append(roles.Tenant[v1.TenantRole_TENANT_ROLE_VIEWER.String()], methodName)
visibility.Tenant[methodName] = true
case v1.TenantRole_TENANT_ROLE_GUEST.String():
roles.Tenant[v1.TenantRole_TENANT_ROLE_GUEST.String()] = append(roles.Tenant[v1.TenantRole_TENANT_ROLE_GUEST.String()], methodName)
case v1.TenantRole_TENANT_ROLE_OWNER.String(), v1.TenantRole_TENANT_ROLE_EDITOR.String(), v1.TenantRole_TENANT_ROLE_VIEWER.String(), v1.TenantRole_TENANT_ROLE_GUEST.String():
roles.Tenant[role] = append(roles.Tenant[role], methodName)
visibility.Tenant[methodName] = true
case v1.TenantRole_TENANT_ROLE_UNSPECIFIED.String():
// noop
// Project
case v1.ProjectRole_PROJECT_ROLE_OWNER.String():
roles.Project[v1.ProjectRole_PROJECT_ROLE_OWNER.String()] = append(roles.Project[v1.ProjectRole_PROJECT_ROLE_OWNER.String()], methodName)
case v1.ProjectRole_PROJECT_ROLE_OWNER.String(), v1.ProjectRole_PROJECT_ROLE_EDITOR.String(), v1.ProjectRole_PROJECT_ROLE_VIEWER.String():
roles.Project[role] = append(roles.Project[role], methodName)
visibility.Project[methodName] = true
case v1.ProjectRole_PROJECT_ROLE_EDITOR.String():
visibility.Project[methodName] = true
roles.Project[v1.ProjectRole_PROJECT_ROLE_EDITOR.String()] = append(roles.Project[v1.ProjectRole_PROJECT_ROLE_EDITOR.String()], methodName)
case v1.ProjectRole_PROJECT_ROLE_VIEWER.String():
visibility.Project[methodName] = true
roles.Project[v1.ProjectRole_PROJECT_ROLE_VIEWER.String()] = append(roles.Project[v1.ProjectRole_PROJECT_ROLE_VIEWER.String()], methodName)
case v1.ProjectRole_PROJECT_ROLE_UNSPECIFIED.String():
// noop
// Admin
case v1.AdminRole_ADMIN_ROLE_EDITOR.String():
roles.Admin[v1.AdminRole_ADMIN_ROLE_EDITOR.String()] = append(roles.Admin[v1.AdminRole_ADMIN_ROLE_EDITOR.String()], methodName)
visibility.Admin[methodName] = true
case v1.AdminRole_ADMIN_ROLE_VIEWER.String():
roles.Admin[v1.AdminRole_ADMIN_ROLE_VIEWER.String()] = append(roles.Admin[v1.AdminRole_ADMIN_ROLE_VIEWER.String()], methodName)
case v1.AdminRole_ADMIN_ROLE_EDITOR.String(), v1.AdminRole_ADMIN_ROLE_VIEWER.String():
roles.Admin[role] = append(roles.Admin[role], methodName)
visibility.Admin[methodName] = true
case v1.AdminRole_ADMIN_ROLE_UNSPECIFIED.String():
// noop
Expand All @@ -188,6 +173,12 @@ func servicePermissions(root string) (*permissions.ServicePermissions, error) {
visibility.Infra[methodName] = true
case v1.InfraRole_INFRA_ROLE_UNSPECIFIED.String():
// noop
// Machine
case v1.MachineRole_MACHINE_ROLE_EDITOR.String(), v1.MachineRole_MACHINE_ROLE_VIEWER.String():
roles.Machine[role] = append(roles.Machine[role], methodName)
visibility.Machine[methodName] = true
case v1.MachineRole_MACHINE_ROLE_UNSPECIFIED.String():
// noop
// Visibility
case v1.Visibility_VISIBILITY_PUBLIC.String():
visibility.Public[methodName] = true
Expand Down
30 changes: 30 additions & 0 deletions generate/go_servicepermissions.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ func GetServicePermissions() *ServicePermissions {
},
{{- end }}
},
Machine: Machine{
{{- range $role, $methods := .Roles.Machine }}
"{{ $role }}": []string{
{{- range $method := $methods }}
"{{ $method }}",
{{- end }}
},
{{- end }}
},
Tenant: Tenant{
{{- range $role, $methods := .Roles.Tenant }}
"{{ $role }}": []string{
Expand Down Expand Up @@ -77,6 +86,11 @@ func GetServicePermissions() *ServicePermissions {
Infra: map[string]bool{
{{- range $key, $value := .Visibility.Infra }}
"{{ $key }}": {{ $value }} ,
{{- end }}
},
Machine: map[string]bool{
{{- range $key, $value := .Visibility.Machine }}
"{{ $key }}": {{ $value }} ,
{{- end }}
},
Tenant: map[string]bool{
Expand Down Expand Up @@ -118,6 +132,11 @@ func IsInfraScope(req connect.AnyRequest) bool {
return ok
}

func IsMachineScope(req connect.AnyRequest) bool {
_, ok := GetServicePermissions().Visibility.Machine[req.Spec().Procedure]
return ok
}

func IsTenantScope(req connect.AnyRequest) bool {
_, ok := GetServicePermissions().Visibility.Tenant[req.Spec().Procedure]
return ok
Expand Down Expand Up @@ -153,4 +172,15 @@ func GetProjectFromRequest(req connect.AnyRequest) (string, bool) {
return rq.GetProject(), true
}
return "", false
}

func GetMachineIdFromRequest(req connect.AnyRequest) (string, bool) {
if !IsMachineScope(req) {
return "", false
}
switch rq := req.Any().(type) {
case interface{ GetUuid() string }:
return rq.GetUuid(), true
}
return "", false
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ require (
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/cel-go v0.26.1 // indirect
github.com/klauspost/compress v1.18.1 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/minio/minlz v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stoewer/go-strcase v1.3.1 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/text v0.31.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/connect-compress/v2 v2.1.0 h1:8fM8QrVeHT69e5VVSh4yjDaQASYIvOp2uMZq7nVLj2U=
github.com/klauspost/connect-compress/v2 v2.1.0/go.mod h1:Ayurh2wscMMx3AwdGGVL+ylSR5316WfApREDgsqHyH8=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand All @@ -45,8 +45,8 @@ github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8w
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
Expand Down
22 changes: 22 additions & 0 deletions go/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading