morpheus-cli 4.2.4 → 4.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/cli/invoices_command.rb +42 -14
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b6ccabcdbd7fef021565aa109c55832f6e1f67e4fff957849aa31bfff81b14b
|
4
|
+
data.tar.gz: 4241cdcba0dfacfccfd15916340a5ffe1f876067e1565bac202e87c415603c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bda2a86a83aa395736e0fd133d6aae6dd388f474e521252ef5c4bed9855b0e8a4325881c2daa0bdf6fe0ca52f650c853385b0974f1e7d399664e9dd997d4d6f
|
7
|
+
data.tar.gz: 948e5582db73d74a27a270b61155a0ecb5844c0c5e6a58b5e0b6148ea6fbd5bfeb707e42592509ac4be2adab8c59978491caafef8c5e1f465b30cfad8d550529
|
data/Dockerfile
CHANGED
@@ -24,14 +24,18 @@ class Morpheus::Cli::InvoicesCommand
|
|
24
24
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
25
25
|
opts.banner = subcommand_usage()
|
26
26
|
opts.on('-a', '--all', "Display all costs, prices and raw data" ) do
|
27
|
+
options[:show_actual_costs] = true
|
27
28
|
options[:show_costs] = true
|
28
29
|
options[:show_prices] = true
|
29
30
|
options[:show_raw_data] = true
|
30
31
|
end
|
32
|
+
opts.on('--actuals', '--actuals', "Display all actual costs: Compute, Memory, Storage, etc." ) do
|
33
|
+
options[:show_actual_costs] = true
|
34
|
+
end
|
31
35
|
opts.on('--costs', '--costs', "Display all costs: Compute, Memory, Storage, etc." ) do
|
32
36
|
options[:show_costs] = true
|
33
37
|
end
|
34
|
-
opts.on('--prices', '--prices', "Display
|
38
|
+
opts.on('--prices', '--prices', "Display prices: Total, Compute, Memory, Storage, etc." ) do
|
35
39
|
options[:show_prices] = true
|
36
40
|
end
|
37
41
|
opts.on('--type TYPE', String, "Filter by Ref Type eg. ComputeSite (Group), ComputeZone (Cloud), ComputeServer (Host), Instance, Container, User") do |val|
|
@@ -164,7 +168,22 @@ class Morpheus::Cli::InvoicesCommand
|
|
164
168
|
{"PERIOD" => lambda {|it| format_invoice_period(it) } },
|
165
169
|
{"START" => lambda {|it| format_date(it['startDate']) } },
|
166
170
|
{"END" => lambda {|it| it['endDate'] ? format_date(it['endDate']) : '' } },
|
167
|
-
|
171
|
+
{"MTD" => lambda {|it| format_money(it['runningCost']) } },
|
172
|
+
{"TOTAL" => lambda {|it|
|
173
|
+
if it['period'] == current_period && it['totalCost'].to_f > 0
|
174
|
+
format_money(it['totalCost']) + " (Projected)"
|
175
|
+
else
|
176
|
+
format_money(it['totalCost'])
|
177
|
+
end
|
178
|
+
} },
|
179
|
+
{"ACTUAL MTD" => lambda {|it| format_money(it['actualRunningCost']) } },
|
180
|
+
{"ACTUAL TOTAL" => lambda {|it|
|
181
|
+
if it['period'] == current_period && it['actualTotalCost'].to_f > 0
|
182
|
+
format_money(it['actualTotalCost']) + " (Projected)"
|
183
|
+
else
|
184
|
+
format_money(it['actualTotalCost'])
|
185
|
+
end
|
186
|
+
} }
|
168
187
|
]
|
169
188
|
if options[:show_costs]
|
170
189
|
columns += [
|
@@ -175,16 +194,24 @@ class Morpheus::Cli::InvoicesCommand
|
|
175
194
|
{"OTHER" => lambda {|it| format_money(it['extraCost']) } },
|
176
195
|
]
|
177
196
|
end
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
197
|
+
if options[:show_actual_costs]
|
198
|
+
columns += [
|
199
|
+
{"ACTUAL COMPUTE" => lambda {|it| format_money(it['actualComputePrice']) } },
|
200
|
+
# {"ACTUAL MEMORY" => lambda {|it| format_money(it['actualMemoryPrice']) } },
|
201
|
+
{"ACTUAL STORAGE" => lambda {|it| format_money(it['actualStoragePrice']) } },
|
202
|
+
{"ACTUAL NETWORK" => lambda {|it| format_money(it['actualNetworkPrice']) } },
|
203
|
+
{"ACTUAL OTHER" => lambda {|it| format_money(it['actualExtraPrice']) } },
|
204
|
+
# {"ACTUAL MTD" => lambda {|it| format_money(it['actualRunningPrice']) } },
|
205
|
+
# {"ACTUAL TOTAL" => lambda {|it|
|
206
|
+
# if it['period'] == current_period && it['actualTotalPrice'].to_f > 0
|
207
|
+
# format_money(it['actualTotalPrice']) + " (Projected)"
|
208
|
+
# else
|
209
|
+
# format_money(it['actualTotalPrice'])
|
210
|
+
# end
|
211
|
+
# } }
|
212
|
+
]
|
213
|
+
end
|
214
|
+
|
188
215
|
if options[:show_prices]
|
189
216
|
columns += [
|
190
217
|
{"COMPUTE PRICE" => lambda {|it| format_money(it['computePrice']) } },
|
@@ -309,8 +336,9 @@ class Morpheus::Cli::InvoicesCommand
|
|
309
336
|
print "\n"
|
310
337
|
# print_h2 "Costs"
|
311
338
|
cost_rows = [
|
312
|
-
{label: '
|
313
|
-
{label: '
|
339
|
+
{label: 'Usage Price'.upcase, compute: invoice['computePrice'], memory: invoice['memoryPrice'], storage: invoice['storagePrice'], network: invoice['networkPrice'], license: invoice['licensePrice'], extra: invoice['extraPrice'], running: invoice['runningPrice'], total: invoice['totalPrice']},
|
340
|
+
{label: 'Usage Cost'.upcase, compute: invoice['computeCost'], memory: invoice['memoryCost'], storage: invoice['storageCost'], network: invoice['networkCost'], license: invoice['licenseCost'], extra: invoice['extraCost'], running: invoice['runningCost'], total: invoice['totalCost']},
|
341
|
+
{label: 'Actual Cost'.upcase, compute: invoice['actualComputeCost'], memory: invoice['actualMemoryCost'], storage: invoice['actualStorageCost'], network: invoice['actualNetworkCost'], license: invoice['actualLicenseCost'], extra: invoice['actualExtraCost'], running: invoice['actualRunningCost'], total: invoice['actualTotalCost']},
|
314
342
|
]
|
315
343
|
cost_columns = {
|
316
344
|
"" => lambda {|it| it[:label] },
|
data/lib/morpheus/cli/version.rb
CHANGED