CloudMigration: Add service to list all migrations (#85308)
This commit is contained in:
@@ -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