satellite

package
v0.0.0-...-32533e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrManagedByOperator = errors.New("satellite is managed by operator and cannot be edited manually")

Functions

func ToResponse

func ToResponse(s *Satellite) gen.Satellite

ToResponse converts the domain Satellite into the generated API model.

func ToResponseList

func ToResponseList(satellites []*Satellite) []gen.Satellite

ToResponseList converts a slice of domain Satellites into generated API models.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request)

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

func (*Handler) GetByID

func (h *Handler) GetByID(w http.ResponseWriter, r *http.Request)

func (*Handler) Heartbeat

func (h *Handler) Heartbeat(w http.ResponseWriter, r *http.Request)

func (*Handler) List

func (h *Handler) List(w http.ResponseWriter, r *http.Request)

func (*Handler) Update

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

type PostgresRepository

type PostgresRepository struct {
	// contains filtered or unexported fields
}

func NewPostgresRepository

func NewPostgresRepository(db *pgxpool.Pool) *PostgresRepository

func (*PostgresRepository) Create

func (r *PostgresRepository) Create(ctx context.Context, s *Satellite) (*Satellite, error)

func (*PostgresRepository) Delete

func (r *PostgresRepository) Delete(ctx context.Context, id uuid.UUID) error

func (*PostgresRepository) GetByID

func (r *PostgresRepository) GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)

func (*PostgresRepository) List

func (r *PostgresRepository) List(ctx context.Context) ([]*Satellite, error)

func (*PostgresRepository) Update

func (r *PostgresRepository) Update(ctx context.Context, id uuid.UUID, region string) (*Satellite, error)

func (*PostgresRepository) UpdateHeartbeat

func (r *PostgresRepository) UpdateHeartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)

type Repository

type Repository interface {
	Create(ctx context.Context, s *Satellite) (*Satellite, error)
	GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)
	List(ctx context.Context) ([]*Satellite, error)
	Update(ctx context.Context, id uuid.UUID, region string) (*Satellite, error)
	Delete(ctx context.Context, id uuid.UUID) error
	UpdateHeartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)
}

type Satellite

type Satellite struct {
	ID         uuid.UUID  `json:"id"`
	Name       string     `json:"name"`
	Region     string     `json:"region"`
	Status     string     `json:"status"`
	ManagedBy  string     `json:"managed_by"`
	LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
	CreatedAt  time.Time  `json:"created_at"`
}

func ToDomainCreate

func ToDomainCreate(req gen.CreateSatelliteRequest) *Satellite

ToDomainCreate converts an OpenAPI create request into the domain model.

Business fields (ID, Status, ManagedBy, CreatedAt, LastSeenAt) are intentionally left zero-valued. Service.Create is responsible for initializing them.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, sat *Satellite) (*Satellite, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id uuid.UUID, fromOperator bool) error

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)

func (*Service) Heartbeat

func (s *Service) Heartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]*Satellite, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id uuid.UUID, region string, fromOperator bool) (*Satellite, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL