From fa557e25794de5623c91c870f6c96f55127cf824 Mon Sep 17 00:00:00 2001 From: Nitin Prakash Date: Mon, 28 Oct 2024 19:44:26 +0530 Subject: [PATCH] add example --- azure-key-vault/azure-key-vault.cabal | 10 ++++++++++ azure-key-vault/example/Main.hs | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 azure-key-vault/example/Main.hs diff --git a/azure-key-vault/azure-key-vault.cabal b/azure-key-vault/azure-key-vault.cabal index c0d829a..afba7ef 100644 --- a/azure-key-vault/azure-key-vault.cabal +++ b/azure-key-vault/azure-key-vault.cabal @@ -62,3 +62,13 @@ library , text , unliftio default-language: Haskell2010 + +executable example + main-is: Main.hs + hs-source-dirs: example + ghc-options: -Wall + default-language: Haskell2010 + build-depends: + base >= 4.7 && < 5 + , azure-auth + , azure-key-vault diff --git a/azure-key-vault/example/Main.hs b/azure-key-vault/example/Main.hs new file mode 100644 index 0000000..1fd8ed4 --- /dev/null +++ b/azure-key-vault/example/Main.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import Azure.Secret (getSecret) +import Azure.Secret.Types (KeyVaultHost (..), SecretName (..)) +import Azure.Types (newEmptyToken) +import Azure.Auth (defaultAzureCredential) + +main :: IO () +main = do + tok <- newEmptyToken + cred <- defaultAzureCredential Nothing "https://vault.azure.net" tok + -- In order to run this, you need to replace @SecretName@ and @KeyVaultHost@ with + -- appropriate values in your resource group. These are just dummy values. + res <- getSecret (SecretName "radiohead") (KeyVaultHost "albums") cred + print res