gnocchi icon indicating copy to clipboard operation
gnocchi copied to clipboard

Resource Type association?

Open xuyao18 opened this issue 7 years ago • 3 comments

Hi jd!

I'm using gnocchi for about 1 year, this is a cool project.

Recently my workmate make some suggestion about association between resource-types . We create some new resource-types , but we can't query association between this new types by some certain way. The only method is refering some config file . Could we define some new API to do this ?

xuyao18 avatar Oct 30 '17 01:10 xuyao18

Maybe, what do you have in mind exactly?

jd avatar Oct 30 '17 08:10 jd

For example , we can define resource-type instance and instance_disk , when we are searching some instance disk , we use condition like this {"instance_id": {"=": "instance_id_1" }} .

However , if I can't get the definition file about resource-type , I don't know the sub-resource about instance.

Thus, in my mind , we may need to change "get resource-type" like this:

Method: Get
URL: /v1/resource_type/instance 
Response: 
{
    "attributes": {
        "uptime": {
            "min_length": 0,
            "max_length": 255,
            "type": "string",
            "required": true
        },
        ...
    },
    "state": "active",
    "name": "instance",
    "association": {
        "instance_disk": {
            "query": "{\"=\": {\"instance_id\": \"%s\"}}",
            "args": "instance_id"
        }
    }
}

This part of job is done by ceilometer's config file for now . But without access to the config file , I can't get the true definition about certain resource-type.

xuyao18 avatar Nov 13 '17 03:11 xuyao18

So that'd be a foreign key implementation basically. That's something we could think about I guess.

jd avatar Nov 13 '17 09:11 jd