Skip to content

Commit

Permalink
Add path role existence check fun for SDK 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhung committed Sep 25, 2023
1 parent ae2303d commit ca0efbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion path_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func (b *backend) pathRoles() *framework.Path {
Summary: `Delete the specified role.`,
},
},
HelpSynopsis: `Manage data related to roles used to issue Artifactory access tokens.`,
ExistenceCheck: b.existenceCheck,
HelpSynopsis: `Manage data related to roles used to issue Artifactory access tokens.`,
}
}

Expand Down Expand Up @@ -279,3 +280,8 @@ func (b *backend) pathRoleDelete(ctx context.Context, req *logical.Request, data

return nil, nil
}

func (b *backend) existenceCheck(ctx context.Context, req *logical.Request, data *framework.FieldData) (bool, error) {
resp, err := b.pathRoleRead(ctx, req, data)
return resp != nil && !resp.IsError(), err
}

0 comments on commit ca0efbc

Please sign in to comment.