Update the structure a bit
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
softplayer-backend
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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=
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user