openapi: Add display attributes for identity/ (remaining) (#19763)

This commit is contained in:
Anton Averchenkov 2023-04-12 15:46:01 -04:00 committed by GitHub
parent 31e123f7a0
commit d0cc7bc71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 88 additions and 8 deletions

View File

@ -17,6 +17,12 @@ func lookupPaths(i *IdentityStore) []*framework.Path {
return []*framework.Path{
{
Pattern: "lookup/entity$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "entity",
OperationVerb: "look-up",
},
Fields: map[string]*framework.FieldSchema{
"name": {
Type: framework.TypeString,
@ -48,6 +54,12 @@ func lookupPaths(i *IdentityStore) []*framework.Path {
},
{
Pattern: "lookup/group$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationVerb: "look-up",
},
Fields: map[string]*framework.FieldSchema{
"name": {
Type: framework.TypeString,

View File

@ -14,6 +14,12 @@ func upgradePaths(i *IdentityStore) []*framework.Path {
return []*framework.Path{
{
Pattern: "persona$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "persona",
OperationVerb: "create",
},
Fields: map[string]*framework.FieldSchema{
"id": {
Type: framework.TypeString,
@ -49,6 +55,12 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
},
{
Pattern: "persona/id/" + framework.GenericNameRegex("id"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "persona",
OperationSuffix: "by-id",
},
Fields: map[string]*framework.FieldSchema{
"id": {
Type: framework.TypeString,
@ -75,10 +87,26 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
`,
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleEntityUpdateCommon(),
logical.ReadOperation: i.pathAliasIDRead(),
logical.DeleteOperation: i.pathAliasIDDelete(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleEntityUpdateCommon(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "update",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathAliasIDRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathAliasIDDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
},
},
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id"][0]),
@ -86,6 +114,12 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
},
{
Pattern: "persona/id/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "persona",
OperationSuffix: "by-id",
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathAliasIDList(),
},
@ -95,6 +129,12 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
},
{
Pattern: "alias$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "alias",
OperationVerb: "create",
},
Fields: map[string]*framework.FieldSchema{
"id": {
Type: framework.TypeString,
@ -127,6 +167,12 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
{
Pattern: "alias/id/" + framework.GenericNameRegex("id"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "alias",
OperationSuffix: "by-id",
},
Fields: map[string]*framework.FieldSchema{
"id": {
Type: framework.TypeString,
@ -149,10 +195,26 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
Description: "Name of the alias",
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleAliasCreateUpdate(),
logical.ReadOperation: i.pathAliasIDRead(),
logical.DeleteOperation: i.pathAliasIDDelete(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleAliasCreateUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "update",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathAliasIDRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathAliasIDDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
},
},
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id"][0]),
@ -160,6 +222,12 @@ vault <command> <path> metadata=key1=value1 metadata=key2=value2
},
{
Pattern: "alias/id/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "alias",
OperationSuffix: "by-id",
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathAliasIDList(),
},