joyent-cloud-pricing 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +63 -0
- data/lib/pricing/analyzer.rb +1 -1
- data/lib/pricing/version.rb +1 -1
- data/spec/pricing/analyze_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d837beb7e94cad2015118a5b5cdeae6c30bb1dd3
|
4
|
+
data.tar.gz: 3f0c8b423292be9202add92080f0434051f0499c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/pricing/analyzer.rb
CHANGED
@@ -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
|
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
|
data/lib/pricing/version.rb
CHANGED
@@ -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 '#
|
78
|
-
expect(analyzer.
|
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
|
|