stefan-kolb / nucleus

Platform as a Service API abstraction layer.
MIT License
28 stars 0 forks source link

Cloud Foundry service plan costs #47

Open croeck opened 9 years ago

croeck commented 9 years ago

Service costs on Cloud Foundry are not standardized. We must find or propose an approach how the information can be obtained.

{
      "metadata": {
        "guid": "9145da77-6047-4f8f-92c3-249a4cfdd5a5",
        "url": "/v2/service_plans/9145da77-6047-4f8f-92c3-249a4cfdd5a5",
        "created_at": "2014-11-05T00:36:48Z",
        "updated_at": "2015-07-02T23:24:22Z"
      },
      "entity": {
        "name": "sqldb_small",
        "free": false,
        "description": " Includes sensitive data reporting, daily and user-initiated backups, and supports multiple schemas. Database free up to 2 GB size, supporting up to 10 GB storage and 1 GB of memory.",
        "service_guid": "63771da7-5986-443c-882d-635137c54262",
        "extra": "{\"testCheckInterval\":\"10\",\"plan_precedence\":\"20\",\"description\":\"SQL Database Small Plan\",\"name\":\"Small\",\"locationDisplayName\":\"United Kingdom\",\"displayName\":\"Small\",\"costs\":[{\"unit\":\"INSTANCE\",\"unitId\":\"INSTANCE_PER_MONTH\",\"partNumber\":\"D15VJLL\",\"unitQuantity\":\"1\",\"currencies\":[{\"country\":\"USA\",\"amount\":{\"USD\":\"30.00\"}},{\"country\":\"CHE\",\"amount\":{\"CHF\":\"28.44\"}},{\"country\":\"ARG\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"BOL\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"USD\",\"amount\":{\"USD\":\"32.10\"}},{\"country\":\"TWN\",\"amount\":{\"USD\":\"31.50\"}},{\"country\":\"VEN\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"BRA\",\"amount\":{\"BRL\":\"69.00\"}},{\"country\":\"CAN\",\"amount\":{\"CAD\":\"31.69\"}},{\"country\":\"ASEAN\",\"amount\":{\"USD\":\"31.50\"}},{\"country\":\"CHL\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"HKG\",\"amount\":{\"USD\":\"31.50\"}},{\"country\":\"ECU\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"NZL\",\"amount\":{\"NZD\":\"39.15\"}},{\"country\":\"DNK\",\"amount\":{\"DKK\":\"166.00\"}},{\"country\":\"IND\",\"amount\":{\"INR\":\"1811.25\"}},{\"country\":\"JPN\",\"amount\":{\"JPY\":\"3150\"}},{\"country\":\"NOR\",\"amount\":{\"NOK\":\"173.00\"}},{\"country\":\"ZAF\",\"amount\":{\"ZAR\":\"310.00\"}},{\"country\":\"EURO\",\"amount\":{\"EUR\":\"22.57\"}},{\"country\":\"AUS\",\"amount\":{\"AUD\":\"34.02\"}},{\"country\":\"MEX\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"KOR\",\"amount\":{\"KRW\":\"34950.00\"}},{\"country\":\"COL\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"PER\",\"amount\":{\"USD\":\"34.50\"}},{\"country\":\"GBR\",\"amount\":{\"GBP\":\"18.14\"}},{\"country\":\"ISA\",\"amount\":{\"USD\":\"31.50\"}},{\"country\":\"SWE\",\"amount\":{\"SEK\":\"196.00\"}}]}],\"bullets\":[\"10 GB max per instance.\",\"20 concurrent connections.\"]}",
        "unique_id": "137d0caa-34f4-40ff-ac82-fd092578a45b",
        "public": true,
        "active": true,
        "service_url": "/v2/services/63771da7-5986-443c-882d-635137c54262",
        "service_instances_url": "/v2/service_plans/9145da77-6047-4f8f-92c3-249a4cfdd5a5/service_instances"
      }
    }

The service cost model of PaaSal is already built to support Pivotal's constructs.

stefan-kolb commented 9 years ago

Like you said this may differ between CF providers. Maybe we need to skip this info for now (or use defaults for unknown mappings)? A developer must investigate the pricing etc. before he provisions a service anyway?! Otherwise we will probably need a lot of conditionals inside our code getting the provider's name and then mapping metadata for each provider?

croeck commented 9 years ago

Maybe we need to skip this info for now

I agree and opened this issue only so it won't be forgotten.

(or use defaults for unknown mappings)?

This is somehow what we actually do right now. The default is just to not include any price at all.

Otherwise we will probably need a lot of conditionals inside our code getting the provider's name and then mapping metadata for each provider?

Assuming this would work for the most popular providers, it would be a first step. Currently it seems to be the only solution, but maybe Cloud Foundry also comes up with some changes for API v3