joyent-cloud-pricing 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 211775aa77ec92d64c37f94a021f29e4010bc097
4
- data.tar.gz: db713b309bed4b997a60f84ed7c606c093766987
3
+ metadata.gz: d837beb7e94cad2015118a5b5cdeae6c30bb1dd3
4
+ data.tar.gz: 3f0c8b423292be9202add92080f0434051f0499c
5
5
  SHA512:
6
- metadata.gz: b98915180ba7cf6e4d3af28555b44ef100c0443c850b3558bd409ed00ae1f585665a64604bf28c508d5dc4266f223d6f21616582754985e740bac6becaa0a674
7
- data.tar.gz: 3b42c5e32de624e38bc046cc9c924cb64dd8204cff0b6390f30dd45cd5228804b4527b88a75a407173e45dda62159dc283fadf538ca391e464e1a5f98db195fb
6
+ metadata.gz: 5c434d8ed96ceb0c1344f19bd70378105782558e57963a5c7392e9a8ab26a1f953ef30fbe7943649879e0c281176c89c2aeb21a8758c21bd2a4d1c9a7c111250
7
+ data.tar.gz: 0cf755a9ad4dad85a32ed5c67a9dbd7b63bb767cfd29e080c791545cd915a2e28b5f1efa8648da7130559e4d0e68e88f6992b846f907acd6a1a0fecd9f4da410
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/joyent-cloud-pricing.png)](http://badge.fury.io/rb/joyent-cloud-pricing)
1
2
  [![Build status](https://secure.travis-ci.org/kigster/joyent-cloud-pricing.png)](http://travis-ci.org/kigster/joyent-cloud-pricing)
2
3
  [![Code Climate](https://codeclimate.com/github/kigster/joyent-cloud-pricing.png)](https://codeclimate.com/github/kigster/joyent-cloud-pricing)
3
4
 
@@ -58,6 +59,68 @@ To update this file, run provided rake task:
58
59
  rake joyent:pricing:update
59
60
  ```
60
61
 
62
+ ## Full Pricing
63
+
64
+ Full price is stored in the configuration instance.
65
+
66
+ ```ruby
67
+ Joyent::Cloud::Pricing::Configuration.instance["g3-standard-48-smartos"]
68
+ # => 1.536
69
+ ```
70
+
71
+ ## Analysis of Commit Pricing
72
+
73
+ Reserve pricing is meant to be defined by a YAML file, outside of the gem folder,
74
+ somewhere on the file system. File looks like this:
75
+
76
+ ```yaml
77
+ defaults: &defaults
78
+ years: 1
79
+
80
+ reserved:
81
+ "g3-highcpu-32-smartos-cc":
82
+ <<: *defaults
83
+ prepay: 8000.00
84
+ monthly: 500
85
+ quantity: 10
86
+ "g3-highmemory-17.125-smartos":
87
+ <<: *defaults
88
+ prepay: 800.00
89
+ monthly: 60
90
+ quantity: 12
91
+ "g3-highio-60.5-smartos":
92
+ <<: *defaults
93
+ prepay: 1800.00
94
+ monthly: 600
95
+ quantity: 5
96
+ ```
97
+
98
+ Each reserve defines the upfront component (per instance) ```prepay```, monthly pricing and quantity of the
99
+ reserved instances of this type/price.
100
+
101
+ Subsequently, analyzer can be used to analyze the current list of flavors in use versus commit, and
102
+ come up with recommendations and some calculations:
103
+
104
+ ```ruby
105
+ # current list of flavors in use
106
+ flavors = %w(
107
+ g3-highcpu-7-smartos
108
+ g3-highcpu-7-smartos
109
+ g3-highio-60.5-smartos
110
+ g3-highio-60.5-smartos
111
+ g3-highio-60.5-smartos
112
+ )
113
+ commit = Joyent::Cloud::Pricing::Commit.from_yaml 'my_company/config/joyent-commit-pricing.yml'
114
+ analyzer = Joyent::Cloud::Pricing::Analyzer.new(commit, flavors)
115
+
116
+ analyzer.excess_monthly_price # => monthly $$ for instances in excess of reserve
117
+ analyzer.over_committed_zone_list # => list of zones in reserve, but not in reality
118
+ ```
119
+
120
+ ## Command Line Tools
121
+
122
+ TBD.
123
+
61
124
  ## Contributing
62
125
 
63
126
  1. Fork it
@@ -18,7 +18,7 @@ module Joyent::Cloud::Pricing
18
18
  end
19
19
 
20
20
  # Zones that are committed, but do not exist
21
- def over_provisioned_zone_list
21
+ def over_committed_zone_list
22
22
  h = {}
23
23
  zone_list.each_pair { |flavor, count| diff = count - quantity_for(flavor); h[flavor] = -diff if diff < 0 }
24
24
  h
@@ -1,7 +1,7 @@
1
1
  module Joyent
2
2
  module Cloud
3
3
  module Pricing
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -74,8 +74,8 @@ describe 'Joyent::Cloud::Pricing::Analyze' do
74
74
  expect(analyzer.excess_monthly_price).to eql( 6432.48 )
75
75
  end
76
76
 
77
- it '#over_provisioned_zone_list' do
78
- expect(analyzer.over_provisioned_zone_list).to eql( {:"g3-highio-60.5-smartos" => 1 })
77
+ it '#over_committed_zone_list' do
78
+ expect(analyzer.over_committed_zone_list).to eql( {:"g3-highio-60.5-smartos" => 1 })
79
79
  end
80
80
 
81
81
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyent-cloud-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul