VAULT-12144: add openapi responses for /sys/wrapping endpoints (#18627)

* add response structures for /sys/wrapping endpoints

Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>

* added changelog

* dynamic tests should be nil

Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>

---------

Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
This commit is contained in:
Daniel Huckins 2023-03-28 11:12:34 -04:00 committed by GitHub
parent 44894253fc
commit f34313e611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 77 additions and 6 deletions

3
changelog/18627.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
openapi: add openapi response definitions to /sys/wrapping endpoints
```

View File

@ -3135,8 +3135,17 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path {
{ {
Pattern: "wrapping/wrap$", Pattern: "wrapping/wrap$",
Callbacks: map[logical.Operation]framework.OperationFunc{ Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: b.handleWrappingWrap, logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleWrappingWrap,
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
// dynamic fields
Fields: nil,
}},
},
},
}, },
HelpSynopsis: strings.TrimSpace(sysHelp["wrap"][0]), HelpSynopsis: strings.TrimSpace(sysHelp["wrap"][0]),
@ -3154,8 +3163,20 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path {
}, },
}, },
Callbacks: map[logical.Operation]framework.OperationFunc{ Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: b.handleWrappingUnwrap, logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleWrappingUnwrap,
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
// dynamic fields
Fields: nil,
}},
http.StatusNoContent: {{
Description: "No content",
}},
},
},
}, },
HelpSynopsis: strings.TrimSpace(sysHelp["unwrap"][0]), HelpSynopsis: strings.TrimSpace(sysHelp["unwrap"][0]),
@ -3175,10 +3196,48 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path {
logical.UpdateOperation: &framework.PathOperation{ logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleWrappingLookup, Callback: b.handleWrappingLookup,
Summary: "Look up wrapping properties for the given token.", Summary: "Look up wrapping properties for the given token.",
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
Fields: map[string]*framework.FieldSchema{
"creation_ttl": {
Type: framework.TypeDurationSecond,
Required: false,
},
"creation_time": {
Type: framework.TypeTime,
Required: false,
},
"creation_path": {
Type: framework.TypeString,
Required: false,
},
},
}},
},
}, },
logical.ReadOperation: &framework.PathOperation{ logical.ReadOperation: &framework.PathOperation{
Callback: b.handleWrappingLookup, Callback: b.handleWrappingLookup,
Summary: "Look up wrapping properties for the requester's token.", Summary: "Look up wrapping properties for the requester's token.",
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
Fields: map[string]*framework.FieldSchema{
"creation_ttl": {
Type: framework.TypeDurationSecond,
Required: false,
},
"creation_time": {
Type: framework.TypeTime,
Required: false,
},
"creation_path": {
Type: framework.TypeString,
Required: false,
},
},
}},
},
}, },
}, },
@ -3195,8 +3254,17 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path {
}, },
}, },
Callbacks: map[logical.Operation]framework.OperationFunc{ Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: b.handleWrappingRewrap, logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleWrappingRewrap,
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
// dynamic fields
Fields: nil,
}},
},
},
}, },
HelpSynopsis: strings.TrimSpace(sysHelp["rewrap"][0]), HelpSynopsis: strings.TrimSpace(sysHelp["rewrap"][0]),