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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
package lb_domains
import (
"github.com/mimuret/golang-iij-dpf/pkg/api"
"github.com/mimuret/golang-iij-dpf/pkg/apis"
)
type SiteRRType string
const (
SiteRRTypeA SiteRRType = "A"
SiteRRTypeAAAA SiteRRType = "AAAA"
SiteRRTypeCNAME SiteRRType = "CNAME"
)
var _ ChildSpec = &Site{}
// +k8s:deepcopy-gen:interfaces=github.com/mimuret/golang-iij-dpf/pkg/api.Object
type Site struct {
AttributeMeta
ResourceName string `read:"resource_name" create:"resource_name,omitempty" apply:"resource_name"`
Name string `read:"name" create:"name" update:"name" apply:"name"`
RRType SiteRRType `read:"rrtype" create:"rrtype" apply:"rrtype"`
Description string `read:"description" create:"description" update:"description" apply:"description"`
LiveStatus Status `read:"live_status"`
Endpoints []Endpoint `read:"endpoints" apply:"endpoints"`
}
func (c *Site) Init() {
for i := range c.Endpoints {
c.Endpoints[i].AttributeMeta = c.AttributeMeta
c.Endpoints[i].SiteResourceName = c.ResourceName
c.Endpoints[i].Init()
}
}
func (c *Site) GetName() string { return "sites" }
func (c *Site) GetResourceName() string { return c.ResourceName }
func (c *Site) SetResourceName(resourceName string) { c.ResourceName = resourceName }
func (c *Site) GetPathMethod(action api.Action) (string, string) {
return GetPathMethodForChildSpec(action, c)
}
func (c *Site) SetPathParams(args ...interface{}) error {
return apis.SetPathParams(args, &c.LBDomainID, &c.ResourceName)
}
var _ ListSpec = &SiteList{}
// +k8s:deepcopy-gen:interfaces=github.com/mimuret/golang-iij-dpf/pkg/api.Object
type SiteList struct {
AttributeMeta
api.Count
Items []Site `read:"items"`
}
func (c *SiteList) GetName() string { return "sites" }
func (c *SiteList) GetItems() interface{} { return &c.Items }
func (c *SiteList) Len() int { return len(c.Items) }
func (c *SiteList) Index(i int) interface{} { return c.Items[i] }
func (c *SiteList) GetPathMethod(action api.Action) (string, string) {
return GetPathMethodForListSpec(action, c)
}
func (c *SiteList) Init() {
for i := range c.Items {
c.Items[i].AttributeMeta = c.AttributeMeta
c.Items[i].Init()
}
}
func (c *SiteList) SetPathParams(args ...interface{}) error {
return apis.SetPathParams(args, &c.LBDomainID)
}
func init() {
register(&Site{}, &SiteList{})
}
|