gnocchi/doc/source/rest.yaml
gordon chung 1d3c67574a support shrinking/extending policy timespan
add flexibility to allow users to shrink or expand the coverage
of a granularity. this does not support changing the granularity,
just the duration of the granularity (if it exists).

Change-Id: I71715ea75a8d80807616830fd64f1844516d82bc
2016-05-17 16:06:10 +00:00

527 lines
15 KiB
YAML

- name: create-archive-policy
request: |
POST /v1/archive_policy HTTP/1.1
Content-Type: application/json
{
"name": "low",
"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": "low-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": "medium",
"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": "low"
}
- 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: 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: 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: 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-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: 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-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: 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: delete-resource-generic
request: DELETE /v1/resource/generic/{{ scenarios['create-resource-generic']['response'].json['id'] }} HTTP/1.1
- 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: 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