Skip to content

Commit

Permalink
Add api-ref doc for data model api
Browse files Browse the repository at this point in the history
Change-Id: I7d2203f35623ac6b0649ba5d99a04e9d6ca4430f
  • Loading branch information
chenke committed Aug 26, 2019
1 parent 1bd580b commit 5aa4637
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 5 deletions.
1 change: 1 addition & 0 deletions api-ref/source/index.rst
Expand Up @@ -15,3 +15,4 @@ Watcher API
.. include:: watcher-api-v1-strategies.inc
.. include:: watcher-api-v1-services.inc
.. include:: watcher-api-v1-scoring_engines.inc
.. include:: watcher-api-v1-datamodel.inc
112 changes: 107 additions & 5 deletions api-ref/source/parameters.yaml
Expand Up @@ -129,6 +129,14 @@ r_strategy:
in: query
required: false
type: string
r_type:
description: |
Type of data model user want to list. Default type is compute.
Supported values: compute.
Future support values: storage, baremetal.
in: query
required: false
type: string
sort_dir:
description: |
Sorts the response by the requested sort direction.
Expand Down Expand Up @@ -411,6 +419,62 @@ links:
required: true
type: array

# Data Model Node
node_disk:
description: |
The Disk of the node(in GiB).
in: body
required: true
type: integer
node_disk_ratio:
description: |
The Disk Ratio of the node.
in: body
required: true
type: float
node_hostname:
description: |
The Host Name of the node.
in: body
required: true
type: string
node_memory:
description: |
The Memory of the node(in MiB).
in: body
required: true
type: integer
node_memory_ratio:
description: |
The Memory Ratio of the node.
in: body
required: true
type: float
node_state:
description: |
The State of the node. The value is up or down.
in: body
required: true
type: string
node_uuid:
description: |
The Unique UUID of the node.
in: body
required: true
type: string
node_vcpu_ratio:
description: |
The Vcpu ratio of the node.
in: body
required: true
type: float
node_vcpus:
description: |
The Vcpu of the node.
in: body
required: true
type: integer

# Scoring Engine
scoring_engine_description:
description: |
Expand All @@ -430,34 +494,72 @@ scoring_engine_name:
in: body
required: true
type: string

# Data Model Server
server_disk:
description: |
The Disk of the server.
in: body
required: true
type: integer
server_memory:
description: |
The Memory of server.
in: body
required: true
type: integer
server_name:
description: |
The Name of the server.
in: body
required: true
type: string
server_state:
description: |
The State of the server.
in: body
required: true
type: string
server_uuid:
description: |
The Unique UUID of the server.
in: body
required: true
type: string
server_vcpus:
description: |
The Vcpu of the server.
in: body
required: true
type: integer
# Service
service_host:
description: |
Name of host where service is placed on.
The Name of host where service is placed on.
in: body
required: true
type: string
service_id:
description: |
ID of service.
The ID of service.
in: body
required: true
type: integer
service_last_seen_up:
description: |
Time when Watcher service sent latest heartbeat.
The Time when Watcher service sent latest heartbeat.
in: body
required: true
type: string
service_name:
description: |
Name of service like ``watcher-applier``.
The Name of service like ``watcher-applier``.
in: body
required: true
type: string
service_status:
description: |
State of service. It can be either in ACTIVE or FAILED state.
The State of service. It can be either in ACTIVE or FAILED state.
in: body
required: true
type: string
Expand Down
38 changes: 38 additions & 0 deletions api-ref/source/samples/datamodel-list-response.json
@@ -0,0 +1,38 @@
{
"context": [
{
"server_uuid": "1bf91464-9b41-428d-a11e-af691e5563bb",
"server_name": "chenke-test1",
"server_vcpus": "1",
"server_memory": "512",
"server_disk": "1",
"server_state": "active",
"node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
"node_hostname": "localhost.localdomain",
"node_vcpus": "4",
"node_vcpu_ratio": "16.0",
"node_memory": "16383",
"node_memory_ratio": "1.5",
"node_disk": "37"
"node_disk_ratio": "1.0",
"node_state": "up",
},
{
"server_uuid": "e2cb5f6f-fa1d-4ba2-be1e-0bf02fa86ba4",
"server_name": "chenke-test2",
"server_vcpus": "1",
"server_memory": "512",
"server_disk": "1",
"server_state": "active",
"node_uuid": "253e5dd0-9384-41ab-af13-4f2c2ce26112",
"node_hostname": "localhost.localdomain",
"node_vcpus": "4",
"node_vcpu_ratio": "16.0",
"node_memory": "16383",
"node_memory_ratio": "1.5",
"node_disk": "37"
"node_disk_ratio": "1.0",
"node_state": "up",
}
]
}
55 changes: 55 additions & 0 deletions api-ref/source/watcher-api-v1-datamodel.inc
@@ -0,0 +1,55 @@
.. -*- rst -*-
==========
Data Model
==========

``Data Model`` is very important for Watcher to generate resource
optimization solutions. Users can easily view the data model by the
API.


List Data Model
===============

.. rest_method:: GET /v1/data_model

Returns the information about Data Model.

Normal response codes: 200

Error codes: 400,401

Request
-------

.. rest_parameters:: parameters.yaml

- audit: r_audit
- type: r_type

Response
--------

.. rest_parameters:: parameters.yaml

- server_uuid: server_uuid
- server_name: server_name
- server_vcpus: server_vcpus
- server_memory: server_memory
- server_disk: server_disk
- server_state: server_state
- node_uuid: node_uuid
- node_hostname: node_hostname
- node_vcpus: node_vcpus
- node_vcpu_ratio: node_vcpu_ratio
- node_memory: node_memory
- node_memory_ratio: node_memory_ratio
- node_disk: node_disk
- node_disk_ratio: node_disk_ratio
- node_state: node_state

**Example JSON representation of a Data Model:**

.. literalinclude:: samples/datamodel-list-response.json
:language: javascript

0 comments on commit 5aa4637

Please sign in to comment.