openapi: Add display attributes for cert auth (#19383)
This commit is contained in:
parent
0036a35c58
commit
44d4f39e1b
|
@ -21,6 +21,8 @@ import (
|
|||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
|
||||
const operationPrefixCert = "cert"
|
||||
|
||||
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
b := Backend()
|
||||
if err := b.Setup(ctx, conf); err != nil {
|
||||
|
|
|
@ -21,22 +21,33 @@ func pathListCerts(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "certs/?",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
OperationSuffix: "certificates",
|
||||
Navigation: true,
|
||||
ItemType: "Certificate",
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ListOperation: b.pathCertList,
|
||||
},
|
||||
|
||||
HelpSynopsis: pathCertHelpSyn,
|
||||
HelpDescription: pathCertHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Navigation: true,
|
||||
ItemType: "Certificate",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pathCerts(b *backend) *framework.Path {
|
||||
p := &framework.Path{
|
||||
Pattern: "certs/" + framework.GenericNameRegex("name"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
OperationSuffix: "certificate",
|
||||
Action: "Create",
|
||||
ItemType: "Certificate",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -202,10 +213,6 @@ certificate.`,
|
|||
|
||||
HelpSynopsis: pathCertHelpSyn,
|
||||
HelpDescription: pathCertHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Create",
|
||||
ItemType: "Certificate",
|
||||
},
|
||||
}
|
||||
|
||||
tokenutil.AddTokenFields(p.Fields)
|
||||
|
|
|
@ -16,6 +16,11 @@ const maxCacheSize = 100000
|
|||
func pathConfig(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "config",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"disable_binding": {
|
||||
Type: framework.TypeBool,
|
||||
|
@ -34,9 +39,19 @@ func pathConfig(b *backend) *framework.Path {
|
|||
},
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.UpdateOperation: b.pathConfigWrite,
|
||||
logical.ReadOperation: b.pathConfigRead,
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.UpdateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigWrite,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationVerb: "configure",
|
||||
},
|
||||
},
|
||||
logical.ReadOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigRead,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationSuffix: "configuration",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ import (
|
|||
func pathListCRLs(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "crls/?$",
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
OperationSuffix: "crls",
|
||||
},
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.ListOperation: &framework.PathOperation{
|
||||
Callback: b.pathCRLsList,
|
||||
|
@ -44,6 +48,12 @@ func (b *backend) pathCRLsList(ctx context.Context, req *logical.Request, d *fra
|
|||
func pathCRLs(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "crls/" + framework.GenericNameRegex("name"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
OperationSuffix: "crl",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -35,6 +35,10 @@ type ParsedCert struct {
|
|||
func pathLogin(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "login",
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixCert,
|
||||
OperationVerb: "log-in",
|
||||
},
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
|
Loading…
Reference in New Issue