HashMap Module REST API

HashMap Module REST API

GET /v1/rating/module_config/hashmap/types

Return the list of every mapping type available.

Return type:list(unicode)
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.
type Service

Type describing a service.

A service is directly mapped to the usage key, the collected service.

Data samples:

Json
{
    "name": "compute", 
    "service_id": "a733d0e1-1ec9-4800-8df8-671e4affd017"
}
XML
<value>
  <service_id>a733d0e1-1ec9-4800-8df8-671e4affd017</service_id>
  <name>compute</name>
</value>
name
Type:unicode

Name of the service.

service_id
Type:uuid

UUID of the service.

type ServiceCollection

Type describing a list of services.

Data samples:

Json
{
    "services": [
        {
            "name": "compute", 
            "service_id": "a733d0e1-1ec9-4800-8df8-671e4affd017"
        }
    ]
}
XML
<value>
  <services>
    <item>
      <service_id>a733d0e1-1ec9-4800-8df8-671e4affd017</service_id>
      <name>compute</name>
    </item>
  </services>
</value>
services
Type:list(Service)

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.
type Field

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.

Data samples:

Json
{
    "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
    "name": "image_id", 
    "service_id": "a733d0e1-1ec9-4800-8df8-671e4affd017"
}
XML
<value>
  <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
  <name>image_id</name>
  <service_id>a733d0e1-1ec9-4800-8df8-671e4affd017</service_id>
</value>
field_id
Type:uuid

UUID of the field.

name
Type:unicode

Name of the field.

service_id
Type:uuid

UUID of the parent service.

type FieldCollection

Type describing a list of fields.

Data samples:

Json
{
    "fields": [
        {
            "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
            "name": "image_id", 
            "service_id": "a733d0e1-1ec9-4800-8df8-671e4affd017"
        }
    ]
}
XML
<value>
  <fields>
    <item>
      <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
      <name>image_id</name>
      <service_id>a733d0e1-1ec9-4800-8df8-671e4affd017</service_id>
    </item>
  </fields>
</value>
fields
Type:list(Field)

List of fields.

GET /v1/rating/module_config/hashmap/mappings

Get the mapping list

Parameters:
  • service_id – Service UUID to filter on.
  • field_id – Field UUID to filter on.
  • group_id – Group UUID to filter on.
  • no_group – Filter on orphaned mappings.
  • tenant_id – Tenant UUID to filter on.
  • filter_tenant – Explicitly filter on tenant (default is to not

filter on tenant). Useful if you want to filter on tenant being None. :return: List of every mappings. :type service_id: uuid :type field_id: uuid :type group_id: uuid :type no_group: bool :type tenant_id: uuid :type filter_tenant: bool

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:
  • 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

type Mapping

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.

Data samples:

Json
{
    "cost": "4.2", 
    "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
    "mapping_id": "39dbd39d-f663-4444-a795-fb19d81af136", 
    "tenant_id": "7977999e-2e25-11e6-a8b2-df30b233ffcb", 
    "type": "flat", 
    "value": "m1.micro"
}
XML
<value>
  <mapping_id>39dbd39d-f663-4444-a795-fb19d81af136</mapping_id>
  <value>m1.micro</value>
  <type>flat</type>
  <cost>4.2</cost>
  <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
  <tenant_id>7977999e-2e25-11e6-a8b2-df30b233ffcb</tenant_id>
</value>
cost
Type:Decimal

Value of the mapping.

field_id
Type:uuid

UUID of the field.

group_id
Type:uuid

UUID of the hashmap group.

map_type
Type:Enum(flat, rate)

Type of the mapping.

mapping_id
Type:uuid

UUID of the mapping.

service_id
Type:uuid

UUID of the service.

tenant_id
Type:uuid

UUID of the hashmap tenant.

value
Type:unicode

Key of the mapping.

type MappingCollection

Type describing a list of mappings.

Data samples:

Json
{
    "mappings": [
        {
            "cost": "4.2", 
            "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
            "mapping_id": "39dbd39d-f663-4444-a795-fb19d81af136", 
            "tenant_id": "7977999e-2e25-11e6-a8b2-df30b233ffcb", 
            "type": "flat", 
            "value": "m1.micro"
        }
    ]
}
XML
<value>
  <mappings>
    <item>
      <mapping_id>39dbd39d-f663-4444-a795-fb19d81af136</mapping_id>
      <value>m1.micro</value>
      <type>flat</type>
      <cost>4.2</cost>
      <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
      <tenant_id>7977999e-2e25-11e6-a8b2-df30b233ffcb</tenant_id>
    </item>
  </mappings>
</value>
mappings
Type:list(Mapping)

List of mappings.

type Threshold

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.

Data samples:

Json
{
    "cost": "4.2", 
    "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
    "level": "1024", 
    "tenant_id": "7977999e-2e25-11e6-a8b2-df30b233ffcb", 
    "threshold_id": "39dbd39d-f663-4444-a795-fb19d81af136", 
    "type": "flat"
}
XML
<value>
  <threshold_id>39dbd39d-f663-4444-a795-fb19d81af136</threshold_id>
  <level>1024</level>
  <type>flat</type>
  <cost>4.2</cost>
  <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
  <tenant_id>7977999e-2e25-11e6-a8b2-df30b233ffcb</tenant_id>
</value>
cost
Type:Decimal

Value of the threshold.

field_id
Type:uuid

UUID of the field.

group_id
Type:uuid

UUID of the hashmap group.

level
Type:Decimal

Level of the threshold.

map_type
Type:Enum(flat, rate)

Type of the threshold.

service_id
Type:uuid

UUID of the service.

tenant_id
Type:uuid

UUID of the hashmap tenant.

threshold_id
Type:uuid

UUID of the threshold.

type ThresholdCollection

Type describing a list of mappings.

Data samples:

Json
{
    "thresholds": [
        {
            "cost": "4.2", 
            "field_id": "ac55b000-a05b-4832-b2ff-265a034886ab", 
            "level": "1024", 
            "tenant_id": "7977999e-2e25-11e6-a8b2-df30b233ffcb", 
            "threshold_id": "39dbd39d-f663-4444-a795-fb19d81af136", 
            "type": "flat"
        }
    ]
}
XML
<value>
  <thresholds>
    <item>
      <threshold_id>39dbd39d-f663-4444-a795-fb19d81af136</threshold_id>
      <level>1024</level>
      <type>flat</type>
      <cost>4.2</cost>
      <field_id>ac55b000-a05b-4832-b2ff-265a034886ab</field_id>
      <tenant_id>7977999e-2e25-11e6-a8b2-df30b233ffcb</tenant_id>
    </item>
  </thresholds>
</value>
thresholds
Type:list(Threshold)

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

type Group

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.

Data samples:

Json
{
    "group_id": "afe898cb-86d8-4557-ad67-f4f01891bbee", 
    "name": "instance_rating"
}
XML
<value>
  <group_id>afe898cb-86d8-4557-ad67-f4f01891bbee</group_id>
  <name>instance_rating</name>
</value>
group_id
Type:uuid

UUID of the group.

name
Type:unicode

Name of the group.

type GroupCollection

Type describing a list of groups.

Data samples:

Json
{
    "groups": [
        {
            "group_id": "afe898cb-86d8-4557-ad67-f4f01891bbee", 
            "name": "instance_rating"
        }
    ]
}
XML
<value>
  <groups>
    <item>
      <group_id>afe898cb-86d8-4557-ad67-f4f01891bbee</group_id>
      <name>instance_rating</name>
    </item>
  </groups>
</value>
groups
Type:list(Group)

List of groups.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.