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

View File

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