-
Notifications
You must be signed in to change notification settings - Fork 75
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
Improve Roles example for OpenAPI and low level OpenAPI #333
Conversation
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.
Thanks!
govcd/openapi.go
Outdated
@@ -75,9 +77,15 @@ func (client *Client) OpenApiGetAllItems(apiVersion string, urlRef *url.URL, que | |||
return fmt.Errorf("OpenAPI is not supported on this VCD version") | |||
} | |||
|
|||
// Page size is defaulted to 128 (maximum supported number) to reduce HTTP calls and improve performance unless caller | |||
// provides other value | |||
const pageSize = "128" |
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.
Do really need this constant? defaultPageSize(queryParams, "128")
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.
My point was to emphasize it. Hopefully a comment above is sufficient. Removed.
This PR builds on top of #325 to further improve an example with
Roles
as per initial design improvements:OpenApiRole
becomes justRole
as in the end maybe user shouldn’t care what type of API is used – he just needs result in high level API.GetAllOpenApiRoles
function now returns[]*Role
(with client wrapped in) instead of[]*types.Role
. That way one can immediatelly callUpdate
andDelete
on result.CreateRole
function has a pointer receiver of parent (*adminOrg
in this case).OpenApiGetAllItems
will defaultpageSize
to 128 results (maximum) per page unless caller supplies a value.