| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package v1 |
| 20 |
|
| 21 |
import ( |
| 22 |
http "net/http" |
| 23 |
|
| 24 |
batchv1 "k8s.io/api/batch/v1" |
| 25 |
scheme "k8s.io/client-go/kubernetes/scheme" |
| 26 |
rest "k8s.io/client-go/rest" |
| 27 |
) |
| 28 |
|
| 29 |
type BatchV1Interface interface { |
| 30 |
RESTClient() rest.Interface |
| 31 |
CronJobsGetter |
| 32 |
JobsGetter |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
type BatchV1Client struct { |
| 37 |
restClient rest.Interface |
| 38 |
} |
| 39 |
|
| 40 |
func (c *BatchV1Client) CronJobs(namespace string) CronJobInterface { |
| 41 |
return newCronJobs(c, namespace) |
| 42 |
} |
| 43 |
|
| 44 |
func (c *BatchV1Client) Jobs(namespace string) JobInterface { |
| 45 |
return newJobs(c, namespace) |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
func NewForConfig(c *rest.Config) (*BatchV1Client, error) { |
| 52 |
config := *c |
| 53 |
setConfigDefaults(&config) |
| 54 |
httpClient, err := rest.HTTPClientFor(&config) |
| 55 |
if err != nil { |
| 56 |
return nil, err |
| 57 |
} |
| 58 |
return NewForConfigAndClient(&config, httpClient) |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BatchV1Client, error) { |
| 64 |
config := *c |
| 65 |
setConfigDefaults(&config) |
| 66 |
client, err := rest.RESTClientForConfigAndClient(&config, h) |
| 67 |
if err != nil { |
| 68 |
return nil, err |
| 69 |
} |
| 70 |
return &BatchV1Client{client}, nil |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
func NewForConfigOrDie(c *rest.Config) *BatchV1Client { |
| 76 |
client, err := NewForConfig(c) |
| 77 |
if err != nil { |
| 78 |
panic(err) |
| 79 |
} |
| 80 |
return client |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
func New(c rest.Interface) *BatchV1Client { |
| 85 |
return &BatchV1Client{c} |
| 86 |
} |
| 87 |
|
| 88 |
func setConfigDefaults(config *rest.Config) { |
| 89 |
gv := batchv1.SchemeGroupVersion |
| 90 |
config.GroupVersion = &gv |
| 91 |
config.APIPath = "/apis" |
| 92 |
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() |
| 93 |
|
| 94 |
if config.UserAgent == "" { |
| 95 |
config.UserAgent = rest.DefaultKubernetesUserAgent() |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
func (c *BatchV1Client) RESTClient() rest.Interface { |
| 102 |
if c == nil { |
| 103 |
return nil |
| 104 |
} |
| 105 |
return c.restClient |
| 106 |
} |