diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8d79a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +softplayer-backend \ No newline at end of file diff --git a/api/v1/environments.go b/api/v1/environments.go index 16f05e0..8eb63c7 100644 --- a/api/v1/environments.go +++ b/api/v1/environments.go @@ -23,9 +23,10 @@ type EnvironmentsServer struct { // Create an environment func (e *EnvironmentsServer) Create(ctx context.Context, in *proto.CreateOptions) (*proto.EnvironmentFull, error) { data := &controllers.EnvironemntData{ - Name: in.GetName().GetName(), - Provider: in.GetData().GetProvider().String(), - Kubernetes: in.GetData().GetKubernetes().String(), + Name: in.GetMetadata().GetName(), + Description: in.GetMetadata().GetDescription(), + Provider: in.GetSpec().GetProvider().String(), + Kubernetes: in.GetSpec().GetKubernetes().String(), } environment := &controllers.Environemnt{ 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) { data := &controllers.EnvironemntData{ - Name: in.GetName().GetName(), + Name: in.GetMetadata().GetName(), } 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) { data := &controllers.EnvironemntData{ - Name: in.GetName().GetName(), + Name: in.GetMetadata().GetName(), } environment := &controllers.Environemnt{ @@ -80,7 +81,7 @@ func (e *EnvironmentsServer) Get(ctx context.Context, in *proto.GetOptions) (*pr } return &proto.EnvironmentFull{ - Name: &proto.EnvironmentName{ + Metadata: &proto.EnvironmentMetadata{ Name: environment.Data.Name, }, }, nil @@ -100,7 +101,7 @@ func (e *EnvironmentsServer) List(in *proto.ListOptions, stream proto.Environmen for _, env := range envs { if err := stream.Send(&proto.EnvironmentFull{ - Name: &proto.EnvironmentName{ + Metadata: &proto.EnvironmentMetadata{ Name: env, }, }); err != nil { diff --git a/go.mod b/go.mod index ba32167..d8e008b 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ 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 golang.org/x/net v0.22.0 // indirect golang.org/x/sys v0.18.0 // indirect diff --git a/go.sum b/go.sum index 6b3ce8b..cbaf93e 100644 --- a/go.sum +++ b/go.sum @@ -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.5/go.mod h1:OU+833cHwvecr+gsnPEKQYlAJbpL8bqSJVLobdw63qI= +git.badhouseplants.net/softplayer/softplayer-go-proto v0.1.6 h1:ztek91ZtN2pNsq4VCWNYe8oZf5I7WDUMTDtT2GDKHVU= +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/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA= diff --git a/internal/controllers/environments.go b/internal/controllers/environments.go index 0f58ee8..f66e65b 100644 --- a/internal/controllers/environments.go +++ b/internal/controllers/environments.go @@ -27,6 +27,7 @@ type Environemnt struct { type EnvironemntData struct { Name string + Description string Provider string Kubernetes string HetznerData HetznerData @@ -98,7 +99,8 @@ func (env *Environemnt) Create(ctx context.Context) error { }, }, 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 {