Documentation ¶
Overview ¶
package registration provides managed instance information
package registration provides managed instance information
Index ¶
- Constants
- func Fingerprint(log log.T) (string, error)
- func GenerateKeyPair() (publicKey, privateKey, keyType string, err error)
- func GeneratePublicKey(privateKey string) (publicKey string, err error)
- func HasManagedInstancesCredentials(log log.T, manifestFileNamePrefix, vaultKey string) bool
- func InstanceID(log log.T, manifestFileNamePrefix, vaultKey string) string
- func PrivateKey(log log.T, manifestFileNamePrefix, vaultKey string) string
- func PrivateKeyType(log log.T, manifestFileNamePrefix, vaultKey string) string
- func PublicKey(log log.T, manifestFileNamePrefix, vaultKey string) string
- func Region(log log.T, manifestFileNamePrefix, vaultKey string) string
- func ReloadInstanceInfo(log log.T, manifestFileNamePrefix, vaultKey string)
- func ShouldRotatePrivateKey(log log.T, executableToRotateKey string, privateKeyMaxDaysAge int, ...) (bool, error)
- func UpdatePrivateKey(log log.T, privateKey, privateKeyType, manifestFileNamePrefix, vaultKey string) (err error)
- func UpdateServerInfo(instanceID, region, publicKey, privateKey, privateKeyType, ... string) (err error)
- type IOnpremRegistrationInfo
Examples ¶
Constants ¶
const ( RegVaultKey = "RegistrationKey" EC2RegistrationVaultKey = "EC2RegistrationKey" )
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
GenerateKeyPair generate a new keypair
func GeneratePublicKey ¶
func HasManagedInstancesCredentials ¶
HasManagedInstancesCredentials returns true when the valid registration information is present
func InstanceID ¶
InstanceID of the managed instance.
Example ¶
file = fileStub{} vault = vaultStub{rKey: sampleRegistrationKey, data: sampleJson, exists: true} loadServerInfo("", RegVaultKey) // load info with mocked vault instanceID := InstanceID(log.NewMockLog(), "", RegVaultKey) fmt.Println(instanceID)
Output: mi-e6c6f145e6c6f145
func PrivateKey ¶
PrivateKey of the managed instance.
Example ¶
file = fileStub{} vault = vaultStub{rKey: sampleRegistrationKey, data: sampleJson, exists: true} loadServerInfo("", RegVaultKey) // load info with mocked vault privateKey := PrivateKey(log.NewMockLog(), "", RegVaultKey) fmt.Println(privateKey)
Output: KEYe6c6f145e6c6f145
func PrivateKeyType ¶
PrivateKeyType of the managed instance.
func Region ¶
Region of the managed instance.
Example ¶
file = fileStub{} vault = vaultStub{rKey: sampleRegistrationKey, data: sampleJson, exists: true} loadServerInfo("", RegVaultKey) // load info with mocked vault region := Region(log.NewMockLog(), "", RegVaultKey) fmt.Println(region)
Output: us-west-1
func ReloadInstanceInfo ¶
func ShouldRotatePrivateKey ¶
func ShouldRotatePrivateKey(log log.T, executableToRotateKey string, privateKeyMaxDaysAge int, serviceSaysRotate bool, manifestFileNamePrefix, vaultKey string) (bool, error)
ShouldRotatePrivateKey returns true if serviceSaysRotate or private key has surpassed privateKeyMaxDaysAge
func UpdatePrivateKey ¶
func UpdatePrivateKey(log log.T, privateKey, privateKeyType, manifestFileNamePrefix, vaultKey string) (err error)
UpdatePrivateKey saves the private key into the registration persistence store
func UpdateServerInfo ¶
func UpdateServerInfo(instanceID, region, publicKey, privateKey, privateKeyType, manifestFileNamePrefix, vaultKey string) (err error)
UpdateServerInfo saves the instance info into the registration persistence store
Types ¶
type IOnpremRegistrationInfo ¶
type IOnpremRegistrationInfo interface { InstanceID(log.T, string, string) string Region(log.T, string, string) string PrivateKey(log.T, string, string) string PrivateKeyType(log.T, string, string) string Fingerprint(log.T) (string, error) GenerateKeyPair() (string, string, string, error) UpdatePrivateKey(log.T, string, string, string, string) error HasManagedInstancesCredentials(log.T, string, string) bool GeneratePublicKey(string) (string, error) ShouldRotatePrivateKey(log.T, string, int, bool, string, string) (bool, error) ReloadInstanceInfo(log.T, string, string) }
func NewOnpremRegistrationInfo ¶
func NewOnpremRegistrationInfo() IOnpremRegistrationInfo
Temp moved here, should refactor entire file to be behind interface