-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Adding Response Structures to PKI Config #18376
Conversation
@AnPucel can you provide a link (either to docs or source code) to what you're using as references for the fields? |
I mostly followed the callback and looked at the structure of the response that was being returned there. So, it's a little tedious, but they're usually in the same file. |
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.
This looks reasonable to me, though I only spot checked some fields.
Description: "OK", | ||
Fields: map[string]*framework.FieldSchema{ | ||
"expiry": { | ||
Type: framework.TypeString, |
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.
[note]
lots of these fields are durations, maybe we can add a format
field to framework.FieldSchema
eventually to make it more explicit
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#data-types
https://pkg.go.dev/github.com/go-openapi/strfmt#section-readme
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.
We have TypeDurationSecond, but I don't know if the response is formatted correctly for that always?
Sometimes there are also string time.Time
value when its a concrete date instead of a duration though.
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.
Agreed, since we have the tests now, would it be possible to try it out with TypeTime
and TypeDurationSecond
?
vault/sdk/framework/openapi.go
Lines 805 to 807 in 40f599b
case TypeTime: | |
ret.baseType = "string" | |
ret.format = "date-time" |
vault/sdk/framework/openapi.go
Lines 785 to 787 in 40f599b
case TypeDurationSecond, TypeSignedDurationSecond: | |
ret.baseType = "integer" | |
ret.format = "seconds" |
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.
Same comment applies to:
- auto_rebuild_grace_period
- ocsp_expiry
- delta_rebuild_interval
- expiry
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.
Sure! I did update this on a few other PRs. So, I forgot to go back and do it here.
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.
With regard to this, the user sees these as string, e.g. 15m
and then it gets parsed into a duration when it's handled. Shouldn't it reflect what the user sees or should it be a duration?
https://developer.hashicorp.com/vault/api-docs/secret/pki#expiry
Co-authored-by: Anton Averchenkov <[email protected]>
}, | ||
"enable_templating": { | ||
Type: framework.TypeBool, | ||
Description: `Whether or not to enable templating of the |
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.
It might be good to reuse descriptions of response/parmas especially for these configs, but we can do the refactoring after this merges.
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.
Yes! That works for me. I tried to keep them consistent. I can definitely update these with better ones after the fact.
de44314
to
4548149
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.
Thanks for adding the tests! Left a couple comments, otherwise LGTM
Description: "OK", | ||
Fields: map[string]*framework.FieldSchema{ | ||
"expiry": { | ||
Type: framework.TypeString, |
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.
Agreed, since we have the tests now, would it be possible to try it out with TypeTime
and TypeDurationSecond
?
vault/sdk/framework/openapi.go
Lines 805 to 807 in 40f599b
case TypeTime: | |
ret.baseType = "string" | |
ret.format = "date-time" |
vault/sdk/framework/openapi.go
Lines 785 to 787 in 40f599b
case TypeDurationSecond, TypeSignedDurationSecond: | |
ret.baseType = "integer" | |
ret.format = "seconds" |
Description: "OK", | ||
Fields: map[string]*framework.FieldSchema{ | ||
"expiry": { | ||
Type: framework.TypeString, |
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.
Same comment applies to:
- auto_rebuild_grace_period
- ocsp_expiry
- delta_rebuild_interval
- expiry
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 👍
Adding Response Structures to PKI Config. Corresponding response structures are linked below each file name
Please see this RFC for implementation details.
config/ca
config/issuers
root/replace
config/keys
config/cluster
config/crl
config/urls
Related PRs: