Skip to content

Commit b84918a

Browse files
authored
Cleanup endpoints creation (#1526)
Remove some small default arguments.
1 parent 6a068f6 commit b84918a

File tree

70 files changed

+10
-753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+10
-753
lines changed

.generator/src/generator/templates/api.j2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ class {{ classname }}:
6969
},
7070
{%- endfor %}
7171
],
72-
{%- else %}
73-
"servers": None,
7472
{%- endif %}
7573
},
7674
params_map={
@@ -132,8 +130,6 @@ class {{ classname }}:
132130
{%- if operation.requestBody %}
133131
"content_type": [
134132
{%- for mediaType in operation.requestBody.content.keys() %}"{{ mediaType }}"{%- if not loop.last %}, {% endif %}{%- endfor %}]
135-
{% else %}
136-
"content_type": [],
137133
{%- endif %}
138134
},
139135
api_client=api_client,

.generator/src/generator/templates/api_client.j2

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ class Endpoint:
657657
elif is_unstable is False:
658658
raise ApiValueError("Unstable operation '{0}' is disabled".format(self.settings["operation_id"]))
659659

660+
servers = self.settings.get("servers")
660661
try:
661662
index = self.api_client.configuration.server_operation_index.get(
662663
self.settings["operation_id"], self.api_client.configuration.server_index
@@ -665,11 +666,11 @@ class Endpoint:
665666
self.settings["operation_id"], self.api_client.configuration.server_variables
666667
)
667668
host = self.api_client.configuration.get_host_from_settings(
668-
index, variables=server_variables, servers=self.settings["servers"]
669+
index, variables=server_variables, servers=servers
669670
)
670671
except IndexError:
671-
if self.settings["servers"]:
672-
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(self.settings["servers"]))
672+
if servers:
673+
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(servers))
673674
host = None
674675

675676
for key, value in kwargs.items():
@@ -704,7 +705,7 @@ class Endpoint:
704705
if accept_headers_list:
705706
params["header"]["Accept"] = self.api_client.select_header_accept(accept_headers_list)
706707

707-
content_type_headers_list = self.headers_map["content_type"]
708+
content_type_headers_list = self.headers_map.get("content_type")
708709
if content_type_headers_list:
709710
header_list = self.api_client.select_header_content_type(content_type_headers_list)
710711
params["header"]["Content-Type"] = header_list

src/datadog_api_client/api_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ def call_with_http_info(self, **kwargs):
656656
elif is_unstable is False:
657657
raise ApiValueError("Unstable operation '{0}' is disabled".format(self.settings["operation_id"]))
658658

659+
servers = self.settings.get("servers")
659660
try:
660661
index = self.api_client.configuration.server_operation_index.get(
661662
self.settings["operation_id"], self.api_client.configuration.server_index
@@ -664,11 +665,11 @@ def call_with_http_info(self, **kwargs):
664665
self.settings["operation_id"], self.api_client.configuration.server_variables
665666
)
666667
host = self.api_client.configuration.get_host_from_settings(
667-
index, variables=server_variables, servers=self.settings["servers"]
668+
index, variables=server_variables, servers=servers
668669
)
669670
except IndexError:
670-
if self.settings["servers"]:
671-
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(self.settings["servers"]))
671+
if servers:
672+
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(servers))
672673
host = None
673674

674675
for key, value in kwargs.items():
@@ -703,7 +704,7 @@ def call_with_http_info(self, **kwargs):
703704
if accept_headers_list:
704705
params["header"]["Accept"] = self.api_client.select_header_accept(accept_headers_list)
705706

706-
content_type_headers_list = self.headers_map["content_type"]
707+
content_type_headers_list = self.headers_map.get("content_type")
707708
if content_type_headers_list:
708709
header_list = self.api_client.select_header_content_type(content_type_headers_list)
709710
params["header"]["Content-Type"] = header_list

src/datadog_api_client/v1/api/authentication_api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ def __init__(self, api_client=None):
3636
"operation_id": "validate",
3737
"http_method": "GET",
3838
"version": "v1",
39-
"servers": None,
4039
},
4140
params_map={},
4241
headers_map={
4342
"accept": ["application/json"],
44-
"content_type": [],
4543
},
4644
api_client=api_client,
4745
)

