2020-10-20 17:10:23 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/caos/zitadel/pkg/grpc/admin"
|
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) GetDefaultLabelPolicy(ctx context.Context, _ *empty.Empty) (*admin.DefaultLabelPolicyView, error) {
|
|
|
|
result, err := s.iam.GetDefaultLabelPolicy(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return labelPolicyViewFromModel(result), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) UpdateDefaultLabelPolicy(ctx context.Context, policy *admin.DefaultLabelPolicyUpdate) (*admin.DefaultLabelPolicy, error) {
|
2021-01-05 08:33:45 +00:00
|
|
|
result, err := s.command.ChangeDefaultLabelPolicy(ctx, labelPolicyToDomain(policy))
|
2020-10-20 17:10:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-01-05 08:33:45 +00:00
|
|
|
return labelPolicyFromDomain(result), nil
|
2020-10-20 17:10:23 +00:00
|
|
|
}
|