File: instances.interface.mapper.go

package info (click to toggle)
incus 6.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,392 kB
  • sloc: sh: 16,313; ansic: 3,121; python: 457; makefile: 337; ruby: 51; sql: 50; lisp: 6
file content (64 lines) | stat: -rw-r--r-- 2,948 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//go:build linux && cgo && !agent

package cluster

import "context"

// InstanceGenerated is an interface of generated methods for Instance.
type InstanceGenerated interface {
	// GetInstanceConfig returns all available Instance Config
	// generator: instance GetMany
	GetInstanceConfig(ctx context.Context, db tx, instanceID int, filters ...ConfigFilter) (map[string]string, error)

	// GetInstanceDevices returns all available Instance Devices
	// generator: instance GetMany
	GetInstanceDevices(ctx context.Context, db tx, instanceID int, filters ...DeviceFilter) (map[string]Device, error)

	// GetInstances returns all available instances.
	// generator: instance GetMany
	GetInstances(ctx context.Context, db dbtx, filters ...InstanceFilter) ([]Instance, error)

	// GetInstance returns the instance with the given key.
	// generator: instance GetOne
	GetInstance(ctx context.Context, db dbtx, project string, name string) (*Instance, error)

	// GetInstanceID return the ID of the instance with the given key.
	// generator: instance ID
	GetInstanceID(ctx context.Context, db tx, project string, name string) (int64, error)

	// InstanceExists checks if a instance with the given key exists.
	// generator: instance Exists
	InstanceExists(ctx context.Context, db dbtx, project string, name string) (bool, error)

	// CreateInstanceConfig adds new instance Config to the database.
	// generator: instance Create
	CreateInstanceConfig(ctx context.Context, db dbtx, instanceID int64, config map[string]string) error

	// CreateInstanceDevices adds new instance Devices to the database.
	// generator: instance Create
	CreateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) error

	// CreateInstance adds a new instance to the database.
	// generator: instance Create
	CreateInstance(ctx context.Context, db dbtx, object Instance) (int64, error)

	// RenameInstance renames the instance matching the given key parameters.
	// generator: instance Rename
	RenameInstance(ctx context.Context, db dbtx, project string, name string, to string) error

	// DeleteInstance deletes the instance matching the given key parameters.
	// generator: instance DeleteOne-by-Project-and-Name
	DeleteInstance(ctx context.Context, db dbtx, project string, name string) error

	// UpdateInstanceConfig updates the instance Config matching the given key parameters.
	// generator: instance Update
	UpdateInstanceConfig(ctx context.Context, db tx, instanceID int64, config map[string]string) error

	// UpdateInstanceDevices updates the instance Device matching the given key parameters.
	// generator: instance Update
	UpdateInstanceDevices(ctx context.Context, db tx, instanceID int64, devices map[string]Device) error

	// UpdateInstance updates the instance matching the given key parameters.
	// generator: instance Update
	UpdateInstance(ctx context.Context, db tx, project string, name string, object Instance) error
}