Skip to content

Commit

Permalink
Rename searchresult to stuff (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Feb 9, 2018
1 parent 0af444d commit 771e6ba
Show file tree
Hide file tree
Showing 29 changed files with 385 additions and 173 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/kubed/register.go
Expand Up @@ -28,7 +28,7 @@ var (
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&SearchResult{},
&Stuff{},
)
return nil
}
4 changes: 2 additions & 2 deletions pkg/apis/kubed/types.go
Expand Up @@ -9,7 +9,7 @@ import (
// +genclient:onlyVerbs=get
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type SearchResult struct {
type Stuff struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Expand All @@ -19,7 +19,7 @@ type SearchResult struct {
Took metav1.Duration `json:"took"`
}

var _ runtime.Object = &SearchResult{}
var _ runtime.Object = &Stuff{}

type ResultEntry struct {
Score float64 `json:"score"`
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/apis/kubed/v1alpha1/register.go
Expand Up @@ -29,7 +29,7 @@ func init() {
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&SearchResult{},
&Stuff{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/kubed/v1alpha1/types.go
Expand Up @@ -239,7 +239,7 @@ type KubedMetadata struct {
// +genclient:onlyVerbs=get
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type SearchResult struct {
type Stuff struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Expand All @@ -249,7 +249,7 @@ type SearchResult struct {
Took metav1.Duration `json:"took"`
}

var _ runtime.Object = &SearchResult{}
var _ runtime.Object = &Stuff{}

type ResultEntry struct {
Score float64 `json:"score"`
Expand Down
20 changes: 10 additions & 10 deletions pkg/apis/kubed/v1alpha1/zz_generated.conversion.go
Expand Up @@ -38,8 +38,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1alpha1_ResultEntry_To_kubed_ResultEntry,
Convert_kubed_ResultEntry_To_v1alpha1_ResultEntry,
Convert_v1alpha1_SearchResult_To_kubed_SearchResult,
Convert_kubed_SearchResult_To_v1alpha1_SearchResult,
Convert_v1alpha1_Stuff_To_kubed_Stuff,
Convert_kubed_Stuff_To_v1alpha1_Stuff,
)
}

Expand All @@ -65,7 +65,7 @@ func Convert_kubed_ResultEntry_To_v1alpha1_ResultEntry(in *kubed.ResultEntry, ou
return autoConvert_kubed_ResultEntry_To_v1alpha1_ResultEntry(in, out, s)
}

func autoConvert_v1alpha1_SearchResult_To_kubed_SearchResult(in *SearchResult, out *kubed.SearchResult, s conversion.Scope) error {
func autoConvert_v1alpha1_Stuff_To_kubed_Stuff(in *Stuff, out *kubed.Stuff, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Hits = *(*[]kubed.ResultEntry)(unsafe.Pointer(&in.Hits))
out.Total = in.Total
Expand All @@ -74,12 +74,12 @@ func autoConvert_v1alpha1_SearchResult_To_kubed_SearchResult(in *SearchResult, o
return nil
}

// Convert_v1alpha1_SearchResult_To_kubed_SearchResult is an autogenerated conversion function.
func Convert_v1alpha1_SearchResult_To_kubed_SearchResult(in *SearchResult, out *kubed.SearchResult, s conversion.Scope) error {
return autoConvert_v1alpha1_SearchResult_To_kubed_SearchResult(in, out, s)
// Convert_v1alpha1_Stuff_To_kubed_Stuff is an autogenerated conversion function.
func Convert_v1alpha1_Stuff_To_kubed_Stuff(in *Stuff, out *kubed.Stuff, s conversion.Scope) error {
return autoConvert_v1alpha1_Stuff_To_kubed_Stuff(in, out, s)
}

func autoConvert_kubed_SearchResult_To_v1alpha1_SearchResult(in *kubed.SearchResult, out *SearchResult, s conversion.Scope) error {
func autoConvert_kubed_Stuff_To_v1alpha1_Stuff(in *kubed.Stuff, out *Stuff, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Hits = *(*[]ResultEntry)(unsafe.Pointer(&in.Hits))
out.Total = in.Total
Expand All @@ -88,7 +88,7 @@ func autoConvert_kubed_SearchResult_To_v1alpha1_SearchResult(in *kubed.SearchRes
return nil
}

// Convert_kubed_SearchResult_To_v1alpha1_SearchResult is an autogenerated conversion function.
func Convert_kubed_SearchResult_To_v1alpha1_SearchResult(in *kubed.SearchResult, out *SearchResult, s conversion.Scope) error {
return autoConvert_kubed_SearchResult_To_v1alpha1_SearchResult(in, out, s)
// Convert_kubed_Stuff_To_v1alpha1_Stuff is an autogenerated conversion function.
func Convert_kubed_Stuff_To_v1alpha1_Stuff(in *kubed.Stuff, out *Stuff, s conversion.Scope) error {
return autoConvert_kubed_Stuff_To_v1alpha1_Stuff(in, out, s)
}
44 changes: 22 additions & 22 deletions pkg/apis/kubed/v1alpha1/zz_generated.deepcopy.go
Expand Up @@ -555,7 +555,24 @@ func (in *S3Spec) DeepCopy() *S3Spec {
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SearchResult) DeepCopyInto(out *SearchResult) {
func (in *SnapshotSpec) DeepCopyInto(out *SnapshotSpec) {
*out = *in
in.Backend.DeepCopyInto(&out.Backend)
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSpec.
func (in *SnapshotSpec) DeepCopy() *SnapshotSpec {
if in == nil {
return nil
}
out := new(SnapshotSpec)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Stuff) DeepCopyInto(out *Stuff) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
Expand All @@ -570,42 +587,25 @@ func (in *SearchResult) DeepCopyInto(out *SearchResult) {
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SearchResult.
func (in *SearchResult) DeepCopy() *SearchResult {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Stuff.
func (in *Stuff) DeepCopy() *Stuff {
if in == nil {
return nil
}
out := new(SearchResult)
out := new(Stuff)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *SearchResult) DeepCopyObject() runtime.Object {
func (in *Stuff) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SnapshotSpec) DeepCopyInto(out *SnapshotSpec) {
*out = *in
in.Backend.DeepCopyInto(&out.Backend)
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSpec.
func (in *SnapshotSpec) DeepCopy() *SnapshotSpec {
if in == nil {
return nil
}
out := new(SnapshotSpec)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SwiftSpec) DeepCopyInto(out *SwiftSpec) {
*out = *in
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/kubed/zz_generated.deepcopy.go
Expand Up @@ -42,7 +42,7 @@ func (in *ResultEntry) DeepCopy() *ResultEntry {
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SearchResult) DeepCopyInto(out *SearchResult) {
func (in *Stuff) DeepCopyInto(out *Stuff) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
Expand All @@ -57,18 +57,18 @@ func (in *SearchResult) DeepCopyInto(out *SearchResult) {
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SearchResult.
func (in *SearchResult) DeepCopy() *SearchResult {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Stuff.
func (in *Stuff) DeepCopy() *Stuff {
if in == nil {
return nil
}
out := new(SearchResult)
out := new(Stuff)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *SearchResult) DeepCopyObject() runtime.Object {
func (in *Stuff) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
Expand Down
Expand Up @@ -25,8 +25,8 @@ type FakeKubed struct {
*testing.Fake
}

func (c *FakeKubed) SearchResults(namespace string) internalversion.SearchResultInterface {
return &FakeSearchResults{c, namespace}
func (c *FakeKubed) Stuffs(namespace string) internalversion.StuffInterface {
return &FakeStuffs{c, namespace}
}

// RESTClient returns a RESTClient that is used to communicate
Expand Down
Expand Up @@ -22,23 +22,23 @@ import (
testing "k8s.io/client-go/testing"
)

// FakeSearchResults implements SearchResultInterface
type FakeSearchResults struct {
// FakeStuffs implements StuffInterface
type FakeStuffs struct {
Fake *FakeKubed
ns string
}

var searchresultsResource = schema.GroupVersionResource{Group: "kubed.appscode.com", Version: "", Resource: "searchresults"}
var stuffsResource = schema.GroupVersionResource{Group: "kubed.appscode.com", Version: "", Resource: "stuffs"}

var searchresultsKind = schema.GroupVersionKind{Group: "kubed.appscode.com", Version: "", Kind: "SearchResult"}
var stuffsKind = schema.GroupVersionKind{Group: "kubed.appscode.com", Version: "", Kind: "Stuff"}

// Get takes name of the searchResult, and returns the corresponding searchResult object, and an error if there is any.
func (c *FakeSearchResults) Get(name string, options v1.GetOptions) (result *kubed.SearchResult, err error) {
func (c *FakeStuffs) Get(name string, options v1.GetOptions) (result *kubed.Stuff, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(searchresultsResource, c.ns, name), &kubed.SearchResult{})
Invokes(testing.NewGetAction(stuffsResource, c.ns, name), &kubed.Stuff{})

if obj == nil {
return nil, err
}
return obj.(*kubed.SearchResult), err
return obj.(*kubed.Stuff), err
}
@@ -0,0 +1,44 @@
/*
Copyright 2018 The Kubed Authors.
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 (
kubed "github.com/appscode/kubed/pkg/apis/kubed"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
testing "k8s.io/client-go/testing"
)

// FakeStuffs implements StuffInterface
type FakeStuffs struct {
Fake *FakeKubed
ns string
}

var stuffsResource = schema.GroupVersionResource{Group: "kubed.appscode.com", Version: "", Resource: "stuffs"}

var stuffsKind = schema.GroupVersionKind{Group: "kubed.appscode.com", Version: "", Kind: "Stuff"}

// Get takes name of the stuff, and returns the corresponding stuff object, and an error if there is any.
func (c *FakeStuffs) Get(name string, options v1.GetOptions) (result *kubed.Stuff, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(stuffsResource, c.ns, name), &kubed.Stuff{})

if obj == nil {
return nil, err
}
return obj.(*kubed.Stuff), err
}
Expand Up @@ -15,4 +15,4 @@ limitations under the License.
*/
package internalversion

type SearchResultExpansion interface{}
type StuffExpansion interface{}
Expand Up @@ -22,16 +22,16 @@ import (

type KubedInterface interface {
RESTClient() rest.Interface
SearchResultsGetter
StuffsGetter
}

// KubedClient is used to interact with features provided by the kubed.appscode.com group.
type KubedClient struct {
restClient rest.Interface
}

func (c *KubedClient) SearchResults(namespace string) SearchResultInterface {
return newSearchResults(c, namespace)
func (c *KubedClient) Stuffs(namespace string) StuffInterface {
return newStuffs(c, namespace)
}

// NewForConfig creates a new KubedClient for the given config.
Expand Down
Expand Up @@ -22,38 +22,38 @@ import (
rest "k8s.io/client-go/rest"
)

// SearchResultsGetter has a method to return a SearchResultInterface.
// StuffsGetter has a method to return a StuffInterface.
// A group's client should implement this interface.
type SearchResultsGetter interface {
SearchResults(namespace string) SearchResultInterface
type StuffsGetter interface {
Stuffs(namespace string) StuffInterface
}

// SearchResultInterface has methods to work with SearchResult resources.
type SearchResultInterface interface {
Get(name string, options v1.GetOptions) (*kubed.SearchResult, error)
SearchResultExpansion
// StuffInterface has methods to work with Stuff resources.
type StuffInterface interface {
Get(name string, options v1.GetOptions) (*kubed.Stuff, error)
StuffExpansion
}

// searchResults implements SearchResultInterface
// searchResults implements StuffInterface
type searchResults struct {
client rest.Interface
ns string
}

// newSearchResults returns a SearchResults
func newSearchResults(c *KubedClient, namespace string) *searchResults {
// newStuffs returns a Stuffs
func newStuffs(c *KubedClient, namespace string) *searchResults {
return &searchResults{
client: c.RESTClient(),
ns: namespace,
}
}

// Get takes name of the searchResult, and returns the corresponding searchResult object, and an error if there is any.
func (c *searchResults) Get(name string, options v1.GetOptions) (result *kubed.SearchResult, err error) {
result = &kubed.SearchResult{}
func (c *searchResults) Get(name string, options v1.GetOptions) (result *kubed.Stuff, err error) {
result = &kubed.Stuff{}
err = c.client.Get().
Namespace(c.ns).
Resource("searchresults").
Resource("stuffs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Expand Down

0 comments on commit 771e6ba

Please sign in to comment.