Skip to content

Commit

Permalink
Merge pull request #20 from thecodeteam/enhancement-131-configurable-…
Browse files Browse the repository at this point in the history
…catalog-price-currency

Configurable catalog price currency + Jar release 2.0.0
  • Loading branch information
rogalv authored Jun 26, 2020
2 parents 77ecffd + 397bf8d commit 26455e4
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 21 deletions.
29 changes: 29 additions & 0 deletions migrations/v1/202005190115_2_0_10_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
exports.migrate = function (input) {
var current_version = getCurrentProductVersion();

// prints out all properties as json in the description field
// input['properties']['.properties.catalog_services_0_long_description']['value'] = JSON.stringify(input['properties']);

if (current_version.startsWith("1.")) {
// cost currency field added since 2.0
console.log('upgrade needed for currency fields in plan definitions');

addCurrencyDefaults(input['properties']);
}

return input;
};

function addCurrencyDefaults(props) {
for (var plan_collection_index = 0; plan_collection_index < 5; plan_collection_index++) {
var plan_coll = ".properties.catalog_plan_collection" + plan_collection_index;

if (typeof props[plan_coll] !== "undefined" && props[plan_coll] !== null) {
var plans = props[plan_coll]['value'];
for (let plan of plans) {
plan['cost_value'] = plan['cost_usd'];
plan['cost_currency'] = {'value': 'USD', 'type': 'string'};
}
}
}
}
Binary file modified resources/ecs-cf-service-broker.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion tile-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ history:
- 1.2.2
- 1.2.3
- 1.2.4
version: 1.2.5-dev1
version: 2.0.0
75 changes: 55 additions & 20 deletions tile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,16 @@ forms:
type: boolean
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.
configurable: true
- name: cost_usd
label: Cost in US Dollars
- name: cost_value
label: Cost
type: string
configurable: true
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
- name: cost_currency
label: Cost currency
type: string
configurable: true
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
- name: cost_unit
label: Cost Unit
type: string
Expand Down Expand Up @@ -450,7 +455,8 @@ forms:
default:
- name: 5gb
description: 5 GB free trial
cost_usd: 0.00
cost_value: 0.00
cost_currency: USD
cost_unit: MONTHLY
quota_limit: 5
quota_warn: 4
Expand All @@ -461,7 +467,8 @@ forms:
- name: unlimited
repository_plan: true
description: Usage based billing
cost_usd: 0.03
cost_value: 0.03
cost_currency: USD
cost_unit: PER_GB_PER_MONTH
bullet_1: Shared Object Storage
bullet_2: Unlimited Storage
Expand Down Expand Up @@ -616,11 +623,16 @@ forms:
type: boolean
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.
configurable: true
- name: cost_usd
label: Cost in US Dollars
- name: cost_value
label: Cost
type: string
configurable: true
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
- name: cost_currency
label: Cost currency
type: string
configurable: true
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
- name: cost_unit
label: Cost Unit
type: string
Expand Down Expand Up @@ -688,7 +700,8 @@ forms:
default:
- name: 5gb
description: 5 GB free trial
cost_usd: 0.00
cost_value: 0.00
cost_currency: USD
cost_unit: MONTHLY
quota_limit: 5
quota_warn: 4
Expand All @@ -699,7 +712,8 @@ forms:
- name: unlimited
repository_plan: true
description: Usage based billing
cost_usd: 0.03
cost_value: 0.03
cost_currency: USD
cost_unit: PER_GB_PER_MONTH
bullet_1: Shared Object Storage
bullet_2: Unlimited Storage
Expand Down Expand Up @@ -853,11 +867,16 @@ forms:
type: boolean
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.
configurable: true
- name: cost_usd
label: Cost in US Dollars
- name: cost_value
label: Cost
type: string
configurable: true
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
- name: cost_currency
label: Cost currency
type: string
configurable: true
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
- name: cost_unit
label: Cost Unit
type: string
Expand Down Expand Up @@ -925,7 +944,8 @@ forms:
default:
- name: 5gb
description: 5 GB free trial
cost_usd: 0.00
cost_value: 0.00
cost_currency: USD
cost_unit: MONTHLY
quota_limit: 5
quota_warn: 4
Expand All @@ -936,7 +956,8 @@ forms:
- name: unlimited
repository_plan: true
description: Usage based billing
cost_usd: 0.03
cost_value: 0.03
cost_currency: USD
cost_unit: PER_GB_PER_MONTH
bullet_1: Shared Object Storage
bullet_2: Unlimited Storage
Expand Down Expand Up @@ -1090,11 +1111,16 @@ forms:
type: boolean
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.
configurable: true
- name: cost_usd
label: Cost in US Dollars
- name: cost_value
label: Cost
type: string
configurable: true
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
- name: cost_currency
label: Cost currency
type: string
configurable: true
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
- name: cost_unit
label: Cost Unit
type: string
Expand Down Expand Up @@ -1162,7 +1188,8 @@ forms:
default:
- name: 5gb
description: 5 GB free trial
cost_usd: 0.00
cost_value: 0.00
cost_currency: USD
cost_unit: MONTHLY
quota_limit: 5
quota_warn: 4
Expand All @@ -1173,7 +1200,8 @@ forms:
- name: unlimited
repository_plan: true
description: Usage based billing
cost_usd: 0.03
cost_value: 0.03
cost_currency: USD
cost_unit: PER_GB_PER_MONTH
bullet_1: Shared Object Storage
bullet_2: Unlimited Storage
Expand Down Expand Up @@ -1327,11 +1355,16 @@ forms:
type: boolean
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.
configurable: true
- name: cost_usd
label: Cost in US Dollars
- name: cost_value
label: Cost
type: string
configurable: true
description: The cost for the plan based on the "Cost Unit". Should be in the form of a float -- 0.00
- name: cost_currency
label: Cost currency
type: string
configurable: true
description: The currency of a cost for the plan. Should be the three-letter ISO code (USD, EUR)
- name: cost_unit
label: Cost Unit
type: string
Expand Down Expand Up @@ -1399,7 +1432,8 @@ forms:
default:
- name: 5gb
description: 5 GB free trial
cost_usd: 0.00
cost_value: 0.00
cost_currency: USD
cost_unit: MONTHLY
quota_limit: 5
quota_warn: 4
Expand All @@ -1410,7 +1444,8 @@ forms:
- name: unlimited
repository_plan: true
description: Usage based billing
cost_usd: 0.03
cost_value: 0.03
cost_currency: USD
cost_unit: PER_GB_PER_MONTH
bullet_1: Shared Object Storage
bullet_2: Unlimited Storage
Expand Down

0 comments on commit 26455e4

Please sign in to comment.