Skip to content

Commit 229d745

Browse files
feat(api): OpenAPI spec update via Stainless API (#314)
1 parent 4f75ee0 commit 229d745

File tree

21 files changed

+432
-864
lines changed

21 files changed

+432
-864
lines changed

src/cloudflare/resources/firewall/access_rules.py

+30-60
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,16 @@ def create(
9191
9292
timeout: Override the client-level default timeout for this request, in seconds
9393
"""
94-
if not account_id:
95-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
96-
if not zone_id:
97-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
98-
if not account_id and not zone_id:
99-
raise ValueError("You must provide either account_id or zone_id")
10094
if account_id and zone_id:
10195
raise ValueError("You cannot provide both account_id and zone_id")
10296

10397
if account_id:
10498
account_or_zone = "accounts"
10599
account_or_zone_id = account_id
106100
else:
101+
if not zone_id:
102+
raise ValueError("You must provide either account_id or zone_id")
103+
107104
account_or_zone = "zones"
108105
account_or_zone_id = zone_id
109106
return cast(
@@ -176,19 +173,16 @@ def list(
176173
177174
timeout: Override the client-level default timeout for this request, in seconds
178175
"""
179-
if not account_id:
180-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
181-
if not zone_id:
182-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
183-
if not account_id and not zone_id:
184-
raise ValueError("You must provide either account_id or zone_id")
185176
if account_id and zone_id:
186177
raise ValueError("You cannot provide both account_id and zone_id")
187178

188179
if account_id:
189180
account_or_zone = "accounts"
190181
account_or_zone_id = account_id
191182
else:
183+
if not zone_id:
184+
raise ValueError("You must provide either account_id or zone_id")
185+
192186
account_or_zone = "zones"
193187
account_or_zone_id = zone_id
194188
return self._get_api_list(
@@ -246,19 +240,16 @@ def delete(
246240
247241
timeout: Override the client-level default timeout for this request, in seconds
248242
"""
249-
if not account_id:
250-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
251-
if not zone_id:
252-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
253-
if not account_id and not zone_id:
254-
raise ValueError("You must provide either account_id or zone_id")
255243
if account_id and zone_id:
256244
raise ValueError("You cannot provide both account_id and zone_id")
257245

258246
if account_id:
259247
account_or_zone = "accounts"
260248
account_or_zone_id = account_id
261249
else:
250+
if not zone_id:
251+
raise ValueError("You must provide either account_id or zone_id")
252+
262253
account_or_zone = "zones"
263254
account_or_zone_id = zone_id
264255
return self._delete(
@@ -314,19 +305,16 @@ def edit(
314305
315306
timeout: Override the client-level default timeout for this request, in seconds
316307
"""
317-
if not account_id:
318-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
319-
if not zone_id:
320-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
321-
if not account_id and not zone_id:
322-
raise ValueError("You must provide either account_id or zone_id")
323308
if account_id and zone_id:
324309
raise ValueError("You cannot provide both account_id and zone_id")
325310

326311
if account_id:
327312
account_or_zone = "accounts"
328313
account_or_zone_id = account_id
329314
else:
315+
if not zone_id:
316+
raise ValueError("You must provide either account_id or zone_id")
317+
330318
account_or_zone = "zones"
331319
account_or_zone_id = zone_id
332320
return cast(
@@ -383,19 +371,16 @@ def get(
383371
384372
timeout: Override the client-level default timeout for this request, in seconds
385373
"""
386-
if not account_id:
387-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
388-
if not zone_id:
389-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
390-
if not account_id and not zone_id:
391-
raise ValueError("You must provide either account_id or zone_id")
392374
if account_id and zone_id:
393375
raise ValueError("You cannot provide both account_id and zone_id")
394376

395377
if account_id:
396378
account_or_zone = "accounts"
397379
account_or_zone_id = account_id
398380
else:
381+
if not zone_id:
382+
raise ValueError("You must provide either account_id or zone_id")
383+
399384
account_or_zone = "zones"
400385
account_or_zone_id = zone_id
401386
return cast(
@@ -467,19 +452,16 @@ async def create(
467452
468453
timeout: Override the client-level default timeout for this request, in seconds
469454
"""
470-
if not account_id:
471-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
472-
if not zone_id:
473-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
474-
if not account_id and not zone_id:
475-
raise ValueError("You must provide either account_id or zone_id")
476455
if account_id and zone_id:
477456
raise ValueError("You cannot provide both account_id and zone_id")
478457

479458
if account_id:
480459
account_or_zone = "accounts"
481460
account_or_zone_id = account_id
482461
else:
462+
if not zone_id:
463+
raise ValueError("You must provide either account_id or zone_id")
464+
483465
account_or_zone = "zones"
484466
account_or_zone_id = zone_id
485467
return cast(
@@ -552,19 +534,16 @@ def list(
552534
553535
timeout: Override the client-level default timeout for this request, in seconds
554536
"""
555-
if not account_id:
556-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
557-
if not zone_id:
558-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
559-
if not account_id and not zone_id:
560-
raise ValueError("You must provide either account_id or zone_id")
561537
if account_id and zone_id:
562538
raise ValueError("You cannot provide both account_id and zone_id")
563539

564540
if account_id:
565541
account_or_zone = "accounts"
566542
account_or_zone_id = account_id
567543
else:
544+
if not zone_id:
545+
raise ValueError("You must provide either account_id or zone_id")
546+
568547
account_or_zone = "zones"
569548
account_or_zone_id = zone_id
570549
return self._get_api_list(
@@ -622,19 +601,16 @@ async def delete(
622601
623602
timeout: Override the client-level default timeout for this request, in seconds
624603
"""
625-
if not account_id:
626-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
627-
if not zone_id:
628-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
629-
if not account_id and not zone_id:
630-
raise ValueError("You must provide either account_id or zone_id")
631604
if account_id and zone_id:
632605
raise ValueError("You cannot provide both account_id and zone_id")
633606

634607
if account_id:
635608
account_or_zone = "accounts"
636609
account_or_zone_id = account_id
637610
else:
611+
if not zone_id:
612+
raise ValueError("You must provide either account_id or zone_id")
613+
638614
account_or_zone = "zones"
639615
account_or_zone_id = zone_id
640616
return await self._delete(
@@ -690,19 +666,16 @@ async def edit(
690666
691667
timeout: Override the client-level default timeout for this request, in seconds
692668
"""
693-
if not account_id:
694-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
695-
if not zone_id:
696-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
697-
if not account_id and not zone_id:
698-
raise ValueError("You must provide either account_id or zone_id")
699669
if account_id and zone_id:
700670
raise ValueError("You cannot provide both account_id and zone_id")
701671

702672
if account_id:
703673
account_or_zone = "accounts"
704674
account_or_zone_id = account_id
705675
else:
676+
if not zone_id:
677+
raise ValueError("You must provide either account_id or zone_id")
678+
706679
account_or_zone = "zones"
707680
account_or_zone_id = zone_id
708681
return cast(
@@ -759,19 +732,16 @@ async def get(
759732
760733
timeout: Override the client-level default timeout for this request, in seconds
761734
"""
762-
if not account_id:
763-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
764-
if not zone_id:
765-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
766-
if not account_id and not zone_id:
767-
raise ValueError("You must provide either account_id or zone_id")
768735
if account_id and zone_id:
769736
raise ValueError("You cannot provide both account_id and zone_id")
770737

771738
if account_id:
772739
account_or_zone = "accounts"
773740
account_or_zone_id = account_id
774741
else:
742+
if not zone_id:
743+
raise ValueError("You must provide either account_id or zone_id")
744+
775745
account_or_zone = "zones"
776746
account_or_zone_id = zone_id
777747
return cast(

src/cloudflare/resources/logpush/datasets/fields.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,16 @@ def get(
6767
"""
6868
if not dataset_id:
6969
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
70-
if not account_id:
71-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
72-
if not zone_id:
73-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
74-
if not account_id and not zone_id:
75-
raise ValueError("You must provide either account_id or zone_id")
7670
if account_id and zone_id:
7771
raise ValueError("You cannot provide both account_id and zone_id")
7872

7973
if account_id:
8074
account_or_zone = "accounts"
8175
account_or_zone_id = account_id
8276
else:
77+
if not zone_id:
78+
raise ValueError("You must provide either account_id or zone_id")
79+
8380
account_or_zone = "zones"
8481
account_or_zone_id = zone_id
8582
return self._get(
@@ -139,19 +136,16 @@ async def get(
139136
"""
140137
if not dataset_id:
141138
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
142-
if not account_id:
143-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
144-
if not zone_id:
145-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
146-
if not account_id and not zone_id:
147-
raise ValueError("You must provide either account_id or zone_id")
148139
if account_id and zone_id:
149140
raise ValueError("You cannot provide both account_id and zone_id")
150141

151142
if account_id:
152143
account_or_zone = "accounts"
153144
account_or_zone_id = account_id
154145
else:
146+
if not zone_id:
147+
raise ValueError("You must provide either account_id or zone_id")
148+
155149
account_or_zone = "zones"
156150
account_or_zone_id = zone_id
157151
return await self._get(

src/cloudflare/resources/logpush/datasets/jobs.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,16 @@ def get(
6666
"""
6767
if not dataset_id:
6868
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
69-
if not account_id:
70-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
71-
if not zone_id:
72-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
73-
if not account_id and not zone_id:
74-
raise ValueError("You must provide either account_id or zone_id")
7569
if account_id and zone_id:
7670
raise ValueError("You cannot provide both account_id and zone_id")
7771

7872
if account_id:
7973
account_or_zone = "accounts"
8074
account_or_zone_id = account_id
8175
else:
76+
if not zone_id:
77+
raise ValueError("You must provide either account_id or zone_id")
78+
8279
account_or_zone = "zones"
8380
account_or_zone_id = zone_id
8481
return self._get(
@@ -136,19 +133,16 @@ async def get(
136133
"""
137134
if not dataset_id:
138135
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
139-
if not account_id:
140-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
141-
if not zone_id:
142-
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
143-
if not account_id and not zone_id:
144-
raise ValueError("You must provide either account_id or zone_id")
145136
if account_id and zone_id:
146137
raise ValueError("You cannot provide both account_id and zone_id")
147138

148139
if account_id:
149140
account_or_zone = "accounts"
150141
account_or_zone_id = account_id
151142
else:
143+
if not zone_id:
144+
raise ValueError("You must provide either account_id or zone_id")
145+
152146
account_or_zone = "zones"
153147
account_or_zone_id = zone_id
154148
return await self._get(

0 commit comments

Comments
 (0)