openapi: Add display attributes for Consul (#19413)
This commit is contained in:
parent
c8803cb571
commit
c025747e46
|
@ -10,6 +10,8 @@ import (
|
|||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
|
||||
const operationPrefixConsul = "consul"
|
||||
|
||||
// ReportedVersion is used to report a specific version to Vault.
|
||||
var ReportedVersion = ""
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ import (
|
|||
func pathConfigAccess(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "config/access",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixConsul,
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"address": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -55,9 +60,20 @@ must be x509 PEM encoded and if this is set you need to also set client_cert.`,
|
|||
},
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ReadOperation: b.pathConfigAccessRead,
|
||||
logical.UpdateOperation: b.pathConfigAccessWrite,
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.ReadOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigAccessRead,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationSuffix: "access-configuration",
|
||||
},
|
||||
},
|
||||
logical.UpdateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigAccessWrite,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationVerb: "configure",
|
||||
OperationSuffix: "access",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ func pathListRoles(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "roles/?$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixConsul,
|
||||
OperationSuffix: "roles",
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ListOperation: b.pathRoleList,
|
||||
},
|
||||
|
@ -26,6 +31,12 @@ func pathListRoles(b *backend) *framework.Path {
|
|||
func pathRoles(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "roles/" + framework.GenericNameRegex("name"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixConsul,
|
||||
OperationSuffix: "role",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -21,6 +21,13 @@ const (
|
|||
func pathToken(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "creds/" + framework.GenericNameRegex("role"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixConsul,
|
||||
OperationVerb: "generate",
|
||||
OperationSuffix: "credentials",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"role": {
|
||||
Type: framework.TypeString,
|
||||
|
|
Loading…
Reference in New Issue