[v11.0.x] CloudMigration: Add service to list all migrations (#86350)
CloudMigration: Add service to list all migrations (#85308)
(cherry picked from commit 5b147d0847)
Co-authored-by: lean.dev <34773040+leandro-deveikis@users.noreply.github.com>
This commit is contained in:
co-authored by
lean.dev
parent
2ee985abc2
commit
23a24bc9af
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// CloudMigrationsServiceImpl Define the Service Implementation.
|
||||
// Service Define the cloudmigration.Service Implementation.
|
||||
type Service struct {
|
||||
store store
|
||||
|
||||
@@ -192,13 +192,29 @@ func (s *Service) SaveEncryptedToken(ctx context.Context, token string) error {
|
||||
}
|
||||
|
||||
func (s *Service) GetMigration(ctx context.Context, id int64) (*cloudmigration.CloudMigrationResponse, error) {
|
||||
// TODO: Implement method
|
||||
// commenting to fix linter, uncomment when this function is implemented
|
||||
// ctx, span := s.tracer.Start(ctx, "CloudMigrationService.GetMigration")
|
||||
// defer span.End()
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *Service) GetMigrationList(ctx context.Context) ([]cloudmigration.CloudMigrationResponse, error) {
|
||||
// TODO: Implement method
|
||||
return nil, nil
|
||||
func (s *Service) GetMigrationList(ctx context.Context) (*cloudmigration.CloudMigrationListResponse, error) {
|
||||
values, err := s.store.GetAllCloudMigrations(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
migrations := make([]cloudmigration.CloudMigrationResponse, 0)
|
||||
for _, v := range values {
|
||||
migrations = append(migrations, cloudmigration.CloudMigrationResponse{
|
||||
ID: v.ID,
|
||||
Stack: v.Stack,
|
||||
Created: v.Created,
|
||||
Updated: v.Updated,
|
||||
})
|
||||
}
|
||||
return &cloudmigration.CloudMigrationListResponse{Migrations: migrations}, nil
|
||||
}
|
||||
|
||||
func (s *Service) CreateMigration(ctx context.Context, cm cloudmigration.CloudMigrationRequest) (*cloudmigration.CloudMigrationResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user