Module: Misty::Microversion

Overview

Handles OpenStack Services supporting Microversion feature

Defined Under Namespace

Classes: VersionError

Instance Method Summary collapse

Instance Method Details

#microversion_header(version) ⇒ Object



18
19
20
# File 'lib/misty/microversion.rb', line 18

def microversion_header(version)
  {'X-Openstack-API-Version' => "#{service_types[0]} #{version}" }
end

#set_version(version) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/misty/microversion.rb', line 4

def set_version(version)
  case version
  when nil || ''
    # TODO:
    # version_discovery
  when 'latest'
    'latest'
  when /^([1-9]+\d*)\.([1-9]+\d*)$/
    version if version_match(version)
  else
    raise VersionError, ":version must be '<number.number>' or 'latest'"
  end
end