Skip to content

Conversation

spikecurtis
Copy link
Contributor

Fixes #3278

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis requested review from kylecarbs and a team August 17, 2022 16:12
@spikecurtis spikecurtis requested a review from a team as a code owner August 17, 2022 16:12

client := coderdtest.New(t, nil)
coderdtest.CreateFirstUser(t, client)
cmd, root := clitest.New(t, "features", "list", "-o", "json")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly slightly weird is that when you do -o json you get the whole Entitlements struct, but when you do -o table (or default output), you only get the features in the table.

What is missing in the table output are the warnings, but our plan is to print license warnings after every CLI command, so when that is done you will still get them in the output.

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

Just one comment on the API, but LGTM.

Comment on lines 37 to 40
type EntitlementsRequest struct {
// placeholder so that we can add request parameters in future
// without breaking changes to the go API
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm tempted not to do this unless we have certainty that all parameters would be optional.

Otherwise a syntax error wouldn't occur, but the API request may fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have certainty that all parameters will be optional, but adding a new non-optional parameter is always an API breaking change.

If we formulate things with this placeholder, we at least have a straightforward way to add optional parameters in future without a breaking change. It's true that we could do opts ...EntilementsRequestOptions in future, but that's inconsistent with how other methods work, so I added the placeholder...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, well, looks like my hand is being forced to what you suggest anyway. Typescript doesn't like the empty struct from our autogenerated code, so I'll just drop this. Not worth fixing for something we're not crazy about in the first place.

Signed-off-by: Spike Curtis <spike@coder.com>
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis merged commit acd0cd6 into main Aug 17, 2022
@spikecurtis spikecurtis deleted the spike/3278_entitlements_cli branch August 17, 2022 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Entitlements API in AGPL
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy