CloudKitty REST API (v1)¶
Collector¶
-
GET
/v1/collector
¶ Unused function, hack to let pecan route requests to subcontrollers.
-
GET
/v1/collector/mappings
¶ Return the list of every services mapped to a collector.
- Parameters
collector (
str
) – Filter on the collector name.
- Return
Service to collector mappings collection.
- Return type
-
GET
/v1/collector/mappings/
(service)¶ Return a service to collector mapping.
- Parameters
service (
str
) – Name of the service to filter on.
- Return type
-
POST
/v1/collector/mappings
¶ Create a service to collector mapping.
- Parameters
collector (
str
) – Name of the collector to apply mapping on.service (
str
) – Name of the service to apply mapping on.
- Return type
-
DELETE
/v1/collector/mappings
¶ Delete a service to collector mapping.
- Parameters
service (
str
) – Name of the service to filter on.
-
GET
/v1/collector/states
¶ Query the enable state of a collector.
- Parameters
name (
str
) – Name of the collector.
- Return
State of the collector.
- Return type
-
PUT
/v1/collector/states
¶ Set the enable state of a collector.
- Parameters
name (
str
) – Name of the collector.infos (
CollectorInfos
) – New state informations of the collector.
- Return
State of the collector.
- Return type
-
type
CollectorInfos
¶ Type describing a collector module.
Data samples:
- Json
{ "enabled": true, "name": "gnocchi" }
- XML
b'<value>\n <name>gnocchi</name>\n <enabled>true</enabled>\n</value>'
-
enabled
¶ State of the collector.
-
name
¶ Name of the collector.
-
type
ServiceToCollectorMapping
¶ Type describing a service to collector mapping.
Data samples:
- Json
{ "collector": "gnocchi", "service": "compute" }
- XML
b'<value>\n <service>compute</service>\n <collector>gnocchi</collector>\n</value>'
-
collector
¶ Name of the collector.
-
service
¶ Name of the service.
-
type
ServiceToCollectorMappingCollection
¶ Type describing a service to collector mapping collection.
Data samples:
- Json
{ "mappings": [ { "collector": "gnocchi", "service": "compute" } ] }
- XML
b'<value>\n <mappings>\n <item>\n <service>compute</service>\n <collector>gnocchi</collector>\n </item>\n </mappings>\n</value>'
-
mappings
¶ List of service to collector mappings.
Info¶
-
GET
/v1/info/config
¶ Return current configuration.
- Return type
dict(
str
:None
)
-
GET
/v1/info/metric
¶ Get the metric list.
- Return
List of every metrics.
- Return type
-
GET
/v1/info/metric/
(metric_name)¶ Return a metric.
- Parameters
metric_name (
str
) – name of the metric.
- Return type
-
type
CloudkittyMetricInfo
¶ Type describing a metric info in CloudKitty.
Data samples:
- Json
{ "metadata": [ "resource_id", "project_id", "qty", "unit" ], "metric_id": "image.size", "unit": "MiB" }
- XML
b'<value>\n <metric_id>image.size</metric_id>\n <metadata>\n <item>resource_id</item>\n <item>project_id</item>\n <item>qty</item>\n <item>unit</item>\n </metadata>\n <unit>MiB</unit>\n</value>'
-
metadata
¶ List of metric metadata
-
metric_id
¶ Name of the metric.
-
unit
¶ Metric unit
-
type
CloudkittyMetricInfoCollection
¶ A list of CloudKittyMetricInfo.
Data samples:
- Json
{ "metrics": [ { "metadata": [ "resource_id", "project_id", "qty", "unit" ], "metric_id": "image.size", "unit": "MiB" } ] }
- XML
b'<value>\n <metrics>\n <item>\n <metric_id>image.size</metric_id>\n <metadata>\n <item>resource_id</item>\n <item>project_id</item>\n <item>qty</item>\n <item>unit</item>\n </metadata>\n <unit>MiB</unit>\n </item>\n </metrics>\n</value>'
-
GET
/v1/info/service
¶ Get the service list (deprecated).
- Return
List of every services.
- Return type
-
GET
/v1/info/service/
(service_name)¶ Return a service (deprecated).
- Parameters
service_name (
str
) – name of the service.
- Return type
Rating¶
-
GET
/v1/rating/modules
¶ return the list of loaded modules.
- Return
name of every loaded modules.
- Return type
-
GET
/v1/rating/modules/
(module_id)¶ return a module
- Return
CloudKittyModule
- Return type
-
PUT
/v1/rating/modules
¶ Change the state and priority of a module.
- Parameters
module_id (
str
) – name of the module to modifymodule (
CloudkittyModule
) – CloudKittyModule object describing the new desired state
- Return type
-
POST
/v1/rating/quote
¶ Get an instant quote based on multiple resource descriptions.
- Parameters
res_data (
CloudkittyResourceCollection
) – List of resource descriptions.
- Return
Total price for these descriptions.
- Return type
float
-
GET
/v1/rating/reload_modules
¶ Trigger a rating module list reload.
-
type
CloudkittyModule
¶ A rating extension summary
Data samples:
- Json
{ "description": "Sample extension.", "enabled": true, "hot-config": false, "priority": 2 }
- XML
b'<value>\n <description>Sample extension.</description>\n <enabled>true</enabled>\n <hot-config>false</hot-config>\n <priority>2</priority>\n</value>'
-
description
¶ Short description of the extension.
-
enabled
¶ Extension status.
-
hot_config
¶ On-the-fly configuration support.
-
module_id
¶ Name of the extension.
-
priority
¶ Priority of the extension.
-
type
CloudkittyModuleCollection
¶ A list of rating extensions.
Data samples:
- Json
{}
- XML
b'<value />'
-
type
CloudkittyResource
¶ Type describing a resource in CloudKitty.
Data samples:
- Json
{ "desc": { "image_id": "a41fba37-2429-4f15-aa00-b5bc4bf557bf" }, "service": "compute", "volume": "1" }
- XML
b'<value>\n <service>compute</service>\n <desc>\n <item>\n <key>image_id</key>\n <value>a41fba37-2429-4f15-aa00-b5bc4bf557bf</value>\n </item>\n </desc>\n <volume>1</volume>\n</value>'
-
desc
¶ Description of the resources parameters.
-
service
¶ Name of the service.
-
volume
¶ Volume of resources.
-
type
CloudkittyResourceCollection
¶ A list of CloudKittyResources.
Data samples:
- Json
{}
- XML
b'<value />'
Report¶
-
GET
/v1/report/summary
¶ Return the summary to pay for a given period.
- Return type
SummaryCollectionModel
-
GET
/v1/report/tenants
¶ Return the list of rated tenants.
- Return type
list(
str
)
-
GET
/v1/report/total
¶ Return the amount to pay for a given period.
- Return type
Decimal
Storage¶
-
GET
/v1/storage/dataframes
¶ Return a list of rated resources for a time period and a tenant.
- Parameters
begin (
datetime
) – Start of the periodend (
datetime
) – End of the periodtenant_id (
str
) – UUID of the tenant to filter on.resource_type (
str
) – Type of the resource to filter on.
- Return
Collection of DataFrame objects.
- Return type
-
type
RatedResource
¶ Represents a rated CloudKitty resource.
Data samples:
- Json
{ "desc": { "flavor": "m1.tiny", "vcpus": "1" }, "rating": "1.0", "service": "compute", "volume": "1.0" }
- XML
b'<value>\n <rating>1.0</rating>\n <service>compute</service>\n <desc>\n <item>\n <key>flavor</key>\n <value>m1.tiny</value>\n </item>\n <item>\n <key>vcpus</key>\n <value>1</value>\n </item>\n </desc>\n <volume>1.0</volume>\n</value>'
-
type
DataFrame
¶ Type describing a stored data frame.
Data samples:
- Json
{ "begin": "2015-04-22T07:00:00", "end": "2015-04-22T08:00:00", "resources": [ { "desc": { "flavor": "m1.tiny", "vcpus": "1" }, "rating": "1.0", "service": "compute", "volume": "1.0" } ], "tenant_id": "69d12143688f413cbf5c3cfe03ed0a12" }
- XML
b'<value>\n <begin>2015-04-22T07:00:00</begin>\n <end>2015-04-22T08:00:00</end>\n <tenant_id>69d12143688f413cbf5c3cfe03ed0a12</tenant_id>\n <resources>\n <item>\n <rating>1.0</rating>\n <service>compute</service>\n <desc>\n <item>\n <key>flavor</key>\n <value>m1.tiny</value>\n </item>\n <item>\n <key>vcpus</key>\n <value>1</value>\n </item>\n </desc>\n <volume>1.0</volume>\n </item>\n </resources>\n</value>'
-
begin
¶ Begin date for the sample.
-
end
¶ End date for the sample.
-
resources
¶ A resource list.
-
tenant_id
¶ Tenant owner of the sample.
-
type
DataFrameCollection
¶ A list of stored data frames.
Data samples:
- Json
{ "dataframes": [ { "begin": "2015-04-22T07:00:00", "end": "2015-04-22T08:00:00", "resources": [ { "desc": { "flavor": "m1.tiny", "vcpus": "1" }, "rating": "1.0", "service": "compute", "volume": "1.0" } ], "tenant_id": "69d12143688f413cbf5c3cfe03ed0a12" } ] }
- XML
b'<value>\n <dataframes>\n <item>\n <begin>2015-04-22T07:00:00</begin>\n <end>2015-04-22T08:00:00</end>\n <tenant_id>69d12143688f413cbf5c3cfe03ed0a12</tenant_id>\n <resources>\n <item>\n <rating>1.0</rating>\n <service>compute</service>\n <desc>\n <item>\n <key>flavor</key>\n <value>m1.tiny</value>\n </item>\n <item>\n <key>vcpus</key>\n <value>1</value>\n </item>\n </desc>\n <volume>1.0</volume>\n </item>\n </resources>\n </item>\n </dataframes>\n</value>'