schema

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListModels

func ListModels() []interface{}

ListModels lists all the models in this schema.

Types

type Egress

type Egress struct {
	ID          string            `gorm:"primaryKey" json:"id"`
	Name        string            `gorm:"name" json:"name"`
	Network     string            `gorm:"network" json:"network"`
	Description string            `gorm:"description" json:"description"`
	Nodes       datatypes.JSONMap `gorm:"nodes" json:"nodes"`
	Tags        datatypes.JSONMap `gorm:"tags" json:"tags"`
	Range       string            `gorm:"range" json:"range"`
	Nat         bool              `gorm:"nat" json:"nat"`
	//IsInetGw    bool              `gorm:"is_inet_gw" json:"is_internet_gateway"`
	Status    bool      `gorm:"status" json:"status"`
	CreatedBy string    `gorm:"created_by" json:"created_by"`
	CreatedAt time.Time `gorm:"created_at" json:"created_at"`
	UpdatedAt time.Time `gorm:"updated_at" json:"updated_at"`
}

func (*Egress) Create

func (e *Egress) Create(ctx context.Context) error

func (*Egress) Delete

func (e *Egress) Delete(ctx context.Context) error

func (*Egress) Get

func (e *Egress) Get(ctx context.Context) error

func (*Egress) ListByNetwork

func (e *Egress) ListByNetwork(ctx context.Context) (egs []Egress, err error)

func (*Egress) Table

func (e *Egress) Table() string

func (*Egress) Update

func (e *Egress) Update(ctx context.Context) error

func (*Egress) UpdateEgressStatus

func (e *Egress) UpdateEgressStatus(ctx context.Context) error

func (*Egress) UpdateNatStatus

func (e *Egress) UpdateNatStatus(ctx context.Context) error

type Event

type Event struct {
	ID          string           `gorm:"primaryKey" json:"id"`
	Action      models.Action    `gorm:"action" json:"action"`
	Source      datatypes.JSON   `gorm:"source" json:"source"`
	Origin      models.Origin    `gorm:"origin" json:"origin"`
	Target      datatypes.JSON   `gorm:"target" json:"target"`
	NetworkID   models.NetworkID `gorm:"network_id" json:"network_id"`
	TriggeredBy string           `gorm:"triggered_by" json:"triggered_by"`
	Diff        datatypes.JSON   `gorm:"diff" json:"diff"`
	TimeStamp   time.Time        `gorm:"time_stamp" json:"time_stamp"`
}

func (*Event) Create

func (a *Event) Create(ctx context.Context) error

func (*Event) DeleteOldEvents

func (a *Event) DeleteOldEvents(ctx context.Context, retentionDays int) error

func (*Event) Get

func (a *Event) Get(ctx context.Context) error

func (*Event) List

func (a *Event) List(ctx context.Context, from, to time.Time) (ats []Event, err error)

func (*Event) ListByNetwork

func (a *Event) ListByNetwork(ctx context.Context, from, to time.Time) (ats []Event, err error)

func (*Event) ListByUser

func (a *Event) ListByUser(ctx context.Context, from, to time.Time) (ats []Event, err error)

func (*Event) ListByUserAndNetwork

func (a *Event) ListByUserAndNetwork(ctx context.Context, from, to time.Time) (ats []Event, err error)

func (*Event) Update

func (a *Event) Update(ctx context.Context) error

type Job

type Job struct {
	ID        string `gorm:"primaryKey"`
	CreatedAt time.Time
}

Job represents a task that netmaker server wants to do.

Ideally, a jobs table should have details about its type, status, who initiated it, etc. But, for now, the table only contains records of jobs that have been done, so that it is easier to prevent a task from being executed again.

func (*Job) Create

func (j *Job) Create(ctx context.Context) error

Create creates a job record in the jobs table.

func (*Job) Get

func (j *Job) Get(ctx context.Context) error

Get returns a job record with the given Job.ID.

type UserAccessToken

type UserAccessToken struct {
	ID        string    `gorm:"primaryKey" json:"id"`
	Name      string    `json:"name"`
	UserName  string    `json:"user_name"`
	ExpiresAt time.Time `json:"expires_at"`
	LastUsed  time.Time `json:"last_used"`
	CreatedBy string    `json:"created_by"`
	CreatedAt time.Time `json:"created_at"`
}

UserAccessToken - token used to access netmaker

func (*UserAccessToken) CountByUser added in v1.0.0

func (a *UserAccessToken) CountByUser(ctx context.Context) (int, error)

func (*UserAccessToken) Create

func (a *UserAccessToken) Create(ctx context.Context) error

func (*UserAccessToken) Delete

func (a *UserAccessToken) Delete(ctx context.Context) error

func (*UserAccessToken) DeleteAllUserTokens

func (a *UserAccessToken) DeleteAllUserTokens(ctx context.Context) error

func (*UserAccessToken) Get

func (a *UserAccessToken) Get(ctx context.Context) error

func (*UserAccessToken) List

func (a *UserAccessToken) List(ctx context.Context) (ats []UserAccessToken, err error)

func (*UserAccessToken) ListByUser

func (a *UserAccessToken) ListByUser(ctx context.Context) (ats []UserAccessToken)

func (*UserAccessToken) Update

func (a *UserAccessToken) Update(ctx context.Context) error

Jump to

Keyboard shortcuts

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