Update the structure a bit
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Nikolai Rodionov 2024-04-29 14:07:02 +02:00
parent 0d20db4020
commit a4c8415449
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
5 changed files with 15 additions and 11 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
softplayer-backend

View File

@ -23,9 +23,10 @@ type EnvironmentsServer struct {
// Create an environment // Create an environment
func (e *EnvironmentsServer) Create(ctx context.Context, in *proto.CreateOptions) (*proto.EnvironmentFull, error) { func (e *EnvironmentsServer) Create(ctx context.Context, in *proto.CreateOptions) (*proto.EnvironmentFull, error) {
data := &controllers.EnvironemntData{ data := &controllers.EnvironemntData{
Name: in.GetName().GetName(), Name: in.GetMetadata().GetName(),
Provider: in.GetData().GetProvider().String(), Description: in.GetMetadata().GetDescription(),
Kubernetes: in.GetData().GetKubernetes().String(), Provider: in.GetSpec().GetProvider().String(),
Kubernetes: in.GetSpec().GetKubernetes().String(),
} }
environment := &controllers.Environemnt{ environment := &controllers.Environemnt{
UserID: in.GetOwnerId().GetUuid(), UserID: in.GetOwnerId().GetUuid(),
@ -47,7 +48,7 @@ func (e *EnvironmentsServer) Update(ctx context.Context, in *proto.UpdateOptions
func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions) (*empty.Empty, error) { func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions) (*empty.Empty, error) {
data := &controllers.EnvironemntData{ data := &controllers.EnvironemntData{
Name: in.GetName().GetName(), Name: in.GetMetadata().GetName(),
} }
environment := &controllers.Environemnt{ environment := &controllers.Environemnt{
@ -65,7 +66,7 @@ func (e *EnvironmentsServer) Delete(ctx context.Context, in *proto.DeleteOptions
func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*proto.EnvironmentFull, error) { func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*proto.EnvironmentFull, error) {
data := &controllers.EnvironemntData{ data := &controllers.EnvironemntData{
Name: in.GetName().GetName(), Name: in.GetMetadata().GetName(),
} }
environment := &controllers.Environemnt{ environment := &controllers.Environemnt{
@ -80,7 +81,7 @@ func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*pr
} }
return &proto.EnvironmentFull{ return &proto.EnvironmentFull{
Name: &proto.EnvironmentName{ Metadata: &proto.EnvironmentMetadata{
Name: environment.Data.Name, Name: environment.Data.Name,
}, },
}, nil }, nil
@ -100,7 +101,7 @@ func (e *EnvironmentsServer) List(in *proto.ListOptions, stream proto.Environmen
for _, env := range envs { for _, env := range envs {
if err := stream.Send(&proto.EnvironmentFull{ if err := stream.Send(&proto.EnvironmentFull{
Name: &proto.EnvironmentName{ Metadata: &proto.EnvironmentMetadata{
Name: env, Name: env,
}, },
}); err != nil { }); err != nil {

2
go.mod
View File

@ -67,7 +67,7 @@ require (
) )
require ( require (
git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.5 git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.6
github.com/golang/protobuf v1.5.4 github.com/golang/protobuf v1.5.4
golang.org/x/net v0.22.0 // indirect golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect golang.org/x/sys v0.18.0 // indirect

4
go.sum
View File

@ -1,5 +1,5 @@
git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.5 h1:HETV0silTTK//EUGsSM71U1j5lzVjHThmvKXZXWtBLg= git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.6 h1:ztek91ZtN2pNsq4VCWNYe8oZf5I7WDUMTDtT2GDKHVU=
git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.5/go.mod h1:OU+833cHwvecr+gsnPEKQYlAJbpL8bqSJVLobdw63qI= git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.6/go.mod h1:OU+833cHwvecr+gsnPEKQYlAJbpL8bqSJVLobdw63qI=
github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU=
github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA= github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA=

View File

@ -27,6 +27,7 @@ type Environemnt struct {
type EnvironemntData struct { type EnvironemntData struct {
Name string Name string
Description string
Provider string Provider string
Kubernetes string Kubernetes string
HetznerData HetznerData HetznerData HetznerData
@ -98,7 +99,8 @@ func (env *Environemnt) Create(ctx context.Context) error {
}, },
}, },
Data: map[string]string{ Data: map[string]string{
"vars": env.Data.buildVars(), "description": env.Data.Description,
"vars": env.Data.buildVars(),
}, },
} }
if err := kube.Create(ctx, controller.GetClient(), &obj, false); err != nil { if err := kube.Create(ctx, controller.GetClient(), &obj, false); err != nil {