22
33from __future__ import annotations
44
5- from typing import List , Type , Iterable , cast
5+ from typing import List , Type , cast
66from typing_extensions import Literal
77
88import httpx
@@ -69,25 +69,36 @@ def create(
6969 self ,
7070 * ,
7171 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" ],
7375 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7476 # The extra values given here take precedence over values defined on the client or passed to this method.
7577 extra_headers : Headers | None = None ,
7678 extra_query : Query | None = None ,
7779 extra_body : Body | None = None ,
7880 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
7981 ) -> OperationCreateResponse :
80- """Add one or more operations to a zone.
82+ """Add one operation to a zone.
8183
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.
8789
8890 Args:
8991 zone_id: Identifier
9092
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+
91102 extra_headers: Send extra headers
92103
93104 extra_query: Add additional query parameters to the request
@@ -99,8 +110,15 @@ def create(
99110 if not zone_id :
100111 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
101112 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+ ),
104122 options = make_request_options (
105123 extra_headers = extra_headers ,
106124 extra_query = extra_query ,
@@ -344,25 +362,36 @@ async def create(
344362 self ,
345363 * ,
346364 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" ],
348368 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
349369 # The extra values given here take precedence over values defined on the client or passed to this method.
350370 extra_headers : Headers | None = None ,
351371 extra_query : Query | None = None ,
352372 extra_body : Body | None = None ,
353373 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
354374 ) -> OperationCreateResponse :
355- """Add one or more operations to a zone.
375+ """Add one operation to a zone.
356376
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.
362382
363383 Args:
364384 zone_id: Identifier
365385
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+
366395 extra_headers: Send extra headers
367396
368397 extra_query: Add additional query parameters to the request
@@ -374,8 +403,15 @@ async def create(
374403 if not zone_id :
375404 raise ValueError (f"Expected a non-empty value for `zone_id` but received { zone_id !r} " )
376405 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+ ),
379415 options = make_request_options (
380416 extra_headers = extra_headers ,
381417 extra_query = extra_query ,
0 commit comments