openapi: Add display attributes for identity/group (#19762)

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

View File

@ -19,6 +19,13 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
return []*framework.Path{ return []*framework.Path{
{ {
Pattern: "group-alias$", Pattern: "group-alias$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationVerb: "create",
OperationSuffix: "alias",
},
Fields: map[string]*framework.FieldSchema{ Fields: map[string]*framework.FieldSchema{
"id": { "id": {
Type: framework.TypeString, Type: framework.TypeString,
@ -37,6 +44,7 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
Description: "ID of the group to which this is an alias.", Description: "ID of the group to which this is an alias.",
}, },
}, },
Callbacks: map[logical.Operation]framework.OperationFunc{ Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupAliasRegister(), logical.UpdateOperation: i.pathGroupAliasRegister(),
}, },
@ -46,6 +54,12 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group-alias/id/" + framework.GenericNameRegex("id"), Pattern: "group-alias/id/" + framework.GenericNameRegex("id"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "alias-by-id",
},
Fields: map[string]*framework.FieldSchema{ Fields: map[string]*framework.FieldSchema{
"id": { "id": {
Type: framework.TypeString, Type: framework.TypeString,
@ -64,10 +78,26 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
Description: "ID of the group to which this is an alias.", Description: "ID of the group to which this is an alias.",
}, },
}, },
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupAliasIDUpdate(), Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: i.pathGroupAliasIDRead(), logical.UpdateOperation: &framework.PathOperation{
logical.DeleteOperation: i.pathGroupAliasIDDelete(), Callback: i.pathGroupAliasIDUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "update",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathGroupAliasIDRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathGroupAliasIDDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
},
}, },
HelpSynopsis: strings.TrimSpace(groupAliasHelp["group-alias-by-id"][0]), HelpSynopsis: strings.TrimSpace(groupAliasHelp["group-alias-by-id"][0]),
@ -75,6 +105,12 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group-alias/id/?$", Pattern: "group-alias/id/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "aliases-by-id",
},
Callbacks: map[logical.Operation]framework.OperationFunc{ Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathGroupAliasIDList(), logical.ListOperation: i.pathGroupAliasIDList(),
}, },

View File

@ -62,6 +62,12 @@ func groupPaths(i *IdentityStore) []*framework.Path {
return []*framework.Path{ return []*framework.Path{
{ {
Pattern: "group$", Pattern: "group$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationVerb: "create",
},
Fields: groupPathFields(), Fields: groupPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{ Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupRegister(), logical.UpdateOperation: i.pathGroupRegister(),
@ -72,11 +78,33 @@ func groupPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group/id/" + framework.GenericNameRegex("id"), Pattern: "group/id/" + framework.GenericNameRegex("id"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "by-id",
},
Fields: groupPathFields(), Fields: groupPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupIDUpdate(), Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: i.pathGroupIDRead(), logical.UpdateOperation: &framework.PathOperation{
logical.DeleteOperation: i.pathGroupIDDelete(), Callback: i.pathGroupIDUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "update",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathGroupIDRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathGroupIDDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
},
}, },
HelpSynopsis: strings.TrimSpace(groupHelp["group-by-id"][0]), HelpSynopsis: strings.TrimSpace(groupHelp["group-by-id"][0]),
@ -84,6 +112,12 @@ func groupPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group/id/?$", Pattern: "group/id/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "by-id",
},
Callbacks: map[logical.Operation]framework.OperationFunc{ Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathGroupIDList(), logical.ListOperation: i.pathGroupIDList(),
}, },
@ -93,11 +127,33 @@ func groupPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group/name/(?P<name>.+)", Pattern: "group/name/(?P<name>.+)",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "by-name",
},
Fields: groupPathFields(), Fields: groupPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupNameUpdate(), Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: i.pathGroupNameRead(), logical.UpdateOperation: &framework.PathOperation{
logical.DeleteOperation: i.pathGroupNameDelete(), Callback: i.pathGroupNameUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "update",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathGroupNameRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathGroupNameDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
},
}, },
HelpSynopsis: strings.TrimSpace(groupHelp["group-by-name"][0]), HelpSynopsis: strings.TrimSpace(groupHelp["group-by-name"][0]),
@ -105,6 +161,12 @@ func groupPaths(i *IdentityStore) []*framework.Path {
}, },
{ {
Pattern: "group/name/?$", Pattern: "group/name/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "group",
OperationSuffix: "by-name",
},
Callbacks: map[logical.Operation]framework.OperationFunc{ Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathGroupNameList(), logical.ListOperation: i.pathGroupNameList(),
}, },