Class: Vault

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/clients/azure/vault.rb

Overview

Wrapper class for ::Azure::KeyVault::Profiles::Latest::Mgmt::Client allowing custom configuration, for example, defining additional settings for the ::MsRestAzure::ApplicationTokenProvider.

Constant Summary collapse

AUTH_ENDPOINT =
MsRestAzure::AzureEnvironments::AzureCloud.active_directory_endpoint_url
RESOURCE_ENDPOINT =
"https://vault.azure.net".freeze

Class Method Summary collapse

Class Method Details

.client(vault_name, credentials) ⇒ Object

Raises:

  • (::Train::UserError)


9
10
11
12
13
14
15
16
# File 'lib/train/transports/clients/azure/vault.rb', line 9

def self.client(vault_name, credentials)
  raise ::Train::UserError, "Vault Name cannot be nil" if vault_name.nil?

  credentials[:credentials] = ::MsRest::TokenCredentials.new(provider(credentials))
  credentials[:base_url] = api_endpoint(vault_name)

  ::Azure::KeyVault::Profiles::Latest::Mgmt::Client.new(credentials)
end