Server-Side-Implementation
This commit is contained in:
39
clientset/v1alpha1/api.go
Normal file
39
clientset/v1alpha1/api.go
Normal file
@ -0,0 +1,39 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"git.kocoder.xyz/kocoder/portforwarder/api/types/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type TraefikV1Alpha1Interface interface {
|
||||
Ingressroute(namespace string) IngressrouteInterface
|
||||
}
|
||||
|
||||
type TraefikV1Alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func NewForConfig(c *rest.Config) (TraefikV1Alpha1Interface, error) {
|
||||
config := *c
|
||||
config.ContentConfig.GroupVersion = &schema.GroupVersion{Group: v1alpha1.GroupName, Version: v1alpha1.GroupVersion}
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TraefikV1Alpha1Client{restClient: client}, nil
|
||||
}
|
||||
|
||||
func (c *TraefikV1Alpha1Client) Ingressroute(namespace string) IngressrouteInterface {
|
||||
return ingressrouteClient{
|
||||
restClient: c.restClient,
|
||||
ns: namespace,
|
||||
rn: "ingressroutes",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user