openapi: Add display attributes for RabbitMQ plugin (#19540)

This commit is contained in:
Anton Averchenkov 2023-04-10 14:19:32 -04:00 committed by GitHub
parent c61052ef29
commit f257d68576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 3 deletions

View File

@ -14,6 +14,8 @@ import (
rabbithole "github.com/michaelklishin/rabbit-hole/v2"
)
const operationPrefixRabbitMQ = "rabbit-mq"
// Factory creates and configures the backend
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
b := Backend()

View File

@ -20,6 +20,13 @@ const (
func pathConfigConnection(b *backend) *framework.Path {
return &framework.Path{
Pattern: "config/connection",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixRabbitMQ,
OperationVerb: "configure",
OperationSuffix: "connection",
},
Fields: map[string]*framework.FieldSchema{
"connection_uri": {
Type: framework.TypeString,

View File

@ -15,6 +15,11 @@ import (
func pathConfigLease(b *backend) *framework.Path {
return &framework.Path{
Pattern: "config/lease",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixRabbitMQ,
},
Fields: map[string]*framework.FieldSchema{
"ttl": {
Type: framework.TypeDurationSecond,
@ -28,9 +33,21 @@ func pathConfigLease(b *backend) *framework.Path {
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ReadOperation: b.pathLeaseRead,
logical.UpdateOperation: b.pathLeaseUpdate,
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.pathLeaseRead,
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
OperationSuffix: "lease-configuration",
},
},
logical.UpdateOperation: &framework.PathOperation{
Callback: b.pathLeaseUpdate,
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
OperationSuffix: "lease",
},
},
},
HelpSynopsis: pathConfigLeaseHelpSyn,

View File

@ -21,6 +21,13 @@ const (
func pathCreds(b *backend) *framework.Path {
return &framework.Path{
Pattern: "creds/" + framework.GenericNameRegex("name"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixRabbitMQ,
OperationVerb: "request",
OperationSuffix: "credentials",
},
Fields: map[string]*framework.FieldSchema{
"name": {
Type: framework.TypeString,

View File

@ -16,6 +16,10 @@ import (
func pathListRoles(b *backend) *framework.Path {
return &framework.Path{
Pattern: "roles/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixRabbitMQ,
OperationSuffix: "roles",
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: b.pathRoleList,
},
@ -27,6 +31,10 @@ func pathListRoles(b *backend) *framework.Path {
func pathRoles(b *backend) *framework.Path {
return &framework.Path{
Pattern: "roles/" + framework.GenericNameRegex("name"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixRabbitMQ,
OperationSuffix: "role",
},
Fields: map[string]*framework.FieldSchema{
"name": {
Type: framework.TypeString,