skyline-apiserver/skyline_apiserver/schemas/prometheus.py
Boxiang Zhu f3dacbcea7 chore: Add license for python file and update policy
1. Add license for python file
2. Update the policy for all services

Change-Id: I4bc6a68874afe1cc51da1a24d278165356d5dec3
2022-08-25 14:35:55 +08:00

64 lines
2.1 KiB
Python

# Copyright 2022 99cloud
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class PrometheusQueryResultBase(BaseModel):
metric: Dict[str, str] = Field(..., description="Prometheus metric")
value: List[Any] = Field(..., description="Prometheus metric value")
class PrometheusQueryDataBase(BaseModel):
resultType: str = Field(..., description="Prometheus result type")
class PrometheusResponseBase(BaseModel):
status: str = Field(..., description="Prometheus status")
errorType: Optional[str] = Field(None, description="Prometheus error type")
error: Optional[str] = Field(None, description="Prometheus error")
warnings: Optional[str] = Field(None, description="Prometheus warnings")
class PrometheusQueryResult(PrometheusQueryResultBase):
""""""
class PrometheusQueryData(PrometheusQueryDataBase):
result: List[PrometheusQueryResult] = Field(..., description="Prometheus query result")
class PrometheusQueryResponse(PrometheusResponseBase):
data: Optional[PrometheusQueryData] = Field(None, description="Prometheus query data")
class PrometheusQueryRangeResult(PrometheusQueryResultBase):
""""""
class PrometheusQueryRangeData(PrometheusQueryDataBase):
result: List[PrometheusQueryRangeResult] = Field(
..., description="Prometheus query range result"
)
class PrometheusQueryRangeResponse(PrometheusResponseBase):
data: Optional[PrometheusQueryRangeData] = Field(
None, description="Prometheus query range data"
)