deb-gnocchi/doc/source/rest.yaml

750 lines
21 KiB
YAML

- name: create-archive-policy
request: |
POST /v1/archive_policy HTTP/1.1
Content-Type: application/json
{
"name": "short",
"back_window": 0,
"definition": [
{
"granularity": "1s",
"timespan": "1 hour"
},
{
"points": 48,
"timespan": "1 day"
}
]
}
- name: create-archive-policy-without-max
request: |
POST /v1/archive_policy HTTP/1.1
Content-Type: application/json
{
"name": "short-without-max",
"aggregation_methods": ["-max", "-min"],
"back_window": 0,
"definition": [
{
"granularity": "1s",
"timespan": "1 hour"
},
{
"points": 48,
"timespan": "1 day"
}
]
}
- name: get-archive-policy
request: GET /v1/archive_policy/{{ scenarios['create-archive-policy']['response'].json['name'] }} HTTP/1.1
- name: list-archive-policy
request: GET /v1/archive_policy HTTP/1.1
- name: update-archive-policy
request: |
PATCH /v1/archive_policy/{{ scenarios['create-archive-policy']['response'].json['name'] }} HTTP/1.1
Content-Type: application/json
{
"definition": [
{
"granularity": "1s",
"timespan": "1 hour"
},
{
"points": 48,
"timespan": "1 day"
}
]
}
- name: create-archive-policy-to-delete
request: |
POST /v1/archive_policy HTTP/1.1
Content-Type: application/json
{
"name": "some-archive-policy",
"back_window": 0,
"definition": [
{
"granularity": "1s",
"timespan": "1 hour"
},
{
"points": 48,
"timespan": "1 day"
}
]
}
- name: delete-archive-policy
request: DELETE /v1/archive_policy/{{ scenarios['create-archive-policy-to-delete']['response'].json['name'] }} HTTP/1.1
- name: create-metric
request: |
POST /v1/metric HTTP/1.1
Content-Type: application/json
{
"archive_policy_name": "high"
}
- name: create-metric-2
request: |
POST /v1/metric HTTP/1.1
Content-Type: application/json
{
"archive_policy_name": "low"
}
- name: create-archive-policy-rule
request: |
POST /v1/archive_policy_rule HTTP/1.1
Content-Type: application/json
{
"name": "test_rule",
"metric_pattern": "disk.io.*",
"archive_policy_name": "low"
}
- name: get-archive-policy-rule
request: GET /v1/archive_policy_rule/{{ scenarios['create-archive-policy-rule']['response'].json['name'] }} HTTP/1.1
- name: list-archive-policy-rule
request: GET /v1/archive_policy_rule HTTP/1.1
- name: create-archive-policy-rule-to-delete
request: |
POST /v1/archive_policy_rule HTTP/1.1
Content-Type: application/json
{
"name": "test_rule_delete",
"metric_pattern": "disk.io.*",
"archive_policy_name": "low"
}
- name: delete-archive-policy-rule
request: DELETE /v1/archive_policy_rule/{{ scenarios['create-archive-policy-rule-to-delete']['response'].json['name'] }} HTTP/1.1
- name: get-metric
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }} HTTP/1.1
- name: list-metric
request: GET /v1/metric HTTP/1.1
- name: list-metric-pagination
request: GET /v1/metric?limit=100&sort=name:asc HTTP/1.1
- name: post-measures
request: |
POST /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures HTTP/1.1
Content-Type: application/json
[
{
"timestamp": "2014-10-06T14:33:57",
"value": 43.1
},
{
"timestamp": "2014-10-06T14:34:12",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:20",
"value": 2
}
]
- name: post-measures-batch
request: |
POST /v1/batch/metrics/measures HTTP/1.1
Content-Type: application/json
{
"{{ scenarios['create-metric']['response'].json['id'] }}":
[
{
"timestamp": "2014-10-06T14:34:12",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:20",
"value": 2
}
],
"{{ scenarios['create-metric-2']['response'].json['id'] }}":
[
{
"timestamp": "2014-10-06T16:12:12",
"value": 3
},
{
"timestamp": "2014-10-06T18:14:52",
"value": 4
}
]
}
- name: search-value-in-metric
request: |
POST /v1/search/metric?metric_id={{ scenarios['create-metric']['response'].json['id'] }} HTTP/1.1
Content-Type: application/json
{"and": [{">=": [{"+": 23}, 50]}, {"!=": 55}]}
- name: create-metric-a
request: |
POST /v1/metric HTTP/1.1
Content-Type: application/json
{
"archive_policy_name": "short"
}
- name: post-measures-for-granularity-search
request: |
POST /v1/metric/{{ scenarios['create-metric-a']['response'].json['id'] }}/measures HTTP/1.1
Content-Type: application/json
[
{
"timestamp": "2014-10-06T14:34:12",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:14",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:16",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:18",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:20",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:22",
"value": 12
},
{
"timestamp": "2014-10-06T14:34:24",
"value": 12
}
]
- name: search-value-in-metrics-by-granularity
request: |
POST /v1/search/metric?metric_id={{ scenarios['create-metric-a']['response'].json['id'] }}&granularity=1second&granularity=1800s HTTP/1.1
Content-Type: application/json
{"=": 12}
- name: get-measures
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures HTTP/1.1
- name: get-measures-from
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures?start=2014-10-06T14:34 HTTP/1.1
- name: get-measures-max
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures?aggregation=max HTTP/1.1
- name: get-measures-granularity
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures?granularity=1 HTTP/1.1
- name: get-measures-refresh
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures?refresh=true HTTP/1.1
- name: get-measures-resample
request: GET /v1/metric/{{ scenarios['create-metric']['response'].json['id'] }}/measures?resample=5&granularity=1 HTTP/1.1
- name: create-resource-generic
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "75C44741-CC60-4033-804E-2D3098C7D2E9",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D"
}
- name: create-resource-with-new-metrics
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "AB68DA77-FA82-4E67-ABA9-270C5A98CBCB",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"metrics": {"temperature": {"archive_policy_name": "low"}}
}
- name: create-resource-type-instance
request: |
POST /v1/resource_type HTTP/1.1
Content-Type: application/json
{
"name": "instance",
"attributes": {
"display_name": {"type": "string", "required": true},
"flavor_id": {"type": "string", "required": true},
"image_ref": {"type": "string", "required": true},
"host": {"type": "string", "required": true},
"server_group": {"type": "string", "required": false}
}
}
- name: create-resource-instance
request: |
POST /v1/resource/instance HTTP/1.1
Content-Type: application/json
{
"id": "6868DA77-FA82-4E67-ABA9-270C5AE8CBCA",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"started_at": "2014-01-02 23:23:34",
"ended_at": "2014-01-04 10:00:12",
"flavor_id": "2",
"image_ref": "http://image",
"host": "compute1",
"display_name": "myvm",
"metrics": {}
}
- name: list-resource-generic
request: GET /v1/resource/generic HTTP/1.1
- name: list-resource-instance
request: GET /v1/resource/instance HTTP/1.1
- name: list-resource-generic-details
request: GET /v1/resource/generic?details=true HTTP/1.1
- name: list-resource-generic-pagination
request: GET /v1/resource/generic?limit=2&sort=id:asc HTTP/1.1
- name: search-resource-for-user
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
{"=": {"user_id": "{{ scenarios['create-resource-instance']['response'].json['user_id'] }}"}}
- name: search-resource-for-host-like
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
{"like": {"host": "compute%"}}
- name: search-resource-for-user-details
request: |
POST /v1/search/resource/generic?details=true HTTP/1.1
Content-Type: application/json
{"=": {"user_id": "{{ scenarios['create-resource-instance']['response'].json['user_id'] }}"}}
- name: search-resource-for-user-after-timestamp
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
{"and": [
{"=": {"user_id": "{{ scenarios['create-resource-instance']['response'].json['user_id'] }}"}},
{">=": {"started_at": "2010-01-01"}}
]}
- name: search-resource-lifespan
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
{">=": {"lifespan": "30 min"}}
- name: get-resource-generic
request: GET /v1/resource/generic/{{ scenarios['create-resource-generic']['response'].json['id'] }} HTTP/1.1
- name: get-instance
request: GET /v1/resource/instance/{{ scenarios['create-resource-instance']['response'].json['id'] }} HTTP/1.1
- name: create-resource-instance-bis
request: |
POST /v1/resource/instance HTTP/1.1
Content-Type: application/json
{
"id": "AB0B5802-E79B-4C84-8998-9237F60D9CAE",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"flavor_id": "2",
"image_ref": "http://image",
"host": "compute1",
"display_name": "myvm",
"metrics": {}
}
- name: patch-resource
request: |
PATCH /v1/resource/instance/{{ scenarios['create-resource-instance']['response'].json['id'] }} HTTP/1.1
Content-Type: application/json
{"host": "compute2"}
- name: get-patched-instance-history
request: GET /v1/resource/instance/{{ scenarios['create-resource-instance']['response'].json['id'] }}/history HTTP/1.1
- name: get-patched-instance
request: GET /v1/resource/instance/{{ scenarios['create-resource-instance']['response'].json['id'] }} HTTP/1.1
- name: create-resource-type
request: |
POST /v1/resource_type HTTP/1.1
Content-Type: application/json
{
"name": "my_custom_type",
"attributes": {
"myid": {"type": "uuid"},
"display_name": {"type": "string", "required": true},
"prefix": {"type": "string", "required": false, "max_length": 8, "min_length": 3},
"size": {"type": "number", "min": 5, "max": 32.8},
"enabled": {"type": "bool", "required": false}
}
}
- name: create-resource-type-2
request: |
POST /v1/resource_type HTTP/1.1
Content-Type: application/json
{"name": "my_other_type"}
- name: get-resource-type
request: GET /v1/resource_type/my_custom_type HTTP/1.1
- name: list-resource-type
request: GET /v1/resource_type HTTP/1.1
- name: patch-resource-type
request: |
PATCH /v1/resource_type/my_custom_type HTTP/1.1
Content-Type: application/json-patch+json
[
{
"op": "add",
"path": "/attributes/awesome-stuff",
"value": {"type": "bool", "required": false}
},
{
"op": "add",
"path": "/attributes/required-stuff",
"value": {"type": "bool", "required": true, "options": {"fill": true}}
},
{
"op": "remove",
"path": "/attributes/prefix"
}
]
- name: delete-resource-type
request: DELETE /v1/resource_type/my_custom_type HTTP/1.1
- name: search-resource-history
request: |
POST /v1/search/resource/instance?history=true HTTP/1.1
Content-Type: application/json
{"=": {"id": "{{ scenarios['create-resource-instance']['response'].json['id'] }}"}}
- name: search-resource-history-in-accept
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
Accept: application/json; history=true
{"=": {"id": "{{ scenarios['create-resource-instance']['response'].json['id'] }}"}}
- name: search-resource-history-partial
request: |
POST /v1/search/resource/instance HTTP/1.1
Content-Type: application/json
Accept: application/json; history=true
{"and": [
{"=": {"host": "compute1"}},
{">=": {"revision_start": "{{ scenarios['get-instance']['response'].json['revision_start'] }}"}},
{"or": [{"<=": {"revision_end": "{{ scenarios['get-patched-instance']['response'].json['revision_start'] }}"}},
{"=": {"revision_end": null}}]}
]}
- name: create-resource-instance-with-metrics
request: |
POST /v1/resource/instance HTTP/1.1
Content-Type: application/json
{
"id": "6F24EDD9-5A2F-4592-B708-FFBED821C5D2",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"flavor_id": "2",
"image_ref": "http://image",
"host": "compute1",
"display_name": "myvm2",
"server_group": "my_autoscaling_group",
"metrics": {"cpu.util": "{{ scenarios['create-metric']['response'].json['id'] }}"}
}
- name: create-resource-instance-with-dynamic-metrics
request: |
POST /v1/resource/instance HTTP/1.1
Content-Type: application/json
{
"id": "15e9c872-7ca9-11e4-a2da-2fb4032dfc09",
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
"flavor_id": "2",
"image_ref": "http://image",
"host": "compute2",
"display_name": "myvm3",
"server_group": "my_autoscaling_group",
"metrics": {"cpu.util": {"archive_policy_name": "{{ scenarios['create-archive-policy']['response'].json['name'] }}"}}
}
- name: post-measures-batch-named
request: |
POST /v1/batch/resources/metrics/measures HTTP/1.1
Content-Type: application/json
{
"{{ scenarios['create-resource-with-new-metrics']['response'].json['id'] }}": {
"temperature": [
{ "timestamp": "2014-10-06T14:34:12", "value": 17 },
{ "timestamp": "2014-10-06T14:34:20", "value": 18 }
]
},
"{{ scenarios['create-resource-instance-with-dynamic-metrics']['response'].json['id'] }}": {
"cpu.util": [
{ "timestamp": "2014-10-06T14:34:12", "value": 12 },
{ "timestamp": "2014-10-06T14:34:20", "value": 2 }
]
},
"{{ scenarios['create-resource-instance-with-metrics']['response'].json['id'] }}": {
"cpu.util": [
{ "timestamp": "2014-10-06T14:34:12", "value": 6 },
{ "timestamp": "2014-10-06T14:34:20", "value": 25 }
]
}
}
- name: post-measures-batch-named-create
request: |
POST /v1/batch/resources/metrics/measures?create_metrics=true HTTP/1.1
Content-Type: application/json
{
"{{ scenarios['create-resource-with-new-metrics']['response'].json['id'] }}": {
"disk.io.test": [
{ "timestamp": "2014-10-06T14:34:12", "value": 71 },
{ "timestamp": "2014-10-06T14:34:20", "value": 81 }
]
}
}
- name: delete-resource-generic
request: DELETE /v1/resource/generic/{{ scenarios['create-resource-generic']['response'].json['id'] }} HTTP/1.1
- name: create-resources-a
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AA19-BBE0-E1E2-2D3JDC7D289R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: create-resources-b
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AAEF-AA90-E1E2-2D3JDC7D289R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: create-resources-c
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AAEF-BCEF-E112-2D3JDC7D289R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: create-resources-d
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AAEF-BCEF-E112-2D15DC7D289R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: create-resources-e
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AAEF-BCEF-E112-2D3JDC30289R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: create-resources-f
request: |
POST /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"id": "340102AA-AAEF-BCEF-E112-2D15349D109R",
"user_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ",
"project_id": "BD3A1E52-KKKC-2123-BGLH-WWUUD88CD7WZ"
}
- name: delete-resources-by-ids
request: |
DELETE /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
"in": {
"id": [
"{{ scenarios['create-resources-a']['response'].json['id'] }}",
"{{ scenarios['create-resources-b']['response'].json['id'] }}",
"{{ scenarios['create-resources-c']['response'].json['id'] }}"
]
}
}
- name: delete-resources-by-time
request: |
DELETE /v1/resource/generic HTTP/1.1
Content-Type: application/json
{
">=": {"started_at": "{{ scenarios['create-resources-f']['response'].json['started_at'] }}"}
}
- name: get-resource-named-metrics-measures
request: GET /v1/resource/generic/{{ scenarios['create-resource-instance-with-metrics']['response'].json['id'] }}/metric/cpu.util/measures?start=2014-10-06T14:34 HTTP/1.1
- name: post-resource-named-metrics-measures1
request: |
POST /v1/resource/generic/{{ scenarios['create-resource-instance-with-metrics']['response'].json['id'] }}/metric/cpu.util/measures HTTP/1.1
Content-Type: application/json
[
{
"timestamp": "2014-10-06T14:33:57",
"value": 3.5
},
{
"timestamp": "2014-10-06T14:34:12",
"value": 20
},
{
"timestamp": "2014-10-06T14:34:20",
"value": 9
}
]
- name: post-resource-named-metrics-measures2
request: |
POST /v1/resource/generic/{{ scenarios['create-resource-instance-with-dynamic-metrics']['response'].json['id'] }}/metric/cpu.util/measures HTTP/1.1
Content-Type: application/json
[
{
"timestamp": "2014-10-06T14:33:57",
"value": 25.1
},
{
"timestamp": "2014-10-06T14:34:12",
"value": 4.5
},
{
"timestamp": "2014-10-06T14:34:20",
"value": 14.2
}
]
- name: get-across-metrics-measures-by-attributes-lookup
request: |
POST /v1/aggregation/resource/instance/metric/cpu.util?start=2014-10-06T14:34&aggregation=mean HTTP/1.1
Content-Type: application/json
{"=": {"server_group": "my_autoscaling_group"}}
- name: get-across-metrics-measures-by-attributes-lookup-groupby
request: |
POST /v1/aggregation/resource/instance/metric/cpu.util?groupby=host&groupby=flavor_id HTTP/1.1
Content-Type: application/json
{"=": {"server_group": "my_autoscaling_group"}}
- name: get-across-metrics-measures-by-metric-ids
request: |
GET /v1/aggregation/metric?metric={{ scenarios['create-resource-instance-with-metrics']['response'].json['metrics']['cpu.util'] }}&metric={{ scenarios['create-resource-instance-with-dynamic-metrics']['response'].json['metrics']['cpu.util'] }}&start=2014-10-06T14:34&aggregation=mean HTTP/1.1
- name: get-across-metrics-measures-by-metric-ids-reaggregate
request: |
GET /v1/aggregation/metric?metric={{ scenarios['create-resource-instance-with-metrics']['response'].json['metrics']['cpu.util'] }}&metric={{ scenarios['create-resource-instance-with-dynamic-metrics']['response'].json['metrics']['cpu.util'] }}&aggregation=mean&reaggregation=min HTTP/1.1
- name: get-across-metrics-measures-by-metric-ids-fill
request: |
GET /v1/aggregation/metric?metric={{ scenarios['create-resource-instance-with-metrics']['response'].json['metrics']['cpu.util'] }}&metric={{ scenarios['create-resource-instance-with-dynamic-metrics']['response'].json['metrics']['cpu.util'] }}&fill=0&granularity=1 HTTP/1.1
- name: append-metrics-to-resource
request: |
POST /v1/resource/generic/{{ scenarios['create-resource-instance-with-metrics']['response'].json['id'] }}/metric HTTP/1.1
Content-Type: application/json
{"memory": {"archive_policy_name": "low"}}
- name: get-capabilities
request: GET /v1/capabilities HTTP/1.1
- name: get-status
request: GET /v1/status HTTP/1.1