HashMap Module REST API¶
- GET /v1/rating/module_config/hashmap/types¶
Return the list of every mapping type available.
- Return type:
list(
str)
- GET /v1/rating/module_config/hashmap/services¶
Get the service list
- Return:
List of every services.
- Return type:
ServiceCollection
- GET /v1/rating/module_config/hashmap/services/(service_id)¶
Return a service.
- Parameters:
service_id (
uuid) – UUID of the service to filter on.
- Return type:
Service
- POST /v1/rating/module_config/hashmap/services¶
Create hashmap service.
- Parameters:
service_data (
Service) – Informations about the service to create.
- Return type:
Service
- DELETE /v1/rating/module_config/hashmap/services¶
Delete the service and all the sub keys recursively.
- Parameters:
service_id (
uuid) – UUID of the service to delete.
- class cloudkitty.rating.hash.datamodels.service.Service(**kw)[source]¶
Type describing a service.
A service is directly mapped to the usage key, the collected service.
- name¶
Name of the service.
- service_id¶
UUID of the service.
- class cloudkitty.rating.hash.datamodels.service.ServiceCollection(**kw)[source]¶
Type describing a list of services.
- services¶
List of services.
- GET /v1/rating/module_config/hashmap/fields¶
Get the field list.
- Parameters:
service_id (
uuid) – Service’s UUID to filter on.
- Return:
List of every fields.
- Return type:
FieldCollection
- GET /v1/rating/module_config/hashmap/fields/(field_id)¶
Return a field.
- Parameters:
field_id (
uuid) – UUID of the field to filter on.
- Return type:
Field
- POST /v1/rating/module_config/hashmap/fields¶
Create a field.
- Parameters:
field_data (
Field) – Informations about the field to create.
- Return type:
Field
- DELETE /v1/rating/module_config/hashmap/fields¶
Delete the field and all the sub keys recursively.
- Parameters:
field_id (
uuid) – UUID of the field to delete.
- class cloudkitty.rating.hash.datamodels.field.Field(**kw)[source]¶
Type describing a field.
A field is mapping a value of the ‘desc’ dict of the CloudKitty data. It’s used to map the name of a metadata.
- field_id¶
UUID of the field.
- name¶
Name of the field.
- service_id¶
UUID of the parent service.
- class cloudkitty.rating.hash.datamodels.field.FieldCollection(**kw)[source]¶
Type describing a list of fields.
- fields¶
List of fields.
- GET /v1/rating/module_config/hashmap/mappings¶
Get the mapping list
- Parameters:
service_id (
uuid) – Service UUID to filter on.field_id (
uuid) – Field UUID to filter on.group_id (
uuid) – Group UUID to filter on.no_group (
bool) – Filter on orphaned mappings.tenant_id (
uuid) – Tenant UUID to filter on.filter_tenant (
bool) – Explicitly filter on tenant (default is to not filter on tenant). Useful if you want to filter on tenant being None.deleted (
bool) – Show deleted mappings.start (
datetime) – Mappings with start after date.end (
datetime) – Mappings with end before date.updated_by (
str) – user uuid to filter on.created_by (
str) – user uuid to filter on.deleted_by (
str) – user uuid to filter on.description (
str) – mapping that contains the text in description.is_active (
bool) – only active mappings.
- Param:
all: list all rules.
- Return:
List of every mappings.
- Return type:
MappingCollection
- GET /v1/rating/module_config/hashmap/mappings/(mapping_id)¶
Return a mapping.
- Parameters:
mapping_id (
uuid) – UUID of the mapping to filter on.
- Return type:
Mapping
- POST /v1/rating/module_config/hashmap/mappings¶
Create a mapping.
- Parameters:
force (
bool) – Allows start and end in the past.mapping_data (
Mapping) – Informations about the mapping to create.
- Return type:
Mapping
- PUT /v1/rating/module_config/hashmap/mappings¶
Update a mapping.
- Parameters:
mapping_id (
uuid) – UUID of the mapping to update.mapping (
Mapping) – Mapping data to insert.
- DELETE /v1/rating/module_config/hashmap/mappings¶
Delete a mapping.
- Parameters:
mapping_id (
uuid) – UUID of the mapping to delete.
- GET /v1/rating/module_config/hashmap/mappings/group¶
Get the group attached to the mapping.
- Parameters:
mapping_id (
uuid) – UUID of the mapping to filter on.
- Return type:
Group
- class cloudkitty.rating.hash.datamodels.mapping.Mapping(**kw)[source]¶
Type describing a Mapping.
A mapping is used to apply rating rules based on a value, if the parent is a field then it’s check the value of a metadata. If it’s a service then it directly apply the rate to the volume.
- cost¶
Value of the mapping.
- created_at¶
The date the rule was created.
- created_by¶
The id of the user who created the rule.
- deleted¶
The date the rule was deleted.
- deleted_by¶
The id of the user who deleted the rule.
- description¶
The description of the rule.
- end¶
Must be None or a date in the future. To set a date in the past, use the force parameter in the POST query.
- field_id¶
UUID of the field.
- group_id¶
UUID of the hashmap group.
- map_type¶
Type of the mapping.
- mapping_id¶
UUID of the mapping.
- name¶
The name of the rule.
- service_id¶
UUID of the service.
- start¶
Must be None or a date in the future. To set a date in the past, use the force parameter in the POST query.
- tenant_id¶
ID of the hashmap tenant.
- updated_by¶
The id of the user who last updated the rule.
- value¶
Key of the mapping.
- class cloudkitty.rating.hash.datamodels.mapping.MappingCollection(**kw)[source]¶
Type describing a list of mappings.
- mappings¶
List of mappings.
- class cloudkitty.rating.hash.datamodels.threshold.Threshold(**kw)[source]¶
Type describing a Threshold.
A threshold is used to apply rating rules based on a level, if the parent is a field then the level is checked against a metadata. If it’s a service then it’s the quantity of the resource that is checked.
- cost¶
Value of the threshold.
- field_id¶
UUID of the field.
- group_id¶
UUID of the hashmap group.
- level¶
Level of the threshold.
- map_type¶
Type of the threshold.
- service_id¶
UUID of the service.
- tenant_id¶
ID of the hashmap tenant.
- threshold_id¶
UUID of the threshold.
- class cloudkitty.rating.hash.datamodels.threshold.ThresholdCollection(**kw)[source]¶
Type describing a list of mappings.
- thresholds¶
List of thresholds.
- GET /v1/rating/module_config/hashmap/groups¶
Get the group list
- Return:
List of every group.
- Return type:
GroupCollection
- GET /v1/rating/module_config/hashmap/groups/(group_id)¶
Return a group.
- Parameters:
group_id (
uuid) – UUID of the group to filter on.
- Return type:
Group
- POST /v1/rating/module_config/hashmap/groups¶
Create a group.
- Parameters:
group_data (
Group) – Informations about the group to create.
- Return type:
Group
- DELETE /v1/rating/module_config/hashmap/groups¶
Delete a group.
- Parameters:
group_id (
uuid) – UUID of the group to delete.recursive (
bool) – Delete mappings recursively.
- GET /v1/rating/module_config/hashmap/groups/mappings¶
Get the mappings attached to the group.
- Parameters:
group_id (
uuid) – UUID of the group to filter on.
- Return type:
MappingCollection
- GET /v1/rating/module_config/hashmap/groups/thresholds¶
Get the thresholds attached to the group.
- Parameters:
group_id (
uuid) – UUID of the group to filter on.
- Return type:
ThresholdCollection
- class cloudkitty.rating.hash.datamodels.group.Group(**kw)[source]¶
Type describing a group.
A group is used to divide calculations. It can be used to create a group for the instance rating (flavor) and one if we have premium images (image_id). So you can take into account multiple parameters during the rating.
- group_id¶
UUID of the group.
- name¶
Name of the group.