src/datadog_api_client/v1/api/aws_integration_api.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self, api_client=None):
3939
"operation_id": "create_aws_account",
4040
"http_method": "POST",
4141
"version": "v1",
42-
"servers": None,
4342
},
4443
params_map={
4544
"body": {
@@ -60,7 +59,6 @@ def __init__(self, api_client=None):
6059
"operation_id": "create_aws_tag_filter",
6160
"http_method": "POST",
6261
"version": "v1",
63-
"servers": None,
6462
},
6563
params_map={
6664
"body": {
@@ -81,7 +79,6 @@ def __init__(self, api_client=None):
8179
"operation_id": "create_new_aws_external_id",
8280
"http_method": "PUT",
8381
"version": "v1",
84-
"servers": None,
8582
},
8683
params_map={
8784
"body": {
@@ -102,7 +99,6 @@ def __init__(self, api_client=None):
10299
"operation_id": "delete_aws_account",
103100
"http_method": "DELETE",
104101
"version": "v1",
105-
"servers": None,
106102
},
107103
params_map={
108104
"body": {
@@ -123,7 +119,6 @@ def __init__(self, api_client=None):
123119
"operation_id": "delete_aws_tag_filter",
124120
"http_method": "DELETE",
125121
"version": "v1",
126-
"servers": None,
127122
},
128123
params_map={
129124
"body": {
@@ -144,12 +139,10 @@ def __init__(self, api_client=None):
144139
"operation_id": "list_available_aws_namespaces",
145140
"http_method": "GET",
146141
"version": "v1",
147-
"servers": None,
148142
},
149143
params_map={},
150144
headers_map={
151145
"accept": ["application/json"],
152-
"content_type": [],
153146
},
154147
api_client=api_client,
155148
)
@@ -162,7 +155,6 @@ def __init__(self, api_client=None):
162155
"operation_id": "list_aws_accounts",
163156
"http_method": "GET",
164157
"version": "v1",
165-
"servers": None,
166158
},
167159
params_map={
168160
"account_id": {
@@ -183,7 +175,6 @@ def __init__(self, api_client=None):
183175
},
184176
headers_map={
185177
"accept": ["application/json"],
186-
"content_type": [],
187178
},
188179
api_client=api_client,
189180
)
@@ -196,7 +187,6 @@ def __init__(self, api_client=None):
196187
"operation_id": "list_aws_tag_filters",
197188
"http_method": "GET",
198189
"version": "v1",
199-
"servers": None,
200190
},
201191
params_map={
202192
"account_id": {
@@ -208,7 +198,6 @@ def __init__(self, api_client=None):
208198
},
209199
headers_map={
210200
"accept": ["application/json"],
211-
"content_type": [],
212201
},
213202
api_client=api_client,
214203
)
@@ -221,7 +210,6 @@ def __init__(self, api_client=None):
221210
"operation_id": "update_aws_account",
222211
"http_method": "PUT",
223212
"version": "v1",
224-
"servers": None,
225213
},
226214
params_map={
227215
"account_id": {

src/datadog_api_client/v1/api/aws_logs_integration_api.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def __init__(self, api_client=None):
3333
"operation_id": "check_aws_logs_lambda_async",
3434
"http_method": "POST",
3535
"version": "v1",
36-
"servers": None,
3736
},
3837
params_map={
3938
"body": {
@@ -54,7 +53,6 @@ def __init__(self, api_client=None):
5453
"operation_id": "check_aws_logs_services_async",
5554
"http_method": "POST",
5655
"version": "v1",
57-
"servers": None,
5856
},
5957
params_map={
6058
"body": {
@@ -75,7 +73,6 @@ def __init__(self, api_client=None):
7573
"operation_id": "create_aws_lambda_arn",
7674
"http_method": "POST",
7775
"version": "v1",
78-
"servers": None,
7976
},
8077
params_map={
8178
"body": {
@@ -96,7 +93,6 @@ def __init__(self, api_client=None):
9693
"operation_id": "delete_aws_lambda_arn",
9794
"http_method": "DELETE",
9895
"version": "v1",
99-
"servers": None,
10096
},
10197
params_map={
10298
"body": {
@@ -117,7 +113,6 @@ def __init__(self, api_client=None):
117113
"operation_id": "enable_aws_log_services",
118114
"http_method": "POST",
119115
"version": "v1",
120-
"servers": None,
121116
},
122117
params_map={
123118
"body": {
@@ -138,12 +133,10 @@ def __init__(self, api_client=None):
138133
"operation_id": "list_aws_logs_integrations",
139134
"http_method": "GET",
140135
"version": "v1",
141-
"servers": None,
142136
},
143137
params_map={},
144138
headers_map={
145139
"accept": ["application/json"],
146-
"content_type": [],
147140
},
148141
api_client=api_client,
149142
)
@@ -156,12 +149,10 @@ def __init__(self, api_client=None):
156149
"operation_id": "list_aws_logs_services",
157150
"http_method": "GET",
158151
"version": "v1",
159-
"servers": None,
160152
},
161153
params_map={},
162154
headers_map={
163155
"accept": ["application/json"],
164-
"content_type": [],
165156
},
166157
api_client=api_client,
167158
)

src/datadog_api_client/v1/api/azure_integration_api.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(self, api_client=None):
3030
"operation_id": "create_azure_integration",
3131
"http_method": "POST",
3232
"version": "v1",
33-
"servers": None,
3433
},
3534
params_map={
3635
"body": {
@@ -51,7 +50,6 @@ def __init__(self, api_client=None):
5150
"operation_id": "delete_azure_integration",
5251
"http_method": "DELETE",
5352
"version": "v1",
54-
"servers": None,
5553
},
5654
params_map={
5755
"body": {
@@ -72,12 +70,10 @@ def __init__(self, api_client=None):
7270
"operation_id": "list_azure_integration",
7371
"http_method": "GET",
7472
"version": "v1",
75-
"servers": None,
7673
},
7774
params_map={},
7875
headers_map={
7976
"accept": ["application/json"],
80-
"content_type": [],
8177
},
8278
api_client=api_client,
8379
)
@@ -90,7 +86,6 @@ def __init__(self, api_client=None):
9086
"operation_id": "update_azure_host_filters",
9187
"http_method": "POST",
9288
"version": "v1",
93-
"servers": None,
9489
},
9590
params_map={
9691
"body": {
@@ -111,7 +106,6 @@ def __init__(self, api_client=None):
111106
"operation_id": "update_azure_integration",
112107
"http_method": "PUT",
113108
"version": "v1",
114-
"servers": None,
115109
},
116110
params_map={
117111
"body": {

src/datadog_api_client/v1/api/dashboard_lists_api.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def __init__(self, api_client=None):
3232
"operation_id": "create_dashboard_list",
3333
"http_method": "POST",
3434
"version": "v1",
35-
"servers": None,
3635
},
3736
params_map={
3837
"body": {
@@ -53,7 +52,6 @@ def __init__(self, api_client=None):
5352
"operation_id": "delete_dashboard_list",
5453
"http_method": "DELETE",
5554
"version": "v1",
56-
"servers": None,
5755
},
5856
params_map={
5957
"list_id": {
@@ -65,7 +63,6 @@ def __init__(self, api_client=None):
6563
},
6664
headers_map={
6765
"accept": ["application/json"],
68-
"content_type": [],
6966
},
7067
api_client=api_client,
7168
)
@@ -78,7 +75,6 @@ def __init__(self, api_client=None):
7875
"operation_id": "get_dashboard_list",
7976
"http_method": "GET",
8077
"version": "v1",
81-
"servers": None,
8278
},
8379
params_map={
8480
"list_id": {
@@ -90,7 +86,6 @@ def __init__(self, api_client=None):
9086
},
9187
headers_map={
9288
"accept": ["application/json"],
93-
"content_type": [],
9489
},
9590
api_client=api_client,
9691
)
@@ -103,12 +98,10 @@ def __init__(self, api_client=None):
10398
"operation_id": "list_dashboard_lists",
10499
"http_method": "GET",
105100
"version": "v1",
106-
"servers": None,
107101
},
108102
params_map={},
109103
headers_map={
110104
"accept": ["application/json"],
111-
"content_type": [],
112105
},
113106
api_client=api_client,
114107
)
@@ -121,7 +114,6 @@ def __init__(self, api_client=None):
121114
"operation_id": "update_dashboard_list",
122115
"http_method": "PUT",
123116
"version": "v1",
124-
"servers": None,
125117
},
126118
params_map={
127119
"list_id": {

0 commit comments

Comments
 (0)