diff --git a/apis/ops/v1alpha1/openapi_generated.go b/apis/ops/v1alpha1/openapi_generated.go index be7d8e28a7..f9f91a3620 100644 --- a/apis/ops/v1alpha1/openapi_generated.go +++ b/apis/ops/v1alpha1/openapi_generated.go @@ -753,6 +753,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/ops/v1alpha1.SolrVolumeExpansionSpec": schema_apimachinery_apis_ops_v1alpha1_SolrVolumeExpansionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.TLSSpec": schema_apimachinery_apis_ops_v1alpha1_TLSSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.Topology": schema_apimachinery_apis_ops_v1alpha1_Topology(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequest": schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequest(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequestList(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequestSpec": schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequestSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ZooKeeperHorizontalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_ZooKeeperHorizontalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ZooKeeperOpsRequest": schema_apimachinery_apis_ops_v1alpha1_ZooKeeperOpsRequest(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.ZooKeeperOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_ZooKeeperOpsRequestList(ref), @@ -36533,6 +36536,157 @@ func schema_apimachinery_apis_ops_v1alpha1_Topology(ref common.ReferenceCallback } } +func schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequest(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequestSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.OpsRequestStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubedb.dev/apimachinery/apis/ops/v1alpha1.OpsRequestStatus", "kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequestSpec"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequestList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "WeaviateOpsRequestList is a list of WeaviateOpsRequests", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of WeaviateOpsRequest CRD objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequest"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubedb.dev/apimachinery/apis/ops/v1alpha1.WeaviateOpsRequest"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_WeaviateOpsRequestSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "WeaviateOpsRequestSpec is the spec for WeaviateOpsRequest", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "databaseRef": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the Weaviate reference", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "restart": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for restarting database", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "apply": { + SchemaProps: spec.SchemaProps{ + Description: "ApplyOption is to control the execution of OpsRequest depending on the database state.", + Type: []string{"string"}, + Format: "", + }, + }, + "maxRetries": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"databaseRef", "type"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"}, + } +} + func schema_apimachinery_apis_ops_v1alpha1_ZooKeeperHorizontalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/ops/v1alpha1/register.go b/apis/ops/v1alpha1/register.go index 13f55fc212..5b67918d52 100644 --- a/apis/ops/v1alpha1/register.go +++ b/apis/ops/v1alpha1/register.go @@ -106,6 +106,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &SolrOpsRequestList{}, &ZooKeeperOpsRequest{}, &ZooKeeperOpsRequestList{}, + &WeaviateOpsRequest{}, + &WeaviateOpsRequestList{}, ) scheme.AddKnownTypes(SchemeGroupVersion, diff --git a/apis/ops/v1alpha1/weaviate_ops_helpers.go b/apis/ops/v1alpha1/weaviate_ops_helpers.go new file mode 100644 index 0000000000..7653ddd4f8 --- /dev/null +++ b/apis/ops/v1alpha1/weaviate_ops_helpers.go @@ -0,0 +1,41 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +var _ Accessor = &WeaviateOpsRequest{} + +func (w *WeaviateOpsRequest) GetObjectMeta() metav1.ObjectMeta { + return w.ObjectMeta +} + +func (w *WeaviateOpsRequest) GetDBRefName() string { + return w.Spec.DatabaseRef.Name +} + +func (w *WeaviateOpsRequest) GetRequestType() string { + return string(w.Spec.Type) +} + +func (w *WeaviateOpsRequest) GetStatus() OpsRequestStatus { + return w.Status +} + +func (w *WeaviateOpsRequest) SetStatus(s OpsRequestStatus) { + w.Status = s +} diff --git a/apis/ops/v1alpha1/weaviate_ops_types.go b/apis/ops/v1alpha1/weaviate_ops_types.go new file mode 100644 index 0000000000..7f391b025e --- /dev/null +++ b/apis/ops/v1alpha1/weaviate_ops_types.go @@ -0,0 +1,86 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +//go:generate go-enum --mustparse --names --values +package v1alpha1 + +import ( + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ResourceCodeWeaviateOpsRequest = "wvops" + ResourceKindWeaviateOpsRequest = "WeaviateOpsRequest" + ResourceSingularWeaviateOpsRequest = "weaviateopsrequest" + ResourcePluralWeaviateOpsRequest = "weaviateopsrequests" +) + +// WeaviateDBOpsRequest defines a Weaviate DBA operation. + +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=weaviateopsrequests,singular=weaviateopsrequest,shortName=wvops,categories={ops,kubedb,appscode} +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type WeaviateOpsRequest struct { + metav1.TypeMeta `json:",inline,omitempty"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WeaviateOpsRequestSpec `json:"spec,omitempty"` + Status OpsRequestStatus `json:"status,omitempty"` +} + +// WeaviateOpsRequestSpec is the spec for WeaviateOpsRequest +type WeaviateOpsRequestSpec struct { + // Specifies the Weaviate reference + DatabaseRef core.LocalObjectReference `json:"databaseRef"` + + // Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc. + Type WeaviateOpsRequestType `json:"type"` + + // Specifies information necessary for restarting database + Restart *RestartSpec `json:"restart,omitempty"` + + // Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure. + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // ApplyOption is to control the execution of OpsRequest depending on the database state. + // +kubebuilder:default="IfReady" + Apply ApplyOption `json:"apply,omitempty"` + + // +kubebuilder:default=1 + MaxRetries int32 `json:"maxRetries,omitempty"` +} + +// +kubebuilder:validation:Enum=Restart +// ENUM(Restart) +type WeaviateOpsRequestType string + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// WeaviateOpsRequestList is a list of WeaviateOpsRequests +type WeaviateOpsRequestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + // Items is a list of WeaviateOpsRequest CRD objects + Items []WeaviateOpsRequest `json:"items,omitempty"` +} diff --git a/apis/ops/v1alpha1/weaviate_ops_types_enum.go b/apis/ops/v1alpha1/weaviate_ops_types_enum.go new file mode 100644 index 0000000000..91e2f29da0 --- /dev/null +++ b/apis/ops/v1alpha1/weaviate_ops_types_enum.go @@ -0,0 +1,69 @@ +// Code generated by go-enum DO NOT EDIT. +// Version: v0.9.2 + +// Built By: go install + +package v1alpha1 + +import ( + "fmt" + "strings" +) + +const ( + // WeaviateOpsRequestTypeRestart is a WeaviateOpsRequestType of type Restart. + WeaviateOpsRequestTypeRestart WeaviateOpsRequestType = "Restart" +) + +var ErrInvalidWeaviateOpsRequestType = fmt.Errorf("not a valid WeaviateOpsRequestType, try [%s]", strings.Join(_WeaviateOpsRequestTypeNames, ", ")) + +var _WeaviateOpsRequestTypeNames = []string{ + string(WeaviateOpsRequestTypeRestart), +} + +// WeaviateOpsRequestTypeNames returns a list of possible string values of WeaviateOpsRequestType. +func WeaviateOpsRequestTypeNames() []string { + tmp := make([]string, len(_WeaviateOpsRequestTypeNames)) + copy(tmp, _WeaviateOpsRequestTypeNames) + return tmp +} + +// WeaviateOpsRequestTypeValues returns a list of the values for WeaviateOpsRequestType +func WeaviateOpsRequestTypeValues() []WeaviateOpsRequestType { + return []WeaviateOpsRequestType{ + WeaviateOpsRequestTypeRestart, + } +} + +// String implements the Stringer interface. +func (x WeaviateOpsRequestType) String() string { + return string(x) +} + +// IsValid provides a quick way to determine if the typed value is +// part of the allowed enumerated values +func (x WeaviateOpsRequestType) IsValid() bool { + _, err := ParseWeaviateOpsRequestType(string(x)) + return err == nil +} + +var _WeaviateOpsRequestTypeValue = map[string]WeaviateOpsRequestType{ + "Restart": WeaviateOpsRequestTypeRestart, +} + +// ParseWeaviateOpsRequestType attempts to convert a string to a WeaviateOpsRequestType. +func ParseWeaviateOpsRequestType(name string) (WeaviateOpsRequestType, error) { + if x, ok := _WeaviateOpsRequestTypeValue[name]; ok { + return x, nil + } + return WeaviateOpsRequestType(""), fmt.Errorf("%s is %w", name, ErrInvalidWeaviateOpsRequestType) +} + +// MustParseWeaviateOpsRequestType converts a string to a WeaviateOpsRequestType, and panics if is not valid. +func MustParseWeaviateOpsRequestType(name string) WeaviateOpsRequestType { + val, err := ParseWeaviateOpsRequestType(name) + if err != nil { + panic(err) + } + return val +} diff --git a/apis/ops/v1alpha1/zz_generated.deepcopy.go b/apis/ops/v1alpha1/zz_generated.deepcopy.go index 697e6fa98b..16afae2047 100644 --- a/apis/ops/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ops/v1alpha1/zz_generated.deepcopy.go @@ -7078,6 +7078,94 @@ func (in *Topology) DeepCopy() *Topology { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WeaviateOpsRequest) DeepCopyInto(out *WeaviateOpsRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeaviateOpsRequest. +func (in *WeaviateOpsRequest) DeepCopy() *WeaviateOpsRequest { + if in == nil { + return nil + } + out := new(WeaviateOpsRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WeaviateOpsRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WeaviateOpsRequestList) DeepCopyInto(out *WeaviateOpsRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WeaviateOpsRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeaviateOpsRequestList. +func (in *WeaviateOpsRequestList) DeepCopy() *WeaviateOpsRequestList { + if in == nil { + return nil + } + out := new(WeaviateOpsRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WeaviateOpsRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WeaviateOpsRequestSpec) DeepCopyInto(out *WeaviateOpsRequestSpec) { + *out = *in + out.DatabaseRef = in.DatabaseRef + if in.Restart != nil { + in, out := &in.Restart, &out.Restart + *out = new(RestartSpec) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeaviateOpsRequestSpec. +func (in *WeaviateOpsRequestSpec) DeepCopy() *WeaviateOpsRequestSpec { + if in == nil { + return nil + } + out := new(WeaviateOpsRequestSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ZooKeeperHorizontalScalingSpec) DeepCopyInto(out *ZooKeeperHorizontalScalingSpec) { *out = *in diff --git a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go index 423982875b..cabe33a714 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go @@ -129,6 +129,10 @@ func (c *FakeOpsV1alpha1) SolrOpsRequests(namespace string) v1alpha1.SolrOpsRequ return &FakeSolrOpsRequests{c, namespace} } +func (c *FakeOpsV1alpha1) WeaviateOpsRequests(namespace string) v1alpha1.WeaviateOpsRequestInterface { + return &FakeWeaviateOpsRequests{c, namespace} +} + func (c *FakeOpsV1alpha1) ZooKeeperOpsRequests(namespace string) v1alpha1.ZooKeeperOpsRequestInterface { return &FakeZooKeeperOpsRequests{c, namespace} } diff --git a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_weaviateopsrequest.go b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_weaviateopsrequest.go new file mode 100644 index 0000000000..7793e1aacf --- /dev/null +++ b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_weaviateopsrequest.go @@ -0,0 +1,142 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeWeaviateOpsRequests implements WeaviateOpsRequestInterface +type FakeWeaviateOpsRequests struct { + Fake *FakeOpsV1alpha1 + ns string +} + +var weaviateopsrequestsResource = v1alpha1.SchemeGroupVersion.WithResource("weaviateopsrequests") + +var weaviateopsrequestsKind = v1alpha1.SchemeGroupVersion.WithKind("WeaviateOpsRequest") + +// Get takes name of the weaviateOpsRequest, and returns the corresponding weaviateOpsRequest object, and an error if there is any. +func (c *FakeWeaviateOpsRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(weaviateopsrequestsResource, c.ns, name), &v1alpha1.WeaviateOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.WeaviateOpsRequest), err +} + +// List takes label and field selectors, and returns the list of WeaviateOpsRequests that match those selectors. +func (c *FakeWeaviateOpsRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WeaviateOpsRequestList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(weaviateopsrequestsResource, weaviateopsrequestsKind, c.ns, opts), &v1alpha1.WeaviateOpsRequestList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.WeaviateOpsRequestList{ListMeta: obj.(*v1alpha1.WeaviateOpsRequestList).ListMeta} + for _, item := range obj.(*v1alpha1.WeaviateOpsRequestList).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 weaviateOpsRequests. +func (c *FakeWeaviateOpsRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(weaviateopsrequestsResource, c.ns, opts)) + +} + +// Create takes the representation of a weaviateOpsRequest and creates it. Returns the server's representation of the weaviateOpsRequest, and an error, if there is any. +func (c *FakeWeaviateOpsRequests) Create(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.CreateOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(weaviateopsrequestsResource, c.ns, weaviateOpsRequest), &v1alpha1.WeaviateOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.WeaviateOpsRequest), err +} + +// Update takes the representation of a weaviateOpsRequest and updates it. Returns the server's representation of the weaviateOpsRequest, and an error, if there is any. +func (c *FakeWeaviateOpsRequests) Update(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(weaviateopsrequestsResource, c.ns, weaviateOpsRequest), &v1alpha1.WeaviateOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.WeaviateOpsRequest), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeWeaviateOpsRequests) UpdateStatus(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (*v1alpha1.WeaviateOpsRequest, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(weaviateopsrequestsResource, "status", c.ns, weaviateOpsRequest), &v1alpha1.WeaviateOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.WeaviateOpsRequest), err +} + +// Delete takes name of the weaviateOpsRequest and deletes it. Returns an error if one occurs. +func (c *FakeWeaviateOpsRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(weaviateopsrequestsResource, c.ns, name, opts), &v1alpha1.WeaviateOpsRequest{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeWeaviateOpsRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(weaviateopsrequestsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.WeaviateOpsRequestList{}) + return err +} + +// Patch applies the patch and returns the patched weaviateOpsRequest. +func (c *FakeWeaviateOpsRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WeaviateOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(weaviateopsrequestsResource, c.ns, name, pt, data, subresources...), &v1alpha1.WeaviateOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.WeaviateOpsRequest), err +} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go index 3f28b559db..4cdf0af5b8 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go @@ -68,4 +68,6 @@ type SinglestoreOpsRequestExpansion interface{} type SolrOpsRequestExpansion interface{} +type WeaviateOpsRequestExpansion interface{} + type ZooKeeperOpsRequestExpansion interface{} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go b/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go index 308e6d90cf..6da48fc54d 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go @@ -54,6 +54,7 @@ type OpsV1alpha1Interface interface { RedisSentinelOpsRequestsGetter SinglestoreOpsRequestsGetter SolrOpsRequestsGetter + WeaviateOpsRequestsGetter ZooKeeperOpsRequestsGetter } @@ -162,6 +163,10 @@ func (c *OpsV1alpha1Client) SolrOpsRequests(namespace string) SolrOpsRequestInte return newSolrOpsRequests(c, namespace) } +func (c *OpsV1alpha1Client) WeaviateOpsRequests(namespace string) WeaviateOpsRequestInterface { + return newWeaviateOpsRequests(c, namespace) +} + func (c *OpsV1alpha1Client) ZooKeeperOpsRequests(namespace string) ZooKeeperOpsRequestInterface { return newZooKeeperOpsRequests(c, namespace) } diff --git a/client/clientset/versioned/typed/ops/v1alpha1/weaviateopsrequest.go b/client/clientset/versioned/typed/ops/v1alpha1/weaviateopsrequest.go new file mode 100644 index 0000000000..f7ff326fdd --- /dev/null +++ b/client/clientset/versioned/typed/ops/v1alpha1/weaviateopsrequest.go @@ -0,0 +1,196 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + scheme "kubedb.dev/apimachinery/client/clientset/versioned/scheme" + + 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" +) + +// WeaviateOpsRequestsGetter has a method to return a WeaviateOpsRequestInterface. +// A group's client should implement this interface. +type WeaviateOpsRequestsGetter interface { + WeaviateOpsRequests(namespace string) WeaviateOpsRequestInterface +} + +// WeaviateOpsRequestInterface has methods to work with WeaviateOpsRequest resources. +type WeaviateOpsRequestInterface interface { + Create(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.CreateOptions) (*v1alpha1.WeaviateOpsRequest, error) + Update(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (*v1alpha1.WeaviateOpsRequest, error) + UpdateStatus(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (*v1alpha1.WeaviateOpsRequest, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.WeaviateOpsRequest, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.WeaviateOpsRequestList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WeaviateOpsRequest, err error) + WeaviateOpsRequestExpansion +} + +// weaviateOpsRequests implements WeaviateOpsRequestInterface +type weaviateOpsRequests struct { + client rest.Interface + ns string +} + +// newWeaviateOpsRequests returns a WeaviateOpsRequests +func newWeaviateOpsRequests(c *OpsV1alpha1Client, namespace string) *weaviateOpsRequests { + return &weaviateOpsRequests{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the weaviateOpsRequest, and returns the corresponding weaviateOpsRequest object, and an error if there is any. +func (c *weaviateOpsRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + result = &v1alpha1.WeaviateOpsRequest{} + err = c.client.Get(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of WeaviateOpsRequests that match those selectors. +func (c *weaviateOpsRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.WeaviateOpsRequestList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.WeaviateOpsRequestList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested weaviateOpsRequests. +func (c *weaviateOpsRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a weaviateOpsRequest and creates it. Returns the server's representation of the weaviateOpsRequest, and an error, if there is any. +func (c *weaviateOpsRequests) Create(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.CreateOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + result = &v1alpha1.WeaviateOpsRequest{} + err = c.client.Post(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(weaviateOpsRequest). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a weaviateOpsRequest and updates it. Returns the server's representation of the weaviateOpsRequest, and an error, if there is any. +func (c *weaviateOpsRequests) Update(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + result = &v1alpha1.WeaviateOpsRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + Name(weaviateOpsRequest.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(weaviateOpsRequest). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *weaviateOpsRequests) UpdateStatus(ctx context.Context, weaviateOpsRequest *v1alpha1.WeaviateOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.WeaviateOpsRequest, err error) { + result = &v1alpha1.WeaviateOpsRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + Name(weaviateOpsRequest.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(weaviateOpsRequest). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the weaviateOpsRequest and deletes it. Returns an error if one occurs. +func (c *weaviateOpsRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *weaviateOpsRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("weaviateopsrequests"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched weaviateOpsRequest. +func (c *weaviateOpsRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.WeaviateOpsRequest, err error) { + result = &v1alpha1.WeaviateOpsRequest{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("weaviateopsrequests"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index edf596a0ad..caa22e76e3 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -393,6 +393,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().SinglestoreOpsRequests().Informer()}, nil case opsv1alpha1.SchemeGroupVersion.WithResource("solropsrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().SolrOpsRequests().Informer()}, nil + case opsv1alpha1.SchemeGroupVersion.WithResource("weaviateopsrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().WeaviateOpsRequests().Informer()}, nil case opsv1alpha1.SchemeGroupVersion.WithResource("zookeeperopsrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().ZooKeeperOpsRequests().Informer()}, nil diff --git a/client/informers/externalversions/ops/v1alpha1/interface.go b/client/informers/externalversions/ops/v1alpha1/interface.go index d9b88951c0..5979e32050 100644 --- a/client/informers/externalversions/ops/v1alpha1/interface.go +++ b/client/informers/externalversions/ops/v1alpha1/interface.go @@ -74,6 +74,8 @@ type Interface interface { SinglestoreOpsRequests() SinglestoreOpsRequestInformer // SolrOpsRequests returns a SolrOpsRequestInformer. SolrOpsRequests() SolrOpsRequestInformer + // WeaviateOpsRequests returns a WeaviateOpsRequestInformer. + WeaviateOpsRequests() WeaviateOpsRequestInformer // ZooKeeperOpsRequests returns a ZooKeeperOpsRequestInformer. ZooKeeperOpsRequests() ZooKeeperOpsRequestInformer } @@ -214,6 +216,11 @@ func (v *version) SolrOpsRequests() SolrOpsRequestInformer { return &solrOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// WeaviateOpsRequests returns a WeaviateOpsRequestInformer. +func (v *version) WeaviateOpsRequests() WeaviateOpsRequestInformer { + return &weaviateOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // ZooKeeperOpsRequests returns a ZooKeeperOpsRequestInformer. func (v *version) ZooKeeperOpsRequests() ZooKeeperOpsRequestInformer { return &zooKeeperOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/ops/v1alpha1/weaviateopsrequest.go b/client/informers/externalversions/ops/v1alpha1/weaviateopsrequest.go new file mode 100644 index 0000000000..2ea1ae6977 --- /dev/null +++ b/client/informers/externalversions/ops/v1alpha1/weaviateopsrequest.go @@ -0,0 +1,91 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + opsv1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + versioned "kubedb.dev/apimachinery/client/clientset/versioned" + internalinterfaces "kubedb.dev/apimachinery/client/informers/externalversions/internalinterfaces" + v1alpha1 "kubedb.dev/apimachinery/client/listers/ops/v1alpha1" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// WeaviateOpsRequestInformer provides access to a shared informer and lister for +// WeaviateOpsRequests. +type WeaviateOpsRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.WeaviateOpsRequestLister +} + +type weaviateOpsRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewWeaviateOpsRequestInformer constructs a new informer for WeaviateOpsRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWeaviateOpsRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWeaviateOpsRequestInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredWeaviateOpsRequestInformer constructs a new informer for WeaviateOpsRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWeaviateOpsRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpsV1alpha1().WeaviateOpsRequests(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpsV1alpha1().WeaviateOpsRequests(namespace).Watch(context.TODO(), options) + }, + }, + &opsv1alpha1.WeaviateOpsRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *weaviateOpsRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWeaviateOpsRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *weaviateOpsRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&opsv1alpha1.WeaviateOpsRequest{}, f.defaultInformer) +} + +func (f *weaviateOpsRequestInformer) Lister() v1alpha1.WeaviateOpsRequestLister { + return v1alpha1.NewWeaviateOpsRequestLister(f.Informer().GetIndexer()) +} diff --git a/client/listers/ops/v1alpha1/expansion_generated.go b/client/listers/ops/v1alpha1/expansion_generated.go index 407960b91a..52e532d8d9 100644 --- a/client/listers/ops/v1alpha1/expansion_generated.go +++ b/client/listers/ops/v1alpha1/expansion_generated.go @@ -218,6 +218,14 @@ type SolrOpsRequestListerExpansion interface{} // SolrOpsRequestNamespaceLister. type SolrOpsRequestNamespaceListerExpansion interface{} +// WeaviateOpsRequestListerExpansion allows custom methods to be added to +// WeaviateOpsRequestLister. +type WeaviateOpsRequestListerExpansion interface{} + +// WeaviateOpsRequestNamespaceListerExpansion allows custom methods to be added to +// WeaviateOpsRequestNamespaceLister. +type WeaviateOpsRequestNamespaceListerExpansion interface{} + // ZooKeeperOpsRequestListerExpansion allows custom methods to be added to // ZooKeeperOpsRequestLister. type ZooKeeperOpsRequestListerExpansion interface{} diff --git a/client/listers/ops/v1alpha1/weaviateopsrequest.go b/client/listers/ops/v1alpha1/weaviateopsrequest.go new file mode 100644 index 0000000000..bdd807c53a --- /dev/null +++ b/client/listers/ops/v1alpha1/weaviateopsrequest.go @@ -0,0 +1,100 @@ +/* +Copyright AppsCode Inc. and Contributors + +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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// WeaviateOpsRequestLister helps list WeaviateOpsRequests. +// All objects returned here must be treated as read-only. +type WeaviateOpsRequestLister interface { + // List lists all WeaviateOpsRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.WeaviateOpsRequest, err error) + // WeaviateOpsRequests returns an object that can list and get WeaviateOpsRequests. + WeaviateOpsRequests(namespace string) WeaviateOpsRequestNamespaceLister + WeaviateOpsRequestListerExpansion +} + +// weaviateOpsRequestLister implements the WeaviateOpsRequestLister interface. +type weaviateOpsRequestLister struct { + indexer cache.Indexer +} + +// NewWeaviateOpsRequestLister returns a new WeaviateOpsRequestLister. +func NewWeaviateOpsRequestLister(indexer cache.Indexer) WeaviateOpsRequestLister { + return &weaviateOpsRequestLister{indexer: indexer} +} + +// List lists all WeaviateOpsRequests in the indexer. +func (s *weaviateOpsRequestLister) List(selector labels.Selector) (ret []*v1alpha1.WeaviateOpsRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.WeaviateOpsRequest)) + }) + return ret, err +} + +// WeaviateOpsRequests returns an object that can list and get WeaviateOpsRequests. +func (s *weaviateOpsRequestLister) WeaviateOpsRequests(namespace string) WeaviateOpsRequestNamespaceLister { + return weaviateOpsRequestNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// WeaviateOpsRequestNamespaceLister helps list and get WeaviateOpsRequests. +// All objects returned here must be treated as read-only. +type WeaviateOpsRequestNamespaceLister interface { + // List lists all WeaviateOpsRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.WeaviateOpsRequest, err error) + // Get retrieves the WeaviateOpsRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.WeaviateOpsRequest, error) + WeaviateOpsRequestNamespaceListerExpansion +} + +// weaviateOpsRequestNamespaceLister implements the WeaviateOpsRequestNamespaceLister +// interface. +type weaviateOpsRequestNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all WeaviateOpsRequests in the indexer for a given namespace. +func (s weaviateOpsRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.WeaviateOpsRequest, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.WeaviateOpsRequest)) + }) + return ret, err +} + +// Get retrieves the WeaviateOpsRequest from the indexer for a given namespace and name. +func (s weaviateOpsRequestNamespaceLister) Get(name string) (*v1alpha1.WeaviateOpsRequest, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("weaviateopsrequest"), name) + } + return obj.(*v1alpha1.WeaviateOpsRequest), nil +} diff --git a/crds/ops.kubedb.com_weaviateopsrequests.yaml b/crds/ops.kubedb.com_weaviateopsrequests.yaml new file mode 100644 index 0000000000..147258efb8 --- /dev/null +++ b/crds/ops.kubedb.com_weaviateopsrequests.yaml @@ -0,0 +1,135 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: kubedb + name: weaviateopsrequests.ops.kubedb.com +spec: + group: ops.kubedb.com + names: + categories: + - ops + - kubedb + - appscode + kind: WeaviateOpsRequest + listKind: WeaviateOpsRequestList + plural: weaviateopsrequests + shortNames: + - wvops + singular: weaviateopsrequest + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.type + name: Type + type: string + - jsonPath: .status.phase + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + apply: + default: IfReady + enum: + - IfReady + - Always + type: string + databaseRef: + properties: + name: + default: "" + type: string + type: object + x-kubernetes-map-type: atomic + maxRetries: + default: 1 + format: int32 + type: integer + restart: + type: object + timeout: + type: string + type: + enum: + - Restart + type: string + required: + - databaseRef + - type + type: object + status: + properties: + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + observedGeneration: + format: int64 + type: integer + reason: + type: string + severity: + type: string + status: + type: string + type: + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + pausedBackups: + items: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + type: array + phase: + enum: + - Pending + - Progressing + - Successful + - WaitingForApproval + - Failed + - Approved + - Denied + - Skipped + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {}