keyvault

package
v0.0.0-...-86c76a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKey

func CreateKey(ctx context.Context, vaultName, keyName string) (key keyvault.KeyBundle, err error)

CreateKeyBundle creates a key in the specified keyvault

func CreateVault

func CreateVault(ctx context.Context, vaultName string) (keyvault.Vault, error)

CreateVault creates a new vault

func CreateVaultWithPolicies

func CreateVaultWithPolicies(ctx context.Context, vaultName, userID string) (vault keyvault.Vault, err error)

CreateVaultWithPolicies creates a new Vault with policies granting access to the specified user.

func DeleteVault

func DeleteVault(ctx context.Context, vaultName string) (autorest.Response, error)

DeleteVault deletes an existing vault

func GetVault

func GetVault(ctx context.Context, vaultName string) (keyvault.Vault, error)

GetVault returns an existing vault

func GetVaults

func GetVaults()

GetVaults lists all key vaults in a subscription

func SetVaultPermissions

func SetVaultPermissions(ctx context.Context, vaultName string) (keyvault.Vault, error)

SetVaultPermissions adds an access policy permitting this app's Client ID to manage keys and secrets.

Example
var groupName = config.GenerateGroupName("KeyVault")
config.SetGroupName(groupName)

ctx := context.Background()
defer resources.Cleanup(ctx)

_, err := resources.CreateGroup(ctx, config.GroupName())
if err != nil {
	util.PrintAndLog(err.Error())
}

_, err = CreateVault(ctx, kvName)
if err != nil {
	util.PrintAndLog(err.Error())
}
util.PrintAndLog("vault created")

_, err = SetVaultPermissions(ctx, kvName)
if err != nil {
	util.PrintAndLog(err.Error())
}
util.PrintAndLog("set vault permissions")

_, err = CreateKey(ctx, kvName, keyName)
if err != nil {
	util.PrintAndLog(err.Error())
}
util.PrintAndLog("created key")
Output:

vault created
set vault permissions
created key

func SetVaultPermissionsForDeployment

func SetVaultPermissionsForDeployment(ctx context.Context, vaultName string) (keyvault.Vault, error)

SetVaultPermissionsForDeployment updates a key vault to enable deployments and add permissions to the application

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL