Documentation
¶
Overview ¶
Package vault provides a Go implementation of the Chef Vault API.
Index ¶
- Variables
- type CreateDataResponse
- type CreateResponse
- type DataBagItemType
- type DeleteResponse
- type Payload
- type RefreshResponse
- type RemoveDataResponse
- type RemoveResponse
- type Response
- type RotateResponse
- type Service
- func (s *Service) Create(payload *Payload) (*CreateResponse, error)
- func (s *Service) Delete(vaultName string) (*DeleteResponse, error)
- func (s *Service) DeleteItem(vaultName, vaultItem string) (*DeleteResponse, error)
- func (s *Service) GetItem(vaultName, vaultItem string) (chef.DataBagItem, error)
- func (s *Service) IsVault(vaultName, vaultItem string) (bool, error)
- func (s *Service) ItemType(vaultName, vaultItem string) (DataBagItemType, error)
- func (s *Service) List() (*chef.DataBagListResult, error)
- func (s *Service) ListItems(vaultName string) (*chef.DataBagListResult, error)
- func (s *Service) Refresh(payload *Payload) (*RefreshResponse, error)
- func (s *Service) Remove(payload *Payload) (*RemoveResponse, error)
- func (s *Service) RotateAllKeys() ([]RotateResponse, error)
- func (s *Service) RotateKeys(payload *Payload) (*RotateResponse, error)
- func (s *Service) Update(payload *Payload) (*UpdateResponse, error)
- type UpdateDataResponse
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilPayload is returned when a nil *Payload is passed to a public API. ErrNilPayload = errors.New("vault: payload cannot be nil") // ErrMissingVaultName is returned when VaultName is empty. ErrMissingVaultName = errors.New("vault: missing VaultName") // ErrMissingVaultItemName is returned when VaultItemName is empty. ErrMissingVaultItemName = errors.New("vault: missing VaultItemName") )
Functions ¶
This section is empty.
Types ¶
type CreateDataResponse ¶
type CreateDataResponse struct {
URI string `json:"uri"`
}
CreateDataResponse represents the response returned after creating vault content.
type CreateResponse ¶
type CreateResponse struct {
Response
Data *CreateDataResponse `json:"data"`
KeysURIs []string `json:"keys_uris"`
}
CreateResponse represents the structure of the response from a Create operation.
type DataBagItemType ¶
type DataBagItemType string
DataBagItemType represents the classification of a Chef data bag item as determined by Chef-Vault semantics.
const ( // DataBagItemTypeVault indicates the item is a Chef Vault. DataBagItemTypeVault DataBagItemType = "vault" // DataBagItemTypeEncrypted indicates the item is an encrypted data bag item containing // encrypted application data. DataBagItemTypeEncrypted DataBagItemType = "encrypted" // DataBagItemTypeNormal indicates the item is a standard Chef data bag item // with no Chef-Vault or encrypted data bag semantics applied. DataBagItemTypeNormal DataBagItemType = "normal" )
type DeleteResponse ¶
DeleteResponse represents the structure of the response from a Delete operation.
type Payload ¶
type Payload struct {
VaultName string
VaultItemName string
Content map[string]interface{}
KeysMode *item_keys.KeysMode
SearchQuery *string
Admins []string
Clients []string
Clean bool
CleanUnknown bool
SkipReencrypt bool
}
Payload represents the input parameters used to create, update, or refresh a vault item.
type RefreshResponse ¶
type RefreshResponse = UpdateResponse
RefreshResponse intentionally mirrors UpdateResponse for API parity.
type RemoveDataResponse ¶
type RemoveDataResponse struct {
URI string `json:"uri"`
}
RemoveDataResponse represents the response returned after removing data from the vault item.
type RemoveResponse ¶
type RemoveResponse struct {
Response
Data *RemoveDataResponse `json:"data"`
KeysURIs []string `json:"keys"`
}
RemoveResponse represents the structure of the response from a Remove operation.
type Response ¶
type Response struct {
URI string `json:"uri"`
}
Response represents the basic structure of a response from a Vault operation.
type RotateResponse ¶
RotateResponse represents the structure of the response from a RotateKeys operation.
type Service ¶
Service provides Vault operations backed by a Chef Server client.
func NewService ¶
NewService returns a Service configured with the given Chef client.
func (*Service) Create ¶
func (s *Service) Create(payload *Payload) (*CreateResponse, error)
Create adds a vault item and its associated keys to the Chef server.
References:
- Chef API Docs: https://docs.chef.io/server/api_chef_server/#post-9
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_create.rb
func (*Service) Delete ¶
func (s *Service) Delete(vaultName string) (*DeleteResponse, error)
Delete destroys the entire vault, all the items, and keys from the Chef Server (nuclear option).
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#delete-9
func (*Service) DeleteItem ¶
func (s *Service) DeleteItem(vaultName, vaultItem string) (*DeleteResponse, error)
DeleteItem destroys a specified vault item and its keys.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#delete-10
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_delete.rb
func (*Service) GetItem ¶
func (s *Service) GetItem(vaultName, vaultItem string) (chef.DataBagItem, error)
GetItem returns the decrypted items in the vault.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#get-26
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_show.rb
func (*Service) IsVault ¶
IsVault determines whether the data bag item is a vault.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#get-24
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_isvault.rb
func (*Service) ItemType ¶
func (s *Service) ItemType(vaultName, vaultItem string) (DataBagItemType, error)
ItemType determines whether the data bag item is a vault, encrypted data bag, or a normal data bag item.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#get-24
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_itemtype.rb
func (*Service) List ¶
func (s *Service) List() (*chef.DataBagListResult, error)
List returns a list of vaults on the server.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#get-24
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_list.rb
func (*Service) ListItems ¶
func (s *Service) ListItems(vaultName string) (*chef.DataBagListResult, error)
ListItems returns a list of the items in a vault.
References:
- Chef API Docs: https://docs.chef.io/api_chef_server/#get-25
func (*Service) Refresh ¶
func (s *Service) Refresh(payload *Payload) (*RefreshResponse, error)
Refresh reprocesses the vault search query and ensures all matching nodes have an encrypted secret, without modifying existing vault content or access rules.
References:
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_refresh.rb
func (*Service) Remove ¶
func (s *Service) Remove(payload *Payload) (*RemoveResponse, error)
Remove removes clients, admins, or data keys from an existing vault item.
References:
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_remove.rb
func (*Service) RotateAllKeys ¶
func (s *Service) RotateAllKeys() ([]RotateResponse, error)
RotateAllKeys performs a full key rotation for every vault item in the Chef server, regenerating shared secrets and re-encrypting data for each item.
References:
func (*Service) RotateKeys ¶
func (s *Service) RotateKeys(payload *Payload) (*RotateResponse, error)
RotateKeys rotates the shared secret for a vault item by generating a new secret, re-encrypting all client/admin keys, and re-encrypting the vault data.
References:
func (*Service) Update ¶
func (s *Service) Update(payload *Payload) (*UpdateResponse, error)
Update modifies a vault item and its access keys on the Chef server.
References:
- Chef API Docs: https://docs.chef.io/server/api_chef_server/#post-9
- Chef-Vault Source: https://github.com/chef/chef-vault/blob/main/lib/chef/knife/vault_update.rb
type UpdateDataResponse ¶
type UpdateDataResponse struct {
URI string `json:"uri"`
}
UpdateDataResponse represents the response returned after updating vault content.
type UpdateResponse ¶
type UpdateResponse struct {
Response
Data *UpdateDataResponse `json:"data,omitempty"`
KeysURIs []string `json:"keys_uris,omitempty"`
}
UpdateResponse represents the structure of the response from an Update operation.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cheferr provides helpers for interpreting errors returned by the go-chef client in a consistent, semantic way.
|
Package cheferr provides helpers for interpreting errors returned by the go-chef client in a consistent, semantic way. |
|
Package item defines data structures and helpers for Chef Vault items.
|
Package item defines data structures and helpers for Chef Vault items. |
|
Package item_keys contains helpers for managing Chef Vault item keys.
|
Package item_keys contains helpers for managing Chef Vault item keys. |