{ "openapi": "3.0.1", "info": { "title": "Ros-backend API", "description": "Flask Backend API for Resource Optimization Service", "contact": {}, "license": { "name": "GPLv3", "url": "https://www.gnu.org/licenses/gpl-3.0.en.html" }, "version": "v1" }, "servers": [ { "url": "https://console.redhat.com/api/ros/v1", "description": "ROS Production API" } ], "paths": { "/status": { "get": { "summary": "Health check liveness call", "description": "A small JSON indicating the application is deployed. This serves as both the liveness and readiness call.", "operationId": "getStatus", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Status" } } } } } } }, "/is_configured": { "get": { "summary": "Check ROS configured", "description": "Check whether service is configured.", "operationId": "getServiceConfigurationInfo", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IsServiceConfigured" } } } } } } }, "/systems": { "get": { "summary": "Lists all systems from cloud having performance profile", "description": "Lists all systems from cloud having performance profile", "operationId": "getSystems", "parameters": [ { "$ref": "#/components/parameters/limitParam" }, { "$ref": "#/components/parameters/offsetParam" }, { "$ref": "#/components/parameters/orderByParam" }, { "$ref": "#/components/parameters/orderHowParam" }, { "$ref": "#/components/parameters/filterParam" }, { "$ref": "#/components/parameters/filterStateParam" }, { "$ref": "#/components/parameters/filterOSParam" }, { "$ref": "#/components/parameters/filterGroupParam" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Systems" } } } } }, "security": [ { "RhIdentity": [] } ] } }, "/systems/{inventory_id}": { "get": { "summary": "Show the system details by given inventory id", "description": "Show the system details by given inventory id", "operationId": "getSystemDetails", "parameters": [ { "name": "inventory_id", "in": "path", "description": "Inventory ID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SystemDetails" } } } } } } }, "/systems/{inventory_id}/history": { "get": { "summary": "Show the system's performance history by given inventory id", "description": "Show the system's performance history by given inventory id", "operationId": "getPerformanceHistoryForSystem", "parameters": [ { "name": "inventory_id", "in": "path", "description": "Inventory ID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PerformanceHistory" } } } } } } }, "/systems/{inventory_id}/suggestions": { "get": { "summary": "Show the list of suggestions by given inventory id", "description": "Show the list of suggestions by given inventory id", "operationId": "getSuggestionsForSystem", "parameters": [ { "name": "inventory_id", "in": "path", "description": "Inventory ID", "required": true, "schema": { "type": "string" } }, { "name": "description", "in": "query", "required": false, "description": "Filter system with the given description", "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestionsList" } } } } } } }, "/executive_report": { "get": { "summary": "Executive report for systems", "description": "Executive report for systems", "operationId": "getExecutiveReportForSystems", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExecutiveReportItem" } } } } } } }, "/rating": { "post": { "summary": "submit suggestion rating", "description": "submit suggestion rating", "operationId": "addSuggestionRatingToSystem", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rating" } } } }, "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rating" } } } }, "200": { "description": "Updated an existing rating submitted by same user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rating" } } } }, "422": { "description": "Invalid choice of input for rating", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } } } } }, "/suggested_instance_types": { "get": { "summary": "List all suggested instance types for the system", "description": "Lists suggested instance types as per the suggestions", "operationId": "getSuggestedInstanceTypes", "parameters": [ { "$ref": "#/components/parameters/limitParam" }, { "$ref": "#/components/parameters/offsetParam" }, { "$ref": "#/components/parameters/SuggestedInstanceTypeOrderByParam" }, { "$ref": "#/components/parameters/orderHowParam" }, { "$ref":"#/components/parameters/filterInstanceType" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestedInstanceTypes" } } } } } } } }, "components": { "schemas": { "Links": { "type": "object", "properties": { "first": { "type": "string" }, "last": { "type": "string" }, "next": { "type": "string" }, "previous": { "type": "string" } } }, "ListMeta": { "type": "object", "properties": { "limit": { "type": "integer" }, "offset" : { "type": "integer" }, "count": { "type": "integer" } } }, "Systems": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/SystemItem" } }, "links": { "$ref": "#/components/schemas/Links" }, "meta": { "$ref": "#/components/schemas/ListMeta" } } }, "IsServiceConfigured": { "type": "object", "properties": { "success": { "type": "boolean" }, "code" : { "type": "string" }, "count": { "type": "integer" }, "systems_stats": { "type": "object", "properties": { "waiting_for_data": { "type": "integer" }, "with_suggestions": { "type": "integer" } } } } }, "SystemItem": { "type": "object", "properties": { "fqdn": { "type": "string" }, "display_name": { "type": "string" }, "inventory_id": { "type": "string" }, "org_id": { "type": "string" }, "number_of_suggestions": { "type": "integer" }, "state": { "type": "string" }, "performance_utilization": { "type": "object", "properties": { "cpu": { "type": "integer" }, "memory": { "type": "integer" }, "max_io": { "type": "number" }, "io_all": { "type": "object" } } }, "cloud_provider": { "type": "string" }, "instance_type": { "type": "string" }, "idling_time": { "type": "number" }, "os": { "type": "string" }, "report_date": { "type": "string" }, "groups": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } } } } }, "Status": { "required": [ "status" ], "properties": { "status": { "type": "string" } } }, "SystemDetails": { "type": "object", "properties": { "fqdn": { "type": "string" }, "inventory_id": { "type": "string" }, "display_name": { "type": "string" }, "performance_utilization": { "type": "object", "properties": { "cpu": { "type": "integer" }, "memory": { "type": "integer" }, "max_io": { "type": "number" }, "io_all": { "type": "object" } } }, "rating": { "type": "integer", "enum": [-1, 0, 1] }, "number_of_suggestions": { "type": "integer" }, "state": { "type": "string" }, "report_date": { "type": "string" }, "instance_type": { "type": "string" }, "cloud_provider": { "type": "string" }, "idling_time": { "type": "number" }, "os": { "type": "string" }, "psi_enabled": { "type": "boolean" } } }, "PerformanceHistory": { "type": "object", "properties": { "meta": { "$ref": "#/components/schemas/ListMeta" }, "links": { "$ref": "#/components/schemas/Links" }, "inventory_id": { "type": "string" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/PerformanceItem" } } } }, "ExecutiveReportItem": { "type": "object", "properties": { "systems_per_state": { "type": "object", "properties": { "under_pressure": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" } } }, "undersized": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" } } }, "oversized": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" } } }, "waiting_for_data": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" } } }, "idling": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" } } } } }, "conditions": { "type": "object", "properties": { "cpu": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" }, "undersized": { "type": "integer" }, "oversized": { "type": "integer" }, "under_pressure": { "type": "integer" } } }, "io": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" }, "undersized": { "type": "integer" }, "oversized": { "type": "integer" }, "under_pressure": { "type": "integer" } } }, "memory": { "type": "object", "properties": { "count": { "type": "integer" }, "percentage": { "type": "number" }, "undersized": { "type": "integer" }, "oversized": { "type": "integer" }, "under_pressure": { "type": "integer" } } }, "instance_types_highlights": { "type": "object", "properties":{ "current": { "type": "object", "properties": { "type": { "type": "string" }, "count": { "type": "integer" }, "desc": { "type": "string" } } }, "suggested": { "type": "object", "properties": { "type": { "type": "string" }, "count": { "type": "integer" }, "desc": { "type": "string" } } }, "historical": { "type": "object", "properties": { "type": { "type": "string" }, "count": { "type": "integer" }, "desc": { "type": "string" } } } } }, "meta": { "type": "object", "properties": { "total_count": { "type": "integer" }, "non_optimized_count": { "type": "integer" }, "conditions_count": { "type": "integer" }, "stale_count": { "type": "integer" }, "non_psi_count": { "type": "integer" }, "psi_enabled_count": { "type": "integer" } } } } } } }, "PerformanceItem": { "type": "object", "properties": { "cpu": { "type": "integer" }, "memory": { "type": "integer" }, "max_io": { "type": "number" }, "io_all": { "type": "object" }, "report_date": { "type": "string" } } }, "SuggestionsList": { "type": "object", "properties": { "inventory_id": { "type": "string" }, "meta": { "type": "object", "properties": { "count": { "type": "integer" } } }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/SuggestionsItem" } } } }, "SuggestionsItem": { "type": "object", "properties": { "rule_id": { "type": "string" }, "description": { "type": "string" }, "reason": { "type": "string" }, "resolution": { "type": "string" }, "condition": { "type": "string" }, "detected_issues": { "type": "string" }, "suggested_instances": { "type": "string" }, "current_instance": { "type": "string" }, "psi_enabled": { "type": "boolean" } } }, "Rating": { "type": "object", "properties": { "inventory_id": { "type": "string" }, "rating": { "type": "integer", "enum": [-1, 0, 1] } } }, "Message": { "type": "object", "properties": { "message": { "type": "string", "description": "Message text" } } }, "SuggestedInstanceTypes": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/SuggestedInstanceTypesItem" } }, "links": { "$ref": "#/components/schemas/Links" }, "meta": { "$ref": "#/components/schemas/ListMeta" } } }, "SuggestedInstanceTypesItem": { "type": "object", "properties": { "instance_type": { "type": "string" }, "cloud_provider": { "type": "string" }, "system_count": { "type": "integer" }, "description": { "type": "string" } } } }, "parameters": { "limitParam": { "name": "limit", "in": "query", "required": false, "description": "Number of items to return", "schema": { "type": "integer", "default": 10 } }, "offsetParam": { "name": "offset", "in": "query", "required": false, "description": "Number of items to skip before starting to collect the result set", "schema": { "type": "integer", "default": 0 } }, "orderByParam": { "name": "order_by", "in": "query", "required": false, "description": "Ordering field name, defaults to report_date", "schema": { "type": "string", "default": "report_date", "enum": [ "display_name", "cpu", "memory", "max_io", "number_of_suggestions", "state", "os", "report_date", "group_name" ] } }, "orderHowParam": { "name": "order_how", "in": "query", "required": false, "description": "Direction of the ordering, defaults to DESC", "schema": { "type": "string", "default": "DESC", "enum": [ "ASC", "DESC" ] } }, "filterParam": { "name": "display_name", "in": "query", "required": false, "description": "Filter system with the given display name ", "schema": { "type": "string" } }, "filterStateParam": { "name": "state", "in": "query", "required": false, "description": "Filter system with the given state", "schema": { "type": "array", "items": { "type": "string", "enum": [ "Idling", "Oversized", "Undersized", "Optimized", "Under pressure", "Waiting for data" ] } } }, "filterOSParam": { "name": "os", "in": "query", "required": false, "description": "Filter system with the given RHEL OS version. Eg, 8.4", "schema": { "type": "array", "items": { "type": "string" } } }, "filterGroupParam": { "name": "group_name", "in": "query", "required": false, "description": "Filter systems by given group name", "schema": { "type": "array", "items": { "type": "string" } } }, "filterInstanceType": { "name": "instance_type", "in": "query", "required": false, "description": "Filter by instance type's name", "schema": { "type": "string" } }, "SuggestedInstanceTypeOrderByParam": { "name": "order_by", "in": "query", "required": false, "description": "Ordering field name, defaults to system count", "schema": { "type": "string", "default": "system_count", "enum": [ "instance_type", "system_count" ] } } }, "securitySchemes": { "RhIdentity": { "in": "header", "name": "x-rh-identity", "description": "Base64-encoded JSON identity header provided by 3Scale. Contains an account number of the user issuing the request. Format of the JSON{'identity': {'account_number': '12345678'}}", "type": "apiKey" } } } }