mirror of
https://github.com/hashicorp/vault.git
synced 2025-12-04 17:11:23 +01:00
Add a distinguishing prefix to OpenAPI operation IDs for enterprise stubs (#22072)
* Add a distinguishing prefix to OpenAPI operation IDs for enterprise stubs As discussed in https://github.com/hashicorp/vault-client-go/issues/208 * Dropping system from operation IDs per PR feedback.
This commit is contained in:
parent
0268d9d11b
commit
efa76db05a
@ -74,6 +74,13 @@ var (
|
|||||||
Pattern: pattern,
|
Pattern: pattern,
|
||||||
Operations: make(map[logical.Operation]framework.OperationHandler),
|
Operations: make(map[logical.Operation]framework.OperationHandler),
|
||||||
Fields: make(map[string]*framework.FieldSchema),
|
Fields: make(map[string]*framework.FieldSchema),
|
||||||
|
DisplayAttrs: &framework.DisplayAttributes{
|
||||||
|
// Since we lack full information for Fields, and all information for Responses, the generated
|
||||||
|
// OpenAPI won't be good for much other than identifying the endpoint exists at all. Thus, it
|
||||||
|
// is useful to make it clear that this is only a stub. Code generation will use this to ignore
|
||||||
|
// these operations.
|
||||||
|
OperationPrefix: "enterprise-stub",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, parameter := range pathSpec.parameters {
|
for _, parameter := range pathSpec.parameters {
|
||||||
@ -172,8 +179,9 @@ var (
|
|||||||
// This path, though an enterprise path, has always been handled in OSS.
|
// This path, though an enterprise path, has always been handled in OSS.
|
||||||
paths = append(paths, &framework.Path{
|
paths = append(paths, &framework.Path{
|
||||||
Pattern: "replication/status",
|
Pattern: "replication/status",
|
||||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
Operations: map[logical.Operation]framework.OperationHandler{
|
||||||
logical.ReadOperation: func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
|
logical.ReadOperation: &framework.PathOperation{
|
||||||
|
Callback: func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
|
||||||
resp := &logical.Response{
|
resp := &logical.Response{
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"mode": "disabled",
|
"mode": "disabled",
|
||||||
@ -181,6 +189,11 @@ var (
|
|||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
},
|
},
|
||||||
|
DisplayAttrs: &framework.DisplayAttributes{
|
||||||
|
OperationVerb: "read",
|
||||||
|
OperationSuffix: "replication-status",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user