Skip to content

Commit

Permalink
chore: k8s data adapters added (#88)
Browse files Browse the repository at this point in the history
* feat: k8s struct adapter

* fix: adapters

* chore: updated to builder pattern
  • Loading branch information
Ash-exp authored Jul 18, 2024
1 parent d496143 commit 9fa6185
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions utils/k8s/adapter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package k8s

func NewK8sRequestBean() *K8sRequestBean {
return &K8sRequestBean{}
}

func (req *K8sRequestBean) WithResourceIdentifier(resourceIdentifier *ResourceIdentifier) *K8sRequestBean {
if resourceIdentifier == nil {
resourceIdentifier = &ResourceIdentifier{}
}
req.ResourceIdentifier = *resourceIdentifier
return req
}

func NewResourceIdentifier() *ResourceIdentifier {
return &ResourceIdentifier{}
}

func (req *ResourceIdentifier) WithName(name string) *ResourceIdentifier {
req.Name = name
return req
}

func (req *ResourceIdentifier) WithNameSpace(namespace string) *ResourceIdentifier {
req.Namespace = namespace
return req
}

func (req *ResourceIdentifier) WithGroup(group string) *ResourceIdentifier {
req.GroupVersionKind.Group = group
return req
}

func (req *ResourceIdentifier) WithVersion(version string) *ResourceIdentifier {
req.GroupVersionKind.Version = version
return req
}

func (req *ResourceIdentifier) WithKind(kind string) *ResourceIdentifier {
req.GroupVersionKind.Kind = kind
return req
}

0 comments on commit 9fa6185

Please sign in to comment.