Documentation ¶
Index ¶
- func CreateKey(ctx context.Context, vaultName, keyName string) (key keyvault.KeyBundle, err error)
- func CreateVault(ctx context.Context, vaultName string) (keyvault.Vault, error)
- func CreateVaultWithPolicies(ctx context.Context, vaultName, userID string) (vault keyvault.Vault, err error)
- func DeleteVault(ctx context.Context, vaultName string) (autorest.Response, error)
- func GetVault(ctx context.Context, vaultName string) (keyvault.Vault, error)
- func GetVaults()
- func PassManager()
- func SetVaultPermissions(ctx context.Context, vaultName string) (keyvault.Vault, error)
- func SetVaultPermissionsForDeployment(ctx context.Context, vaultName string) (keyvault.Vault, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateVault ¶
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 ¶
DeleteVault deletes an existing vault
func PassManager ¶
func PassManager()
func SetVaultPermissions ¶
SetVaultPermissions adds an access policy permitting this app's Client ID to manage keys and secrets.
Example ¶
package main import ( "context" "github.com/marstr/randname" "github.com/Azure-Samples/azure-sdk-for-go-samples/services/internal/config" "github.com/Azure-Samples/azure-sdk-for-go-samples/services/internal/util" "github.com/Azure-Samples/azure-sdk-for-go-samples/services/resources" ) var ( kvName = randname.GenerateWithPrefix("vault-sample-go-", 5) keyName = randname.GenerateWithPrefix("key-sample-go-", 5) ) func main() { 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.LogAndPanic(err) } util.PrintAndLog("resource group created") _, err = CreateVault(ctx, kvName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("vault created") _, err = SetVaultPermissions(ctx, kvName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("set vault permissions") _, err = CreateKey(ctx, kvName, keyName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created key") }
Output: resource group created vault created set vault permissions created key
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.