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
70 changes: 70 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36135,6 +36135,51 @@ components:
required:
- name
type: object
LicensesListRequest:
properties:
data:
$ref: '#/components/schemas/LicensesListRequestData'
type: object
LicensesListRequestData:
properties:
attributes:
$ref: '#/components/schemas/LicensesListRequestDataAttributes'
id:
description: Unique identifier for the request
type: string
type:
$ref: '#/components/schemas/LicensesListRequestDataType'
required:
- type
type: object
LicensesListRequestDataAttributes:
properties:
licenses:
description: List of available licenses
items:
$ref: '#/components/schemas/LicensesListRequestLicense'
type: array
type: object
LicensesListRequestDataType:
default: licenserequest
enum:
- licenserequest
example: licenserequest
type: string
x-enum-varnames:
- LICENSEREQUEST
LicensesListRequestLicense:
properties:
display_name:
description: The display name of the license
type: string
identifier:
description: The SPDX identifier of the license
type: string
short_name:
description: The short name of the license
type: string
type: object
Links:
description: The JSON:API links related to pagination.
properties:
Expand Down Expand Up @@ -104994,6 +105039,31 @@ paths:
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/licenses/list:
get:
description: Returns a list of all available license identifiers and display
names that can be used for filtering and categorization in SCA.
operationId: GetLicenses
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LicensesListRequest'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- code_analysis_read
summary: Get list of available licenses
tags:
- Static Analysis
x-unstable: '**Note**: This endpoint may be subject to changes.'
/api/v2/static-analysis-sca/vulnerabilities/resolve-vulnerable-symbols:
post:
operationId: CreateSCAResolveVulnerableSymbols
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 @@ -15040,6 +15040,41 @@ datadog\_api\_client.v2.model.library module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.licenses\_list\_request module
------------------------------------------------------------

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

datadog\_api\_client.v2.model.licenses\_list\_request\_data module
------------------------------------------------------------------

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

datadog\_api\_client.v2.model.licenses\_list\_request\_data\_attributes module
------------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.licenses\_list\_request\_data\_type module
------------------------------------------------------------------------

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

datadog\_api\_client.v2.model.licenses\_list\_request\_license module
---------------------------------------------------------------------

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

datadog\_api\_client.v2.model.links module
------------------------------------------

Expand Down
14 changes: 14 additions & 0 deletions examples/v2/static-analysis/GetLicenses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Get list of available licenses returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi

configuration = Configuration()
configuration.unstable_operations["get_licenses"] = True
with ApiClient(configuration) as api_client:
api_instance = StaticAnalysisApi(api_client)
response = api_instance.get_licenses()

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def __init__(
"v2.get_custom_rule": False,
"v2.get_custom_rule_revision": False,
"v2.get_custom_ruleset": False,
"v2.get_licenses": False,
"v2.list_custom_rule_revisions": False,
"v2.revert_custom_rule_revision": False,
"v2.update_custom_ruleset": False,
Expand Down
29 changes: 29 additions & 0 deletions src/datadog_api_client/v2/api/static_analysis_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
unset,
)
from datadog_api_client.v2.model.sca_request import ScaRequest
from datadog_api_client.v2.model.licenses_list_request import LicensesListRequest
from datadog_api_client.v2.model.resolve_vulnerable_symbols_response import ResolveVulnerableSymbolsResponse
from datadog_api_client.v2.model.resolve_vulnerable_symbols_request import ResolveVulnerableSymbolsRequest
from datadog_api_client.v2.model.custom_ruleset_response import CustomRulesetResponse
Expand Down Expand Up @@ -275,6 +276,22 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_licenses_endpoint = _Endpoint(
settings={
"response_type": (LicensesListRequest,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/static-analysis-sca/licenses/list",
"operation_id": "get_licenses",
"http_method": "GET",
"version": "v2",
},
params_map={},
headers_map={
"accept": ["*/*"],
},
api_client=api_client,
)

self._list_custom_rule_revisions_endpoint = _Endpoint(
settings={
"response_type": (CustomRuleRevisionsResponse,),
Expand Down Expand Up @@ -552,6 +569,18 @@ def get_custom_ruleset(

return self._get_custom_ruleset_endpoint.call_with_http_info(**kwargs)

def get_licenses(
self,
) -> LicensesListRequest:
"""Get list of available licenses.

Returns a list of all available license identifiers and display names that can be used for filtering and categorization in SCA.

:rtype: LicensesListRequest
"""
kwargs: Dict[str, Any] = {}
return self._get_licenses_endpoint.call_with_http_info(**kwargs)

def list_custom_rule_revisions(
self,
ruleset_name: str,
Expand Down
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/licenses_list_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.licenses_list_request_data import LicensesListRequestData


class LicensesListRequest(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.licenses_list_request_data import LicensesListRequestData

return {
"data": (LicensesListRequestData,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[LicensesListRequestData, UnsetType] = unset, **kwargs):
"""


:param data:
:type data: LicensesListRequestData, optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
64 changes: 64 additions & 0 deletions src/datadog_api_client/v2/model/licenses_list_request_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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.licenses_list_request_data_attributes import LicensesListRequestDataAttributes
from datadog_api_client.v2.model.licenses_list_request_data_type import LicensesListRequestDataType


class LicensesListRequestData(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.licenses_list_request_data_attributes import LicensesListRequestDataAttributes
from datadog_api_client.v2.model.licenses_list_request_data_type import LicensesListRequestDataType

return {
"attributes": (LicensesListRequestDataAttributes,),
"id": (str,),
"type": (LicensesListRequestDataType,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"type": "type",
}

def __init__(
self_,
type: LicensesListRequestDataType,
attributes: Union[LicensesListRequestDataAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
**kwargs,
):
"""


:param attributes:
:type attributes: LicensesListRequestDataAttributes, optional

:param id: Unique identifier for the request
:type id: str, optional

:param type:
:type type: LicensesListRequestDataType
"""
if attributes is not unset:
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
super().__init__(kwargs)

self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 List, Union, TYPE_CHECKING

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


if TYPE_CHECKING:
from datadog_api_client.v2.model.licenses_list_request_license import LicensesListRequestLicense


class LicensesListRequestDataAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.licenses_list_request_license import LicensesListRequestLicense

return {
"licenses": ([LicensesListRequestLicense],),
}

attribute_map = {
"licenses": "licenses",
}

def __init__(self_, licenses: Union[List[LicensesListRequestLicense], UnsetType] = unset, **kwargs):
"""


:param licenses: List of available licenses
:type licenses: [LicensesListRequestLicense], optional
"""
if licenses is not unset:
kwargs["licenses"] = licenses
super().__init__(kwargs)
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 LicensesListRequestDataType(ModelSimple):
"""


:param value: If omitted defaults to "licenserequest". Must be one of ["licenserequest"].
:type value: str
"""

allowed_values = {
"licenserequest",
}
LICENSEREQUEST: ClassVar["LicensesListRequestDataType"]

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


LicensesListRequestDataType.LICENSEREQUEST = LicensesListRequestDataType("licenserequest")
Loading