Skip to content

Commit

Permalink
Merge pull request #14134 from deads2k/api-01-gc-defaults
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored May 17, 2017
2 parents aa5392b + 34ff3a2 commit 3d82103
Show file tree
Hide file tree
Showing 14 changed files with 722 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/build/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,8 @@ type ImageLabel struct {
Value string
}

// +genclient=true

// BuildConfig is a template which can be used to create new builds.
type BuildConfig struct {
metav1.TypeMeta
Expand Down
2 changes: 2 additions & 0 deletions pkg/build/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,8 @@ type ImageLabel struct {
Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
}

// +genclient=true

// Build configurations define a build process for new Docker images. There are three types of builds possible - a Docker build using a Dockerfile, a Source-to-Image build that uses a specially prepared base image that accepts source code that it can make runnable, and a custom build that can run // arbitrary Docker images as a base and accept the build parameters. Builds run on the cluster and on completion are pushed to the Docker registry specified in the "output" section. A build can be triggered via a webhook, when the base image changes, or when a user manually requests a new build be // created.
//
// Each build created by a build configuration is numbered and refers back to its parent configuration. Multiple builds can be triggered at once. Builds that do not have "output" set can be used to test code or run a verification build.
Expand Down
5 changes: 5 additions & 0 deletions pkg/build/generated/clientset/typed/build/v1/build_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type BuildV1Interface interface {
RESTClient() rest.Interface
BuildsGetter
BuildConfigsGetter
}

// BuildV1Client is used to interact with features provided by the build.openshift.io group.
Expand All @@ -21,6 +22,10 @@ func (c *BuildV1Client) Builds(namespace string) BuildResourceInterface {
return newBuilds(c, namespace)
}

func (c *BuildV1Client) BuildConfigs(namespace string) BuildConfigInterface {
return newBuildConfigs(c, namespace)
}

// NewForConfig creates a new BuildV1Client for the given config.
func NewForConfig(c *rest.Config) (*BuildV1Client, error) {
config := *c
Expand Down
156 changes: 156 additions & 0 deletions pkg/build/generated/clientset/typed/build/v1/buildconfig.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package v1

import (
v1 "github.com/openshift/origin/pkg/build/api/v1"
scheme "github.com/openshift/origin/pkg/build/generated/clientset/scheme"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)

// BuildConfigsGetter has a method to return a BuildConfigInterface.
// A group's client should implement this interface.
type BuildConfigsGetter interface {
BuildConfigs(namespace string) BuildConfigInterface
}

// BuildConfigInterface has methods to work with BuildConfig resources.
type BuildConfigInterface interface {
Create(*v1.BuildConfig) (*v1.BuildConfig, error)
Update(*v1.BuildConfig) (*v1.BuildConfig, error)
UpdateStatus(*v1.BuildConfig) (*v1.BuildConfig, error)
Delete(name string, options *meta_v1.DeleteOptions) error
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
Get(name string, options meta_v1.GetOptions) (*v1.BuildConfig, error)
List(opts meta_v1.ListOptions) (*v1.BuildConfigList, error)
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BuildConfig, err error)
BuildConfigExpansion
}

// buildConfigs implements BuildConfigInterface
type buildConfigs struct {
client rest.Interface
ns string
}

// newBuildConfigs returns a BuildConfigs
func newBuildConfigs(c *BuildV1Client, namespace string) *buildConfigs {
return &buildConfigs{
client: c.RESTClient(),
ns: namespace,
}
}

// Create takes the representation of a buildConfig and creates it. Returns the server's representation of the buildConfig, and an error, if there is any.
func (c *buildConfigs) Create(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) {
result = &v1.BuildConfig{}
err = c.client.Post().
Namespace(c.ns).
Resource("buildconfigs").
Body(buildConfig).
Do().
Into(result)
return
}

// Update takes the representation of a buildConfig and updates it. Returns the server's representation of the buildConfig, and an error, if there is any.
func (c *buildConfigs) Update(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) {
result = &v1.BuildConfig{}
err = c.client.Put().
Namespace(c.ns).
Resource("buildconfigs").
Name(buildConfig.Name).
Body(buildConfig).
Do().
Into(result)
return
}

// UpdateStatus was generated because the type contains a Status member.
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().

func (c *buildConfigs) UpdateStatus(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) {
result = &v1.BuildConfig{}
err = c.client.Put().
Namespace(c.ns).
Resource("buildconfigs").
Name(buildConfig.Name).
SubResource("status").
Body(buildConfig).
Do().
Into(result)
return
}

// Delete takes name of the buildConfig and deletes it. Returns an error if one occurs.
func (c *buildConfigs) Delete(name string, options *meta_v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("buildconfigs").
Name(name).
Body(options).
Do().
Error()
}

// DeleteCollection deletes a collection of objects.
func (c *buildConfigs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("buildconfigs").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}

// Get takes name of the buildConfig, and returns the corresponding buildConfig object, and an error if there is any.
func (c *buildConfigs) Get(name string, options meta_v1.GetOptions) (result *v1.BuildConfig, err error) {
result = &v1.BuildConfig{}
err = c.client.Get().
Namespace(c.ns).
Resource("buildconfigs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}

// List takes label and field selectors, and returns the list of BuildConfigs that match those selectors.
func (c *buildConfigs) List(opts meta_v1.ListOptions) (result *v1.BuildConfigList, err error) {
result = &v1.BuildConfigList{}
err = c.client.Get().
Namespace(c.ns).
Resource("buildconfigs").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}

// Watch returns a watch.Interface that watches the requested buildConfigs.
func (c *buildConfigs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("buildconfigs").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}

// Patch applies the patch and returns the patched buildConfig.
func (c *buildConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BuildConfig, err error) {
result = &v1.BuildConfig{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("buildconfigs").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ func (c *FakeBuildV1) Builds(namespace string) v1.BuildResourceInterface {
return &FakeBuilds{c, namespace}
}

func (c *FakeBuildV1) BuildConfigs(namespace string) v1.BuildConfigInterface {
return &FakeBuildConfigs{c, namespace}
}

// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeBuildV1) RESTClient() rest.Interface {
Expand Down
112 changes: 112 additions & 0 deletions pkg/build/generated/clientset/typed/build/v1/fake/fake_buildconfig.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package fake

import (
v1 "github.com/openshift/origin/pkg/build/api/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)

// FakeBuildConfigs implements BuildConfigInterface
type FakeBuildConfigs struct {
Fake *FakeBuildV1
ns string
}

var buildconfigsResource = schema.GroupVersionResource{Group: "build.openshift.io", Version: "v1", Resource: "buildconfigs"}

func (c *FakeBuildConfigs) Create(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(buildconfigsResource, c.ns, buildConfig), &v1.BuildConfig{})

if obj == nil {
return nil, err
}
return obj.(*v1.BuildConfig), err
}

func (c *FakeBuildConfigs) Update(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(buildconfigsResource, c.ns, buildConfig), &v1.BuildConfig{})

if obj == nil {
return nil, err
}
return obj.(*v1.BuildConfig), err
}

func (c *FakeBuildConfigs) UpdateStatus(buildConfig *v1.BuildConfig) (*v1.BuildConfig, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(buildconfigsResource, "status", c.ns, buildConfig), &v1.BuildConfig{})

if obj == nil {
return nil, err
}
return obj.(*v1.BuildConfig), err
}

func (c *FakeBuildConfigs) Delete(name string, options *meta_v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(buildconfigsResource, c.ns, name), &v1.BuildConfig{})

return err
}

func (c *FakeBuildConfigs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(buildconfigsResource, c.ns, listOptions)

_, err := c.Fake.Invokes(action, &v1.BuildConfigList{})
return err
}

func (c *FakeBuildConfigs) Get(name string, options meta_v1.GetOptions) (result *v1.BuildConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(buildconfigsResource, c.ns, name), &v1.BuildConfig{})

if obj == nil {
return nil, err
}
return obj.(*v1.BuildConfig), err
}

func (c *FakeBuildConfigs) List(opts meta_v1.ListOptions) (result *v1.BuildConfigList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(buildconfigsResource, c.ns, opts), &v1.BuildConfigList{})

if obj == nil {
return nil, err
}

label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1.BuildConfigList{}
for _, item := range obj.(*v1.BuildConfigList).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 buildConfigs.
func (c *FakeBuildConfigs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(buildconfigsResource, c.ns, opts))

}

// Patch applies the patch and returns the patched buildConfig.
func (c *FakeBuildConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BuildConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(buildconfigsResource, c.ns, name, data, subresources...), &v1.BuildConfig{})

if obj == nil {
return nil, err
}
return obj.(*v1.BuildConfig), err
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package v1

type BuildResourceExpansion interface{}

type BuildConfigExpansion interface{}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
type BuildInterface interface {
RESTClient() rest.Interface
BuildsGetter
BuildConfigsGetter
}

// BuildClient is used to interact with features provided by the build.openshift.io group.
Expand All @@ -19,6 +20,10 @@ func (c *BuildClient) Builds(namespace string) BuildResourceInterface {
return newBuilds(c, namespace)
}

func (c *BuildClient) BuildConfigs(namespace string) BuildConfigInterface {
return newBuildConfigs(c, namespace)
}

// NewForConfig creates a new BuildClient for the given config.
func NewForConfig(c *rest.Config) (*BuildClient, error) {
config := *c
Expand Down
Loading

0 comments on commit 3d82103

Please sign in to comment.