/
cluster__put.go
34 lines (26 loc) · 981 Bytes
/
cluster__put.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cluster
import (
"context"
authoperator "github.com/octohelm/kubepkg/internal/dashboard/apis/auth/operator"
"github.com/octohelm/courier/pkg/courier"
"github.com/octohelm/kubepkg/internal/dashboard/domain/group"
"github.com/octohelm/kubepkg/pkg/rbac"
"github.com/octohelm/kubepkg/internal/dashboard/domain/cluster"
"github.com/octohelm/courier/pkg/courierhttp"
clusterrepository "github.com/octohelm/kubepkg/internal/dashboard/domain/cluster/repository"
)
func (PutCluster) MiddleOperators() courier.MiddleOperators {
return courier.MiddleOperators{
rbac.Need(
authoperator.NeedAdminRole(group.ROLE_TYPE__MEMBER),
),
}
}
type PutCluster struct {
courierhttp.MethodPut `path:"/clusters/:name"`
Name string `name:"name" in:"path"`
Info cluster.Info `in:"body"`
}
func (p *PutCluster) Output(ctx context.Context) (any, error) {
return clusterrepository.NewClusterRepository().PutInfo(ctx, p.Name, p.Info)
}