Skip to content

Commit 26455e4

Browse files
authored
Merge pull request #20 from thecodeteam/enhancement-131-configurable-catalog-price-currency
Configurable catalog price currency + Jar release 2.0.0
2 parents 77ecffd + 397bf8d commit 26455e4

File tree

4 files changed

+85
-21
lines changed

4 files changed

+85
-21
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
exports.migrate = function (input) {
2+
var current_version = getCurrentProductVersion();
3+
4+
// prints out all properties as json in the description field
5+
// input['properties']['.properties.catalog_services_0_long_description']['value'] = JSON.stringify(input['properties']);
6+
7+
if (current_version.startsWith("1.")) {
8+
// cost currency field added since 2.0
9+
console.log('upgrade needed for currency fields in plan definitions');
10+
11+
addCurrencyDefaults(input['properties']);
12+
}
13+
14+
return input;
15+
};
16+
17+
function addCurrencyDefaults(props) {
18+
for (var plan_collection_index = 0; plan_collection_index < 5; plan_collection_index++) {
19+
var plan_coll = ".properties.catalog_plan_collection" + plan_collection_index;
20+
21+
if (typeof props[plan_coll] !== "undefined" && props[plan_coll] !== null) {
22+
var plans = props[plan_coll]['value'];
23+
for (let plan of plans) {
24+
plan['cost_value'] = plan['cost_usd'];
25+
plan['cost_currency'] = {'value': 'USD', 'type': 'string'};
26+
}
27+
}
28+
}
29+
}

resources/ecs-cf-service-broker.jar

7.75 MB
Binary file not shown.

tile-history.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ history:
1111
- 1.2.2
1212
- 1.2.3
1313
- 1.2.4
14-
version: 1.2.5-dev1
14+
version: 2.0.0

