Class: Train::Transports::Helpers::Azure::FileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/helpers/azure/file_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ FileParser

Returns a new instance of FileParser.



5
6
7
8
9
# File 'lib/train/transports/helpers/azure/file_parser.rb', line 5

def initialize(credentials)
  @credentials = credentials

  validate!
end

Instance Method Details

#subscription_idObject



17
18
19
# File 'lib/train/transports/helpers/azure/file_parser.rb', line 17

def subscription_id
  @subscription_id ||= @credentials.sections[0]
end

#validate!Object



11
12
13
14
15
# File 'lib/train/transports/helpers/azure/file_parser.rb', line 11

def validate!
  return if @credentials.sections.count == 1

  raise "Credentials file must have one entry. Check your credentials file. If you have more than one entry set AZURE_SUBSCRIPTION_ID environment variable."
end