Skip to content

Commit

Permalink
Fix schema for query scalar API (#1668)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Sep 22, 2023
1 parent 74c0d74 commit 63f6e00
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-09-21 17:08:23.707353",
"spec_repo_commit": "bcba1c72"
"regenerated": "2023-09-22 09:03:29.627031",
"spec_repo_commit": "98de9afb"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-09-21 17:08:23.720744",
"spec_repo_commit": "bcba1c72"
"regenerated": "2023-09-22 09:03:29.720701",
"spec_repo_commit": "98de9afb"
}
}
}
28 changes: 22 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3712,9 +3712,7 @@ components:
example: a
type: string
type:
description: The type of column present.
example: number
type: string
$ref: '#/components/schemas/ScalarColumnTypeNumber'
values:
description: The array of numerical values for one formula or query.
example:
Expand All @@ -3723,6 +3721,7 @@ components:
description: An individual value for a given column and group-by.
example: 0.5
format: double
nullable: true
type: number
type: array
type: object
Expand Down Expand Up @@ -5509,9 +5508,7 @@ components:
example: env
type: string
type:
description: The type of column present.
example: group
type: string
$ref: '#/components/schemas/ScalarColumnTypeGroup'
values:
description: The array of tag values for each group found for the results
of the formulas or queries.
Expand Down Expand Up @@ -12111,6 +12108,24 @@ components:
oneOf:
- $ref: '#/components/schemas/GroupScalarColumn'
- $ref: '#/components/schemas/DataScalarColumn'
ScalarColumnTypeGroup:
default: group
description: The type of column present for groups.
enum:
- group
example: group
type: string
x-enum-varnames:
- GROUP
ScalarColumnTypeNumber:
default: number
description: The type of column present for numbers.
enum:
- number
example: number
type: string
x-enum-varnames:
- NUMBER
ScalarFormulaQueryRequest:
description: A wrapper request around one scalar query to be executed.
properties:
Expand Down Expand Up @@ -12215,6 +12230,7 @@ components:
If the second element is not present, the API returns null.'
items:
$ref: '#/components/schemas/Unit'
nullable: true
type: array
type: object
ScalarQuery:
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5391,6 +5391,20 @@ scalar\_column
:members:
:show-inheritance:

scalar\_column\_type\_group
---------------------------

.. automodule:: datadog_api_client.v2.model.scalar_column_type_group
:members:
:show-inheritance:

scalar\_column\_type\_number
----------------------------

.. automodule:: datadog_api_client.v2.model.scalar_column_type_number
:members:
:show-inheritance:

scalar\_formula\_query\_request
-------------------------------

Expand Down
15 changes: 9 additions & 6 deletions src/datadog_api_client/v2/model/data_scalar_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@
from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
none_type,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.scalar_meta import ScalarMeta
from datadog_api_client.v2.model.scalar_column_type_number import ScalarColumnTypeNumber


