Skip to content

Commit

Permalink
backport of commit 5ee68b2e8d50239ffa4d3de33e692d68b3924603 (#24326)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Palmiotto <[email protected]>
  • Loading branch information
1 parent 0fe4970 commit f1016e7
Showing 1 changed file with 45 additions and 19 deletions.
64 changes: 45 additions & 19 deletions vault/identity_store_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ func entityPaths(i *IdentityStore) []*framework.Path {
return []*framework.Path{
{
Pattern: "entity$",
Fields: entityPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleEntityUpdateCommon(),

Fields: entityPathFields(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleEntityUpdateCommon(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity"][0]),
Expand All @@ -69,10 +72,16 @@ func entityPaths(i *IdentityStore) []*framework.Path {
{
Pattern: "entity/name/(?P<name>.+)",
Fields: entityPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleEntityUpdateCommon(),
logical.ReadOperation: i.pathEntityNameRead(),
logical.DeleteOperation: i.pathEntityNameDelete(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleEntityUpdateCommon(),
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathEntityNameRead(),
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathEntityNameDelete(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity-name"][0]),
Expand All @@ -81,10 +90,16 @@ func entityPaths(i *IdentityStore) []*framework.Path {
{
Pattern: "entity/id/" + framework.GenericNameRegex("id"),
Fields: entityPathFields(),
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleEntityUpdateCommon(),
logical.ReadOperation: i.pathEntityIDRead(),
logical.DeleteOperation: i.pathEntityIDDelete(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleEntityUpdateCommon(),
},
logical.ReadOperation: &framework.PathOperation{
Callback: i.pathEntityIDRead(),
},
logical.DeleteOperation: &framework.PathOperation{
Callback: i.pathEntityIDDelete(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity-id"][0]),
Expand All @@ -98,26 +113,35 @@ func entityPaths(i *IdentityStore) []*framework.Path {
Description: "Entity IDs to delete",
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.handleEntityBatchDelete(),

Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.handleEntityBatchDelete(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["batch-delete"][0]),
HelpDescription: strings.TrimSpace(entityHelp["batch-delete"][1]),
},
{
Pattern: "entity/name/?$",
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathEntityNameList(),

Operations: map[logical.Operation]framework.OperationHandler{
logical.ListOperation: &framework.PathOperation{
Callback: i.pathEntityNameList(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity-name-list"][0]),
HelpDescription: strings.TrimSpace(entityHelp["entity-name-list"][1]),
},
{
Pattern: "entity/id/?$",
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: i.pathEntityIDList(),

Operations: map[logical.Operation]framework.OperationHandler{
logical.ListOperation: &framework.PathOperation{
Callback: i.pathEntityIDList(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity-id-list"][0]),
Expand All @@ -143,8 +167,10 @@ func entityPaths(i *IdentityStore) []*framework.Path {
Description: "Setting this will follow the 'mine' strategy for merging MFA secrets. If there are secrets of the same type both in entities that are merged from and in entity into which all others are getting merged, secrets in the destination will be unaltered. If not set, this API will throw an error containing all the conflicts.",
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathEntityMergeID(),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: i.pathEntityMergeID(),
},
},

HelpSynopsis: strings.TrimSpace(entityHelp["entity-merge-id"][0]),
Expand Down

0 comments on commit f1016e7

Please sign in to comment.