tile.yml

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,16 @@ forms:
378378
type: boolean
379379
description: Use this plan for the internal metadata of the broker. This should only be enabled for one service, as the broker may pick from repository enabled plans at random on startup.
380380
configurable: true
381-
- name: cost_usd
382-
label: Cost in US Dollars
381+
- name: cost_value
382+
label: Cost
383383
type: string
384384
configurable: true
385385
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
386+
- name: cost_currency
387+
label: Cost currency
388+
type: string
389+
configurable: true
390+
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
386391
- name: cost_unit
387392
label: Cost Unit
388393
type: string
@@ -450,7 +455,8 @@ forms:
450455
default:
451456
- name: 5gb
452457
description: 5 GB free trial
453-
cost_usd: 0.00
458+
cost_value: 0.00
459+
cost_currency: USD
454460
cost_unit: MONTHLY
455461
quota_limit: 5
456462
quota_warn: 4
@@ -461,7 +467,8 @@ forms:
461467
- name: unlimited
462468
repository_plan: true
463469
description: Usage based billing
464-
cost_usd: 0.03
470+
cost_value: 0.03
471+
cost_currency: USD
465472
cost_unit: PER_GB_PER_MONTH
466473
bullet_1: Shared Object Storage
467474
bullet_2: Unlimited Storage
@@ -616,11 +623,16 @@ forms:
616623
type: boolean
617624
description: Use this plan for the internal metadata of the broker. This should only be enabled for one service, as the broker may pick from repository enabled plans at random on startup.
618625
configurable: true
619-
- name: cost_usd
620-
label: Cost in US Dollars
626+
- name: cost_value
627+
label: Cost
621628
type: string
622629
configurable: true
623630
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
631+
- name: cost_currency
632+
label: Cost currency
633+
type: string
634+
configurable: true
635+
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
624636
- name: cost_unit
625637
label: Cost Unit
626638
type: string
@@ -688,7 +700,8 @@ forms:
688700
default:
689701
- name: 5gb
690702
description: 5 GB free trial
691-
cost_usd: 0.00
703+
cost_value: 0.00
704+
cost_currency: USD
692705
cost_unit: MONTHLY
693706
quota_limit: 5
694707
quota_warn: 4
@@ -699,7 +712,8 @@ forms:
699712
- name: unlimited
700713
repository_plan: true
701714
description: Usage based billing
702-
cost_usd: 0.03
715+
cost_value: 0.03
716+
cost_currency: USD
703717
cost_unit: PER_GB_PER_MONTH
704718
bullet_1: Shared Object Storage
705719
bullet_2: Unlimited Storage
@@ -853,11 +867,16 @@ forms:
853867
type: boolean
854868
description: Use this plan for the internal metadata of the broker. This should only be enabled for one service, as the broker may pick from repository enabled plans at random on startup.
855869
configurable: true
856-
- name: cost_usd
857-
label: Cost in US Dollars
870+
- name: cost_value
871+
label: Cost
858872
type: string
859873
configurable: true
860874
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
875+
- name: cost_currency
876+
label: Cost currency
877+
type: string
878+
configurable: true
879+
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
861880
- name: cost_unit
862881
label: Cost Unit
863882
type: string
@@ -925,7 +944,8 @@ forms:
925944
default:
926945
- name: 5gb
927946
description: 5 GB free trial
928-
cost_usd: 0.00
947+
cost_value: 0.00
948+
cost_currency: USD
929949
cost_unit: MONTHLY
930950
quota_limit: 5
931951
quota_warn: 4
@@ -936,7 +956,8 @@ forms:
936956
- name: unlimited
937957
repository_plan: true
938958
description: Usage based billing
939-
cost_usd: 0.03
959+
cost_value: 0.03
960+
cost_currency: USD
940961
cost_unit: PER_GB_PER_MONTH
941962
bullet_1: Shared Object Storage
942963
bullet_2: Unlimited Storage
@@ -1090,11 +1111,16 @@ forms:
10901111
type: boolean
10911112
description: Use this plan for the internal metadata of the broker. This should only be enabled for one service, as the broker may pick from repository enabled plans at random on startup.
10921113
configurable: true
1093-
- name: cost_usd
1094-
label: Cost in US Dollars
1114+
- name: cost_value
1115+
label: Cost
10951116
type: string
10961117
configurable: true
10971118
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
1119+
- name: cost_currency
1120+
label: Cost currency
1121+
type: string
1122+
configurable: true
1123+
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
10981124
- name: cost_unit
10991125
label: Cost Unit
11001126
type: string
@@ -1162,7 +1188,8 @@ forms:
11621188
default:
11631189
- name: 5gb
11641190
description: 5 GB free trial
1165-
cost_usd: 0.00
1191+
cost_value: 0.00
1192+
cost_currency: USD
11661193
cost_unit: MONTHLY
11671194
quota_limit: 5
11681195
quota_warn: 4
@@ -1173,7 +1200,8 @@ forms:
11731200
- name: unlimited
11741201
repository_plan: true
11751202
description: Usage based billing
1176-
cost_usd: 0.03
1203+
cost_value: 0.03
1204+
cost_currency: USD
11771205
cost_unit: PER_GB_PER_MONTH
11781206
bullet_1: Shared Object Storage
11791207
bullet_2: Unlimited Storage
@@ -1327,11 +1355,16 @@ forms:
13271355
type: boolean
13281356
description: Use this plan for the internal metadata of the broker. This should only be enabled for one service, as the broker may pick from repository enabled plans at random on startup.
13291357
configurable: true
1330-
- name: cost_usd
1331-
label: Cost in US Dollars
1358+
- name: cost_value
1359+
label: Cost
13321360
type: string
13331361
configurable: true
13341362
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
1363+
- name: cost_currency
1364+
label: Cost currency
1365+
type: string
1366+
configurable: true
1367+
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
13351368
- name: cost_unit
13361369
label: Cost Unit
13371370
type: string
@@ -1399,7 +1432,8 @@ forms:
13991432
default:
14001433
- name: 5gb
14011434
description: 5 GB free trial
1402-
cost_usd: 0.00
1435+
cost_value: 0.00
1436+
cost_currency: USD
14031437
cost_unit: MONTHLY
14041438
quota_limit: 5
14051439
quota_warn: 4
@@ -1410,7 +1444,8 @@ forms:
14101444
- name: unlimited
14111445
repository_plan: true
14121446
description: Usage based billing
1413-
cost_usd: 0.03
1447+
cost_value: 0.03
1448+
cost_currency: USD
14141449
cost_unit: PER_GB_PER_MONTH
14151450
bullet_1: Shared Object Storage
14161451
bullet_2: Unlimited Storage

0 commit comments

Comments
 (0)