class DataScalarColumn(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.scalar_meta import ScalarMeta
from datadog_api_client.v2.model.scalar_column_type_number import ScalarColumnTypeNumber

return {
"meta": (ScalarMeta,),
"name": (str,),
"type": (str,),
"values": ([float],),
"type": (ScalarColumnTypeNumber,),
"values": ([float, none_type],),
}

attribute_map = {
Expand All @@ -40,7 +43,7 @@ def __init__(
self_,
meta: Union[ScalarMeta, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
type: Union[str, UnsetType] = unset,
type: Union[ScalarColumnTypeNumber, UnsetType] = unset,
values: Union[List[float], UnsetType] = unset,
**kwargs,
):
Expand All @@ -53,11 +56,11 @@ def __init__(
:param name: The name referencing the formula or query for this column.
:type name: str, optional
:param type: The type of column present.
:type type: str, optional
:param type: The type of column present for numbers.
:type type: ScalarColumnTypeNumber, optional
:param values: The array of numerical values for one formula or query.
:type values: [float], optional
:type values: [float, none_type], optional
"""
if meta is not unset:
kwargs["meta"] = meta
Expand Down
16 changes: 11 additions & 5 deletions src/datadog_api_client/v2/model/group_scalar_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, Union
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
Expand All @@ -13,12 +13,18 @@
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.scalar_column_type_group import ScalarColumnTypeGroup


class GroupScalarColumn(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.scalar_column_type_group import ScalarColumnTypeGroup

return {
"name": (str,),
"type": (str,),
"type": (ScalarColumnTypeGroup,),
"values": ([[str]],),
}

Expand All @@ -31,7 +37,7 @@ def openapi_types(_):
def __init__(
self_,
name: Union[str, UnsetType] = unset,
type: Union[str, UnsetType] = unset,
type: Union[ScalarColumnTypeGroup, UnsetType] = unset,
values: Union[List[List[str]], UnsetType] = unset,
**kwargs,
):
Expand All @@ -41,8 +47,8 @@ def __init__(
:param name: The name of the tag key or group.
:type name: str, optional
:param type: The type of column present.
:type type: str, optional
:param type: The type of column present for groups.
:type type: ScalarColumnTypeGroup, optional
:param values: The array of tag values for each group found for the results of the formulas or queries.
:type values: [[str]], optional
Expand Down
4 changes: 2 additions & 2 deletions src/datadog_api_client/v2/model/scalar_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def __init__(self, **kwargs):
:param name: The name of the tag key or group.
:type name: str, optional
:param type: The type of column present.
:type type: str, optional
:param type: The type of column present for groups.
:type type: ScalarColumnTypeGroup, optional
:param values: The array of tag values for each group found for the results of the formulas or queries.
:type values: [[str]], optional
Expand Down
35 changes: 35 additions & 0 deletions src/datadog_api_client/v2/model/scalar_column_type_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class ScalarColumnTypeGroup(ModelSimple):
"""
The type of column present for groups.
:param value: If omitted defaults to "group". Must be one of ["group"].
:type value: str
"""

allowed_values = {
"group",
}
GROUP: ClassVar["ScalarColumnTypeGroup"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


ScalarColumnTypeGroup.GROUP = ScalarColumnTypeGroup("group")
35 changes: 35 additions & 0 deletions src/datadog_api_client/v2/model/scalar_column_type_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class ScalarColumnTypeNumber(ModelSimple):
"""
The type of column present for numbers.
:param value: If omitted defaults to "number". Must be one of ["number"].
:type value: str
"""

allowed_values = {
"number",
}
NUMBER: ClassVar["ScalarColumnTypeNumber"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


ScalarColumnTypeNumber.NUMBER = ScalarColumnTypeNumber("number")
6 changes: 3 additions & 3 deletions src/datadog_api_client/v2/model/scalar_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ def openapi_types(_):
from datadog_api_client.v2.model.unit import Unit

return {
"unit": ([Unit, none_type],),
"unit": ([Unit, none_type], none_type),
}

attribute_map = {
"unit": "unit",
}

def __init__(self_, unit: Union[List[Unit], UnsetType] = unset, **kwargs):
def __init__(self_, unit: Union[List[Unit], none_type, UnsetType] = unset, **kwargs):
"""
Metadata for the resulting numerical values.
:param unit: Detailed information about the unit.
First element describes the "primary unit" (for example, ``bytes`` in ``bytes per second`` ).
The second element describes the "per unit" (for example, ``second`` in ``bytes per second`` ).
If the second element is not present, the API returns null.
:type unit: [Unit, none_type], optional
:type unit: [Unit, none_type], none_type, optional
"""
if unit is not unset:
kwargs["unit"] = unit
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,8 @@
from datadog_api_client.v2.model.saml_assertion_attribute_attributes import SAMLAssertionAttributeAttributes
from datadog_api_client.v2.model.saml_assertion_attributes_type import SAMLAssertionAttributesType
from datadog_api_client.v2.model.scalar_column import ScalarColumn
from datadog_api_client.v2.model.scalar_column_type_group import ScalarColumnTypeGroup
from datadog_api_client.v2.model.scalar_column_type_number import ScalarColumnTypeNumber
from datadog_api_client.v2.model.scalar_formula_query_request import ScalarFormulaQueryRequest
from datadog_api_client.v2.model.scalar_formula_query_response import ScalarFormulaQueryResponse
from datadog_api_client.v2.model.scalar_formula_request import ScalarFormulaRequest
Expand Down Expand Up @@ -2119,6 +2121,8 @@
"SAMLAssertionAttributeAttributes",
"SAMLAssertionAttributesType",
"ScalarColumn",
"ScalarColumnTypeGroup",
"ScalarColumnTypeNumber",
"ScalarFormulaQueryRequest",
"ScalarFormulaQueryResponse",
"ScalarFormulaRequest",
Expand Down

0 comments on commit 63f6e00

Please sign in to comment.