File: log.go

package info (click to toggle)
golang-github-mimuret-golang-iij-dpf 0.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,340 kB
  • sloc: makefile: 55
file content (43 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download
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
package lb_domains

import (
	"github.com/mimuret/golang-iij-dpf/pkg/api"
	"github.com/mimuret/golang-iij-dpf/pkg/apis"
	"github.com/mimuret/golang-iij-dpf/pkg/apis/dpf/v1/core"
)

var _ CountableListSpec = &LogList{}

// +k8s:deepcopy-gen:interfaces=github.com/mimuret/golang-iij-dpf/pkg/api.Object

type LogList struct {
	AttributeMeta
	api.Count
	Items []core.Log `read:"items"`
}

func (c *LogList) GetName() string         { return "logs" }
func (c *LogList) GetItems() interface{}   { return &c.Items }
func (c *LogList) Len() int                { return len(c.Items) }
func (c *LogList) Index(i int) interface{} { return c.Items[i] }
func (c *LogList) GetMaxLimit() int32      { return 100 }
func (c *LogList) ClearItems()             { c.Items = []core.Log{} }
func (c *LogList) AddItem(v interface{}) bool {
	if a, ok := v.(core.Log); ok {
		c.Items = append(c.Items, a)
		return true
	}
	return false
}

func (c *LogList) GetPathMethod(action api.Action) (string, string) {
	return GetPathMethodForCountableListSpec(action, c)
}
func (c *LogList) Init() {}
func (c *LogList) SetPathParams(args ...interface{}) error {
	return apis.SetPathParams(args, &c.LBDomainID)
}

func init() {
	register(&LogList{})
}