2
2
3
3
from __future__ import annotations
4
4
5
- from typing import List , Type , Iterable , cast
5
+ from typing import List , Type , cast
6
6
from typing_extensions import Literal
7
7
8
8
import httpx
@@ -69,25 +69,36 @@ def create(
69
69
self ,
70
70
* ,
71
71
zone_id : str ,
72
- operations : Iterable [operation_create_params .Operation ],
72
+ endpoint : str ,
73
+ host : str ,
74
+ method : Literal ["GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "CONNECT" , "PATCH" , "TRACE" ],
73
75
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
74
76
# The extra values given here take precedence over values defined on the client or passed to this method.
75
77
extra_headers : Headers | None = None ,
76
78
extra_query : Query | None = None ,
77
79
extra_body : Body | None = None ,
78
80
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
79
81
) -> OperationCreateResponse :
80
- """Add one or more operations to a zone.
82
+ """Add one operation to a zone.
81
83
82
- Endpoints can contain path variables.
83
- Host, method, endpoint will be normalized to a canoncial form when creating an
84
- operation and must be unique on the zone. Inserting an operation that matches an
85
- existing one will return the record of the already existing operation and update
86
- its last_updated date.
84
+ Endpoints can contain path variables. Host, method,
85
+ endpoint will be normalized to a canoncial form when creating an operation and
86
+ must be unique on the zone. Inserting an operation that matches an existing one
87
+ will return the record of the already existing operation and update its
88
+ last_updated date.
87
89
88
90
Args:
89
91
zone_id: Identifier
90
92
93
+ endpoint: The endpoint which can contain path parameter templates in curly braces, each
94
+ will be replaced from left to right with {varN}, starting with {var1}, during
95
+ insertion. This will further be Cloudflare-normalized upon insertion. See:
96
+ https://developers.cloudflare.com/rules/normalization/how-it-works/.
97
+
98
+ host: RFC3986-compliant host.
99
+
100
+ method: The HTTP method used to access the endpoint.
101
+
91
102
extra_headers: Send extra headers
92
103
93
104
extra_query: Add additional query parameters to the request
@@ -99,8 +110,15 @@ def create(
99
110
if not zone_id :
100
111
raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
101
112
return self ._post (
102
- f"/zones/{ zone_id } /api_gateway/operations" ,
103
- body = maybe_transform (operations , Iterable [operation_create_params .Operation ]),
113
+ f"/zones/{ zone_id } /api_gateway/operations/item" ,
114
+ body = maybe_transform (
115
+ {
116
+ "endpoint" : endpoint ,
117
+ "host" : host ,
118
+ "method" : method ,
119
+ },
120
+ operation_create_params .OperationCreateParams ,
121
+ ),
104
122
options = make_request_options (
105
123
extra_headers = extra_headers ,
106
124
extra_query = extra_query ,
@@ -344,25 +362,36 @@ async def create(
344
362
self ,
345
363
* ,
346
364
zone_id : str ,
347
- operations : Iterable [operation_create_params .Operation ],
365
+ endpoint : str ,
366
+ host : str ,
367
+ method : Literal ["GET" , "POST" , "HEAD" , "OPTIONS" , "PUT" , "DELETE" , "CONNECT" , "PATCH" , "TRACE" ],
348
368
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
349
369
# The extra values given here take precedence over values defined on the client or passed to this method.
350
370
extra_headers : Headers | None = None ,
351
371
extra_query : Query | None = None ,
352
372
extra_body : Body | None = None ,
353
373
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
354
374
) -> OperationCreateResponse :
355
- """Add one or more operations to a zone.
375
+ """Add one operation to a zone.
356
376
357
- Endpoints can contain path variables.
358
- Host, method, endpoint will be normalized to a canoncial form when creating an
359
- operation and must be unique on the zone. Inserting an operation that matches an
360
- existing one will return the record of the already existing operation and update
361
- its last_updated date.
377
+ Endpoints can contain path variables. Host, method,
378
+ endpoint will be normalized to a canoncial form when creating an operation and
379
+ must be unique on the zone. Inserting an operation that matches an existing one
380
+ will return the record of the already existing operation and update its
381
+ last_updated date.
362
382
363
383
Args:
364
384
zone_id: Identifier
365
385
386
+ endpoint: The endpoint which can contain path parameter templates in curly braces, each
387
+ will be replaced from left to right with {varN}, starting with {var1}, during
388
+ insertion. This will further be Cloudflare-normalized upon insertion. See:
389
+ https://developers.cloudflare.com/rules/normalization/how-it-works/.
390
+
391
+ host: RFC3986-compliant host.
392
+
393
+ method: The HTTP method used to access the endpoint.
394
+
366
395
extra_headers: Send extra headers
367
396
368
397
extra_query: Add additional query parameters to the request
@@ -374,8 +403,15 @@ async def create(
374
403
if not zone_id :
375
404
raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
376
405
return await self ._post (
377
- f"/zones/{ zone_id } /api_gateway/operations" ,
378
- body = await async_maybe_transform (operations , Iterable [operation_create_params .Operation ]),
406
+ f"/zones/{ zone_id } /api_gateway/operations/item" ,
407
+ body = await async_maybe_transform (
408
+ {
409
+ "endpoint" : endpoint ,
410
+ "host" : host ,
411
+ "method" : method ,
412
+ },
413
+ operation_create_params .OperationCreateParams ,
414
+ ),
379
415
options = make_request_options (
380
416
extra_headers = extra_headers ,
381
417
extra_query = extra_query ,
0 commit comments