Skip to content

Commit

Permalink
Add Kafka Schema Registry APIs (#1217)
Browse files Browse the repository at this point in the history
Signed-off-by: obaydullahmhs <[email protected]>
  • Loading branch information
obaydullahmhs authored May 30, 2024
1 parent 5e6b27e commit 46e5080
Show file tree
Hide file tree
Showing 35 changed files with 5,704 additions and 0 deletions.
202 changes: 202 additions & 0 deletions apis/catalog/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apis/catalog/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ZooKeeperVersionList{},
&MSSQLServerVersion{},
&MSSQLServerVersionList{},
&SchemaRegistryVersion{},
&SchemaRegistryVersionList{},
)

scheme.AddKnownTypes(SchemeGroupVersion,
Expand Down
64 changes: 64 additions & 0 deletions apis/catalog/v1alpha1/schemaregistry_version_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
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 (
"fmt"

"kubedb.dev/apimachinery/apis"
"kubedb.dev/apimachinery/apis/catalog"
"kubedb.dev/apimachinery/crds"

"kmodules.xyz/client-go/apiextensions"
)

func (_ *SchemaRegistryVersion) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralSchemaRegistryVersion))
}

var _ apis.ResourceInfo = &SchemaRegistryVersion{}

func (r *SchemaRegistryVersion) ResourceFQN() string {
return fmt.Sprintf("%s.%s", ResourcePluralSchemaRegistryVersion, catalog.GroupName)
}

func (r *SchemaRegistryVersion) ResourceShortCode() string {
return ResourceCodeSchemaRegistryVersion
}

func (r *SchemaRegistryVersion) ResourceKind() string {
return ResourceKindSchemaRegistryVersion
}

func (r *SchemaRegistryVersion) ResourceSingular() string {
return ResourceSingularSchemaRegistryVersion
}

func (r *SchemaRegistryVersion) ResourcePlural() string {
return ResourcePluralSchemaRegistryVersion
}

func (r *SchemaRegistryVersion) ValidateSpecs() error {
if r.Spec.Version == "" ||
r.Spec.Registry.Image == "" ||
r.Spec.InMemory.Image == "" {
return fmt.Errorf(`atleast one of the following specs is not set for schemaRegistryVersion "%v":
spec.version,
spec.registry.image, r.inMemory.image`, r.Name)
}
return nil
}
Loading

0 comments on commit 46e5080

Please sign in to comment.