openapi: Add display attributes for Radius auth (#19392)
This commit is contained in:
parent
44d4f39e1b
commit
2ec2d050c0
|
@ -10,6 +10,8 @@ import (
|
|||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
|
||||
const operationPrefixRadius = "radius"
|
||||
|
||||
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
b := Backend()
|
||||
if err := b.Setup(ctx, conf); err != nil {
|
||||
|
|
|
@ -15,6 +15,12 @@ import (
|
|||
func pathConfig(b *backend) *framework.Path {
|
||||
p := &framework.Path{
|
||||
Pattern: "config",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixRadius,
|
||||
Action: "Configure",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"host": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -80,17 +86,29 @@ func pathConfig(b *backend) *framework.Path {
|
|||
|
||||
ExistenceCheck: b.configExistenceCheck,
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ReadOperation: b.pathConfigRead,
|
||||
logical.CreateOperation: b.pathConfigCreateUpdate,
|
||||
logical.UpdateOperation: b.pathConfigCreateUpdate,
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.ReadOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigRead,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationSuffix: "configuration",
|
||||
},
|
||||
},
|
||||
logical.CreateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigCreateUpdate,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationVerb: "configure",
|
||||
},
|
||||
},
|
||||
logical.UpdateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigCreateUpdate,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationVerb: "configure",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
HelpSynopsis: pathConfigHelpSyn,
|
||||
HelpDescription: pathConfigHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Configure",
|
||||
},
|
||||
}
|
||||
|
||||
tokenutil.AddTokenFields(p.Fields)
|
||||
|
|
|
@ -23,6 +23,13 @@ import (
|
|||
func pathLogin(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "login" + framework.OptionalParamRegex("urlusername"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixRadius,
|
||||
OperationVerb: "log-in",
|
||||
OperationSuffix: "|with-username",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"urlusername": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -17,22 +17,33 @@ func pathUsersList(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "users/?$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixRadius,
|
||||
OperationSuffix: "users",
|
||||
Navigation: true,
|
||||
ItemType: "User",
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ListOperation: b.pathUserList,
|
||||
},
|
||||
|
||||
HelpSynopsis: pathUserHelpSyn,
|
||||
HelpDescription: pathUserHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Navigation: true,
|
||||
ItemType: "User",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pathUsers(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: `users/(?P<name>.+)`,
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixRadius,
|
||||
OperationSuffix: "user",
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -56,10 +67,6 @@ func pathUsers(b *backend) *framework.Path {
|
|||
|
||||
HelpSynopsis: pathUserHelpSyn,
|
||||
HelpDescription: pathUserHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue