File: endpoint_manual_operation.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 (51 lines) | stat: -rw-r--r-- 1,644 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
44
45
46
47
48
49
50
51
package lb_domains

import (
	"fmt"
	"net/http"

	"github.com/mimuret/golang-iij-dpf/pkg/api"
	"github.com/mimuret/golang-iij-dpf/pkg/apis"
)

var _ ChildSpec = &Site{}

// +k8s:deepcopy-gen:interfaces=github.com/mimuret/golang-iij-dpf/pkg/api.Object
type EndpointManualFailover struct {
	SiteAttributeMeta
	EndpointResourceName string
}

func (c *EndpointManualFailover) GetName() string { return "failover" }
func (c *EndpointManualFailover) GetPathMethod(action api.Action) (string, string) {
	if action == api.ActionApply {
		return http.MethodPost, fmt.Sprintf("/lb_domains/%s/sites/%s/endpoints/%s/failover", c.LBDomainID, c.SiteResourceName, c.EndpointResourceName)
	}
	return "", ""
}

func (c *EndpointManualFailover) SetPathParams(args ...interface{}) error {
	return apis.SetPathParams(args, &c.LBDomainID, &c.SiteResourceName, &c.EndpointResourceName)
}

// +k8s:deepcopy-gen:interfaces=github.com/mimuret/golang-iij-dpf/pkg/api.Object
type EndpointManualFailback struct {
	SiteAttributeMeta
	EndpointResourceName string
}

func (c *EndpointManualFailback) GetName() string { return "failback" }
func (c *EndpointManualFailback) GetPathMethod(action api.Action) (string, string) {
	if action == api.ActionApply {
		return http.MethodPost, fmt.Sprintf("/lb_domains/%s/sites/%s/endpoints/%s/failback", c.LBDomainID, c.SiteResourceName, c.EndpointResourceName)
	}
	return "", ""
}

func (c *EndpointManualFailback) SetPathParams(args ...interface{}) error {
	return apis.SetPathParams(args, &c.LBDomainID, &c.SiteResourceName, &c.EndpointResourceName)
}

func init() {
	register(&EndpointManualFailover{}, &EndpointManualFailback{})
}