-
Notifications
You must be signed in to change notification settings - Fork 403
Add bindable resources endpoint #877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bindable resources endpoint #877
Conversation
d188919
to
af5d46e
Compare
4d2e1d3
to
98df9c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I've tested it on goher cluster and it works like a charm :)
NOTE: IMO we need to inform guys from UI that entry will be returned even if the resources field is empty.
e.g.
{
"data": {
"bindableResources": [
{
"kind": "function",
"resources": []
},
{
"kind": "deployment",
"resources": [
{
"name": "api-controller",
"namespace": "kyma-system"
},
}
so on the UI probably they should not display this entry
func (rsv *bindableResourcesResolver) ListBindableResources(ctx context.Context, environment string) ([]gqlschema.BindableResourcesOutputItem, error) { | ||
res, err := rsv.lister.ListResources(environment) | ||
if err != nil { | ||
glog.Error(errors.Wrapf(err, "while listing %s for %s `%s` in environment `%s`", pretty.BindableResources, pretty.UsageKind, environment)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to much %s
) | ||
|
||
func TestBindableResourcesResolver_ListBindableResources(t *testing.T) { | ||
svc := automock.NewBindableResourcesLister() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing // GIVEN
dynamicClient usageKindDynamicOperations | ||
client v1alpha12.ServicecatalogV1alpha1Interface | ||
informer cache.SharedIndexInformer | ||
resourceInterface dynamic.Interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe more like dynamicCli
results := make([]gqlschema.BindableResourcesOutputItem, 0) | ||
usageKinds := svc.informer.GetStore().List() | ||
for _, item := range usageKinds { | ||
uk := item.(*v1alpha1.UsageKind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add checking the UK casting
uk, ok := item.(*v1alpha1.UsageKind)
thanks to that it will be more robust
98df9c3
to
a5e523f
Compare
a5e523f
to
7969186
Compare
Description
Changes proposed in this pull request: