Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71914,6 +71914,55 @@ components:
$ref: "#/components/schemas/Trigger"
type: array
type: object
SpecAttributes:
description: Attributes of an API spec.
properties:
name:
description: The name of the spec.
example: pets-api
type: string
status:
$ref: "#/components/schemas/SpecAttributesStatus"
version:
description: The version of the spec.
example: "2.1.0"
type: string
type: object
SpecAttributesStatus:
description: The publication status of the spec.
enum:
- published
- draft
- deprecated
example: published
type: string
x-enum-varnames:
- PUBLISHED
- DRAFT
- DEPRECATED
SpecData:
description: A single API spec resource.
properties:
attributes:
$ref: "#/components/schemas/SpecAttributes"
id:
description: The unique identifier of the spec.
example: d5e5d5a0-1234-5678-9abc-def012345678
type: string
type:
$ref: "#/components/schemas/SpecType"
required:
- type
type: object
SpecType:
default: spec
description: Type of the spec resource.
enum:
- spec
example: spec
type: string
x-enum-varnames:
- SPEC
SpecVersion:
description: The version of the CycloneDX specification a BOM conforms to.
enum:
Expand All @@ -71932,6 +71981,15 @@ components:
- ONE_THREE
- ONE_FOUR
- ONE_FIVE
SpecsListResponse:
description: Response containing a list of specs.
properties:
data:
description: List of specs.
items:
$ref: "#/components/schemas/SpecData"
type: array
type: object
SplitAPIKey:
description: The definition of the `SplitAPIKey` object.
properties:
Expand Down Expand Up @@ -137984,6 +138042,43 @@ paths:
cursorPath: meta.page.after
limitParam: body.data.attributes.page.limit
resultsPath: data
/api/v2/specs:
get:
description: Returns a list of API specs stored in the system.
operationId: ListSpecs
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- attributes:
name: pets-api
status: published
version: "2.1.0"
id: d5e5d5a0-1234-5678-9abc-def012345678
type: spec
- attributes:
name: users-api
status: draft
version: "1.0.0"
id: a1b2c3d4-5678-9abc-def0-123456789abc
type: spec
schema:
$ref: "#/components/schemas/SpecsListResponse"
description: OK
"403":
$ref: "#/components/responses/ForbiddenResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: List API specs
tags:
- Specs
/api/v2/static-analysis-sca/dependencies:
post:
operationId: CreateSCAResult
Expand Down Expand Up @@ -148377,6 +148472,9 @@ tags:
description: Find out more at
url: https://docs.datadoghq.com/tracing/metrics/metrics_namespace/
name: Spans Metrics
- description: |-
View API specs stored in the system.
name: Specs
- description: API for static analysis
name: Static Analysis
- description: Manage your status pages and communicate service disruptions to stakeholders via Datadog's API. See the [Status Pages documentation](https://docs.datadoghq.com/incident_response/status_pages/) for more information.
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,13 @@ datadog\_api\_client.v2.api.spans\_metrics\_api module
:members:
:show-inheritance:

datadog\_api\_client.v2.api.specs\_api module
---------------------------------------------

.. automodule:: datadog_api_client.v2.api.specs_api
:members:
:show-inheritance:

datadog\_api\_client.v2.api.static\_analysis\_api module
--------------------------------------------------------

Expand Down
35 changes: 35 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31777,6 +31777,41 @@ datadog\_api\_client.v2.model.spec module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.spec\_attributes module
-----------------------------------------------------

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

datadog\_api\_client.v2.model.spec\_attributes\_status module
-------------------------------------------------------------

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

datadog\_api\_client.v2.model.spec\_data module
-----------------------------------------------

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

datadog\_api\_client.v2.model.spec\_type module
-----------------------------------------------

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

datadog\_api\_client.v2.model.specs\_list\_response module
----------------------------------------------------------

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

datadog\_api\_client.v2.model.split\_api\_key module
----------------------------------------------------

Expand Down
13 changes: 13 additions & 0 deletions examples/v2/specs/ListSpecs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
List API specs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.specs_api import SpecsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = SpecsApi(api_client)
response = api_instance.list_specs()

print(response)
49 changes: 49 additions & 0 deletions src/datadog_api_client/v2/api/specs_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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 typing import Any, Dict

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.v2.model.specs_list_response import SpecsListResponse


class SpecsApi:
"""
View API specs stored in the system.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._list_specs_endpoint = _Endpoint(
settings={
"response_type": (SpecsListResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/specs",
"operation_id": "list_specs",
"http_method": "GET",
"version": "v2",
},
params_map={},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

def list_specs(
self,
) -> SpecsListResponse:
"""List API specs.

Returns a list of API specs stored in the system.

:rtype: SpecsListResponse
"""
kwargs: Dict[str, Any] = {}
return self._list_specs_endpoint.call_with_http_info(**kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
from datadog_api_client.v2.api.spa_api import SpaApi
from datadog_api_client.v2.api.spans_api import SpansApi
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi
from datadog_api_client.v2.api.specs_api import SpecsApi
from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi
from datadog_api_client.v2.api.status_pages_api import StatusPagesApi
from datadog_api_client.v2.api.storage_management_api import StorageManagementApi
Expand Down Expand Up @@ -210,6 +211,7 @@
"SpaApi",
"SpansApi",
"SpansMetricsApi",
"SpecsApi",
"StaticAnalysisApi",
"StatusPagesApi",
"StorageManagementApi",
Expand Down
62 changes: 62 additions & 0 deletions src/datadog_api_client/v2/model/spec_attributes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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 typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.spec_attributes_status import SpecAttributesStatus


class SpecAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.spec_attributes_status import SpecAttributesStatus

return {
"name": (str,),
"status": (SpecAttributesStatus,),
"version": (str,),
}

attribute_map = {
"name": "name",
"status": "status",
"version": "version",
}

def __init__(
self_,
name: Union[str, UnsetType] = unset,
status: Union[SpecAttributesStatus, UnsetType] = unset,
version: Union[str, UnsetType] = unset,
**kwargs,
):
"""
Attributes of an API spec.

:param name: The name of the spec.
:type name: str, optional

:param status: The publication status of the spec.
:type status: SpecAttributesStatus, optional

:param version: The version of the spec.
:type version: str, optional
"""
if name is not unset:
kwargs["name"] = name
if status is not unset:
kwargs["status"] = status
if version is not unset:
kwargs["version"] = version
super().__init__(kwargs)
41 changes: 41 additions & 0 deletions src/datadog_api_client/v2/model/spec_attributes_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 SpecAttributesStatus(ModelSimple):
"""
The publication status of the spec.

:param value: Must be one of ["published", "draft", "deprecated"].
:type value: str
"""

allowed_values = {
"published",
"draft",
"deprecated",
}
PUBLISHED: ClassVar["SpecAttributesStatus"]
DRAFT: ClassVar["SpecAttributesStatus"]
DEPRECATED: ClassVar["SpecAttributesStatus"]

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


SpecAttributesStatus.PUBLISHED = SpecAttributesStatus("published")
SpecAttributesStatus.DRAFT = SpecAttributesStatus("draft")
SpecAttributesStatus.DEPRECATED = SpecAttributesStatus("deprecated")
Loading
Loading