lib/aws/rikanjo/mode/rds.rb in aws-rikanjo-0.0.7 vs lib/aws/rikanjo/mode/rds.rb in aws-rikanjo-0.0.8
- old
+ new
@@ -30,20 +30,22 @@
return {:hr_price => i["prices"]["USD"]}
end
end
end
+
+ abort("[rds][#{region}][#{@instance_type}] Not found om-price?")
end
def ri_price_from_contents contents
region = self.convert_region(@region)
mtype = (@multiaz) ? 'multiAZdeployRes' : 'stdDeployRes'
# parse
json = self.parse_contents(contents)
- ri_info = {}
+ ri_info = nil
json["config"]["regions"].each do |r|
next unless r["region"] == region
r["instanceTypes"].each do |type|
@@ -53,10 +55,11 @@
next unless type["type"] == mtype
type["tiers"].each do |i|
next unless i["size"] == @instance_type
+ ri_info = ri_info || {}
i["valueColumns"].each do |y|
# beauty
y["name"].gsub!(/^year/, 'yr')
y["prices"]["USD"].gsub!(/,/, '')
@@ -70,10 +73,12 @@
end
end
end
+ abort("[rds][#{region}][#{@instance_type}] Not found ri-price?") unless ri_info
+
return ri_info
end
def price_url
@price_url
@@ -95,16 +100,18 @@
def convert_region region
# not same om region
case region
when "us-east-1" then "us-east"
when "us-west-1" then "us-west"
+ when "us-west-2" then "us-west-2"
when "eu-west-1" then "eu-ireland"
when "ap-southeast-1" then "apac-sin"
when "ap-northeast-1" then "apac-tokyo"
when "ap-southeast-2" then "apac-syd"
when "sa-east-1" then "sa-east-1"
end
end
+
end
end
end
end