2017-10-11 17:21:20 +00:00
|
|
|
package vault
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
|
|
"github.com/hashicorp/vault/logical/framework"
|
|
|
|
)
|
|
|
|
|
|
|
|
func upgradePaths(i *IdentityStore) []*framework.Path {
|
|
|
|
return []*framework.Path{
|
|
|
|
{
|
|
|
|
Pattern: "persona$",
|
|
|
|
Fields: map[string]*framework.FieldSchema{
|
|
|
|
"id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "ID of the alias",
|
|
|
|
},
|
|
|
|
"entity_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"mount_accessor": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Mount accessor to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Name of the alias",
|
|
|
|
},
|
|
|
|
"metadata": {
|
2017-11-14 01:59:42 +00:00
|
|
|
Type: framework.TypeKVPairs,
|
|
|
|
Description: `Metadata to be associated with the alias.
|
|
|
|
In CLI, this parameter can be repeated multiple times, and it all gets merged together.
|
|
|
|
For example:
|
|
|
|
vault <command> <path> metadata=key1=value1 metadata=key2=value2
|
|
|
|
`,
|
2017-10-11 17:21:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
2017-10-17 18:08:51 +00:00
|
|
|
logical.UpdateOperation: i.pathAliasRegister,
|
2017-10-11 17:21:20 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias"][1]),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Pattern: "persona/id/" + framework.GenericNameRegex("id"),
|
|
|
|
Fields: map[string]*framework.FieldSchema{
|
|
|
|
"id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "ID of the alias",
|
|
|
|
},
|
|
|
|
"entity_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias should be tied to",
|
|
|
|
},
|
|
|
|
"mount_accessor": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Mount accessor to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Name of the alias",
|
|
|
|
},
|
|
|
|
"metadata": {
|
2017-11-14 01:59:42 +00:00
|
|
|
Type: framework.TypeKVPairs,
|
|
|
|
Description: `Metadata to be associated with the alias.
|
|
|
|
In CLI, this parameter can be repeated multiple times, and it all gets merged together.
|
|
|
|
For example:
|
|
|
|
vault <command> <path> metadata=key1=value1 metadata=key2=value2
|
|
|
|
`,
|
2017-10-11 17:21:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
2017-10-17 18:08:51 +00:00
|
|
|
logical.UpdateOperation: i.pathAliasIDUpdate,
|
|
|
|
logical.ReadOperation: i.pathAliasIDRead,
|
|
|
|
logical.DeleteOperation: i.pathAliasIDDelete,
|
2017-10-11 17:21:20 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias-id"][1]),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Pattern: "persona/id/?$",
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
2017-10-17 18:08:51 +00:00
|
|
|
logical.ListOperation: i.pathAliasIDList,
|
2017-10-11 17:21:20 +00:00
|
|
|
},
|
|
|
|
|
2017-11-14 01:59:42 +00:00
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id-list"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias-id-list"][1]),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Pattern: "alias$",
|
|
|
|
Fields: map[string]*framework.FieldSchema{
|
|
|
|
"id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "ID of the alias",
|
|
|
|
},
|
|
|
|
"entity_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias belongs to. This field is deprecated in favor of 'canonical_id'.",
|
|
|
|
},
|
|
|
|
"canonical_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"mount_accessor": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Mount accessor to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Name of the alias",
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
Type: framework.TypeKVPairs,
|
|
|
|
Description: `Metadata to be associated with the alias.
|
|
|
|
In CLI, this parameter can be repeated multiple times, and it all gets merged together.
|
|
|
|
For example:
|
|
|
|
vault <command> <path> metadata=key1=value1 metadata=key2=value2
|
|
|
|
`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
|
|
logical.UpdateOperation: i.pathAliasRegister,
|
|
|
|
},
|
|
|
|
|
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias"][1]),
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
Pattern: "alias/id/" + framework.GenericNameRegex("id"),
|
|
|
|
Fields: map[string]*framework.FieldSchema{
|
|
|
|
"id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "ID of the alias",
|
|
|
|
},
|
|
|
|
"entity_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias should be tied to. This field is deprecated in favor of 'canonical_id'.",
|
|
|
|
},
|
|
|
|
"canonical_id": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Entity ID to which this alias should be tied to",
|
|
|
|
},
|
|
|
|
"mount_accessor": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Mount accessor to which this alias belongs to",
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Name of the alias",
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
Type: framework.TypeKVPairs,
|
|
|
|
Description: `Metadata to be associated with the alias.
|
|
|
|
In CLI, this parameter can be repeated multiple times, and it all gets merged together.
|
|
|
|
For example:
|
|
|
|
vault <command> <path> metadata=key1=value1 metadata=key2=value2
|
|
|
|
`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
|
|
logical.UpdateOperation: i.pathAliasIDUpdate,
|
|
|
|
logical.ReadOperation: i.pathAliasIDRead,
|
|
|
|
logical.DeleteOperation: i.pathAliasIDDelete,
|
|
|
|
},
|
|
|
|
|
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias-id"][1]),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Pattern: "alias/id/?$",
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
|
|
logical.ListOperation: i.pathAliasIDList,
|
|
|
|
},
|
|
|
|
|
2017-10-11 17:21:20 +00:00
|
|
|
HelpSynopsis: strings.TrimSpace(aliasHelp["alias-id-list"][0]),
|
|
|
|
HelpDescription: strings.TrimSpace(aliasHelp["alias-id-list"][1]),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|