Update the structure a bit
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user