From a37b750f86383364d8e46e5f8954d93b158cf0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Tue, 22 Mar 2022 09:42:18 +0100 Subject: [PATCH 1/6] Fix snake case issues A few operations and models are affected by a small problem where a character gets isolated. This fixes it. --- .generator/src/generator/cli.py | 4 +- .generator/src/generator/openapi.py | 10 ++ .generator/src/generator/templates/api.j2 | 14 +-- .../src/generator/templates/configuration.j2 | 2 +- .../src/generator/templates/model_generic.j2 | 2 +- .../src/generator/templates/model_oneof.j2 | 2 +- .../src/generator/templates/model_simple.j2 | 2 +- .generator/src/generator/templates/models.j2 | 2 +- docs/datadog_api_client.v1.model.rst | 44 ++++----- docs/datadog_api_client.v2.model.rst | 96 +++++++++---------- .../v1/api/organizations_api.py | 12 +-- .../v1/api/usage_metering_api.py | 2 +- .../v1/model/synthetics_basic_auth.py | 2 +- ..._ntlm.py => synthetics_basic_authn_tlm.py} | 2 +- ....py => synthetics_basic_authn_tlm_type.py} | 0 .../{usage_io_t_hour.py => usage_iot_hour.py} | 0 ...io_t_response.py => usage_iot_response.py} | 2 +- src/datadog_api_client/v1/models/__init__.py | 8 +- .../v2/api/auth_n_mappings_api.py | 70 +++++++------- .../{auth_n_mapping.py => authn_mapping.py} | 8 +- ...ributes.py => authn_mapping_attributes.py} | 0 ....py => authn_mapping_create_attributes.py} | 0 ...e_data.py => authn_mapping_create_data.py} | 6 +- ... => authn_mapping_create_relationships.py} | 0 ...est.py => authn_mapping_create_request.py} | 2 +- ..._included.py => authn_mapping_included.py} | 0 ...hips.py => authn_mapping_relationships.py} | 0 ..._response.py => authn_mapping_response.py} | 2 +- ....py => authn_mapping_update_attributes.py} | 0 ...e_data.py => authn_mapping_update_data.py} | 6 +- ... => authn_mapping_update_relationships.py} | 0 ...est.py => authn_mapping_update_request.py} | 2 +- ...response.py => authn_mappings_response.py} | 2 +- ...appings_sort.py => authn_mappings_sort.py} | 0 ...appings_type.py => authn_mappings_type.py} | 0 src/datadog_api_client/v2/models/__init__.py | 32 +++---- 36 files changed, 174 insertions(+), 162 deletions(-) rename src/datadog_api_client/v1/model/{synthetics_basic_auth_ntlm.py => synthetics_basic_authn_tlm.py} (97%) rename src/datadog_api_client/v1/model/{synthetics_basic_auth_ntlm_type.py => synthetics_basic_authn_tlm_type.py} (100%) rename src/datadog_api_client/v1/model/{usage_io_t_hour.py => usage_iot_hour.py} (100%) rename src/datadog_api_client/v1/model/{usage_io_t_response.py => usage_iot_response.py} (94%) rename src/datadog_api_client/v2/model/{auth_n_mapping.py => authn_mapping.py} (86%) rename src/datadog_api_client/v2/model/{auth_n_mapping_attributes.py => authn_mapping_attributes.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_create_attributes.py => authn_mapping_create_attributes.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_create_data.py => authn_mapping_create_data.py} (86%) rename src/datadog_api_client/v2/model/{auth_n_mapping_create_relationships.py => authn_mapping_create_relationships.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_create_request.py => authn_mapping_create_request.py} (93%) rename src/datadog_api_client/v2/model/{auth_n_mapping_included.py => authn_mapping_included.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_relationships.py => authn_mapping_relationships.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_response.py => authn_mapping_response.py} (94%) rename src/datadog_api_client/v2/model/{auth_n_mapping_update_attributes.py => authn_mapping_update_attributes.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_update_data.py => authn_mapping_update_data.py} (87%) rename src/datadog_api_client/v2/model/{auth_n_mapping_update_relationships.py => authn_mapping_update_relationships.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mapping_update_request.py => authn_mapping_update_request.py} (93%) rename src/datadog_api_client/v2/model/{auth_n_mappings_response.py => authn_mappings_response.py} (95%) rename src/datadog_api_client/v2/model/{auth_n_mappings_sort.py => authn_mappings_sort.py} (100%) rename src/datadog_api_client/v2/model/{auth_n_mappings_type.py => authn_mappings_type.py} (100%) diff --git a/.generator/src/generator/cli.py b/.generator/src/generator/cli.py index 77a7395144..4340b53046 100644 --- a/.generator/src/generator/cli.py +++ b/.generator/src/generator/cli.py @@ -39,6 +39,8 @@ def cli(input, output): env.filters["parameters"] = openapi.parameters env.filters["return_type"] = openapi.return_type env.filters["snake_case"] = formatter.snake_case + env.filters["operation_name"] = openapi.operation_name + env.filters["model_name"] = openapi.model_name env.globals["enumerate"] = enumerate env.globals["version"] = version @@ -88,7 +90,7 @@ def cli(input, output): package.mkdir(exist_ok=True) for name, model in models.items(): - filename = formatter.snake_case(name) + ".py" + filename = openapi.model_name(name) + ".py" model_path = package / "model" / filename model_path.parent.mkdir(parents=True, exist_ok=True) with model_path.open("w") as fp: diff --git a/.generator/src/generator/openapi.py b/.generator/src/generator/openapi.py index 917466f9e2..79b39217f0 100644 --- a/.generator/src/generator/openapi.py +++ b/.generator/src/generator/openapi.py @@ -286,6 +286,16 @@ def operation(spec, operation_id): return None +def operation_name(operation_id): + operation_id = operation_id.replace("IdP", "Idp").replace("AuthN", "Authn") + return formatter.snake_case(operation_id) + + +def model_name(model): + model = model.replace("IoT", "Iot").replace("AuthN", "Authn") + return formatter.snake_case(model) + + def get_api_models(operations): seen = set() for _, _, operation in operations: diff --git a/.generator/src/generator/templates/api.j2 b/.generator/src/generator/templates/api.j2 index 4874372f1a..a692740491 100644 --- a/.generator/src/generator/templates/api.j2 +++ b/.generator/src/generator/templates/api.j2 @@ -9,7 +9,7 @@ from {{ package }}.model_utils import ( none_type, ) {%- for model in get_api_models(operations) %} -from {{ package }}.{{ version }}.model.{{ model|snake_case }} import {{ model }} +from {{ package }}.{{ version }}.model.{{ model|model_name }} import {{ model }} {%- endfor %} {% set classname = name.replace(" ", "") + "Api" %} @@ -22,14 +22,14 @@ class {{ classname }}: {% for path, method, operation in operations|sort(attribute="2.operationId") %} {%- set httpMethod = method.upper() %} {%- set returnType = operation|return_type %} - self._{{ operation.operationId|snake_case }}_endpoint = _Endpoint( + self._{{ operation.operationId|operation_name }}_endpoint = _Endpoint( settings={ "response_type": {% if returnType %}({{ returnType }},){% else %}None{% endif %}, {%- set authMethods = operation.security if "security" in operation else openapi.security %} "auth": [ {%- for auth in (authMethods or []) %}"{{ '", "'.join(auth.keys()) }}"{%- if not loop.last %}, {% endif %}{%- endfor %}], "endpoint_path": "{{ path }}", - "operation_id": "{{ operation.operationId|snake_case }}", + "operation_id": "{{ operation.operationId|operation_name }}", "http_method": "{{httpMethod}}", {%- set servers = operation.servers %} {%- if servers %} @@ -129,7 +129,7 @@ class {{ classname }}: {% endfor %} {%- for path, method, operation in operations|sort(attribute="2.operationId") %} - def {{ operation.operationId|snake_case }}(self, {% for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}**kwargs): + def {{ operation.operationId|operation_name }}(self, {% for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}**kwargs): """{{ operation.summary|indent(8) }}. {% if operation.description %} {{ operation.description.replace("\\", "\\\\")|indent(8) }} @@ -137,7 +137,7 @@ class {{ classname }}: This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.{{ operation.operationId|snake_case }}( + >>> thread = api.{{ operation.operationId|operation_name }}( {%- for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}async_req=True) >>> result = thread.get() {# keep new line #} @@ -179,9 +179,9 @@ class {{ classname }}: {%- set returnType = operation|return_type %} :rtype: {% if returnType %}{{ returnType }}{% else %}None{% endif %} """ - kwargs = self._{{ operation.operationId|snake_case }}_endpoint.default_arguments(kwargs) + kwargs = self._{{ operation.operationId|operation_name }}_endpoint.default_arguments(kwargs) {%- for name, parameter in operation|parameters if parameter.required %} kwargs["{{ name|attribute_name }}"] = {{ name|attribute_name }} {% endfor %} - return self._{{ operation.operationId|snake_case }}_endpoint.call_with_http_info(**kwargs) + return self._{{ operation.operationId|operation_name }}_endpoint.call_with_http_info(**kwargs) {% endfor %} diff --git a/.generator/src/generator/templates/configuration.j2 b/.generator/src/generator/templates/configuration.j2 index 4ebf450670..2d470d3fb1 100644 --- a/.generator/src/generator/templates/configuration.j2 +++ b/.generator/src/generator/templates/configuration.j2 @@ -33,7 +33,7 @@ class Configuration(BaseConfiguration): {%- for operations in apis.values() %} {%- for _, _, operation in operations|sort(attribute="2.operationId") %} {%- if "x-unstable" in operation %} - "{{ operation.operationId|snake_case }}": False, + "{{ operation.operationId|operation_name }}": False, {%- endif %} {%- endfor %} {%- endfor %} diff --git a/.generator/src/generator/templates/model_generic.j2 b/.generator/src/generator/templates/model_generic.j2 index 47e3ff17c8..e95df6435c 100644 --- a/.generator/src/generator/templates/model_generic.j2 +++ b/.generator/src/generator/templates/model_generic.j2 @@ -2,7 +2,7 @@ {%- if refs %} def lazy_import(): {%- for ref in refs %} - from {{ package }}.{{ version }}.model.{{ ref|snake_case }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} {%- endfor %} {# keep new line #} {%- for ref in refs %} diff --git a/.generator/src/generator/templates/model_oneof.j2 b/.generator/src/generator/templates/model_oneof.j2 index 6b8827f037..682db99dda 100644 --- a/.generator/src/generator/templates/model_oneof.j2 +++ b/.generator/src/generator/templates/model_oneof.j2 @@ -2,7 +2,7 @@ {%- if refs %} def lazy_import(): {%- for ref in refs %} - from {{ package }}.{{ version }}.model.{{ ref|snake_case }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} {%- endfor %} {%- for ref in refs %} globals()["{{ ref }}"] = {{ ref }} diff --git a/.generator/src/generator/templates/model_simple.j2 b/.generator/src/generator/templates/model_simple.j2 index a5650c337d..429d0f3fe6 100644 --- a/.generator/src/generator/templates/model_simple.j2 +++ b/.generator/src/generator/templates/model_simple.j2 @@ -1,7 +1,7 @@ {%- set ref = get_type_for_items(model) %} {%- if ref %} def lazy_import(): - from {{ package }}.{{ version }}.model.{{ ref|snake_case }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} globals()["{{ ref }}"] = {{ ref }} {%- endif %} diff --git a/.generator/src/generator/templates/models.j2 b/.generator/src/generator/templates/models.j2 index 03a9a1e426..26e801b0db 100644 --- a/.generator/src/generator/templates/models.j2 +++ b/.generator/src/generator/templates/models.j2 @@ -1,4 +1,4 @@ {%- for model in models %} -from {{ package }}.{{ version }}.model.{{ model|snake_case }} import {{ model }} +from {{ package }}.{{ version }}.model.{{ model|model_name }} import {{ model }} {%- endfor %} diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 10550543bf..535ff31614 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -3529,22 +3529,6 @@ synthetics\_basic\_auth :undoc-members: :show-inheritance: -synthetics\_basic\_auth\_ntlm ------------------------------ - -.. automodule:: datadog_api_client.v1.model.synthetics_basic_auth_ntlm - :members: - :undoc-members: - :show-inheritance: - -synthetics\_basic\_auth\_ntlm\_type ------------------------------------ - -.. automodule:: datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type - :members: - :undoc-members: - :show-inheritance: - synthetics\_basic\_auth\_sigv4 ------------------------------ @@ -3577,6 +3561,22 @@ synthetics\_basic\_auth\_web\_type :undoc-members: :show-inheritance: +synthetics\_basic\_authn\_tlm +----------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_basic_authn_tlm + :members: + :undoc-members: + :show-inheritance: + +synthetics\_basic\_authn\_tlm\_type +----------------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_basic_authn_tlm_type + :members: + :undoc-members: + :show-inheritance: + synthetics\_batch\_details -------------------------- @@ -4769,18 +4769,18 @@ usage\_ingested\_spans\_response :undoc-members: :show-inheritance: -usage\_io\_t\_hour ------------------- +usage\_iot\_hour +---------------- -.. automodule:: datadog_api_client.v1.model.usage_io_t_hour +.. automodule:: datadog_api_client.v1.model.usage_iot_hour :members: :undoc-members: :show-inheritance: -usage\_io\_t\_response ----------------------- +usage\_iot\_response +-------------------- -.. automodule:: datadog_api_client.v1.model.usage_io_t_response +.. automodule:: datadog_api_client.v1.model.usage_iot_response :members: :undoc-members: :show-inheritance: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 97b266a407..8074eea69c 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -305,130 +305,130 @@ audit\_logs\_warning :undoc-members: :show-inheritance: -auth\_n\_mapping ----------------- +authn\_mapping +-------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping +.. automodule:: datadog_api_client.v2.model.authn_mapping :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_attributes ----------------------------- +authn\_mapping\_attributes +-------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_attributes +.. automodule:: datadog_api_client.v2.model.authn_mapping_attributes :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_create\_attributes ------------------------------------- +authn\_mapping\_create\_attributes +---------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_create_attributes +.. automodule:: datadog_api_client.v2.model.authn_mapping_create_attributes :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_create\_data ------------------------------- +authn\_mapping\_create\_data +---------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_create_data +.. automodule:: datadog_api_client.v2.model.authn_mapping_create_data :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_create\_relationships ---------------------------------------- +authn\_mapping\_create\_relationships +------------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_create_relationships +.. automodule:: datadog_api_client.v2.model.authn_mapping_create_relationships :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_create\_request ---------------------------------- +authn\_mapping\_create\_request +------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_create_request +.. automodule:: datadog_api_client.v2.model.authn_mapping_create_request :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_included --------------------------- +authn\_mapping\_included +------------------------ -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_included +.. automodule:: datadog_api_client.v2.model.authn_mapping_included :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_relationships -------------------------------- +authn\_mapping\_relationships +----------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_relationships +.. automodule:: datadog_api_client.v2.model.authn_mapping_relationships :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_response --------------------------- +authn\_mapping\_response +------------------------ -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_response +.. automodule:: datadog_api_client.v2.model.authn_mapping_response :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_update\_attributes ------------------------------------- +authn\_mapping\_update\_attributes +---------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_update_attributes +.. automodule:: datadog_api_client.v2.model.authn_mapping_update_attributes :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_update\_data ------------------------------- +authn\_mapping\_update\_data +---------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_update_data +.. automodule:: datadog_api_client.v2.model.authn_mapping_update_data :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_update\_relationships ---------------------------------------- +authn\_mapping\_update\_relationships +------------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_update_relationships +.. automodule:: datadog_api_client.v2.model.authn_mapping_update_relationships :members: :undoc-members: :show-inheritance: -auth\_n\_mapping\_update\_request ---------------------------------- +authn\_mapping\_update\_request +------------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mapping_update_request +.. automodule:: datadog_api_client.v2.model.authn_mapping_update_request :members: :undoc-members: :show-inheritance: -auth\_n\_mappings\_response ---------------------------- +authn\_mappings\_response +------------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mappings_response +.. automodule:: datadog_api_client.v2.model.authn_mappings_response :members: :undoc-members: :show-inheritance: -auth\_n\_mappings\_sort ------------------------ +authn\_mappings\_sort +--------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mappings_sort +.. automodule:: datadog_api_client.v2.model.authn_mappings_sort :members: :undoc-members: :show-inheritance: -auth\_n\_mappings\_type ------------------------ +authn\_mappings\_type +--------------------- -.. automodule:: datadog_api_client.v2.model.auth_n_mappings_type +.. automodule:: datadog_api_client.v2.model.authn_mappings_type :members: :undoc-members: :show-inheritance: diff --git a/src/datadog_api_client/v1/api/organizations_api.py b/src/datadog_api_client/v1/api/organizations_api.py index fe0690371b..be87ff0201 100644 --- a/src/datadog_api_client/v1/api/organizations_api.py +++ b/src/datadog_api_client/v1/api/organizations_api.py @@ -108,12 +108,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._upload_id_p_for_org_endpoint = _Endpoint( + self._upload_idp_for_org_endpoint = _Endpoint( settings={ "response_type": (IdpResponse,), "auth": ["apiKeyAuth", "appKeyAuth"], "endpoint_path": "/api/v1/org/{public_id}/idp_metadata", - "operation_id": "upload_id_p_for_org", + "operation_id": "upload_idp_for_org", "http_method": "POST", "servers": None, }, @@ -319,7 +319,7 @@ def update_org(self, public_id, body, **kwargs): return self._update_org_endpoint.call_with_http_info(**kwargs) - def upload_id_p_for_org(self, public_id, idp_file, **kwargs): + def upload_idp_for_org(self, public_id, idp_file, **kwargs): """Upload IdP metadata. There are a couple of options for updating the Identity Provider (IdP) @@ -332,7 +332,7 @@ def upload_id_p_for_org(self, public_id, idp_file, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.upload_id_p_for_org(public_id, idp_file, async_req=True) + >>> thread = api.upload_idp_for_org(public_id, idp_file, async_req=True) >>> result = thread.get() :param public_id: The `public_id` of the organization you are operating with @@ -365,9 +365,9 @@ def upload_id_p_for_org(self, public_id, idp_file, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: IdpResponse """ - kwargs = self._upload_id_p_for_org_endpoint.default_arguments(kwargs) + kwargs = self._upload_idp_for_org_endpoint.default_arguments(kwargs) kwargs["public_id"] = public_id kwargs["idp_file"] = idp_file - return self._upload_id_p_for_org_endpoint.call_with_http_info(**kwargs) + return self._upload_idp_for_org_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v1/api/usage_metering_api.py b/src/datadog_api_client/v1/api/usage_metering_api.py index 03160a9a38..835e52504d 100644 --- a/src/datadog_api_client/v1/api/usage_metering_api.py +++ b/src/datadog_api_client/v1/api/usage_metering_api.py @@ -31,7 +31,7 @@ from datadog_api_client.v1.model.usage_incident_management_response import UsageIncidentManagementResponse from datadog_api_client.v1.model.usage_indexed_spans_response import UsageIndexedSpansResponse from datadog_api_client.v1.model.usage_ingested_spans_response import UsageIngestedSpansResponse -from datadog_api_client.v1.model.usage_io_t_response import UsageIoTResponse +from datadog_api_client.v1.model.usage_iot_response import UsageIoTResponse from datadog_api_client.v1.model.usage_logs_response import UsageLogsResponse from datadog_api_client.v1.model.usage_logs_by_retention_response import UsageLogsByRetentionResponse from datadog_api_client.v1.model.usage_logs_by_index_response import UsageLogsByIndexResponse diff --git a/src/datadog_api_client/v1/model/synthetics_basic_auth.py b/src/datadog_api_client/v1/model/synthetics_basic_auth.py index f62e597331..b54e7a8f68 100644 --- a/src/datadog_api_client/v1/model/synthetics_basic_auth.py +++ b/src/datadog_api_client/v1/model/synthetics_basic_auth.py @@ -12,7 +12,7 @@ def lazy_import(): from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb from datadog_api_client.v1.model.synthetics_basic_auth_sigv4 import SyntheticsBasicAuthSigv4 - from datadog_api_client.v1.model.synthetics_basic_auth_ntlm import SyntheticsBasicAuthNTLM + from datadog_api_client.v1.model.synthetics_basic_authn_tlm import SyntheticsBasicAuthNTLM globals()["SyntheticsBasicAuthWeb"] = SyntheticsBasicAuthWeb globals()["SyntheticsBasicAuthSigv4"] = SyntheticsBasicAuthSigv4 diff --git a/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py b/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py similarity index 97% rename from src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py rename to src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py index 5ff8d4eef5..aa306a9815 100644 --- a/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py +++ b/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type import SyntheticsBasicAuthNTLMType + from datadog_api_client.v1.model.synthetics_basic_authn_tlm_type import SyntheticsBasicAuthNTLMType globals()["SyntheticsBasicAuthNTLMType"] = SyntheticsBasicAuthNTLMType diff --git a/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm_type.py b/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm_type.py similarity index 100% rename from src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm_type.py rename to src/datadog_api_client/v1/model/synthetics_basic_authn_tlm_type.py diff --git a/src/datadog_api_client/v1/model/usage_io_t_hour.py b/src/datadog_api_client/v1/model/usage_iot_hour.py similarity index 100% rename from src/datadog_api_client/v1/model/usage_io_t_hour.py rename to src/datadog_api_client/v1/model/usage_iot_hour.py diff --git a/src/datadog_api_client/v1/model/usage_io_t_response.py b/src/datadog_api_client/v1/model/usage_iot_response.py similarity index 94% rename from src/datadog_api_client/v1/model/usage_io_t_response.py rename to src/datadog_api_client/v1/model/usage_iot_response.py index 38182db9e7..9b396dfdc2 100644 --- a/src/datadog_api_client/v1/model/usage_io_t_response.py +++ b/src/datadog_api_client/v1/model/usage_iot_response.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v1.model.usage_io_t_hour import UsageIoTHour + from datadog_api_client.v1.model.usage_iot_hour import UsageIoTHour globals()["UsageIoTHour"] = UsageIoTHour diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index a976f1921a..f715c1a713 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -493,8 +493,8 @@ from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType from datadog_api_client.v1.model.synthetics_basic_auth import SyntheticsBasicAuth -from datadog_api_client.v1.model.synthetics_basic_auth_ntlm import SyntheticsBasicAuthNTLM -from datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type import SyntheticsBasicAuthNTLMType +from datadog_api_client.v1.model.synthetics_basic_authn_tlm import SyntheticsBasicAuthNTLM +from datadog_api_client.v1.model.synthetics_basic_authn_tlm_type import SyntheticsBasicAuthNTLMType from datadog_api_client.v1.model.synthetics_basic_auth_sigv4 import SyntheticsBasicAuthSigv4 from datadog_api_client.v1.model.synthetics_basic_auth_sigv4_type import SyntheticsBasicAuthSigv4Type from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb @@ -672,8 +672,8 @@ from datadog_api_client.v1.model.usage_indexed_spans_response import UsageIndexedSpansResponse from datadog_api_client.v1.model.usage_ingested_spans_hour import UsageIngestedSpansHour from datadog_api_client.v1.model.usage_ingested_spans_response import UsageIngestedSpansResponse -from datadog_api_client.v1.model.usage_io_t_hour import UsageIoTHour -from datadog_api_client.v1.model.usage_io_t_response import UsageIoTResponse +from datadog_api_client.v1.model.usage_iot_hour import UsageIoTHour +from datadog_api_client.v1.model.usage_iot_response import UsageIoTResponse from datadog_api_client.v1.model.usage_lambda_hour import UsageLambdaHour from datadog_api_client.v1.model.usage_lambda_response import UsageLambdaResponse from datadog_api_client.v1.model.usage_logs_by_index_hour import UsageLogsByIndexHour diff --git a/src/datadog_api_client/v2/api/auth_n_mappings_api.py b/src/datadog_api_client/v2/api/auth_n_mappings_api.py index 3a71a42122..d53cfae744 100644 --- a/src/datadog_api_client/v2/api/auth_n_mappings_api.py +++ b/src/datadog_api_client/v2/api/auth_n_mappings_api.py @@ -4,11 +4,11 @@ from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint -from datadog_api_client.v2.model.auth_n_mappings_response import AuthNMappingsResponse -from datadog_api_client.v2.model.auth_n_mappings_sort import AuthNMappingsSort -from datadog_api_client.v2.model.auth_n_mapping_response import AuthNMappingResponse -from datadog_api_client.v2.model.auth_n_mapping_create_request import AuthNMappingCreateRequest -from datadog_api_client.v2.model.auth_n_mapping_update_request import AuthNMappingUpdateRequest +from datadog_api_client.v2.model.authn_mappings_response import AuthNMappingsResponse +from datadog_api_client.v2.model.authn_mappings_sort import AuthNMappingsSort +from datadog_api_client.v2.model.authn_mapping_response import AuthNMappingResponse +from datadog_api_client.v2.model.authn_mapping_create_request import AuthNMappingCreateRequest +from datadog_api_client.v2.model.authn_mapping_update_request import AuthNMappingUpdateRequest class AuthNMappingsApi: @@ -17,12 +17,12 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - self._create_auth_n_mapping_endpoint = _Endpoint( + self._create_authn_mapping_endpoint = _Endpoint( settings={ "response_type": (AuthNMappingResponse,), "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/authn_mappings", - "operation_id": "create_auth_n_mapping", + "operation_id": "create_authn_mapping", "http_method": "POST", "servers": None, }, @@ -37,12 +37,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._delete_auth_n_mapping_endpoint = _Endpoint( + self._delete_authn_mapping_endpoint = _Endpoint( settings={ "response_type": None, "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/authn_mappings/{authn_mapping_id}", - "operation_id": "delete_auth_n_mapping", + "operation_id": "delete_authn_mapping", "http_method": "DELETE", "servers": None, }, @@ -61,12 +61,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._get_auth_n_mapping_endpoint = _Endpoint( + self._get_authn_mapping_endpoint = _Endpoint( settings={ "response_type": (AuthNMappingResponse,), "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/authn_mappings/{authn_mapping_id}", - "operation_id": "get_auth_n_mapping", + "operation_id": "get_authn_mapping", "http_method": "GET", "servers": None, }, @@ -85,12 +85,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._list_auth_n_mappings_endpoint = _Endpoint( + self._list_authn_mappings_endpoint = _Endpoint( settings={ "response_type": (AuthNMappingsResponse,), "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/authn_mappings", - "operation_id": "list_auth_n_mappings", + "operation_id": "list_authn_mappings", "http_method": "GET", "servers": None, }, @@ -129,12 +129,12 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._update_auth_n_mapping_endpoint = _Endpoint( + self._update_authn_mapping_endpoint = _Endpoint( settings={ "response_type": (AuthNMappingResponse,), "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/authn_mappings/{authn_mapping_id}", - "operation_id": "update_auth_n_mapping", + "operation_id": "update_authn_mapping", "http_method": "PATCH", "servers": None, }, @@ -155,7 +155,7 @@ def __init__(self, api_client=None): api_client=api_client, ) - def create_auth_n_mapping(self, body, **kwargs): + def create_authn_mapping(self, body, **kwargs): """Create an AuthN Mapping. Create an AuthN Mapping. @@ -163,7 +163,7 @@ def create_auth_n_mapping(self, body, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.create_auth_n_mapping(body, async_req=True) + >>> thread = api.create_authn_mapping(body, async_req=True) >>> result = thread.get() :type body: AuthNMappingCreateRequest @@ -193,12 +193,12 @@ def create_auth_n_mapping(self, body, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: AuthNMappingResponse """ - kwargs = self._create_auth_n_mapping_endpoint.default_arguments(kwargs) + kwargs = self._create_authn_mapping_endpoint.default_arguments(kwargs) kwargs["body"] = body - return self._create_auth_n_mapping_endpoint.call_with_http_info(**kwargs) + return self._create_authn_mapping_endpoint.call_with_http_info(**kwargs) - def delete_auth_n_mapping(self, authn_mapping_id, **kwargs): + def delete_authn_mapping(self, authn_mapping_id, **kwargs): """Delete an AuthN Mapping. Delete an AuthN Mapping specified by AuthN Mapping UUID. @@ -206,7 +206,7 @@ def delete_auth_n_mapping(self, authn_mapping_id, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.delete_auth_n_mapping(authn_mapping_id, async_req=True) + >>> thread = api.delete_authn_mapping(authn_mapping_id, async_req=True) >>> result = thread.get() :param authn_mapping_id: The UUID of the AuthN Mapping. @@ -237,12 +237,12 @@ def delete_auth_n_mapping(self, authn_mapping_id, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: None """ - kwargs = self._delete_auth_n_mapping_endpoint.default_arguments(kwargs) + kwargs = self._delete_authn_mapping_endpoint.default_arguments(kwargs) kwargs["authn_mapping_id"] = authn_mapping_id - return self._delete_auth_n_mapping_endpoint.call_with_http_info(**kwargs) + return self._delete_authn_mapping_endpoint.call_with_http_info(**kwargs) - def get_auth_n_mapping(self, authn_mapping_id, **kwargs): + def get_authn_mapping(self, authn_mapping_id, **kwargs): """Get an AuthN Mapping by UUID. Get an AuthN Mapping specified by the AuthN Mapping UUID. @@ -250,7 +250,7 @@ def get_auth_n_mapping(self, authn_mapping_id, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.get_auth_n_mapping(authn_mapping_id, async_req=True) + >>> thread = api.get_authn_mapping(authn_mapping_id, async_req=True) >>> result = thread.get() :param authn_mapping_id: The UUID of the AuthN Mapping. @@ -281,12 +281,12 @@ def get_auth_n_mapping(self, authn_mapping_id, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: AuthNMappingResponse """ - kwargs = self._get_auth_n_mapping_endpoint.default_arguments(kwargs) + kwargs = self._get_authn_mapping_endpoint.default_arguments(kwargs) kwargs["authn_mapping_id"] = authn_mapping_id - return self._get_auth_n_mapping_endpoint.call_with_http_info(**kwargs) + return self._get_authn_mapping_endpoint.call_with_http_info(**kwargs) - def list_auth_n_mappings(self, **kwargs): + def list_authn_mappings(self, **kwargs): """List all AuthN Mappings. List all AuthN Mappings in the org. @@ -294,7 +294,7 @@ def list_auth_n_mappings(self, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.list_auth_n_mappings(async_req=True) + >>> thread = api.list_authn_mappings(async_req=True) >>> result = thread.get() :param page_size: Size for a given page. @@ -333,10 +333,10 @@ def list_auth_n_mappings(self, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: AuthNMappingsResponse """ - kwargs = self._list_auth_n_mappings_endpoint.default_arguments(kwargs) - return self._list_auth_n_mappings_endpoint.call_with_http_info(**kwargs) + kwargs = self._list_authn_mappings_endpoint.default_arguments(kwargs) + return self._list_authn_mappings_endpoint.call_with_http_info(**kwargs) - def update_auth_n_mapping(self, authn_mapping_id, body, **kwargs): + def update_authn_mapping(self, authn_mapping_id, body, **kwargs): """Edit an AuthN Mapping. Edit an AuthN Mapping. @@ -344,7 +344,7 @@ def update_auth_n_mapping(self, authn_mapping_id, body, **kwargs): This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.update_auth_n_mapping(authn_mapping_id, body, async_req=True) + >>> thread = api.update_authn_mapping(authn_mapping_id, body, async_req=True) >>> result = thread.get() :param authn_mapping_id: The UUID of the AuthN Mapping. @@ -376,9 +376,9 @@ def update_auth_n_mapping(self, authn_mapping_id, body, **kwargs): :return: If the method is called asynchronously, returns the request thread. :rtype: AuthNMappingResponse """ - kwargs = self._update_auth_n_mapping_endpoint.default_arguments(kwargs) + kwargs = self._update_authn_mapping_endpoint.default_arguments(kwargs) kwargs["authn_mapping_id"] = authn_mapping_id kwargs["body"] = body - return self._update_auth_n_mapping_endpoint.call_with_http_info(**kwargs) + return self._update_authn_mapping_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/auth_n_mapping.py b/src/datadog_api_client/v2/model/authn_mapping.py similarity index 86% rename from src/datadog_api_client/v2/model/auth_n_mapping.py rename to src/datadog_api_client/v2/model/authn_mapping.py index f6c10c91dd..49c8c614b5 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping.py +++ b/src/datadog_api_client/v2/model/authn_mapping.py @@ -10,10 +10,10 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping_attributes import AuthNMappingAttributes - from datadog_api_client.v2.model.auth_n_mapping_included import AuthNMappingIncluded - from datadog_api_client.v2.model.auth_n_mapping_relationships import AuthNMappingRelationships - from datadog_api_client.v2.model.auth_n_mappings_type import AuthNMappingsType + from datadog_api_client.v2.model.authn_mapping_attributes import AuthNMappingAttributes + from datadog_api_client.v2.model.authn_mapping_included import AuthNMappingIncluded + from datadog_api_client.v2.model.authn_mapping_relationships import AuthNMappingRelationships + from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType globals()["AuthNMappingAttributes"] = AuthNMappingAttributes globals()["AuthNMappingIncluded"] = AuthNMappingIncluded diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_attributes.py b/src/datadog_api_client/v2/model/authn_mapping_attributes.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_attributes.py rename to src/datadog_api_client/v2/model/authn_mapping_attributes.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_create_attributes.py b/src/datadog_api_client/v2/model/authn_mapping_create_attributes.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_create_attributes.py rename to src/datadog_api_client/v2/model/authn_mapping_create_attributes.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_create_data.py b/src/datadog_api_client/v2/model/authn_mapping_create_data.py similarity index 86% rename from src/datadog_api_client/v2/model/auth_n_mapping_create_data.py rename to src/datadog_api_client/v2/model/authn_mapping_create_data.py index 8808e7b3b2..45be464e02 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping_create_data.py +++ b/src/datadog_api_client/v2/model/authn_mapping_create_data.py @@ -10,9 +10,9 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping_create_attributes import AuthNMappingCreateAttributes - from datadog_api_client.v2.model.auth_n_mapping_create_relationships import AuthNMappingCreateRelationships - from datadog_api_client.v2.model.auth_n_mappings_type import AuthNMappingsType + from datadog_api_client.v2.model.authn_mapping_create_attributes import AuthNMappingCreateAttributes + from datadog_api_client.v2.model.authn_mapping_create_relationships import AuthNMappingCreateRelationships + from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType globals()["AuthNMappingCreateAttributes"] = AuthNMappingCreateAttributes globals()["AuthNMappingCreateRelationships"] = AuthNMappingCreateRelationships diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_create_relationships.py b/src/datadog_api_client/v2/model/authn_mapping_create_relationships.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_create_relationships.py rename to src/datadog_api_client/v2/model/authn_mapping_create_relationships.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_create_request.py b/src/datadog_api_client/v2/model/authn_mapping_create_request.py similarity index 93% rename from src/datadog_api_client/v2/model/auth_n_mapping_create_request.py rename to src/datadog_api_client/v2/model/authn_mapping_create_request.py index 12601de795..7377dd0094 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping_create_request.py +++ b/src/datadog_api_client/v2/model/authn_mapping_create_request.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping_create_data import AuthNMappingCreateData + from datadog_api_client.v2.model.authn_mapping_create_data import AuthNMappingCreateData globals()["AuthNMappingCreateData"] = AuthNMappingCreateData diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_included.py b/src/datadog_api_client/v2/model/authn_mapping_included.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_included.py rename to src/datadog_api_client/v2/model/authn_mapping_included.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_relationships.py b/src/datadog_api_client/v2/model/authn_mapping_relationships.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_relationships.py rename to src/datadog_api_client/v2/model/authn_mapping_relationships.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_response.py b/src/datadog_api_client/v2/model/authn_mapping_response.py similarity index 94% rename from src/datadog_api_client/v2/model/auth_n_mapping_response.py rename to src/datadog_api_client/v2/model/authn_mapping_response.py index 0c4b2d518a..d44cc06ad4 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping_response.py +++ b/src/datadog_api_client/v2/model/authn_mapping_response.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping import AuthNMapping + from datadog_api_client.v2.model.authn_mapping import AuthNMapping globals()["AuthNMapping"] = AuthNMapping diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_update_attributes.py b/src/datadog_api_client/v2/model/authn_mapping_update_attributes.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_update_attributes.py rename to src/datadog_api_client/v2/model/authn_mapping_update_attributes.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_update_data.py b/src/datadog_api_client/v2/model/authn_mapping_update_data.py similarity index 87% rename from src/datadog_api_client/v2/model/auth_n_mapping_update_data.py rename to src/datadog_api_client/v2/model/authn_mapping_update_data.py index 336c12179b..99c3442576 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping_update_data.py +++ b/src/datadog_api_client/v2/model/authn_mapping_update_data.py @@ -10,9 +10,9 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping_update_attributes import AuthNMappingUpdateAttributes - from datadog_api_client.v2.model.auth_n_mapping_update_relationships import AuthNMappingUpdateRelationships - from datadog_api_client.v2.model.auth_n_mappings_type import AuthNMappingsType + from datadog_api_client.v2.model.authn_mapping_update_attributes import AuthNMappingUpdateAttributes + from datadog_api_client.v2.model.authn_mapping_update_relationships import AuthNMappingUpdateRelationships + from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType globals()["AuthNMappingUpdateAttributes"] = AuthNMappingUpdateAttributes globals()["AuthNMappingUpdateRelationships"] = AuthNMappingUpdateRelationships diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_update_relationships.py b/src/datadog_api_client/v2/model/authn_mapping_update_relationships.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mapping_update_relationships.py rename to src/datadog_api_client/v2/model/authn_mapping_update_relationships.py diff --git a/src/datadog_api_client/v2/model/auth_n_mapping_update_request.py b/src/datadog_api_client/v2/model/authn_mapping_update_request.py similarity index 93% rename from src/datadog_api_client/v2/model/auth_n_mapping_update_request.py rename to src/datadog_api_client/v2/model/authn_mapping_update_request.py index a6b65fec2e..5b2e104407 100644 --- a/src/datadog_api_client/v2/model/auth_n_mapping_update_request.py +++ b/src/datadog_api_client/v2/model/authn_mapping_update_request.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping_update_data import AuthNMappingUpdateData + from datadog_api_client.v2.model.authn_mapping_update_data import AuthNMappingUpdateData globals()["AuthNMappingUpdateData"] = AuthNMappingUpdateData diff --git a/src/datadog_api_client/v2/model/auth_n_mappings_response.py b/src/datadog_api_client/v2/model/authn_mappings_response.py similarity index 95% rename from src/datadog_api_client/v2/model/auth_n_mappings_response.py rename to src/datadog_api_client/v2/model/authn_mappings_response.py index 074c8fb0f7..4374a8feb5 100644 --- a/src/datadog_api_client/v2/model/auth_n_mappings_response.py +++ b/src/datadog_api_client/v2/model/authn_mappings_response.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v2.model.auth_n_mapping import AuthNMapping + from datadog_api_client.v2.model.authn_mapping import AuthNMapping from datadog_api_client.v2.model.response_meta_attributes import ResponseMetaAttributes globals()["AuthNMapping"] = AuthNMapping diff --git a/src/datadog_api_client/v2/model/auth_n_mappings_sort.py b/src/datadog_api_client/v2/model/authn_mappings_sort.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mappings_sort.py rename to src/datadog_api_client/v2/model/authn_mappings_sort.py diff --git a/src/datadog_api_client/v2/model/auth_n_mappings_type.py b/src/datadog_api_client/v2/model/authn_mappings_type.py similarity index 100% rename from src/datadog_api_client/v2/model/auth_n_mappings_type.py rename to src/datadog_api_client/v2/model/authn_mappings_type.py diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index db67ad4226..5a95ec23ba 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -36,22 +36,22 @@ from datadog_api_client.v2.model.audit_logs_search_events_request import AuditLogsSearchEventsRequest from datadog_api_client.v2.model.audit_logs_sort import AuditLogsSort from datadog_api_client.v2.model.audit_logs_warning import AuditLogsWarning -from datadog_api_client.v2.model.auth_n_mapping import AuthNMapping -from datadog_api_client.v2.model.auth_n_mapping_attributes import AuthNMappingAttributes -from datadog_api_client.v2.model.auth_n_mapping_create_attributes import AuthNMappingCreateAttributes -from datadog_api_client.v2.model.auth_n_mapping_create_data import AuthNMappingCreateData -from datadog_api_client.v2.model.auth_n_mapping_create_relationships import AuthNMappingCreateRelationships -from datadog_api_client.v2.model.auth_n_mapping_create_request import AuthNMappingCreateRequest -from datadog_api_client.v2.model.auth_n_mapping_included import AuthNMappingIncluded -from datadog_api_client.v2.model.auth_n_mapping_relationships import AuthNMappingRelationships -from datadog_api_client.v2.model.auth_n_mapping_response import AuthNMappingResponse -from datadog_api_client.v2.model.auth_n_mapping_update_attributes import AuthNMappingUpdateAttributes -from datadog_api_client.v2.model.auth_n_mapping_update_data import AuthNMappingUpdateData -from datadog_api_client.v2.model.auth_n_mapping_update_relationships import AuthNMappingUpdateRelationships -from datadog_api_client.v2.model.auth_n_mapping_update_request import AuthNMappingUpdateRequest -from datadog_api_client.v2.model.auth_n_mappings_response import AuthNMappingsResponse -from datadog_api_client.v2.model.auth_n_mappings_sort import AuthNMappingsSort -from datadog_api_client.v2.model.auth_n_mappings_type import AuthNMappingsType +from datadog_api_client.v2.model.authn_mapping import AuthNMapping +from datadog_api_client.v2.model.authn_mapping_attributes import AuthNMappingAttributes +from datadog_api_client.v2.model.authn_mapping_create_attributes import AuthNMappingCreateAttributes +from datadog_api_client.v2.model.authn_mapping_create_data import AuthNMappingCreateData +from datadog_api_client.v2.model.authn_mapping_create_relationships import AuthNMappingCreateRelationships +from datadog_api_client.v2.model.authn_mapping_create_request import AuthNMappingCreateRequest +from datadog_api_client.v2.model.authn_mapping_included import AuthNMappingIncluded +from datadog_api_client.v2.model.authn_mapping_relationships import AuthNMappingRelationships +from datadog_api_client.v2.model.authn_mapping_response import AuthNMappingResponse +from datadog_api_client.v2.model.authn_mapping_update_attributes import AuthNMappingUpdateAttributes +from datadog_api_client.v2.model.authn_mapping_update_data import AuthNMappingUpdateData +from datadog_api_client.v2.model.authn_mapping_update_relationships import AuthNMappingUpdateRelationships +from datadog_api_client.v2.model.authn_mapping_update_request import AuthNMappingUpdateRequest +from datadog_api_client.v2.model.authn_mappings_response import AuthNMappingsResponse +from datadog_api_client.v2.model.authn_mappings_sort import AuthNMappingsSort +from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType from datadog_api_client.v2.model.cloud_workload_security_agent_rule_attributes import ( CloudWorkloadSecurityAgentRuleAttributes, ) From 6c486b3a2cfa075573c988f5c32b07acb1eca718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Tue, 22 Mar 2022 10:26:34 +0100 Subject: [PATCH 2/6] Fix api as well --- .generator/src/generator/cli.py | 9 +++------ .generator/src/generator/openapi.py | 11 +++-------- .generator/src/generator/templates/api.j2 | 14 +++++++------- .generator/src/generator/templates/apis.j2 | 2 +- .../src/generator/templates/configuration.j2 | 2 +- .../src/generator/templates/model_generic.j2 | 2 +- .generator/src/generator/templates/model_oneof.j2 | 2 +- .generator/src/generator/templates/model_simple.j2 | 2 +- .generator/src/generator/templates/models.j2 | 2 +- docs/datadog_api_client.v2.api.rst | 6 +++--- ...uth_n_mappings_api.py => authn_mappings_api.py} | 0 src/datadog_api_client/v2/apis/__init__.py | 2 +- tests/conftest.py | 1 + 13 files changed, 24 insertions(+), 31 deletions(-) rename src/datadog_api_client/v2/api/{auth_n_mappings_api.py => authn_mappings_api.py} (100%) diff --git a/.generator/src/generator/cli.py b/.generator/src/generator/cli.py index 4340b53046..b94ac77605 100644 --- a/.generator/src/generator/cli.py +++ b/.generator/src/generator/cli.py @@ -1,5 +1,4 @@ import pathlib - import click from jinja2 import Environment, FileSystemLoader @@ -38,9 +37,7 @@ def cli(input, output): env.filters["parameter_schema"] = openapi.parameter_schema env.filters["parameters"] = openapi.parameters env.filters["return_type"] = openapi.return_type - env.filters["snake_case"] = formatter.snake_case - env.filters["operation_name"] = openapi.operation_name - env.filters["model_name"] = openapi.model_name + env.filters["safe_snake_case"] = openapi.safe_snake_case env.globals["enumerate"] = enumerate env.globals["version"] = version @@ -90,7 +87,7 @@ def cli(input, output): package.mkdir(exist_ok=True) for name, model in models.items(): - filename = openapi.model_name(name) + ".py" + filename = openapi.safe_snake_case(name) + ".py" model_path = package / "model" / filename model_path.parent.mkdir(parents=True, exist_ok=True) with model_path.open("w") as fp: @@ -106,7 +103,7 @@ def cli(input, output): fp.write(models_j2.render(models=sorted(models))) for name, operations in apis.items(): - filename = formatter.snake_case(name) + "_api.py" + filename = openapi.safe_snake_case(name) + "_api.py" api_path = package / "api" / filename api_path.parent.mkdir(parents=True, exist_ok=True) with api_path.open("w") as fp: diff --git a/.generator/src/generator/openapi.py b/.generator/src/generator/openapi.py index 79b39217f0..8f26e1cff4 100644 --- a/.generator/src/generator/openapi.py +++ b/.generator/src/generator/openapi.py @@ -286,14 +286,9 @@ def operation(spec, operation_id): return None -def operation_name(operation_id): - operation_id = operation_id.replace("IdP", "Idp").replace("AuthN", "Authn") - return formatter.snake_case(operation_id) - - -def model_name(model): - model = model.replace("IoT", "Iot").replace("AuthN", "Authn") - return formatter.snake_case(model) +def safe_snake_case(value): + value = value.replace("IdP", "Idp").replace("AuthN", "Authn").replace("IoT", "Iot") + return formatter.snake_case(value) def get_api_models(operations): diff --git a/.generator/src/generator/templates/api.j2 b/.generator/src/generator/templates/api.j2 index a692740491..d9e6796c41 100644 --- a/.generator/src/generator/templates/api.j2 +++ b/.generator/src/generator/templates/api.j2 @@ -9,7 +9,7 @@ from {{ package }}.model_utils import ( none_type, ) {%- for model in get_api_models(operations) %} -from {{ package }}.{{ version }}.model.{{ model|model_name }} import {{ model }} +from {{ package }}.{{ version }}.model.{{ model|safe_snake_case }} import {{ model }} {%- endfor %} {% set classname = name.replace(" ", "") + "Api" %} @@ -22,14 +22,14 @@ class {{ classname }}: {% for path, method, operation in operations|sort(attribute="2.operationId") %} {%- set httpMethod = method.upper() %} {%- set returnType = operation|return_type %} - self._{{ operation.operationId|operation_name }}_endpoint = _Endpoint( + self._{{ operation.operationId|safe_snake_case }}_endpoint = _Endpoint( settings={ "response_type": {% if returnType %}({{ returnType }},){% else %}None{% endif %}, {%- set authMethods = operation.security if "security" in operation else openapi.security %} "auth": [ {%- for auth in (authMethods or []) %}"{{ '", "'.join(auth.keys()) }}"{%- if not loop.last %}, {% endif %}{%- endfor %}], "endpoint_path": "{{ path }}", - "operation_id": "{{ operation.operationId|operation_name }}", + "operation_id": "{{ operation.operationId|safe_snake_case }}", "http_method": "{{httpMethod}}", {%- set servers = operation.servers %} {%- if servers %} @@ -129,7 +129,7 @@ class {{ classname }}: {% endfor %} {%- for path, method, operation in operations|sort(attribute="2.operationId") %} - def {{ operation.operationId|operation_name }}(self, {% for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}**kwargs): + def {{ operation.operationId|safe_snake_case }}(self, {% for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}**kwargs): """{{ operation.summary|indent(8) }}. {% if operation.description %} {{ operation.description.replace("\\", "\\\\")|indent(8) }} @@ -137,7 +137,7 @@ class {{ classname }}: This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. - >>> thread = api.{{ operation.operationId|operation_name }}( + >>> thread = api.{{ operation.operationId|safe_snake_case }}( {%- for name, parameter in operation|parameters if parameter.required %}{{name|attribute_name}}, {% endfor %}async_req=True) >>> result = thread.get() {# keep new line #} @@ -179,9 +179,9 @@ class {{ classname }}: {%- set returnType = operation|return_type %} :rtype: {% if returnType %}{{ returnType }}{% else %}None{% endif %} """ - kwargs = self._{{ operation.operationId|operation_name }}_endpoint.default_arguments(kwargs) + kwargs = self._{{ operation.operationId|safe_snake_case }}_endpoint.default_arguments(kwargs) {%- for name, parameter in operation|parameters if parameter.required %} kwargs["{{ name|attribute_name }}"] = {{ name|attribute_name }} {% endfor %} - return self._{{ operation.operationId|operation_name }}_endpoint.call_with_http_info(**kwargs) + return self._{{ operation.operationId|safe_snake_case }}_endpoint.call_with_http_info(**kwargs) {% endfor %} diff --git a/.generator/src/generator/templates/apis.j2 b/.generator/src/generator/templates/apis.j2 index d9802cd902..e638fcb9e2 100644 --- a/.generator/src/generator/templates/apis.j2 +++ b/.generator/src/generator/templates/apis.j2 @@ -1,5 +1,5 @@ {%- for api in apis %} {%- set classname = api.replace(" ", "") + "Api" %} -from {{ package }}.{{ version }}.api.{{ classname|snake_case }} import {{ classname }} +from {{ package }}.{{ version }}.api.{{ classname|safe_snake_case }} import {{ classname }} {%- endfor %} diff --git a/.generator/src/generator/templates/configuration.j2 b/.generator/src/generator/templates/configuration.j2 index 2d470d3fb1..1f9b57ab79 100644 --- a/.generator/src/generator/templates/configuration.j2 +++ b/.generator/src/generator/templates/configuration.j2 @@ -33,7 +33,7 @@ class Configuration(BaseConfiguration): {%- for operations in apis.values() %} {%- for _, _, operation in operations|sort(attribute="2.operationId") %} {%- if "x-unstable" in operation %} - "{{ operation.operationId|operation_name }}": False, + "{{ operation.operationId|safe_snake_case }}": False, {%- endif %} {%- endfor %} {%- endfor %} diff --git a/.generator/src/generator/templates/model_generic.j2 b/.generator/src/generator/templates/model_generic.j2 index e95df6435c..e223873ea9 100644 --- a/.generator/src/generator/templates/model_generic.j2 +++ b/.generator/src/generator/templates/model_generic.j2 @@ -2,7 +2,7 @@ {%- if refs %} def lazy_import(): {%- for ref in refs %} - from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|safe_snake_case }} import {{ ref }} {%- endfor %} {# keep new line #} {%- for ref in refs %} diff --git a/.generator/src/generator/templates/model_oneof.j2 b/.generator/src/generator/templates/model_oneof.j2 index 682db99dda..175f4086c8 100644 --- a/.generator/src/generator/templates/model_oneof.j2 +++ b/.generator/src/generator/templates/model_oneof.j2 @@ -2,7 +2,7 @@ {%- if refs %} def lazy_import(): {%- for ref in refs %} - from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|safe_snake_case }} import {{ ref }} {%- endfor %} {%- for ref in refs %} globals()["{{ ref }}"] = {{ ref }} diff --git a/.generator/src/generator/templates/model_simple.j2 b/.generator/src/generator/templates/model_simple.j2 index 429d0f3fe6..b242174e21 100644 --- a/.generator/src/generator/templates/model_simple.j2 +++ b/.generator/src/generator/templates/model_simple.j2 @@ -1,7 +1,7 @@ {%- set ref = get_type_for_items(model) %} {%- if ref %} def lazy_import(): - from {{ package }}.{{ version }}.model.{{ ref|model_name }} import {{ ref }} + from {{ package }}.{{ version }}.model.{{ ref|safe_snake_case }} import {{ ref }} globals()["{{ ref }}"] = {{ ref }} {%- endif %} diff --git a/.generator/src/generator/templates/models.j2 b/.generator/src/generator/templates/models.j2 index 26e801b0db..fe7e383851 100644 --- a/.generator/src/generator/templates/models.j2 +++ b/.generator/src/generator/templates/models.j2 @@ -1,4 +1,4 @@ {%- for model in models %} -from {{ package }}.{{ version }}.model.{{ model|model_name }} import {{ model }} +from {{ package }}.{{ version }}.model.{{ model|safe_snake_case }} import {{ model }} {%- endfor %} diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index b495647b28..62d5484778 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -9,10 +9,10 @@ audit\_api :undoc-members: :show-inheritance: -auth\_n\_mappings\_api ----------------------- +authn\_mappings\_api +-------------------- -.. automodule:: datadog_api_client.v2.api.auth_n_mappings_api +.. automodule:: datadog_api_client.v2.api.authn_mappings_api :members: :undoc-members: :show-inheritance: diff --git a/src/datadog_api_client/v2/api/auth_n_mappings_api.py b/src/datadog_api_client/v2/api/authn_mappings_api.py similarity index 100% rename from src/datadog_api_client/v2/api/auth_n_mappings_api.py rename to src/datadog_api_client/v2/api/authn_mappings_api.py diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 9fb98289b6..3688b89b1d 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -1,5 +1,5 @@ from datadog_api_client.v2.api.audit_api import AuditApi -from datadog_api_client.v2.api.auth_n_mappings_api import AuthNMappingsApi +from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi from datadog_api_client.v2.api.dashboard_lists_api import DashboardListsApi from datadog_api_client.v2.api.incident_services_api import IncidentServicesApi diff --git a/tests/conftest.py b/tests/conftest.py index ea86222d3c..d60b244f32 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -163,6 +163,7 @@ def pytest_bdd_apply_tag(tag, function): def snake_case(value): + value = value.replace("IdP", "Idp").replace("AuthN", "Authn").replace("IoT", "Iot") s1 = PATTERN_LEADING_ALPHA.sub(r"\1_\2", value) s1 = PATTERN_FOLLOWING_ALPHA.sub(r"\1_\2", s1).lower() s1 = PATTERN_WHITESPACE.sub("_", s1) From 2af84fe2492dd6c916b14b047fe1d06ccbb2f434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Wed, 23 Mar 2022 14:19:30 +0100 Subject: [PATCH 3/6] Use a constant --- .generator/src/generator/openapi.py | 5 ++++- tests/conftest.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.generator/src/generator/openapi.py b/.generator/src/generator/openapi.py index 8f26e1cff4..86f3681167 100644 --- a/.generator/src/generator/openapi.py +++ b/.generator/src/generator/openapi.py @@ -5,6 +5,8 @@ from . import formatter +EDGE_CASES = ("IdP", "AuthN", "IoT") + def load(filename): path = pathlib.Path(filename) @@ -287,7 +289,8 @@ def operation(spec, operation_id): def safe_snake_case(value): - value = value.replace("IdP", "Idp").replace("AuthN", "Authn").replace("IoT", "Iot") + for token in EDGE_CASES: + value = value.replace(token, token.title()) return formatter.snake_case(value) diff --git a/tests/conftest.py b/tests/conftest.py index d60b244f32..e394665aa8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -65,6 +65,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): logging.basicConfig() +EDGE_CASES = ("IdP", "AuthN", "IoT") PATTERN_ALPHANUM = re.compile(r"[^A-Za-z0-9]+") PATTERN_DOUBLE_UNDERSCORE = re.compile(r"__+") PATTERN_LEADING_ALPHA = re.compile(r"(.)([A-Z][a-z]+)") @@ -163,7 +164,8 @@ def pytest_bdd_apply_tag(tag, function): def snake_case(value): - value = value.replace("IdP", "Idp").replace("AuthN", "Authn").replace("IoT", "Iot") + for token in EDGE_CASES: + value = value.replace(token, token.title()) s1 = PATTERN_LEADING_ALPHA.sub(r"\1_\2", value) s1 = PATTERN_FOLLOWING_ALPHA.sub(r"\1_\2", s1).lower() s1 = PATTERN_WHITESPACE.sub("_", s1) From 6cefce6c774a5b592c8ca276da233549635e0a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Thu, 24 Mar 2022 10:09:44 +0100 Subject: [PATCH 4/6] Fix NTML --- .generator/src/generator/openapi.py | 6 ++-- docs/datadog_api_client.v1.model.rst | 32 +++++++++---------- .../v1/model/synthetics_basic_auth.py | 2 +- ...n_tlm.py => synthetics_basic_auth_ntlm.py} | 2 +- ....py => synthetics_basic_auth_ntlm_type.py} | 0 src/datadog_api_client/v1/models/__init__.py | 4 +-- tests/conftest.py | 6 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) rename src/datadog_api_client/v1/model/{synthetics_basic_authn_tlm.py => synthetics_basic_auth_ntlm.py} (97%) rename src/datadog_api_client/v1/model/{synthetics_basic_authn_tlm_type.py => synthetics_basic_auth_ntlm_type.py} (100%) diff --git a/.generator/src/generator/openapi.py b/.generator/src/generator/openapi.py index 86f3681167..88183781f0 100644 --- a/.generator/src/generator/openapi.py +++ b/.generator/src/generator/openapi.py @@ -5,7 +5,7 @@ from . import formatter -EDGE_CASES = ("IdP", "AuthN", "IoT") +EDGE_CASES = {"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot"} def load(filename): @@ -289,8 +289,8 @@ def operation(spec, operation_id): def safe_snake_case(value): - for token in EDGE_CASES: - value = value.replace(token, token.title()) + for token, replacement in EDGE_CASES.items(): + value = value.replace(token, replacement) return formatter.snake_case(value) diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 535ff31614..31adade161 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -3529,6 +3529,22 @@ synthetics\_basic\_auth :undoc-members: :show-inheritance: +synthetics\_basic\_auth\_ntlm +----------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_basic_auth_ntlm + :members: + :undoc-members: + :show-inheritance: + +synthetics\_basic\_auth\_ntlm\_type +----------------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type + :members: + :undoc-members: + :show-inheritance: + synthetics\_basic\_auth\_sigv4 ------------------------------ @@ -3561,22 +3577,6 @@ synthetics\_basic\_auth\_web\_type :undoc-members: :show-inheritance: -synthetics\_basic\_authn\_tlm ------------------------------ - -.. automodule:: datadog_api_client.v1.model.synthetics_basic_authn_tlm - :members: - :undoc-members: - :show-inheritance: - -synthetics\_basic\_authn\_tlm\_type ------------------------------------ - -.. automodule:: datadog_api_client.v1.model.synthetics_basic_authn_tlm_type - :members: - :undoc-members: - :show-inheritance: - synthetics\_batch\_details -------------------------- diff --git a/src/datadog_api_client/v1/model/synthetics_basic_auth.py b/src/datadog_api_client/v1/model/synthetics_basic_auth.py index b54e7a8f68..f62e597331 100644 --- a/src/datadog_api_client/v1/model/synthetics_basic_auth.py +++ b/src/datadog_api_client/v1/model/synthetics_basic_auth.py @@ -12,7 +12,7 @@ def lazy_import(): from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb from datadog_api_client.v1.model.synthetics_basic_auth_sigv4 import SyntheticsBasicAuthSigv4 - from datadog_api_client.v1.model.synthetics_basic_authn_tlm import SyntheticsBasicAuthNTLM + from datadog_api_client.v1.model.synthetics_basic_auth_ntlm import SyntheticsBasicAuthNTLM globals()["SyntheticsBasicAuthWeb"] = SyntheticsBasicAuthWeb globals()["SyntheticsBasicAuthSigv4"] = SyntheticsBasicAuthSigv4 diff --git a/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py b/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py similarity index 97% rename from src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py rename to src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py index aa306a9815..5ff8d4eef5 100644 --- a/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm.py +++ b/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm.py @@ -10,7 +10,7 @@ def lazy_import(): - from datadog_api_client.v1.model.synthetics_basic_authn_tlm_type import SyntheticsBasicAuthNTLMType + from datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type import SyntheticsBasicAuthNTLMType globals()["SyntheticsBasicAuthNTLMType"] = SyntheticsBasicAuthNTLMType diff --git a/src/datadog_api_client/v1/model/synthetics_basic_authn_tlm_type.py b/src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm_type.py similarity index 100% rename from src/datadog_api_client/v1/model/synthetics_basic_authn_tlm_type.py rename to src/datadog_api_client/v1/model/synthetics_basic_auth_ntlm_type.py diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index f715c1a713..a4f30fe86c 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -493,8 +493,8 @@ from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType from datadog_api_client.v1.model.synthetics_basic_auth import SyntheticsBasicAuth -from datadog_api_client.v1.model.synthetics_basic_authn_tlm import SyntheticsBasicAuthNTLM -from datadog_api_client.v1.model.synthetics_basic_authn_tlm_type import SyntheticsBasicAuthNTLMType +from datadog_api_client.v1.model.synthetics_basic_auth_ntlm import SyntheticsBasicAuthNTLM +from datadog_api_client.v1.model.synthetics_basic_auth_ntlm_type import SyntheticsBasicAuthNTLMType from datadog_api_client.v1.model.synthetics_basic_auth_sigv4 import SyntheticsBasicAuthSigv4 from datadog_api_client.v1.model.synthetics_basic_auth_sigv4_type import SyntheticsBasicAuthSigv4Type from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb diff --git a/tests/conftest.py b/tests/conftest.py index e394665aa8..305d29997d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -65,7 +65,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): logging.basicConfig() -EDGE_CASES = ("IdP", "AuthN", "IoT") +EDGE_CASES = {"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot"} PATTERN_ALPHANUM = re.compile(r"[^A-Za-z0-9]+") PATTERN_DOUBLE_UNDERSCORE = re.compile(r"__+") PATTERN_LEADING_ALPHA = re.compile(r"(.)([A-Z][a-z]+)") @@ -164,8 +164,8 @@ def pytest_bdd_apply_tag(tag, function): def snake_case(value): - for token in EDGE_CASES: - value = value.replace(token, token.title()) + for token, replacement in EDGE_CASES.items(): + value = value.replace(token, replacement) s1 = PATTERN_LEADING_ALPHA.sub(r"\1_\2", value) s1 = PATTERN_FOLLOWING_ALPHA.sub(r"\1_\2", s1).lower() s1 = PATTERN_WHITESPACE.sub("_", s1) From 1b618e9ff5f5f0b59673e27546ebf19d5ebab95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Thu, 24 Mar 2022 19:09:13 +0100 Subject: [PATCH 5/6] Extract to JSON file --- .generator/src/generator/openapi.py | 4 +++- .generator/src/generator/replacement.json | 1 + tests/conftest.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .generator/src/generator/replacement.json diff --git a/.generator/src/generator/openapi.py b/.generator/src/generator/openapi.py index 88183781f0..82e19fd52b 100644 --- a/.generator/src/generator/openapi.py +++ b/.generator/src/generator/openapi.py @@ -1,3 +1,4 @@ +import json import pathlib import yaml from jsonref import JsonRef @@ -5,7 +6,8 @@ from . import formatter -EDGE_CASES = {"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot"} +with (pathlib.Path(__file__).parent / "replacement.json").open() as f: + EDGE_CASES = json.load(f) def load(filename): diff --git a/.generator/src/generator/replacement.json b/.generator/src/generator/replacement.json new file mode 100644 index 0000000000..3bb25627a5 --- /dev/null +++ b/.generator/src/generator/replacement.json @@ -0,0 +1 @@ +{"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot"} diff --git a/tests/conftest.py b/tests/conftest.py index 305d29997d..a722ab21ee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -65,7 +65,9 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): logging.basicConfig() -EDGE_CASES = {"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot"} +with (pathlib.Path(__file__).parent.parent / ".generator" / "src" / "generator" / "replacement.json").open() as f: + EDGE_CASES = json.load(f) + PATTERN_ALPHANUM = re.compile(r"[^A-Za-z0-9]+") PATTERN_DOUBLE_UNDERSCORE = re.compile(r"__+") PATTERN_LEADING_ALPHA = re.compile(r"(.)([A-Z][a-z]+)") From 6fe5beec7404a303eb23321b3213740c7a590c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Fri, 25 Mar 2022 09:10:26 +0100 Subject: [PATCH 6/6] Imports --- .generator/src/generator/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.generator/src/generator/cli.py b/.generator/src/generator/cli.py index b94ac77605..1a6bccfe46 100644 --- a/.generator/src/generator/cli.py +++ b/.generator/src/generator/cli.py @@ -1,4 +1,5 @@ import pathlib + import click from jinja2 import Environment, FileSystemLoader