Commit c470afc2 authored by Maciej Szulik's avatar Maciej Szulik

Generated changes for moving job internals from pkg/apis/extensions to pkg/apis/batch

parent a3b44473
// +build !ignore_autogenerated
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -14,16 +16,156 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// DO NOT EDIT. THIS FILE IS AUTO-GENERATED BY $KUBEROOT/hack/update-generated-deep-copies.sh.
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package batch
import api "k8s.io/kubernetes/pkg/api"
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
err := api.Scheme.AddGeneratedDeepCopyFuncs()
if err != nil {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
DeepCopy_batch_Job,
DeepCopy_batch_JobCondition,
DeepCopy_batch_JobList,
DeepCopy_batch_JobSpec,
DeepCopy_batch_JobStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_batch_Job(in Job, out *Job, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_batch_JobSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_batch_JobStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_batch_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_batch_JobList(in JobList, out *JobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Job, len(in))
for i := range in {
if err := DeepCopy_batch_Job(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_batch_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error {
if in.Parallelism != nil {
in, out := in.Parallelism, &out.Parallelism
*out = new(int)
**out = *in
} else {
out.Parallelism = nil
}
if in.Completions != nil {
in, out := in.Completions, &out.Completions
*out = new(int)
**out = *in
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
in, out := in.ActiveDeadlineSeconds, &out.ActiveDeadlineSeconds
*out = new(int64)
**out = *in
} else {
out.ActiveDeadlineSeconds = nil
}
if in.Selector != nil {
in, out := in.Selector, &out.Selector
*out = new(unversioned.LabelSelector)
if err := unversioned.DeepCopy_unversioned_LabelSelector(*in, *out, c); err != nil {
return err
}
} else {
out.Selector = nil
}
if in.ManualSelector != nil {
in, out := in.ManualSelector, &out.ManualSelector
*out = new(bool)
**out = *in
} else {
out.ManualSelector = nil
}
if err := api.DeepCopy_api_PodTemplateSpec(in.Template, &out.Template, c); err != nil {
return err
}
return nil
}
func DeepCopy_batch_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) error {
if in.Conditions != nil {
in, out := in.Conditions, &out.Conditions
*out = make([]JobCondition, len(in))
for i := range in {
if err := DeepCopy_batch_JobCondition(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Conditions = nil
}
if in.StartTime != nil {
in, out := in.StartTime, &out.StartTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := in.CompletionTime, &out.CompletionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.CompletionTime = nil
}
out.Active = in.Active
out.Succeeded = in.Succeeded
out.Failed = in.Failed
return nil
}
......@@ -62,11 +62,6 @@ func init() {
DeepCopy_extensions_IngressSpec,
DeepCopy_extensions_IngressStatus,
DeepCopy_extensions_IngressTLS,
DeepCopy_extensions_Job,
DeepCopy_extensions_JobCondition,
DeepCopy_extensions_JobList,
DeepCopy_extensions_JobSpec,
DeepCopy_extensions_JobStatus,
DeepCopy_extensions_PodSecurityPolicy,
DeepCopy_extensions_PodSecurityPolicyList,
DeepCopy_extensions_PodSecurityPolicySpec,
......@@ -572,137 +567,6 @@ func DeepCopy_extensions_IngressTLS(in IngressTLS, out *IngressTLS, c *conversio
return nil
}
func DeepCopy_extensions_Job(in Job, out *Job, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_extensions_JobSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_extensions_JobStatus(in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
func DeepCopy_extensions_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_extensions_JobList(in JobList, out *JobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Job, len(in))
for i := range in {
if err := DeepCopy_extensions_Job(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func DeepCopy_extensions_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error {
if in.Parallelism != nil {
in, out := in.Parallelism, &out.Parallelism
*out = new(int)
**out = *in
} else {
out.Parallelism = nil
}
if in.Completions != nil {
in, out := in.Completions, &out.Completions
*out = new(int)
**out = *in
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
in, out := in.ActiveDeadlineSeconds, &out.ActiveDeadlineSeconds
*out = new(int64)
**out = *in
} else {
out.ActiveDeadlineSeconds = nil
}
if in.Selector != nil {
in, out := in.Selector, &out.Selector
*out = new(unversioned.LabelSelector)
if err := unversioned.DeepCopy_unversioned_LabelSelector(*in, *out, c); err != nil {
return err
}
} else {
out.Selector = nil
}
if in.ManualSelector != nil {
in, out := in.ManualSelector, &out.ManualSelector
*out = new(bool)
**out = *in
} else {
out.ManualSelector = nil
}
if err := api.DeepCopy_api_PodTemplateSpec(in.Template, &out.Template, c); err != nil {
return err
}
return nil
}
func DeepCopy_extensions_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) error {
if in.Conditions != nil {
in, out := in.Conditions, &out.Conditions
*out = make([]JobCondition, len(in))
for i := range in {
if err := DeepCopy_extensions_JobCondition(in[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Conditions = nil
}
if in.StartTime != nil {
in, out := in.StartTime, &out.StartTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := in.CompletionTime, &out.CompletionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
} else {
out.CompletionTime = nil
}
out.Active = in.Active
out.Succeeded = in.Succeeded
out.Failed = in.Failed
return nil
}
func DeepCopy_extensions_PodSecurityPolicy(in PodSecurityPolicy, out *PodSecurityPolicy, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
......
......@@ -18,6 +18,7 @@ package internalclientset
import (
"github.com/golang/glog"
unversionedbatch "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
......@@ -29,6 +30,7 @@ type Interface interface {
Discovery() discovery.DiscoveryInterface
Core() unversionedcore.CoreInterface
Extensions() unversionedextensions.ExtensionsInterface
Batch() unversionedbatch.BatchInterface
}
// Clientset contains the clients for groups. Each group has exactly one
......@@ -37,6 +39,7 @@ type Clientset struct {
*discovery.DiscoveryClient
*unversionedcore.CoreClient
*unversionedextensions.ExtensionsClient
*unversionedbatch.BatchClient
}
// Core retrieves the CoreClient
......@@ -49,6 +52,11 @@ func (c *Clientset) Extensions() unversionedextensions.ExtensionsInterface {
return c.ExtensionsClient
}
// Batch retrieves the BatchClient
func (c *Clientset) Batch() unversionedbatch.BatchInterface {
return c.BatchClient
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
......@@ -70,6 +78,10 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if err != nil {
return &clientset, err
}
clientset.BatchClient, err = unversionedbatch.NewForConfig(&configShallowCopy)
if err != nil {
return &clientset, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
......@@ -84,6 +96,7 @@ func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.ExtensionsClient = unversionedextensions.NewForConfigOrDie(c)
clientset.BatchClient = unversionedbatch.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
......@@ -94,6 +107,7 @@ func New(c *restclient.RESTClient) *Clientset {
var clientset Clientset
clientset.CoreClient = unversionedcore.New(c)
clientset.ExtensionsClient = unversionedextensions.New(c)
clientset.BatchClient = unversionedbatch.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset
......
......@@ -20,6 +20,8 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
unversionedbatch "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
fakeunversionedbatch "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned/fake"
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
fakeunversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/fake"
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
......@@ -70,3 +72,8 @@ func (c *Clientset) Core() unversionedcore.CoreInterface {
func (c *Clientset) Extensions() unversionedextensions.ExtensionsInterface {
return &fakeunversionedextensions.FakeExtensions{Fake: &c.Fake}
}
// Batch retrieves the BatchClient
func (c *Clientset) Batch() unversionedbatch.BatchInterface {
return &fakeunversionedbatch.FakeBatch{Fake: &c.Fake}
}
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type BatchInterface interface {
JobsGetter
}
// BatchClient is used to interact with features provided by the Batch group.
type BatchClient struct {
*restclient.RESTClient
}
func (c *BatchClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
// NewForConfig creates a new BatchClient for the given config.
func NewForConfig(c *restclient.Config) (*BatchClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &BatchClient{client}, nil
}
// NewForConfigOrDie creates a new BatchClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *BatchClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new BatchClient for the given RESTClient.
func New(c *restclient.RESTClient) *BatchClient {
return &BatchClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if batch group is not registered, return an error
g, err := registered.Group("batch")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.Codec = api.Codecs.LegacyCodec(*config.GroupVersion)
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with the default arguments.
// This package has the automatically generated typed clients.
package unversioned
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with the default arguments.
// Package fake has the automatically generated clients.
package fake
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
unversioned "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
core "k8s.io/kubernetes/pkg/client/testing/core"
)
type FakeBatch struct {
*core.Fake
}
func (c *FakeBatch) Jobs(namespace string) unversioned.JobInterface {
return &FakeJobs{c, namespace}
}
......@@ -19,7 +19,7 @@ package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
batch "k8s.io/kubernetes/pkg/apis/batch"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
......@@ -27,45 +27,45 @@ import (
// FakeJobs implements JobInterface
type FakeJobs struct {
Fake *FakeExtensions
Fake *FakeBatch
ns string
}
var jobsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "jobs"}
var jobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "", Resource: "jobs"}
func (c *FakeJobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
func (c *FakeJobs) Create(job *batch.Job) (result *batch.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(jobsResource, c.ns, job), &extensions.Job{})
Invokes(core.NewCreateAction(jobsResource, c.ns, job), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
return obj.(*batch.Job), err
}
func (c *FakeJobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
func (c *FakeJobs) Update(job *batch.Job) (result *batch.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(jobsResource, c.ns, job), &extensions.Job{})
Invokes(core.NewUpdateAction(jobsResource, c.ns, job), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
return obj.(*batch.Job), err
}
func (c *FakeJobs) UpdateStatus(job *extensions.Job) (*extensions.Job, error) {
func (c *FakeJobs) UpdateStatus(job *batch.Job) (*batch.Job, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &extensions.Job{})
Invokes(core.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
return obj.(*batch.Job), err
}
func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(jobsResource, c.ns, name), &extensions.Job{})
Invokes(core.NewDeleteAction(jobsResource, c.ns, name), &batch.Job{})
return err
}
......@@ -73,23 +73,23 @@ func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
func (c *FakeJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(jobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &extensions.JobList{})
_, err := c.Fake.Invokes(action, &batch.JobList{})
return err
}
func (c *FakeJobs) Get(name string) (result *extensions.Job, err error) {
func (c *FakeJobs) Get(name string) (result *batch.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(jobsResource, c.ns, name), &extensions.Job{})
Invokes(core.NewGetAction(jobsResource, c.ns, name), &batch.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
return obj.(*batch.Job), err
}
func (c *FakeJobs) List(opts api.ListOptions) (result *extensions.JobList, err error) {
func (c *FakeJobs) List(opts api.ListOptions) (result *batch.JobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(jobsResource, c.ns, opts), &extensions.JobList{})
Invokes(core.NewListAction(jobsResource, c.ns, opts), &batch.JobList{})
if obj == nil {
return nil, err
......@@ -99,8 +99,8 @@ func (c *FakeJobs) List(opts api.ListOptions) (result *extensions.JobList, err e
if label == nil {
label = labels.Everything()
}
list := &extensions.JobList{}
for _, item := range obj.(*extensions.JobList).Items {
list := &batch.JobList{}
for _, item := range obj.(*batch.JobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
......
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
type JobExpansion interface{}
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
batch "k8s.io/kubernetes/pkg/apis/batch"
watch "k8s.io/kubernetes/pkg/watch"
)
// JobsGetter has a method to return a JobInterface.
// A group's client should implement this interface.
type JobsGetter interface {
Jobs(namespace string) JobInterface
}
// JobInterface has methods to work with Job resources.
type JobInterface interface {
Create(*batch.Job) (*batch.Job, error)
Update(*batch.Job) (*batch.Job, error)
UpdateStatus(*batch.Job) (*batch.Job, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*batch.Job, error)
List(opts api.ListOptions) (*batch.JobList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
JobExpansion
}
// jobs implements JobInterface
type jobs struct {
client *BatchClient
ns string
}
// newJobs returns a Jobs
func newJobs(c *BatchClient, namespace string) *jobs {
return &jobs{
client: c,
ns: namespace,
}
}
// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Create(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Post().
Namespace(c.ns).
Resource("jobs").
Body(job).
Do().
Into(result)
return
}
// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Update(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
Name(job.Name).
Body(job).
Do().
Into(result)
return
}
func (c *jobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
Name(job.Name).
SubResource("status").
Body(job).
Do().
Into(result)
return
}
// Delete takes name of the job and deletes it. Returns an error if one occurs.
func (c *jobs) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *jobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
func (c *jobs) Get(name string) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
func (c *jobs) List(opts api.ListOptions) (result *batch.JobList, err error) {
result = &batch.JobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
......@@ -27,7 +27,6 @@ type ExtensionsInterface interface {
DeploymentsGetter
HorizontalPodAutoscalersGetter
IngressesGetter
JobsGetter
ReplicaSetsGetter
ScalesGetter
ThirdPartyResourcesGetter
......@@ -54,10 +53,6 @@ func (c *ExtensionsClient) Ingresses(namespace string) IngressInterface {
return newIngresses(c, namespace)
}
func (c *ExtensionsClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
......
......@@ -41,10 +41,6 @@ func (c *FakeExtensions) Ingresses(namespace string) unversioned.IngressInterfac
return &FakeIngresses{c, namespace}
}
func (c *FakeExtensions) Jobs(namespace string) unversioned.JobInterface {
return &FakeJobs{c, namespace}
}
func (c *FakeExtensions) ReplicaSets(namespace string) unversioned.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace}
}
......
......@@ -18,7 +18,7 @@ package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
batch "k8s.io/kubernetes/pkg/apis/batch"
watch "k8s.io/kubernetes/pkg/watch"
)
......@@ -30,13 +30,13 @@ type JobsGetter interface {
// JobInterface has methods to work with Job resources.
type JobInterface interface {
Create(*extensions.Job) (*extensions.Job, error)
Update(*extensions.Job) (*extensions.Job, error)
UpdateStatus(*extensions.Job) (*extensions.Job, error)
Create(*batch.Job) (*batch.Job, error)
Update(*batch.Job) (*batch.Job, error)
UpdateStatus(*batch.Job) (*batch.Job, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*extensions.Job, error)
List(opts api.ListOptions) (*extensions.JobList, error)
Get(name string) (*batch.Job, error)
List(opts api.ListOptions) (*batch.JobList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
JobExpansion
}
......@@ -56,8 +56,8 @@ func newJobs(c *ExtensionsClient, namespace string) *jobs {
}
// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Create(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Post().
Namespace(c.ns).
Resource("jobs").
......@@ -68,8 +68,8 @@ func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
}
// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Update(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
......@@ -80,8 +80,8 @@ func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
return
}
func (c *jobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
......@@ -116,8 +116,8 @@ func (c *jobs) DeleteCollection(options *api.DeleteOptions, listOptions api.List
}
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
func (c *jobs) Get(name string) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Get(name string) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
......@@ -128,8 +128,8 @@ func (c *jobs) Get(name string) (result *extensions.Job, err error) {
}
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
func (c *jobs) List(opts api.ListOptions) (result *extensions.JobList, err error) {
result = &extensions.JobList{}
func (c *jobs) List(opts api.ListOptions) (result *batch.JobList, err error) {
result = &batch.JobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
......
......@@ -29,7 +29,6 @@ type ExtensionsInterface interface {
DeploymentsGetter
HorizontalPodAutoscalersGetter
IngressesGetter
JobsGetter
ReplicaSetsGetter
ScalesGetter
ThirdPartyResourcesGetter
......@@ -56,10 +55,6 @@ func (c *ExtensionsClient) Ingresses(namespace string) IngressInterface {
return newIngresses(c, namespace)
}
func (c *ExtensionsClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
......
......@@ -41,10 +41,6 @@ func (c *FakeExtensions) Ingresses(namespace string) unversioned.IngressInterfac
return &FakeIngresses{c, namespace}
}
func (c *FakeExtensions) Jobs(namespace string) unversioned.JobInterface {
return &FakeJobs{c, namespace}
}
func (c *FakeExtensions) ReplicaSets(namespace string) unversioned.ReplicaSetInterface {
return &FakeReplicaSets{c, namespace}
}
......
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeJobs implements JobInterface
type FakeJobs struct {
Fake *FakeExtensions
ns string
}
var jobsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "jobs"}
func (c *FakeJobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(jobsResource, c.ns, job), &extensions.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
}
func (c *FakeJobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(jobsResource, c.ns, job), &extensions.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
}
func (c *FakeJobs) UpdateStatus(job *extensions.Job) (*extensions.Job, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &extensions.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
}
func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(jobsResource, c.ns, name), &extensions.Job{})
return err
}
func (c *FakeJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(jobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &extensions.JobList{})
return err
}
func (c *FakeJobs) Get(name string) (result *extensions.Job, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(jobsResource, c.ns, name), &extensions.Job{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Job), err
}
func (c *FakeJobs) List(opts api.ListOptions) (result *extensions.JobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(jobsResource, c.ns, opts), &extensions.JobList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &extensions.JobList{}
for _, item := range obj.(*extensions.JobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *FakeJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(jobsResource, c.ns, opts))
}
......@@ -20,7 +20,7 @@ package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
batch "k8s.io/kubernetes/pkg/apis/batch"
watch "k8s.io/kubernetes/pkg/watch"
)
......@@ -32,13 +32,13 @@ type JobsGetter interface {
// JobInterface has methods to work with Job resources.
type JobInterface interface {
Create(*extensions.Job) (*extensions.Job, error)
Update(*extensions.Job) (*extensions.Job, error)
UpdateStatus(*extensions.Job) (*extensions.Job, error)
Create(*batch.Job) (*batch.Job, error)
Update(*batch.Job) (*batch.Job, error)
UpdateStatus(*batch.Job) (*batch.Job, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*extensions.Job, error)
List(opts api.ListOptions) (*extensions.JobList, error)
Get(name string) (*batch.Job, error)
List(opts api.ListOptions) (*batch.JobList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
JobExpansion
}
......@@ -58,8 +58,8 @@ func newJobs(c *ExtensionsClient, namespace string) *jobs {
}
// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Create(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Post().
Namespace(c.ns).
Resource("jobs").
......@@ -70,8 +70,8 @@ func (c *jobs) Create(job *extensions.Job) (result *extensions.Job, err error) {
}
// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any.
func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Update(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
......@@ -82,8 +82,8 @@ func (c *jobs) Update(job *extensions.Job) (result *extensions.Job, err error) {
return
}
func (c *jobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Put().
Namespace(c.ns).
Resource("jobs").
......@@ -118,8 +118,8 @@ func (c *jobs) DeleteCollection(options *api.DeleteOptions, listOptions api.List
}
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
func (c *jobs) Get(name string) (result *extensions.Job, err error) {
result = &extensions.Job{}
func (c *jobs) Get(name string) (result *batch.Job, err error) {
result = &batch.Job{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
......@@ -130,8 +130,8 @@ func (c *jobs) Get(name string) (result *extensions.Job, err error) {
}
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
func (c *jobs) List(opts api.ListOptions) (result *extensions.JobList, err error) {
result = &extensions.JobList{}
func (c *jobs) List(opts api.ListOptions) (result *batch.JobList, err error) {
result = &batch.JobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("jobs").
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment