Pay-per-use¶
Entities¶
Pay-per-use Account Resource¶
Field
Explanation
id
Pay-per-use resource identifier
account_id
Account identifier
resource_id
Resource identifier
amount
Amount assigned of the above resource
hourly_price
How much does it cost per hour
conversion_factor
Conversion factor to calculate hourly price
Pay-per-use Resource list:
Pay-per-use Resource¶
Field
Explanation
id
Resource identifier
name
Resource name
slug
Slugified resource name
provider
Which provider is the resource for
min_limit
Minimum amount for the resource
max_limit
Maximum amount for the resource
prices
Dictionary of prices per available currency
conversion_factor
Dictionary of conversion factor per available currency
translations
Dictionary of translations for the resource name
Pay-per-use Resource list:
Pay-per-use Invoice Resource¶
Field
Explanation
id
Invoice identifier
account_id
Account identifier
account_domain
Account domain name
product_name
Product name
resource_id
Resource identifier
total_amount
Total amount used
start_date
When it started
end_date
When it finished
hourly_price
How much does it cost per hour
conversion_factor
Conversion factor to calculate hourly price
Pay-per-use Invoice Resource list:
Pay-per-use History Resource¶
Field
Explanation
id
Unique identifier
account_id
Account identifier
resource_id
Resource identifier
hourly_price
How much does it cost per hour
conversion_factor
Conversion factor to calculate hourly price
total_amount
Total amount of the resource
start_date
When the Pay-per-use resource started
end_date
When the Pay-per-use resource finished
Pay-per-use History Resource list:
Operations¶
List all Pay-per-use Resources available¶
- Method
GET
- Url
/billing/ppu_resources
- Success Code
200
- Returned Data
- Has Token
Yes
List all Pay-per-use resources available.
Example:
curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" "https://api.gigas.com/billing/ppu_resources"
Pay-per-use History¶
- Method
GET
- Url
/billing/ppu_history
- Success Code
200
- Returned Data
- Has Token
Yes
Get all past and current Pay-per-use resources
Example:
curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" "https://api.gigas.com/billing/ppu_history"
List Pay-per-use Account Resources¶
- Method
GET
- Url
/billing/account/<id>/ppu_account_resources
- Success Code
200
- Returned Data
- Has Token
Yes
List all Pay-per-use resources assigned to the given account.
Example:
curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" "https://api.gigas.com/billing/account/ACCOUNT_ID/ppu_account_resources"
Get Pay-per-use Resource Details¶
- Method
GET
- Url
/billing/account/<account_id>/ppu_account_resource/<pay-per-use_resource_id>
- Success Code
200
- Returned Data
- Has Token
Yes
Given an account ID and a Pay-per-use resource ID get its details.
Example:
curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" "https://api.gigas.com/billing/account/ACCOUNT_ID/ppu_account_resource/172803349"
Modify Pay-per-use Resource Details¶
- Method
GET
- Url
/billing/account/<account_id>/ppu_account_resource/<pay-per-use_resource_id>
- Success Code
200
- Returned Data
- Has Token
Yes
Given an account ID and a Pay-per-use resource ID modify its amount.
This call will be used both for adding or removing Pay-per-use resources.
Case example:
Imagine that on a given Cloud Datacenter, you don’t have more Intel CPUs available, but you need two more Intel CPUs for creating a temporary cloud server for testing.
First, add the two Intel CPUs you need:
curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" -d '{"amount":2,"account_id":"ACCOUNT_ID","resource_id":"RESOURCE_ID"}' "https://api.gigas.com/billing/account/ACCOUNT_ID/ppu_account_resource/172803349"
At this point, you will begin to be charged for as long as you have those two Intel CPUs assigned to the Cloud Datacenter.
It’s worth noting that although you have the Intel CPUs assigned to the Cloud Datacenter, they are not assigned to any cloud server yet.
Next step is creating the cloud server following the documentation here: http://api.docs.gigas.com/virtualmachine.html#create-a-new-virtual-machine
Later, when you are ready to stop using the extra Intel CPUs, you first need to destroy the virtual machine that is using them, following the documentation here: http://api.docs.gigas.com/virtualmachine.html#destroy-a-virtual-machine
To remove the Intel CPUs from the Cloud Datacenter, you just need to set the amount to 0 with the same call used before.
curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" -d '{"amount":0,"account_id":"ACCOUNT_ID","resource_id":"RESOURCE_ID"}' "https://api.gigas.com/billing/account/ACCOUNT_ID/ppu_account_resource/172803349"
Once removed, we will stop charging you.
Get Pay-per-use details for a given invoice¶
- Method
GET
- Url
/billing/invoice/<invoice_id>/ppu_invoice_details
- Success Code
200
- Returned Data
- Has Token
Yes
Given an invoice ID return its Pay-per-use details.
Example:
curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: $AUTHORIZATION_TOKEN" "https://api.gigas.com/billing/invoice/38982/ppu_invoice_details/"