targets

package
v0.0.0-...-6c078ff Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamTimeoutSeconds  = "timeout_seconds"
	ParamRetries         = "retries"
	ParamIntervalSeconds = "interval_seconds"
)

Variables

View Source
var (
	ErrNotFound   = errors.New("target not found")
	ErrValidation = errors.New("validation error")
	ErrForbidden  = errors.New("forbidden")
)

Functions

func Module

func Module() fx.Option

Types

type CreateTargetInput

type CreateTargetInput struct {
	Name        string
	Endpoint    string
	Description string
	Visibility  Visibility

	CheckParams map[string]string
}

func (*CreateTargetInput) Validate

func (in *CreateTargetInput) Validate() error

type Repository

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

func NewRepository

func NewRepository(db *bun.DB) *Repository

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, userID string, in CreateTargetInput) (*Target, error)

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, userID string, targetID string) error

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, id string) (*Target, error)

func (*Repository) ListByOwner

func (r *Repository) ListByOwner(ctx context.Context, ownerUserID string) ([]Target, error)

func (*Repository) ListPublic

func (r *Repository) ListPublic(ctx context.Context) ([]Target, error)

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, userID string, id string, in UpdateTargetInput) (*Target, error)

type Service

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

func New

func New(targets *Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, userID string, in CreateTargetInput) (*Target, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, userID string, targetID string) error

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, userID string, targetID string) (*Target, error)

func (*Service) ListOwned

func (s *Service) ListOwned(ctx context.Context, userID string) ([]Target, error)

func (*Service) ListPublic

func (s *Service) ListPublic(ctx context.Context) ([]Target, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, userID string, id string, in UpdateTargetInput) (*Target, error)

type Status

type Status string
const (
	StatusActive   Status = "active"
	StatusInactive Status = "inactive"
	StatusDeleted  Status = "deleted"
)

type Target

type Target struct {
	ID string

	UserID      string
	Name        string
	Endpoint    string
	Description string

	Visibility Visibility
	Status     Status

	CheckParams map[string]string

	CreatedAt time.Time
	UpdatedAt time.Time
}

type UpdateTargetInput

type UpdateTargetInput = CreateTargetInput

type Visibility

type Visibility string
const (
	VisibilityPrivate  Visibility = "private"  // Visible to the private agents only
	VisibilityInternal Visibility = "internal" // Visible to the private and service-provided agents
	VisibilityPublic   Visibility = "public"   // Visible to the any agents
)

Jump to

Keyboard shortcuts

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