dashboardsnapshots

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBaseNotFound = errutil.NotFound("dashboardsnapshots.not-found", errutil.WithPublicMessage("Snapshot not found"))

Functions

func DeleteExternalDashboardSnapshot

func DeleteExternalDashboardSnapshot(externalUrl string) error

func DeleteWithKey

func DeleteWithKey(ctx context.Context, key string, svc Service) error

Types

type CreateDashboardSnapshotCommand

type CreateDashboardSnapshotCommand struct {
	// The "public" fields are defined in this struct while the private/SQL/response params are
	// defied in the rest of this command
	dashboardsnapshot.DashboardCreateCommand

	ExternalURL       string `json:"-"`
	ExternalDeleteURL string `json:"-"`

	// Define the unique key. Required if `external` is `true`.
	// required:false
	Key string `json:"key"`

	// Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.
	// required:false
	DeleteKey string `json:"deleteKey"`

	OrgID  int64 `json:"-"`
	UserID int64 `json:"-"`

	DashboardEncrypted []byte `json:"-"`
}

swagger:model

type CreateExternalSnapshotResponse

type CreateExternalSnapshotResponse struct {
	Key       string `json:"key"`
	DeleteKey string `json:"deleteKey"`
	Url       string `json:"url"`
	DeleteUrl string `json:"deleteUrl"`
}

type DashboardSnapshot

type DashboardSnapshot struct {
	ID                int64 `xorm:"pk autoincr 'id'"`
	Name              string
	Key               string
	DeleteKey         string
	OrgID             int64 `xorm:"org_id"`
	UserID            int64 `xorm:"user_id"`
	External          bool
	ExternalURL       string `xorm:"external_url"`
	ExternalDeleteURL string `xorm:"external_delete_url"`

	Expires time.Time
	Created time.Time
	Updated time.Time

	Dashboard          *simplejson.Json
	DashboardEncrypted []byte
}

DashboardSnapshot model

type DashboardSnapshotDTO

type DashboardSnapshotDTO struct {
	ID          int64  `json:"-" xorm:"id"`
	Name        string `json:"name"`
	Key         string `json:"key"`
	OrgID       int64  `json:"-" xorm:"org_id"`
	UserID      int64  `json:"-" xorm:"user_id"`
	External    bool   `json:"external"`
	ExternalURL string `json:"externalUrl" xorm:"external_url"`

	Expires time.Time `json:"expires"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

DashboardSnapshotDTO without dashboard map

type DashboardSnapshotsList

type DashboardSnapshotsList []*DashboardSnapshotDTO

type DeleteDashboardSnapshotCommand

type DeleteDashboardSnapshotCommand struct {
	DeleteKey string `json:"-"`
}

type DeleteExpiredSnapshotsCommand

type DeleteExpiredSnapshotsCommand struct {
	DeletedRows int64
}

type GetDashboardSnapshotQuery

type GetDashboardSnapshotQuery struct {
	Key       string
	DeleteKey string
}

type GetDashboardSnapshotsQuery

type GetDashboardSnapshotsQuery struct {
	Name         string
	Limit        int
	OrgID        int64
	SignedInUser identity.Requester
}

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockService) CreateDashboardSnapshot

func (_m *MockService) CreateDashboardSnapshot(_a0 context.Context, _a1 *CreateDashboardSnapshotCommand) (*DashboardSnapshot, error)

CreateDashboardSnapshot provides a mock function with given fields: _a0, _a1

func (*MockService) DeleteDashboardSnapshot

func (_m *MockService) DeleteDashboardSnapshot(_a0 context.Context, _a1 *DeleteDashboardSnapshotCommand) error

DeleteDashboardSnapshot provides a mock function with given fields: _a0, _a1

func (*MockService) DeleteExpiredSnapshots

func (_m *MockService) DeleteExpiredSnapshots(_a0 context.Context, _a1 *DeleteExpiredSnapshotsCommand) error

DeleteExpiredSnapshots provides a mock function with given fields: _a0, _a1

func (*MockService) GetDashboardSnapshot

func (_m *MockService) GetDashboardSnapshot(_a0 context.Context, _a1 *GetDashboardSnapshotQuery) (*DashboardSnapshot, error)

GetDashboardSnapshot provides a mock function with given fields: _a0, _a1

func (*MockService) SearchDashboardSnapshots

func (_m *MockService) SearchDashboardSnapshots(_a0 context.Context, _a1 *GetDashboardSnapshotsQuery) (DashboardSnapshotsList, error)

SearchDashboardSnapshots provides a mock function with given fields: _a0, _a1

func (*MockService) ValidateDashboardExists

func (_m *MockService) ValidateDashboardExists(_a0 context.Context, _a1 int64, _a2 string) error

ValidateDashboardExists provides a mock function with given fields: _a0, _a1, _a2

type Service

type Service interface {
	CreateDashboardSnapshot(context.Context, *CreateDashboardSnapshotCommand) (*DashboardSnapshot, error)
	DeleteDashboardSnapshot(context.Context, *DeleteDashboardSnapshotCommand) error
	DeleteExpiredSnapshots(context.Context, *DeleteExpiredSnapshotsCommand) error
	GetDashboardSnapshot(context.Context, *GetDashboardSnapshotQuery) (*DashboardSnapshot, error)
	SearchDashboardSnapshots(context.Context, *GetDashboardSnapshotsQuery) (DashboardSnapshotsList, error)
	ValidateDashboardExists(context.Context, int64, string) error
}

type Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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