Skip to content
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

Data Source for categories #51

Merged
merged 2 commits into from
Apr 19, 2019
Merged

Data Source for categories #51

merged 2 commits into from
Apr 19, 2019

Conversation

marinsalinas
Copy link
Contributor

closes #8

We added category_key data source where you can find the values of the category if it has al least one.


d.SetId(utils.StringValue(resp.Name))

list, err := conn.V3.ListCategoryValues(d.Get("name").(string), &v3.CategoryListMetadata{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern here is pagination, not really an issue here, but I think there is a limit on how much categories can be created, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking about it as well, I already have a workaround on this but I think I'll put it in a next enhancement phase.

list, err := conn.V3.ListCategoryValues(d.Get("name").(string), &v3.CategoryListMetadata{
Kind: utils.StringPtr("category"),
Length: utils.Int64Ptr(500),
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is kinda hard to read, I know it seems easier to send the struct as an argument instead of creating a variable, but it gives unnecessary length to the call

Length: utils.Int64Ptr(500),
})

if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to the comments above, we can move this if to the call above, instead of leaving it here alone

@marinsalinas marinsalinas merged commit 4314396 into master Apr 19, 2019
@marinsalinas marinsalinas deleted the categories-refactor branch April 19, 2019 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datasources for categories
2 participants