diff --git a/internal/cmd/users.go b/internal/cmd/users.go index efe4fe7..daee304 100644 --- a/internal/cmd/users.go +++ b/internal/cmd/users.go @@ -2,6 +2,7 @@ package cmd import ( "context" + "fmt" "github.com/bufbuild/connect-go" api "github.com/jsiebens/ionscale/pkg/gen/ionscale/v1" "github.com/muesli/coral" @@ -16,6 +17,7 @@ func userCommands() *coral.Command { } command.AddCommand(listUsersCommand()) + command.AddCommand(deleteUserCommand()) return command } @@ -65,3 +67,36 @@ func listUsersCommand() *coral.Command { return command } + +func deleteUserCommand() *coral.Command { + command := &coral.Command{ + Use: "delete", + Short: "Deletes a user", + SilenceUsage: true, + } + + var userID uint64 + var target = Target{} + target.prepareCommand(command) + command.Flags().Uint64Var(&userID, "user-id", 0, "User ID.") + + _ = command.MarkFlagRequired("user-id") + + command.RunE = func(command *coral.Command, args []string) error { + client, err := target.createGRPCClient() + if err != nil { + return err + } + + req := api.DeleteUserRequest{UserId: userID} + if _, err := client.DeleteUser(context.Background(), connect.NewRequest(&req)); err != nil { + return err + } + + fmt.Println("User deleted.") + + return nil + } + + return command +} diff --git a/internal/domain/api_key.go b/internal/domain/api_key.go index 252d32b..d2cabd2 100644 --- a/internal/domain/api_key.go +++ b/internal/domain/api_key.go @@ -85,3 +85,11 @@ func (r *repository) LoadApiKey(ctx context.Context, key string) (*ApiKey, error return &m, nil } + +func (r *repository) DeleteApiKeysByUser(ctx context.Context, userID uint64) error { + tx := r.withContext(ctx). + Where("user_id = ?", userID). + Delete(&ApiKey{UserID: userID}) + + return tx.Error +} diff --git a/internal/domain/auth_key.go b/internal/domain/auth_key.go index bab30ce..5368038 100644 --- a/internal/domain/auth_key.go +++ b/internal/domain/auth_key.go @@ -93,6 +93,14 @@ func (r *repository) DeleteAuthKeysByTailnet(ctx context.Context, tailnetID uint return tx.Error } +func (r *repository) DeleteAuthKeysByUser(ctx context.Context, userID uint64) error { + tx := r.withContext(ctx). + Where("user_id = ?", userID). + Delete(&AuthKey{UserID: userID}) + + return tx.Error +} + func (r *repository) ListAuthKeys(ctx context.Context, tailnetID uint64) ([]AuthKey, error) { var authKeys = []AuthKey{} tx := (r.withContext(ctx). diff --git a/internal/domain/machine.go b/internal/domain/machine.go index b72502b..5ad7d93 100644 --- a/internal/domain/machine.go +++ b/internal/domain/machine.go @@ -314,6 +314,11 @@ func (r *repository) DeleteMachineByTailnet(ctx context.Context, tailnetID uint6 return tx.Error } +func (r *repository) DeleteMachineByUser(ctx context.Context, userID uint64) error { + tx := r.withContext(ctx).Model(&Machine{}).Where("user_id = ?", userID).Delete(&Machine{}) + return tx.Error +} + func (r *repository) ListMachineByTailnet(ctx context.Context, tailnetID uint64) (Machines, error) { var machines = []Machine{} diff --git a/internal/domain/repository.go b/internal/domain/repository.go index e51b7f1..60b02fc 100644 --- a/internal/domain/repository.go +++ b/internal/domain/repository.go @@ -22,18 +22,22 @@ type Repository interface { SaveApiKey(ctx context.Context, key *ApiKey) error LoadApiKey(ctx context.Context, key string) (*ApiKey, error) + DeleteApiKeysByUser(ctx context.Context, userID uint64) error GetAuthKey(ctx context.Context, id uint64) (*AuthKey, error) SaveAuthKey(ctx context.Context, key *AuthKey) error DeleteAuthKey(ctx context.Context, id uint64) (bool, error) DeleteAuthKeysByTailnet(ctx context.Context, tailnetID uint64) error + DeleteAuthKeysByUser(ctx context.Context, userID uint64) error ListAuthKeys(ctx context.Context, tailnetID uint64) ([]AuthKey, error) ListAuthKeysByTailnetAndUser(ctx context.Context, tailnetID, userID uint64) ([]AuthKey, error) LoadAuthKey(ctx context.Context, key string) (*AuthKey, error) GetOrCreateServiceUser(ctx context.Context, tailnet *Tailnet) (*User, bool, error) - ListUsers(ctx context.Context, tailnetID uint64) (Users, error) GetOrCreateUserWithAccount(ctx context.Context, tailnet *Tailnet, account *Account) (*User, bool, error) + GetUser(ctx context.Context, userID uint64) (*User, error) + DeleteUser(ctx context.Context, userID uint64) error + ListUsers(ctx context.Context, tailnetID uint64) (Users, error) DeleteUsersByTailnet(ctx context.Context, tailnetID uint64) error SaveMachine(ctx context.Context, m *Machine) error @@ -46,6 +50,7 @@ type Repository interface { ListMachineByTailnet(ctx context.Context, tailnetID uint64) (Machines, error) CountMachineByTailnet(ctx context.Context, tailnetID uint64) (int64, error) DeleteMachineByTailnet(ctx context.Context, tailnetID uint64) error + DeleteMachineByUser(ctx context.Context, userID uint64) error ListMachinePeers(ctx context.Context, tailnetID uint64, key string) (Machines, error) ListInactiveEphemeralMachines(ctx context.Context, checkpoint time.Time) (Machines, error) SetMachineLastSeen(ctx context.Context, machineID uint64) error diff --git a/internal/domain/user.go b/internal/domain/user.go index a42a30a..ec51851 100644 --- a/internal/domain/user.go +++ b/internal/domain/user.go @@ -2,7 +2,9 @@ package domain import ( "context" + "errors" "github.com/jsiebens/ionscale/internal/util" + "gorm.io/gorm" ) type SystemRole string @@ -95,3 +97,23 @@ func (r *repository) GetOrCreateUserWithAccount(ctx context.Context, tailnet *Ta return user, user.ID == id, nil } + +func (r *repository) GetUser(ctx context.Context, userID uint64) (*User, error) { + var m User + tx := r.withContext(ctx).Preload("Tailnet").Preload("Account").First(&m, "id = ? and user_type = ?", userID, UserTypePerson) + + if errors.Is(tx.Error, gorm.ErrRecordNotFound) { + return nil, nil + } + + if tx.Error != nil { + return nil, tx.Error + } + + return &m, nil +} + +func (r *repository) DeleteUser(ctx context.Context, userID uint64) error { + tx := r.withContext(ctx).Delete(&User{ID: userID}) + return tx.Error +} diff --git a/internal/service/users.go b/internal/service/users.go index 3c90c9b..b277365 100644 --- a/internal/service/users.go +++ b/internal/service/users.go @@ -4,6 +4,7 @@ import ( "context" "errors" "github.com/bufbuild/connect-go" + "github.com/jsiebens/ionscale/internal/domain" api "github.com/jsiebens/ionscale/pkg/gen/ionscale/v1" ) @@ -39,3 +40,52 @@ func (s *Service) ListUsers(ctx context.Context, req *connect.Request[api.ListUs return connect.NewResponse(resp), nil } + +func (s *Service) DeleteUser(ctx context.Context, req *connect.Request[api.DeleteUserRequest]) (*connect.Response[api.DeleteUserResponse], error) { + principal := CurrentPrincipal(ctx) + + if !principal.IsSystemAdmin() && principal.UserMatches(req.Msg.UserId) { + return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("unable delete yourself")) + } + + user, err := s.repository.GetUser(ctx, req.Msg.UserId) + if err != nil { + return nil, err + } + + if user == nil { + return nil, connect.NewError(connect.CodeNotFound, errors.New("user not found")) + } + + if !principal.IsSystemAdmin() && !principal.IsTailnetAdmin(user.TailnetID) { + return nil, connect.NewError(connect.CodePermissionDenied, errors.New("permission denied")) + } + + err = s.repository.Transaction(func(tx domain.Repository) error { + if err := tx.DeleteMachineByUser(ctx, req.Msg.UserId); err != nil { + return err + } + + if err := tx.DeleteApiKeysByUser(ctx, req.Msg.UserId); err != nil { + return err + } + + if err := tx.DeleteAuthKeysByUser(ctx, req.Msg.UserId); err != nil { + return err + } + + if err := tx.DeleteUser(ctx, req.Msg.UserId); err != nil { + return err + } + + return nil + }) + + if err != nil { + return nil, err + } + + s.brokers(user.TailnetID).SignalUpdate() + + return connect.NewResponse(&api.DeleteUserResponse{}), nil +} diff --git a/pkg/gen/ionscale/v1/ionscale.pb.go b/pkg/gen/ionscale/v1/ionscale.pb.go index 595ffb5..ce19f9e 100644 --- a/pkg/gen/ionscale/v1/ionscale.pb.go +++ b/pkg/gen/ionscale/v1/ionscale.pb.go @@ -48,7 +48,7 @@ var file_ionscale_v1_ionscale_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x72, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x32, 0xac, 0x11, 0x0a, 0x0f, 0x49, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x53, + 0x74, 0x6f, 0x32, 0xfd, 0x11, 0x0a, 0x0f, 0x49, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, @@ -151,47 +151,52 @@ var file_ionscale_v1_ionscale_proto_rawDesc = []byte{ 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0d, 0x45, - 0x78, 0x70, 0x69, 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x2e, 0x69, - 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, - 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, - 0x70, 0x69, 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, - 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, - 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, - 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x6a, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, - 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, - 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x28, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, - 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x10, 0x47, - 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, - 0x24, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, - 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x73, 0x12, 0x24, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, - 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, 0x6e, 0x73, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, - 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, + 0x68, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0d, + 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x2e, + 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x69, + 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, + 0x78, 0x70, 0x69, 0x72, 0x65, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x69, 0x6f, 0x6e, + 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x6a, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, + 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, + 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x28, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x70, 0x69, + 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x24, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, + 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x61, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x69, 0x6f, 0x6e, 0x73, + 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, 0x6e, 0x73, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, + 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_ionscale_v1_ionscale_proto_goTypes = []interface{}{ @@ -214,36 +219,38 @@ var file_ionscale_v1_ionscale_proto_goTypes = []interface{}{ (*DeleteAuthKeyRequest)(nil), // 16: ionscale.v1.DeleteAuthKeyRequest (*ListAuthKeysRequest)(nil), // 17: ionscale.v1.ListAuthKeysRequest (*ListUsersRequest)(nil), // 18: ionscale.v1.ListUsersRequest - (*ListMachinesRequest)(nil), // 19: ionscale.v1.ListMachinesRequest - (*ExpireMachineRequest)(nil), // 20: ionscale.v1.ExpireMachineRequest - (*DeleteMachineRequest)(nil), // 21: ionscale.v1.DeleteMachineRequest - (*SetMachineKeyExpiryRequest)(nil), // 22: ionscale.v1.SetMachineKeyExpiryRequest - (*GetMachineRoutesRequest)(nil), // 23: ionscale.v1.GetMachineRoutesRequest - (*SetMachineRoutesRequest)(nil), // 24: ionscale.v1.SetMachineRoutesRequest - (*GetVersionResponse)(nil), // 25: ionscale.v1.GetVersionResponse - (*AuthenticationResponse)(nil), // 26: ionscale.v1.AuthenticationResponse - (*GetDERPMapResponse)(nil), // 27: ionscale.v1.GetDERPMapResponse - (*SetDERPMapResponse)(nil), // 28: ionscale.v1.SetDERPMapResponse - (*CreateTailnetResponse)(nil), // 29: ionscale.v1.CreateTailnetResponse - (*GetTailnetResponse)(nil), // 30: ionscale.v1.GetTailnetResponse - (*ListTailnetResponse)(nil), // 31: ionscale.v1.ListTailnetResponse - (*DeleteTailnetResponse)(nil), // 32: ionscale.v1.DeleteTailnetResponse - (*GetDNSConfigResponse)(nil), // 33: ionscale.v1.GetDNSConfigResponse - (*SetDNSConfigResponse)(nil), // 34: ionscale.v1.SetDNSConfigResponse - (*GetIAMPolicyResponse)(nil), // 35: ionscale.v1.GetIAMPolicyResponse - (*SetIAMPolicyResponse)(nil), // 36: ionscale.v1.SetIAMPolicyResponse - (*GetACLPolicyResponse)(nil), // 37: ionscale.v1.GetACLPolicyResponse - (*SetACLPolicyResponse)(nil), // 38: ionscale.v1.SetACLPolicyResponse - (*GetAuthKeyResponse)(nil), // 39: ionscale.v1.GetAuthKeyResponse - (*CreateAuthKeyResponse)(nil), // 40: ionscale.v1.CreateAuthKeyResponse - (*DeleteAuthKeyResponse)(nil), // 41: ionscale.v1.DeleteAuthKeyResponse - (*ListAuthKeysResponse)(nil), // 42: ionscale.v1.ListAuthKeysResponse - (*ListUsersResponse)(nil), // 43: ionscale.v1.ListUsersResponse - (*ListMachinesResponse)(nil), // 44: ionscale.v1.ListMachinesResponse - (*ExpireMachineResponse)(nil), // 45: ionscale.v1.ExpireMachineResponse - (*DeleteMachineResponse)(nil), // 46: ionscale.v1.DeleteMachineResponse - (*SetMachineKeyExpiryResponse)(nil), // 47: ionscale.v1.SetMachineKeyExpiryResponse - (*GetMachineRoutesResponse)(nil), // 48: ionscale.v1.GetMachineRoutesResponse + (*DeleteUserRequest)(nil), // 19: ionscale.v1.DeleteUserRequest + (*ListMachinesRequest)(nil), // 20: ionscale.v1.ListMachinesRequest + (*ExpireMachineRequest)(nil), // 21: ionscale.v1.ExpireMachineRequest + (*DeleteMachineRequest)(nil), // 22: ionscale.v1.DeleteMachineRequest + (*SetMachineKeyExpiryRequest)(nil), // 23: ionscale.v1.SetMachineKeyExpiryRequest + (*GetMachineRoutesRequest)(nil), // 24: ionscale.v1.GetMachineRoutesRequest + (*SetMachineRoutesRequest)(nil), // 25: ionscale.v1.SetMachineRoutesRequest + (*GetVersionResponse)(nil), // 26: ionscale.v1.GetVersionResponse + (*AuthenticationResponse)(nil), // 27: ionscale.v1.AuthenticationResponse + (*GetDERPMapResponse)(nil), // 28: ionscale.v1.GetDERPMapResponse + (*SetDERPMapResponse)(nil), // 29: ionscale.v1.SetDERPMapResponse + (*CreateTailnetResponse)(nil), // 30: ionscale.v1.CreateTailnetResponse + (*GetTailnetResponse)(nil), // 31: ionscale.v1.GetTailnetResponse + (*ListTailnetResponse)(nil), // 32: ionscale.v1.ListTailnetResponse + (*DeleteTailnetResponse)(nil), // 33: ionscale.v1.DeleteTailnetResponse + (*GetDNSConfigResponse)(nil), // 34: ionscale.v1.GetDNSConfigResponse + (*SetDNSConfigResponse)(nil), // 35: ionscale.v1.SetDNSConfigResponse + (*GetIAMPolicyResponse)(nil), // 36: ionscale.v1.GetIAMPolicyResponse + (*SetIAMPolicyResponse)(nil), // 37: ionscale.v1.SetIAMPolicyResponse + (*GetACLPolicyResponse)(nil), // 38: ionscale.v1.GetACLPolicyResponse + (*SetACLPolicyResponse)(nil), // 39: ionscale.v1.SetACLPolicyResponse + (*GetAuthKeyResponse)(nil), // 40: ionscale.v1.GetAuthKeyResponse + (*CreateAuthKeyResponse)(nil), // 41: ionscale.v1.CreateAuthKeyResponse + (*DeleteAuthKeyResponse)(nil), // 42: ionscale.v1.DeleteAuthKeyResponse + (*ListAuthKeysResponse)(nil), // 43: ionscale.v1.ListAuthKeysResponse + (*ListUsersResponse)(nil), // 44: ionscale.v1.ListUsersResponse + (*DeleteUserResponse)(nil), // 45: ionscale.v1.DeleteUserResponse + (*ListMachinesResponse)(nil), // 46: ionscale.v1.ListMachinesResponse + (*ExpireMachineResponse)(nil), // 47: ionscale.v1.ExpireMachineResponse + (*DeleteMachineResponse)(nil), // 48: ionscale.v1.DeleteMachineResponse + (*SetMachineKeyExpiryResponse)(nil), // 49: ionscale.v1.SetMachineKeyExpiryResponse + (*GetMachineRoutesResponse)(nil), // 50: ionscale.v1.GetMachineRoutesResponse } var file_ionscale_v1_ionscale_proto_depIdxs = []int32{ 0, // 0: ionscale.v1.IonscaleService.GetVersion:input_type -> ionscale.v1.GetVersionRequest @@ -265,39 +272,41 @@ var file_ionscale_v1_ionscale_proto_depIdxs = []int32{ 16, // 16: ionscale.v1.IonscaleService.DeleteAuthKey:input_type -> ionscale.v1.DeleteAuthKeyRequest 17, // 17: ionscale.v1.IonscaleService.ListAuthKeys:input_type -> ionscale.v1.ListAuthKeysRequest 18, // 18: ionscale.v1.IonscaleService.ListUsers:input_type -> ionscale.v1.ListUsersRequest - 19, // 19: ionscale.v1.IonscaleService.ListMachines:input_type -> ionscale.v1.ListMachinesRequest - 20, // 20: ionscale.v1.IonscaleService.ExpireMachine:input_type -> ionscale.v1.ExpireMachineRequest - 21, // 21: ionscale.v1.IonscaleService.DeleteMachine:input_type -> ionscale.v1.DeleteMachineRequest - 22, // 22: ionscale.v1.IonscaleService.SetMachineKeyExpiry:input_type -> ionscale.v1.SetMachineKeyExpiryRequest - 23, // 23: ionscale.v1.IonscaleService.GetMachineRoutes:input_type -> ionscale.v1.GetMachineRoutesRequest - 24, // 24: ionscale.v1.IonscaleService.SetMachineRoutes:input_type -> ionscale.v1.SetMachineRoutesRequest - 25, // 25: ionscale.v1.IonscaleService.GetVersion:output_type -> ionscale.v1.GetVersionResponse - 26, // 26: ionscale.v1.IonscaleService.Authenticate:output_type -> ionscale.v1.AuthenticationResponse - 27, // 27: ionscale.v1.IonscaleService.GetDERPMap:output_type -> ionscale.v1.GetDERPMapResponse - 28, // 28: ionscale.v1.IonscaleService.SetDERPMap:output_type -> ionscale.v1.SetDERPMapResponse - 29, // 29: ionscale.v1.IonscaleService.CreateTailnet:output_type -> ionscale.v1.CreateTailnetResponse - 30, // 30: ionscale.v1.IonscaleService.GetTailnet:output_type -> ionscale.v1.GetTailnetResponse - 31, // 31: ionscale.v1.IonscaleService.ListTailnets:output_type -> ionscale.v1.ListTailnetResponse - 32, // 32: ionscale.v1.IonscaleService.DeleteTailnet:output_type -> ionscale.v1.DeleteTailnetResponse - 33, // 33: ionscale.v1.IonscaleService.GetDNSConfig:output_type -> ionscale.v1.GetDNSConfigResponse - 34, // 34: ionscale.v1.IonscaleService.SetDNSConfig:output_type -> ionscale.v1.SetDNSConfigResponse - 35, // 35: ionscale.v1.IonscaleService.GetIAMPolicy:output_type -> ionscale.v1.GetIAMPolicyResponse - 36, // 36: ionscale.v1.IonscaleService.SetIAMPolicy:output_type -> ionscale.v1.SetIAMPolicyResponse - 37, // 37: ionscale.v1.IonscaleService.GetACLPolicy:output_type -> ionscale.v1.GetACLPolicyResponse - 38, // 38: ionscale.v1.IonscaleService.SetACLPolicy:output_type -> ionscale.v1.SetACLPolicyResponse - 39, // 39: ionscale.v1.IonscaleService.GetAuthKey:output_type -> ionscale.v1.GetAuthKeyResponse - 40, // 40: ionscale.v1.IonscaleService.CreateAuthKey:output_type -> ionscale.v1.CreateAuthKeyResponse - 41, // 41: ionscale.v1.IonscaleService.DeleteAuthKey:output_type -> ionscale.v1.DeleteAuthKeyResponse - 42, // 42: ionscale.v1.IonscaleService.ListAuthKeys:output_type -> ionscale.v1.ListAuthKeysResponse - 43, // 43: ionscale.v1.IonscaleService.ListUsers:output_type -> ionscale.v1.ListUsersResponse - 44, // 44: ionscale.v1.IonscaleService.ListMachines:output_type -> ionscale.v1.ListMachinesResponse - 45, // 45: ionscale.v1.IonscaleService.ExpireMachine:output_type -> ionscale.v1.ExpireMachineResponse - 46, // 46: ionscale.v1.IonscaleService.DeleteMachine:output_type -> ionscale.v1.DeleteMachineResponse - 47, // 47: ionscale.v1.IonscaleService.SetMachineKeyExpiry:output_type -> ionscale.v1.SetMachineKeyExpiryResponse - 48, // 48: ionscale.v1.IonscaleService.GetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse - 48, // 49: ionscale.v1.IonscaleService.SetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse - 25, // [25:50] is the sub-list for method output_type - 0, // [0:25] is the sub-list for method input_type + 19, // 19: ionscale.v1.IonscaleService.DeleteUser:input_type -> ionscale.v1.DeleteUserRequest + 20, // 20: ionscale.v1.IonscaleService.ListMachines:input_type -> ionscale.v1.ListMachinesRequest + 21, // 21: ionscale.v1.IonscaleService.ExpireMachine:input_type -> ionscale.v1.ExpireMachineRequest + 22, // 22: ionscale.v1.IonscaleService.DeleteMachine:input_type -> ionscale.v1.DeleteMachineRequest + 23, // 23: ionscale.v1.IonscaleService.SetMachineKeyExpiry:input_type -> ionscale.v1.SetMachineKeyExpiryRequest + 24, // 24: ionscale.v1.IonscaleService.GetMachineRoutes:input_type -> ionscale.v1.GetMachineRoutesRequest + 25, // 25: ionscale.v1.IonscaleService.SetMachineRoutes:input_type -> ionscale.v1.SetMachineRoutesRequest + 26, // 26: ionscale.v1.IonscaleService.GetVersion:output_type -> ionscale.v1.GetVersionResponse + 27, // 27: ionscale.v1.IonscaleService.Authenticate:output_type -> ionscale.v1.AuthenticationResponse + 28, // 28: ionscale.v1.IonscaleService.GetDERPMap:output_type -> ionscale.v1.GetDERPMapResponse + 29, // 29: ionscale.v1.IonscaleService.SetDERPMap:output_type -> ionscale.v1.SetDERPMapResponse + 30, // 30: ionscale.v1.IonscaleService.CreateTailnet:output_type -> ionscale.v1.CreateTailnetResponse + 31, // 31: ionscale.v1.IonscaleService.GetTailnet:output_type -> ionscale.v1.GetTailnetResponse + 32, // 32: ionscale.v1.IonscaleService.ListTailnets:output_type -> ionscale.v1.ListTailnetResponse + 33, // 33: ionscale.v1.IonscaleService.DeleteTailnet:output_type -> ionscale.v1.DeleteTailnetResponse + 34, // 34: ionscale.v1.IonscaleService.GetDNSConfig:output_type -> ionscale.v1.GetDNSConfigResponse + 35, // 35: ionscale.v1.IonscaleService.SetDNSConfig:output_type -> ionscale.v1.SetDNSConfigResponse + 36, // 36: ionscale.v1.IonscaleService.GetIAMPolicy:output_type -> ionscale.v1.GetIAMPolicyResponse + 37, // 37: ionscale.v1.IonscaleService.SetIAMPolicy:output_type -> ionscale.v1.SetIAMPolicyResponse + 38, // 38: ionscale.v1.IonscaleService.GetACLPolicy:output_type -> ionscale.v1.GetACLPolicyResponse + 39, // 39: ionscale.v1.IonscaleService.SetACLPolicy:output_type -> ionscale.v1.SetACLPolicyResponse + 40, // 40: ionscale.v1.IonscaleService.GetAuthKey:output_type -> ionscale.v1.GetAuthKeyResponse + 41, // 41: ionscale.v1.IonscaleService.CreateAuthKey:output_type -> ionscale.v1.CreateAuthKeyResponse + 42, // 42: ionscale.v1.IonscaleService.DeleteAuthKey:output_type -> ionscale.v1.DeleteAuthKeyResponse + 43, // 43: ionscale.v1.IonscaleService.ListAuthKeys:output_type -> ionscale.v1.ListAuthKeysResponse + 44, // 44: ionscale.v1.IonscaleService.ListUsers:output_type -> ionscale.v1.ListUsersResponse + 45, // 45: ionscale.v1.IonscaleService.DeleteUser:output_type -> ionscale.v1.DeleteUserResponse + 46, // 46: ionscale.v1.IonscaleService.ListMachines:output_type -> ionscale.v1.ListMachinesResponse + 47, // 47: ionscale.v1.IonscaleService.ExpireMachine:output_type -> ionscale.v1.ExpireMachineResponse + 48, // 48: ionscale.v1.IonscaleService.DeleteMachine:output_type -> ionscale.v1.DeleteMachineResponse + 49, // 49: ionscale.v1.IonscaleService.SetMachineKeyExpiry:output_type -> ionscale.v1.SetMachineKeyExpiryResponse + 50, // 50: ionscale.v1.IonscaleService.GetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse + 50, // 51: ionscale.v1.IonscaleService.SetMachineRoutes:output_type -> ionscale.v1.GetMachineRoutesResponse + 26, // [26:52] is the sub-list for method output_type + 0, // [0:26] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go b/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go index 1762c51..2362c74 100644 --- a/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go +++ b/pkg/gen/ionscale/v1/ionscalev1connect/ionscale.connect.go @@ -46,6 +46,7 @@ type IonscaleServiceClient interface { DeleteAuthKey(context.Context, *connect_go.Request[v1.DeleteAuthKeyRequest]) (*connect_go.Response[v1.DeleteAuthKeyResponse], error) ListAuthKeys(context.Context, *connect_go.Request[v1.ListAuthKeysRequest]) (*connect_go.Response[v1.ListAuthKeysResponse], error) ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) + DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) ListMachines(context.Context, *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) ExpireMachine(context.Context, *connect_go.Request[v1.ExpireMachineRequest]) (*connect_go.Response[v1.ExpireMachineResponse], error) DeleteMachine(context.Context, *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) @@ -159,6 +160,11 @@ func NewIonscaleServiceClient(httpClient connect_go.HTTPClient, baseURL string, baseURL+"/ionscale.v1.IonscaleService/ListUsers", opts..., ), + deleteUser: connect_go.NewClient[v1.DeleteUserRequest, v1.DeleteUserResponse]( + httpClient, + baseURL+"/ionscale.v1.IonscaleService/DeleteUser", + opts..., + ), listMachines: connect_go.NewClient[v1.ListMachinesRequest, v1.ListMachinesResponse]( httpClient, baseURL+"/ionscale.v1.IonscaleService/ListMachines", @@ -213,6 +219,7 @@ type ionscaleServiceClient struct { deleteAuthKey *connect_go.Client[v1.DeleteAuthKeyRequest, v1.DeleteAuthKeyResponse] listAuthKeys *connect_go.Client[v1.ListAuthKeysRequest, v1.ListAuthKeysResponse] listUsers *connect_go.Client[v1.ListUsersRequest, v1.ListUsersResponse] + deleteUser *connect_go.Client[v1.DeleteUserRequest, v1.DeleteUserResponse] listMachines *connect_go.Client[v1.ListMachinesRequest, v1.ListMachinesResponse] expireMachine *connect_go.Client[v1.ExpireMachineRequest, v1.ExpireMachineResponse] deleteMachine *connect_go.Client[v1.DeleteMachineRequest, v1.DeleteMachineResponse] @@ -316,6 +323,11 @@ func (c *ionscaleServiceClient) ListUsers(ctx context.Context, req *connect_go.R return c.listUsers.CallUnary(ctx, req) } +// DeleteUser calls ionscale.v1.IonscaleService.DeleteUser. +func (c *ionscaleServiceClient) DeleteUser(ctx context.Context, req *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) { + return c.deleteUser.CallUnary(ctx, req) +} + // ListMachines calls ionscale.v1.IonscaleService.ListMachines. func (c *ionscaleServiceClient) ListMachines(ctx context.Context, req *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) { return c.listMachines.CallUnary(ctx, req) @@ -367,6 +379,7 @@ type IonscaleServiceHandler interface { DeleteAuthKey(context.Context, *connect_go.Request[v1.DeleteAuthKeyRequest]) (*connect_go.Response[v1.DeleteAuthKeyResponse], error) ListAuthKeys(context.Context, *connect_go.Request[v1.ListAuthKeysRequest]) (*connect_go.Response[v1.ListAuthKeysResponse], error) ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) + DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) ListMachines(context.Context, *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) ExpireMachine(context.Context, *connect_go.Request[v1.ExpireMachineRequest]) (*connect_go.Response[v1.ExpireMachineResponse], error) DeleteMachine(context.Context, *connect_go.Request[v1.DeleteMachineRequest]) (*connect_go.Response[v1.DeleteMachineResponse], error) @@ -477,6 +490,11 @@ func NewIonscaleServiceHandler(svc IonscaleServiceHandler, opts ...connect_go.Ha svc.ListUsers, opts..., )) + mux.Handle("/ionscale.v1.IonscaleService/DeleteUser", connect_go.NewUnaryHandler( + "/ionscale.v1.IonscaleService/DeleteUser", + svc.DeleteUser, + opts..., + )) mux.Handle("/ionscale.v1.IonscaleService/ListMachines", connect_go.NewUnaryHandler( "/ionscale.v1.IonscaleService/ListMachines", svc.ListMachines, @@ -589,6 +607,10 @@ func (UnimplementedIonscaleServiceHandler) ListUsers(context.Context, *connect_g return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.ListUsers is not implemented")) } +func (UnimplementedIonscaleServiceHandler) DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.DeleteUser is not implemented")) +} + func (UnimplementedIonscaleServiceHandler) ListMachines(context.Context, *connect_go.Request[v1.ListMachinesRequest]) (*connect_go.Response[v1.ListMachinesResponse], error) { return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("ionscale.v1.IonscaleService.ListMachines is not implemented")) } diff --git a/pkg/gen/ionscale/v1/users.pb.go b/pkg/gen/ionscale/v1/users.pb.go index 06e9d72..e957abd 100644 --- a/pkg/gen/ionscale/v1/users.pb.go +++ b/pkg/gen/ionscale/v1/users.pb.go @@ -177,6 +177,91 @@ func (x *ListUsersResponse) GetUsers() []*User { return nil } +type DeleteUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ionscale_v1_users_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserRequest) ProtoMessage() {} + +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_ionscale_v1_users_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { + return file_ionscale_v1_users_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteUserRequest) GetUserId() uint64 { + if x != nil { + return x.UserId + } + return 0 +} + +type DeleteUserResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteUserResponse) Reset() { + *x = DeleteUserResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ionscale_v1_users_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserResponse) ProtoMessage() {} + +func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_ionscale_v1_users_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserResponse) Descriptor() ([]byte, []int) { + return file_ionscale_v1_users_proto_rawDescGZIP(), []int{4} +} + var File_ionscale_v1_users_proto protoreflect.FileDescriptor var file_ionscale_v1_users_proto_rawDesc = []byte{ @@ -193,11 +278,16 @@ var file_ionscale_v1_users_proto_rawDesc = []byte{ 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, 0x6e, 0x73, 0x2f, 0x69, - 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6f, 0x6e, 0x73, - 0x63, 0x61, 0x6c, 0x65, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x2c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3d, 0x5a, 0x3b, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x73, 0x69, 0x65, 0x62, 0x65, + 0x6e, 0x73, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, + 0x69, 0x6f, 0x6e, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -212,11 +302,13 @@ func file_ionscale_v1_users_proto_rawDescGZIP() []byte { return file_ionscale_v1_users_proto_rawDescData } -var file_ionscale_v1_users_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ionscale_v1_users_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_ionscale_v1_users_proto_goTypes = []interface{}{ - (*User)(nil), // 0: ionscale.v1.User - (*ListUsersRequest)(nil), // 1: ionscale.v1.ListUsersRequest - (*ListUsersResponse)(nil), // 2: ionscale.v1.ListUsersResponse + (*User)(nil), // 0: ionscale.v1.User + (*ListUsersRequest)(nil), // 1: ionscale.v1.ListUsersRequest + (*ListUsersResponse)(nil), // 2: ionscale.v1.ListUsersResponse + (*DeleteUserRequest)(nil), // 3: ionscale.v1.DeleteUserRequest + (*DeleteUserResponse)(nil), // 4: ionscale.v1.DeleteUserResponse } var file_ionscale_v1_users_proto_depIdxs = []int32{ 0, // 0: ionscale.v1.ListUsersResponse.users:type_name -> ionscale.v1.User @@ -269,6 +361,30 @@ func file_ionscale_v1_users_proto_init() { return nil } } + file_ionscale_v1_users_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ionscale_v1_users_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -276,7 +392,7 @@ func file_ionscale_v1_users_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ionscale_v1_users_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/ionscale/v1/ionscale.proto b/proto/ionscale/v1/ionscale.proto index 2430164..64d9434 100644 --- a/proto/ionscale/v1/ionscale.proto +++ b/proto/ionscale/v1/ionscale.proto @@ -46,6 +46,7 @@ service IonscaleService { rpc ListAuthKeys (ListAuthKeysRequest) returns (ListAuthKeysResponse) {} rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {} + rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) {} rpc ListMachines (ListMachinesRequest) returns (ListMachinesResponse) {} rpc ExpireMachine(ExpireMachineRequest) returns (ExpireMachineResponse) {} diff --git a/proto/ionscale/v1/users.proto b/proto/ionscale/v1/users.proto index 0e9012e..603c5b8 100644 --- a/proto/ionscale/v1/users.proto +++ b/proto/ionscale/v1/users.proto @@ -16,3 +16,9 @@ message ListUsersRequest { message ListUsersResponse { repeated User users = 1; } + +message DeleteUserRequest { + uint64 user_id = 1; +} + +message DeleteUserResponse {} \ No newline at end of file