Rename identity whitelist and roletag blacklist api endpoints

This commit is contained in:
Jeff Mitchell 2016-05-05 13:34:50 -04:00
parent c69ba40d05
commit 8fef6e3ac0
5 changed files with 26 additions and 14 deletions

View file

@ -76,12 +76,12 @@ func Backend(conf *logical.BackendConfig) (*framework.Backend, error) {
pathConfigTidyRoleTags(b),
pathConfigTidyIdentities(b),
pathListCertificates(b),
pathBlacklistRoleTag(b),
pathListBlacklistRoleTags(b),
pathBlacklistRoleTag(b),
pathTidyRoleTags(b),
pathListWhitelistIdentities(b),
pathWhitelistIdentity(b),
pathTidyIdentities(b),
pathListWhitelistIdentities(b),
},
}

View file

@ -11,7 +11,7 @@ import (
func pathBlacklistRoleTag(b *backend) *framework.Path {
return &framework.Path{
Pattern: "blacklist/roletag/(?P<role_tag>.*)",
Pattern: "roletag-blacklist/(?P<role_tag>.*)",
Fields: map[string]*framework.FieldSchema{
"role_tag": &framework.FieldSchema{
Type: framework.TypeString,
@ -34,7 +34,7 @@ to avoid any encoding problems, it can be base64 encoded.`,
// Path to list all the blacklisted tags.
func pathListBlacklistRoleTags(b *backend) *framework.Path {
return &framework.Path{
Pattern: "blacklist/roletags/?",
Pattern: "roletag-blacklist/?",
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: b.pathBlacklistRoleTagsList,

View file

@ -1,14 +1,20 @@
package aws
import (
"fmt"
"github.com/fatih/structs"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
const (
identityWhitelistConfigPath = "config/tidy/identity-whitelist"
)
func pathConfigTidyIdentities(b *backend) *framework.Path {
return &framework.Path{
Pattern: "config/tidy/identities$",
Pattern: fmt.Sprintf("%s$", identityWhitelistConfigPath),
Fields: map[string]*framework.FieldSchema{
"safety_buffer": &framework.FieldSchema{
Type: framework.TypeDurationSecond,
@ -49,7 +55,7 @@ func (b *backend) pathConfigTidyIdentitiesExistenceCheck(req *logical.Request, d
}
func (b *backend) configTidyIdentities(s logical.Storage) (*tidyWhitelistIdentityConfig, error) {
entry, err := s.Get("config/tidy/identities")
entry, err := s.Get(identityWhitelistConfigPath)
if err != nil {
return nil, err
}
@ -90,7 +96,7 @@ func (b *backend) pathConfigTidyIdentitiesCreateUpdate(req *logical.Request, dat
configEntry.DisablePeriodicTidy = data.Get("disable_periodic_tidy").(bool)
}
entry, err := logical.StorageEntryJSON("config/tidy/identities", configEntry)
entry, err := logical.StorageEntryJSON(identityWhitelistConfigPath, configEntry)
if err != nil {
return nil, err
}
@ -123,7 +129,7 @@ func (b *backend) pathConfigTidyIdentitiesDelete(req *logical.Request, data *fra
b.configMutex.Lock()
defer b.configMutex.Unlock()
return nil, req.Storage.Delete("config/tidy/identities")
return nil, req.Storage.Delete(identityWhitelistConfigPath)
}
type tidyWhitelistIdentityConfig struct {

View file

@ -1,14 +1,20 @@
package aws
import (
"fmt"
"github.com/fatih/structs"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
const (
roletagBlacklistConfigPath = "config/tidy/roletag-blacklist"
)
func pathConfigTidyRoleTags(b *backend) *framework.Path {
return &framework.Path{
Pattern: "config/tidy/roletags$",
Pattern: fmt.Sprintf("%s$", roletagBlacklistConfigPath),
Fields: map[string]*framework.FieldSchema{
"safety_buffer": &framework.FieldSchema{
Type: framework.TypeDurationSecond,
@ -50,7 +56,7 @@ func (b *backend) pathConfigTidyRoleTagsExistenceCheck(req *logical.Request, dat
}
func (b *backend) configTidyRoleTags(s logical.Storage) (*tidyBlacklistRoleTagConfig, error) {
entry, err := s.Get("config/tidy/roletags")
entry, err := s.Get(roletagBlacklistConfigPath)
if err != nil {
return nil, err
}
@ -90,7 +96,7 @@ func (b *backend) pathConfigTidyRoleTagsCreateUpdate(req *logical.Request, data
configEntry.DisablePeriodicTidy = data.Get("disable_periodic_tidy").(bool)
}
entry, err := logical.StorageEntryJSON("config/tidy/roletags", configEntry)
entry, err := logical.StorageEntryJSON(roletagBlacklistConfigPath, configEntry)
if err != nil {
return nil, err
}
@ -123,7 +129,7 @@ func (b *backend) pathConfigTidyRoleTagsDelete(req *logical.Request, data *frame
b.configMutex.Lock()
defer b.configMutex.Unlock()
return nil, req.Storage.Delete("config/tidy/roletags")
return nil, req.Storage.Delete(roletagBlacklistConfigPath)
}
type tidyBlacklistRoleTagConfig struct {

View file

@ -10,7 +10,7 @@ import (
func pathWhitelistIdentity(b *backend) *framework.Path {
return &framework.Path{
Pattern: "whitelist/identity/" + framework.GenericNameRegex("instance_id"),
Pattern: "identity-whitelist/" + framework.GenericNameRegex("instance_id"),
Fields: map[string]*framework.FieldSchema{
"instance_id": &framework.FieldSchema{
Type: framework.TypeString,
@ -30,7 +30,7 @@ func pathWhitelistIdentity(b *backend) *framework.Path {
func pathListWhitelistIdentities(b *backend) *framework.Path {
return &framework.Path{
Pattern: "whitelist/identities/?",
Pattern: "identity-whitelist/?",
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ListOperation: b.pathWhitelistIdentitiesList,