module Idcf::Cli::Controller::Extend::Util

util

Public Instance Methods

get_region(o) click to toggle source

get region

@param o [Hash] options @param read_conf [Boolean] @return String

# File lib/idcf/cli/controller/extend/util.rb, line 13
def get_region(o)
  flg = !class_options[:region].nil?
  Idcf::Cli::Lib::Configure.get_region(o, flg)
end
make_schema_path(o) click to toggle source

make schema path

@param o [Hash] @return String

# File lib/idcf/cli/controller/extend/util.rb, line 22
def make_schema_path(o)
  fn     = name.underscore.split('/').pop
  dir    = Idcf::Cli::Conf::Const::CMD_FILE_DIR
  ext    = Idcf::Cli::Conf::Const::CMD_FILE_EXT
  region = get_region(o)
  v      = service_version(o)
  "#{dir}/#{fn}_#{v}_#{region}.#{ext}"
end
service_version(o) click to toggle source

service version

@param o [Hash] @return String

# File lib/idcf/cli/controller/extend/util.rb, line 35
def service_version(o)
  versions = service_versions(get_region(o))
  result   = o[:version].nil? ? versions.last : o[:version]
  msg      = "not found input version[#{o[:version]}]"
  raise Idcf::Cli::Error::CliError, msg unless versions.include?(result)
  result
end