Class: Armrest::Services::KeyVault::Secret
- Defined in:
- lib/armrest/services/key_vault/secret.rb
Instance Method Summary collapse
-
#show(options = {}) ⇒ Object
Using Azure REST API since the old gem doesnt support secrets github.com/Azure/azure-sdk-for-ruby docs.microsoft.com/en-us/rest/api/keyvault/get-secret/get-secret.
Methods inherited from Base
Methods included from Api::Settings
#client_id, #client_secret, #endpoint, #group, #location, #resource, #subscription_id, #tenant_id
Methods included from Api::HandleResponse
Methods included from Logging
#default_logger, #logger, #logger=
Constructor Details
This class inherits a constructor from Armrest::Services::Base
Instance Method Details
#show(options = {}) ⇒ Object
Using Azure REST API since the old gem doesnt support secrets github.com/Azure/azure-sdk-for-ruby docs.microsoft.com/en-us/rest/api/keyvault/get-secret/get-secret
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/armrest/services/key_vault/secret.rb', line 10 def show(={}) name = [:name] @vault = [:vault] || @options[:vault] || ENV['ARMREST_VAULT'] || self.class.vault version = "/#{version}" if @options[:version] begin resp = api.get("/secrets/#{name}#{version}") rescue SocketError => e if e..include?("vault.azure.net") = "WARN: Vault not found. Vault: #{@vault}" logger.info .color(:yellow) return else raise end end case resp.code.to_s when /^2/ data = JSON.load(resp.body) data['value'] else = (resp) logger.info "WARN: #{}".color(:yellow) return end end |