mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-16 23:01:03 +00:00
feat(api): OpenAPI spec update via Stainless API (#1112)
This commit is contained in:
parent
e53d3c8c80
commit
08aa37f91c
34 changed files with 11 additions and 4608 deletions
|
|
@ -1,2 +1,2 @@
|
|||
configured_endpoints: 1353
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e79cc9a74089de5aec2c720b1e3023ea27869883f43c8b0167198f5967128636.yml
|
||||
configured_endpoints: 1337
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8127f6c197e7f17e9eb9d99add7dff6ecbc8b5a90e298269e2070738ed4368e9.yml
|
||||
|
|
|
|||
37
api.md
37
api.md
|
|
@ -3988,40 +3988,25 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit import (
|
||||
CfInterconnectUpdateResponse,
|
||||
CfInterconnectListResponse,
|
||||
CfInterconnectGetResponse,
|
||||
)
|
||||
from cloudflare.types.magic_transit import CfInterconnectListResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="put /accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}">client.magic_transit.cf_interconnects.<a href="./src/cloudflare/resources/magic_transit/cf_interconnects.py">update</a>(tunnel_identifier, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/cf_interconnect_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/cf_interconnect_update_response.py">CfInterconnectUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/cf_interconnects">client.magic_transit.cf_interconnects.<a href="./src/cloudflare/resources/magic_transit/cf_interconnects.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/cf_interconnect_list_response.py">CfInterconnectListResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}">client.magic_transit.cf_interconnects.<a href="./src/cloudflare/resources/magic_transit/cf_interconnects.py">get</a>(tunnel_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/cf_interconnect_get_response.py">CfInterconnectGetResponse</a></code>
|
||||
|
||||
## GRETunnels
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit import (
|
||||
GRETunnelCreateResponse,
|
||||
GRETunnelUpdateResponse,
|
||||
GRETunnelListResponse,
|
||||
GRETunnelDeleteResponse,
|
||||
GRETunnelGetResponse,
|
||||
)
|
||||
from cloudflare.types.magic_transit import GRETunnelCreateResponse, GRETunnelListResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/magic/gre_tunnels">client.magic_transit.gre_tunnels.<a href="./src/cloudflare/resources/magic_transit/gre_tunnels.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/gre_tunnel_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/gre_tunnel_create_response.py">GRETunnelCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}">client.magic_transit.gre_tunnels.<a href="./src/cloudflare/resources/magic_transit/gre_tunnels.py">update</a>(tunnel_identifier, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/gre_tunnel_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/gre_tunnel_update_response.py">GRETunnelUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/gre_tunnels">client.magic_transit.gre_tunnels.<a href="./src/cloudflare/resources/magic_transit/gre_tunnels.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/gre_tunnel_list_response.py">GRETunnelListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}">client.magic_transit.gre_tunnels.<a href="./src/cloudflare/resources/magic_transit/gre_tunnels.py">delete</a>(tunnel_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/gre_tunnel_delete_response.py">GRETunnelDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}">client.magic_transit.gre_tunnels.<a href="./src/cloudflare/resources/magic_transit/gre_tunnels.py">get</a>(tunnel_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/gre_tunnel_get_response.py">GRETunnelGetResponse</a></code>
|
||||
|
||||
## IPSECTunnels
|
||||
|
||||
|
|
@ -4031,22 +4016,14 @@ Types:
|
|||
from cloudflare.types.magic_transit import (
|
||||
PSKMetadata,
|
||||
IPSECTunnelCreateResponse,
|
||||
IPSECTunnelUpdateResponse,
|
||||
IPSECTunnelListResponse,
|
||||
IPSECTunnelDeleteResponse,
|
||||
IPSECTunnelGetResponse,
|
||||
IPSECTunnelPSKGenerateResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/magic/ipsec_tunnels">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/ipsec_tunnel_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_create_response.py">IPSECTunnelCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">update</a>(tunnel_identifier, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/ipsec_tunnel_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_update_response.py">IPSECTunnelUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/ipsec_tunnels">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_list_response.py">IPSECTunnelListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">delete</a>(tunnel_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_delete_response.py">IPSECTunnelDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">get</a>(tunnel_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_get_response.py">IPSECTunnelGetResponse</a></code>
|
||||
- <code title="post /accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}/psk_generate">client.magic_transit.ipsec_tunnels.<a href="./src/cloudflare/resources/magic_transit/ipsec_tunnels.py">psk_generate</a>(tunnel_identifier, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/ipsec_tunnel_psk_generate_response.py">IPSECTunnelPSKGenerateResponse</a></code>
|
||||
|
||||
## Routes
|
||||
|
||||
|
|
@ -4056,22 +4033,16 @@ Types:
|
|||
from cloudflare.types.magic_transit import (
|
||||
Scope,
|
||||
RouteCreateResponse,
|
||||
RouteUpdateResponse,
|
||||
RouteListResponse,
|
||||
RouteDeleteResponse,
|
||||
RouteEmptyResponse,
|
||||
RouteGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/magic/routes">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/route_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/route_create_response.py">RouteCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_id}/magic/routes/{route_identifier}">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">update</a>(route_identifier, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/route_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/route_update_response.py">RouteUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/routes">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/route_list_response.py">RouteListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_id}/magic/routes/{route_identifier}">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">delete</a>(route_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/route_delete_response.py">RouteDeleteResponse</a></code>
|
||||
- <code title="delete /accounts/{account_id}/magic/routes">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">empty</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/route_empty_response.py">RouteEmptyResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/routes/{route_identifier}">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">get</a>(route_identifier, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/route_get_response.py">RouteGetResponse</a></code>
|
||||
|
||||
## Sites
|
||||
|
||||
|
|
@ -4101,11 +4072,7 @@ from cloudflare.types.magic_transit.sites import ACL, ACLConfiguration, AllowedP
|
|||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/magic/sites/{site_id}/acls">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">create</a>(site_id, \*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/sites/acl_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">ACL</a></code>
|
||||
- <code title="put /accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">update</a>(acl_identifier, \*, account_id, site_id, \*\*<a href="src/cloudflare/types/magic_transit/sites/acl_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">ACL</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/sites/{site_id}/acls">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">list</a>(site_id, \*, account_id) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">SyncSinglePage[ACL]</a></code>
|
||||
- <code title="delete /accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">delete</a>(acl_identifier, \*, account_id, site_id) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">ACL</a></code>
|
||||
- <code title="patch /accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">edit</a>(acl_identifier, \*, account_id, site_id, \*\*<a href="src/cloudflare/types/magic_transit/sites/acl_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">ACL</a></code>
|
||||
- <code title="get /accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">get</a>(acl_identifier, \*, account_id, site_id) -> <a href="./src/cloudflare/types/magic_transit/sites/acl.py">ACL</a></code>
|
||||
|
||||
### LANs
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,6 @@ from typing import Type, cast
|
|||
import httpx
|
||||
|
||||
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ..._utils import (
|
||||
maybe_transform,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
from ..._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ..._response import (
|
||||
|
|
@ -23,10 +19,7 @@ from ..._wrappers import ResultWrapper
|
|||
from ..._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ...types.magic_transit import cf_interconnect_update_params
|
||||
from ...types.magic_transit.cf_interconnect_get_response import CfInterconnectGetResponse
|
||||
from ...types.magic_transit.cf_interconnect_list_response import CfInterconnectListResponse
|
||||
from ...types.magic_transit.cf_interconnect_update_response import CfInterconnectUpdateResponse
|
||||
|
||||
__all__ = ["CfInterconnectsResource", "AsyncCfInterconnectsResource"]
|
||||
|
||||
|
|
@ -40,79 +33,6 @@ class CfInterconnectsResource(SyncAPIResource):
|
|||
def with_streaming_response(self) -> CfInterconnectsResourceWithStreamingResponse:
|
||||
return CfInterconnectsResourceWithStreamingResponse(self)
|
||||
|
||||
def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
gre: cf_interconnect_update_params.GRE | NotGiven = NOT_GIVEN,
|
||||
health_check: cf_interconnect_update_params.HealthCheck | NotGiven = NOT_GIVEN,
|
||||
interface_address: str | NotGiven = NOT_GIVEN,
|
||||
mtu: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> CfInterconnectUpdateResponse:
|
||||
"""Updates a specific interconnect associated with an account.
|
||||
|
||||
Use
|
||||
`?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
description: An optional description of the interconnect.
|
||||
|
||||
gre: The configuration specific to GRE interconnects.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
mtu: The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum
|
||||
value is 576.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"gre": gre,
|
||||
"health_check": health_check,
|
||||
"interface_address": interface_address,
|
||||
"mtu": mtu,
|
||||
},
|
||||
cf_interconnect_update_params.CfInterconnectUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[CfInterconnectUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[CfInterconnectUpdateResponse], ResultWrapper[CfInterconnectUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -152,50 +72,6 @@ class CfInterconnectsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[CfInterconnectListResponse], ResultWrapper[CfInterconnectListResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> CfInterconnectGetResponse:
|
||||
"""
|
||||
Lists details for a specific interconnect.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[CfInterconnectGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[CfInterconnectGetResponse], ResultWrapper[CfInterconnectGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncCfInterconnectsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -206,79 +82,6 @@ class AsyncCfInterconnectsResource(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncCfInterconnectsResourceWithStreamingResponse:
|
||||
return AsyncCfInterconnectsResourceWithStreamingResponse(self)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
gre: cf_interconnect_update_params.GRE | NotGiven = NOT_GIVEN,
|
||||
health_check: cf_interconnect_update_params.HealthCheck | NotGiven = NOT_GIVEN,
|
||||
interface_address: str | NotGiven = NOT_GIVEN,
|
||||
mtu: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> CfInterconnectUpdateResponse:
|
||||
"""Updates a specific interconnect associated with an account.
|
||||
|
||||
Use
|
||||
`?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
description: An optional description of the interconnect.
|
||||
|
||||
gre: The configuration specific to GRE interconnects.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
mtu: The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum
|
||||
value is 576.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"gre": gre,
|
||||
"health_check": health_check,
|
||||
"interface_address": interface_address,
|
||||
"mtu": mtu,
|
||||
},
|
||||
cf_interconnect_update_params.CfInterconnectUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[CfInterconnectUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[CfInterconnectUpdateResponse], ResultWrapper[CfInterconnectUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -318,106 +121,38 @@ class AsyncCfInterconnectsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[CfInterconnectListResponse], ResultWrapper[CfInterconnectListResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> CfInterconnectGetResponse:
|
||||
"""
|
||||
Lists details for a specific interconnect.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/magic/cf_interconnects/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[CfInterconnectGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[CfInterconnectGetResponse], ResultWrapper[CfInterconnectGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class CfInterconnectsResourceWithRawResponse:
|
||||
def __init__(self, cf_interconnects: CfInterconnectsResource) -> None:
|
||||
self._cf_interconnects = cf_interconnects
|
||||
|
||||
self.update = to_raw_response_wrapper(
|
||||
cf_interconnects.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
cf_interconnects.list,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
cf_interconnects.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncCfInterconnectsResourceWithRawResponse:
|
||||
def __init__(self, cf_interconnects: AsyncCfInterconnectsResource) -> None:
|
||||
self._cf_interconnects = cf_interconnects
|
||||
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
cf_interconnects.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
cf_interconnects.list,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
cf_interconnects.get,
|
||||
)
|
||||
|
||||
|
||||
class CfInterconnectsResourceWithStreamingResponse:
|
||||
def __init__(self, cf_interconnects: CfInterconnectsResource) -> None:
|
||||
self._cf_interconnects = cf_interconnects
|
||||
|
||||
self.update = to_streamed_response_wrapper(
|
||||
cf_interconnects.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
cf_interconnects.list,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
cf_interconnects.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncCfInterconnectsResourceWithStreamingResponse:
|
||||
def __init__(self, cf_interconnects: AsyncCfInterconnectsResource) -> None:
|
||||
self._cf_interconnects = cf_interconnects
|
||||
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
cf_interconnects.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
cf_interconnects.list,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
cf_interconnects.get,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,13 +23,9 @@ from ..._wrappers import ResultWrapper
|
|||
from ..._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ...types.magic_transit import gre_tunnel_create_params, gre_tunnel_update_params
|
||||
from ...types.magic_transit.health_check_param import HealthCheckParam
|
||||
from ...types.magic_transit.gre_tunnel_get_response import GRETunnelGetResponse
|
||||
from ...types.magic_transit import gre_tunnel_create_params
|
||||
from ...types.magic_transit.gre_tunnel_list_response import GRETunnelListResponse
|
||||
from ...types.magic_transit.gre_tunnel_create_response import GRETunnelCreateResponse
|
||||
from ...types.magic_transit.gre_tunnel_delete_response import GRETunnelDeleteResponse
|
||||
from ...types.magic_transit.gre_tunnel_update_response import GRETunnelUpdateResponse
|
||||
|
||||
__all__ = ["GRETunnelsResource", "AsyncGRETunnelsResource"]
|
||||
|
||||
|
|
@ -86,91 +82,6 @@ class GRETunnelsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[GRETunnelCreateResponse], ResultWrapper[GRETunnelCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
cloudflare_gre_endpoint: str,
|
||||
customer_gre_endpoint: str,
|
||||
interface_address: str,
|
||||
name: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
health_check: HealthCheckParam | NotGiven = NOT_GIVEN,
|
||||
mtu: int | NotGiven = NOT_GIVEN,
|
||||
ttl: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelUpdateResponse:
|
||||
"""Updates a specific GRE tunnel.
|
||||
|
||||
Use `?validate_only=true` as an optional query
|
||||
parameter to only run validation without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
cloudflare_gre_endpoint: The IP address assigned to the Cloudflare side of the GRE tunnel.
|
||||
|
||||
customer_gre_endpoint: The IP address assigned to the customer side of the GRE tunnel.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
name: The name of the tunnel. The name cannot contain spaces or special characters,
|
||||
must be 15 characters or less, and cannot share a name with another GRE tunnel.
|
||||
|
||||
description: An optional description of the GRE tunnel.
|
||||
|
||||
mtu: Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value
|
||||
is 576.
|
||||
|
||||
ttl: Time To Live (TTL) in number of hops of the GRE tunnel.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"cloudflare_gre_endpoint": cloudflare_gre_endpoint,
|
||||
"customer_gre_endpoint": customer_gre_endpoint,
|
||||
"interface_address": interface_address,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"health_check": health_check,
|
||||
"mtu": mtu,
|
||||
"ttl": ttl,
|
||||
},
|
||||
gre_tunnel_update_params.GRETunnelUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelUpdateResponse], ResultWrapper[GRETunnelUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -210,96 +121,6 @@ class GRETunnelsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[GRETunnelListResponse], ResultWrapper[GRETunnelListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelDeleteResponse:
|
||||
"""Disables and removes a specific static GRE tunnel.
|
||||
|
||||
Use `?validate_only=true` as
|
||||
an optional query parameter to only run validation without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelDeleteResponse], ResultWrapper[GRETunnelDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelGetResponse:
|
||||
"""
|
||||
Lists informtion for a specific GRE tunnel.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelGetResponse], ResultWrapper[GRETunnelGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncGRETunnelsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -353,91 +174,6 @@ class AsyncGRETunnelsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[GRETunnelCreateResponse], ResultWrapper[GRETunnelCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
cloudflare_gre_endpoint: str,
|
||||
customer_gre_endpoint: str,
|
||||
interface_address: str,
|
||||
name: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
health_check: HealthCheckParam | NotGiven = NOT_GIVEN,
|
||||
mtu: int | NotGiven = NOT_GIVEN,
|
||||
ttl: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelUpdateResponse:
|
||||
"""Updates a specific GRE tunnel.
|
||||
|
||||
Use `?validate_only=true` as an optional query
|
||||
parameter to only run validation without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
cloudflare_gre_endpoint: The IP address assigned to the Cloudflare side of the GRE tunnel.
|
||||
|
||||
customer_gre_endpoint: The IP address assigned to the customer side of the GRE tunnel.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
name: The name of the tunnel. The name cannot contain spaces or special characters,
|
||||
must be 15 characters or less, and cannot share a name with another GRE tunnel.
|
||||
|
||||
description: An optional description of the GRE tunnel.
|
||||
|
||||
mtu: Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value
|
||||
is 576.
|
||||
|
||||
ttl: Time To Live (TTL) in number of hops of the GRE tunnel.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"cloudflare_gre_endpoint": cloudflare_gre_endpoint,
|
||||
"customer_gre_endpoint": customer_gre_endpoint,
|
||||
"interface_address": interface_address,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"health_check": health_check,
|
||||
"mtu": mtu,
|
||||
"ttl": ttl,
|
||||
},
|
||||
gre_tunnel_update_params.GRETunnelUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelUpdateResponse], ResultWrapper[GRETunnelUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -477,96 +213,6 @@ class AsyncGRETunnelsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[GRETunnelListResponse], ResultWrapper[GRETunnelListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelDeleteResponse:
|
||||
"""Disables and removes a specific static GRE tunnel.
|
||||
|
||||
Use `?validate_only=true` as
|
||||
an optional query parameter to only run validation without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelDeleteResponse], ResultWrapper[GRETunnelDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> GRETunnelGetResponse:
|
||||
"""
|
||||
Lists informtion for a specific GRE tunnel.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/magic/gre_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[GRETunnelGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[GRETunnelGetResponse], ResultWrapper[GRETunnelGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class GRETunnelsResourceWithRawResponse:
|
||||
def __init__(self, gre_tunnels: GRETunnelsResource) -> None:
|
||||
|
|
@ -575,18 +221,9 @@ class GRETunnelsResourceWithRawResponse:
|
|||
self.create = to_raw_response_wrapper(
|
||||
gre_tunnels.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
gre_tunnels.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
gre_tunnels.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
gre_tunnels.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
gre_tunnels.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncGRETunnelsResourceWithRawResponse:
|
||||
|
|
@ -596,18 +233,9 @@ class AsyncGRETunnelsResourceWithRawResponse:
|
|||
self.create = async_to_raw_response_wrapper(
|
||||
gre_tunnels.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
gre_tunnels.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
gre_tunnels.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
gre_tunnels.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
gre_tunnels.get,
|
||||
)
|
||||
|
||||
|
||||
class GRETunnelsResourceWithStreamingResponse:
|
||||
|
|
@ -617,18 +245,9 @@ class GRETunnelsResourceWithStreamingResponse:
|
|||
self.create = to_streamed_response_wrapper(
|
||||
gre_tunnels.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
gre_tunnels.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
gre_tunnels.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
gre_tunnels.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
gre_tunnels.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncGRETunnelsResourceWithStreamingResponse:
|
||||
|
|
@ -638,15 +257,6 @@ class AsyncGRETunnelsResourceWithStreamingResponse:
|
|||
self.create = async_to_streamed_response_wrapper(
|
||||
gre_tunnels.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
gre_tunnels.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
gre_tunnels.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
gre_tunnels.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
gre_tunnels.get,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,18 +23,10 @@ from ..._wrappers import ResultWrapper
|
|||
from ..._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ...types.magic_transit import (
|
||||
ipsec_tunnel_create_params,
|
||||
ipsec_tunnel_update_params,
|
||||
ipsec_tunnel_psk_generate_params,
|
||||
)
|
||||
from ...types.magic_transit import ipsec_tunnel_create_params
|
||||
from ...types.magic_transit.health_check_param import HealthCheckParam
|
||||
from ...types.magic_transit.ipsec_tunnel_get_response import IPSECTunnelGetResponse
|
||||
from ...types.magic_transit.ipsec_tunnel_list_response import IPSECTunnelListResponse
|
||||
from ...types.magic_transit.ipsec_tunnel_create_response import IPSECTunnelCreateResponse
|
||||
from ...types.magic_transit.ipsec_tunnel_delete_response import IPSECTunnelDeleteResponse
|
||||
from ...types.magic_transit.ipsec_tunnel_update_response import IPSECTunnelUpdateResponse
|
||||
from ...types.magic_transit.ipsec_tunnel_psk_generate_response import IPSECTunnelPSKGenerateResponse
|
||||
|
||||
__all__ = ["IPSECTunnelsResource", "AsyncIPSECTunnelsResource"]
|
||||
|
||||
|
|
@ -129,92 +121,6 @@ class IPSECTunnelsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[IPSECTunnelCreateResponse], ResultWrapper[IPSECTunnelCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
cloudflare_endpoint: str,
|
||||
interface_address: str,
|
||||
name: str,
|
||||
customer_endpoint: str | NotGiven = NOT_GIVEN,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
health_check: HealthCheckParam | NotGiven = NOT_GIVEN,
|
||||
psk: str | NotGiven = NOT_GIVEN,
|
||||
replay_protection: bool | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelUpdateResponse:
|
||||
"""Updates a specific IPsec tunnel associated with an account.
|
||||
|
||||
Use
|
||||
`?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
cloudflare_endpoint: The IP address assigned to the Cloudflare side of the IPsec tunnel.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
name: The name of the IPsec tunnel. The name cannot share a name with other tunnels.
|
||||
|
||||
customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required,
|
||||
but must be set for proactive traceroutes to work.
|
||||
|
||||
description: An optional description forthe IPsec tunnel.
|
||||
|
||||
psk: A randomly generated or provided string for use in the IPsec tunnel.
|
||||
|
||||
replay_protection: If `true`, then IPsec replay protection will be supported in the
|
||||
Cloudflare-to-customer direction.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"cloudflare_endpoint": cloudflare_endpoint,
|
||||
"interface_address": interface_address,
|
||||
"name": name,
|
||||
"customer_endpoint": customer_endpoint,
|
||||
"description": description,
|
||||
"health_check": health_check,
|
||||
"psk": psk,
|
||||
"replay_protection": replay_protection,
|
||||
},
|
||||
ipsec_tunnel_update_params.IPSECTunnelUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelUpdateResponse], ResultWrapper[IPSECTunnelUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -254,146 +160,6 @@ class IPSECTunnelsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[IPSECTunnelListResponse], ResultWrapper[IPSECTunnelListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelDeleteResponse:
|
||||
"""
|
||||
Disables and removes a specific static IPsec Tunnel associated with an account.
|
||||
Use `?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelDeleteResponse], ResultWrapper[IPSECTunnelDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelGetResponse:
|
||||
"""
|
||||
Lists details for a specific IPsec tunnel.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelGetResponse], ResultWrapper[IPSECTunnelGetResponse]),
|
||||
)
|
||||
|
||||
def psk_generate(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
body: object,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelPSKGenerateResponse:
|
||||
"""
|
||||
Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session.
|
||||
Use `?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes. After a PSK is generated, the PSK is immediately
|
||||
persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a
|
||||
safe place.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}/psk_generate",
|
||||
body=maybe_transform(body, ipsec_tunnel_psk_generate_params.IPSECTunnelPSKGenerateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelPSKGenerateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelPSKGenerateResponse], ResultWrapper[IPSECTunnelPSKGenerateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncIPSECTunnelsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -485,92 +251,6 @@ class AsyncIPSECTunnelsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[IPSECTunnelCreateResponse], ResultWrapper[IPSECTunnelCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
cloudflare_endpoint: str,
|
||||
interface_address: str,
|
||||
name: str,
|
||||
customer_endpoint: str | NotGiven = NOT_GIVEN,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
health_check: HealthCheckParam | NotGiven = NOT_GIVEN,
|
||||
psk: str | NotGiven = NOT_GIVEN,
|
||||
replay_protection: bool | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelUpdateResponse:
|
||||
"""Updates a specific IPsec tunnel associated with an account.
|
||||
|
||||
Use
|
||||
`?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
cloudflare_endpoint: The IP address assigned to the Cloudflare side of the IPsec tunnel.
|
||||
|
||||
interface_address: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
|
||||
name: The name of the IPsec tunnel. The name cannot share a name with other tunnels.
|
||||
|
||||
customer_endpoint: The IP address assigned to the customer side of the IPsec tunnel. Not required,
|
||||
but must be set for proactive traceroutes to work.
|
||||
|
||||
description: An optional description forthe IPsec tunnel.
|
||||
|
||||
psk: A randomly generated or provided string for use in the IPsec tunnel.
|
||||
|
||||
replay_protection: If `true`, then IPsec replay protection will be supported in the
|
||||
Cloudflare-to-customer direction.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"cloudflare_endpoint": cloudflare_endpoint,
|
||||
"interface_address": interface_address,
|
||||
"name": name,
|
||||
"customer_endpoint": customer_endpoint,
|
||||
"description": description,
|
||||
"health_check": health_check,
|
||||
"psk": psk,
|
||||
"replay_protection": replay_protection,
|
||||
},
|
||||
ipsec_tunnel_update_params.IPSECTunnelUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelUpdateResponse], ResultWrapper[IPSECTunnelUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -610,146 +290,6 @@ class AsyncIPSECTunnelsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[IPSECTunnelListResponse], ResultWrapper[IPSECTunnelListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelDeleteResponse:
|
||||
"""
|
||||
Disables and removes a specific static IPsec Tunnel associated with an account.
|
||||
Use `?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelDeleteResponse], ResultWrapper[IPSECTunnelDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelGetResponse:
|
||||
"""
|
||||
Lists details for a specific IPsec tunnel.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelGetResponse], ResultWrapper[IPSECTunnelGetResponse]),
|
||||
)
|
||||
|
||||
async def psk_generate(
|
||||
self,
|
||||
tunnel_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
body: object,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> IPSECTunnelPSKGenerateResponse:
|
||||
"""
|
||||
Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session.
|
||||
Use `?validate_only=true` as an optional query parameter to only run validation
|
||||
without persisting changes. After a PSK is generated, the PSK is immediately
|
||||
persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a
|
||||
safe place.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
tunnel_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not tunnel_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `tunnel_identifier` but received {tunnel_identifier!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/magic/ipsec_tunnels/{tunnel_identifier}/psk_generate",
|
||||
body=await async_maybe_transform(body, ipsec_tunnel_psk_generate_params.IPSECTunnelPSKGenerateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[IPSECTunnelPSKGenerateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IPSECTunnelPSKGenerateResponse], ResultWrapper[IPSECTunnelPSKGenerateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class IPSECTunnelsResourceWithRawResponse:
|
||||
def __init__(self, ipsec_tunnels: IPSECTunnelsResource) -> None:
|
||||
|
|
@ -758,21 +298,9 @@ class IPSECTunnelsResourceWithRawResponse:
|
|||
self.create = to_raw_response_wrapper(
|
||||
ipsec_tunnels.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
ipsec_tunnels.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
ipsec_tunnels.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
ipsec_tunnels.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
ipsec_tunnels.get,
|
||||
)
|
||||
self.psk_generate = to_raw_response_wrapper(
|
||||
ipsec_tunnels.psk_generate,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIPSECTunnelsResourceWithRawResponse:
|
||||
|
|
@ -782,21 +310,9 @@ class AsyncIPSECTunnelsResourceWithRawResponse:
|
|||
self.create = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.get,
|
||||
)
|
||||
self.psk_generate = async_to_raw_response_wrapper(
|
||||
ipsec_tunnels.psk_generate,
|
||||
)
|
||||
|
||||
|
||||
class IPSECTunnelsResourceWithStreamingResponse:
|
||||
|
|
@ -806,21 +322,9 @@ class IPSECTunnelsResourceWithStreamingResponse:
|
|||
self.create = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.get,
|
||||
)
|
||||
self.psk_generate = to_streamed_response_wrapper(
|
||||
ipsec_tunnels.psk_generate,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIPSECTunnelsResourceWithStreamingResponse:
|
||||
|
|
@ -830,18 +334,6 @@ class AsyncIPSECTunnelsResourceWithStreamingResponse:
|
|||
self.create = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.get,
|
||||
)
|
||||
self.psk_generate = async_to_streamed_response_wrapper(
|
||||
ipsec_tunnels.psk_generate,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,14 +23,10 @@ from ..._wrappers import ResultWrapper
|
|||
from ..._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ...types.magic_transit import route_create_params, route_update_params
|
||||
from ...types.magic_transit.scope_param import ScopeParam
|
||||
from ...types.magic_transit.route_get_response import RouteGetResponse
|
||||
from ...types.magic_transit import route_create_params
|
||||
from ...types.magic_transit.route_list_response import RouteListResponse
|
||||
from ...types.magic_transit.route_empty_response import RouteEmptyResponse
|
||||
from ...types.magic_transit.route_create_response import RouteCreateResponse
|
||||
from ...types.magic_transit.route_delete_response import RouteDeleteResponse
|
||||
from ...types.magic_transit.route_update_response import RouteUpdateResponse
|
||||
|
||||
__all__ = ["RoutesResource", "AsyncRoutesResource"]
|
||||
|
||||
|
|
@ -87,81 +83,6 @@ class RoutesResource(SyncAPIResource):
|
|||
cast_to=cast(Type[RouteCreateResponse], ResultWrapper[RouteCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
nexthop: str,
|
||||
prefix: str,
|
||||
priority: int,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
scope: ScopeParam | NotGiven = NOT_GIVEN,
|
||||
weight: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteUpdateResponse:
|
||||
"""Update a specific Magic static route.
|
||||
|
||||
Use `?validate_only=true` as an optional
|
||||
query parameter to run validation only without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
nexthop: The next-hop IP Address for the static route.
|
||||
|
||||
prefix: IP Prefix in Classless Inter-Domain Routing format.
|
||||
|
||||
priority: Priority of the static route.
|
||||
|
||||
description: An optional human provided description of the static route.
|
||||
|
||||
scope: Used only for ECMP routes.
|
||||
|
||||
weight: Optional weight of the ECMP scope - if provided.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"nexthop": nexthop,
|
||||
"prefix": prefix,
|
||||
"priority": priority,
|
||||
"description": description,
|
||||
"scope": scope,
|
||||
"weight": weight,
|
||||
},
|
||||
route_update_params.RouteUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteUpdateResponse], ResultWrapper[RouteUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -201,50 +122,6 @@ class RoutesResource(SyncAPIResource):
|
|||
cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteDeleteResponse:
|
||||
"""
|
||||
Disable and remove a specific Magic static route.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteDeleteResponse], ResultWrapper[RouteDeleteResponse]),
|
||||
)
|
||||
|
||||
def empty(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -284,50 +161,6 @@ class RoutesResource(SyncAPIResource):
|
|||
cast_to=cast(Type[RouteEmptyResponse], ResultWrapper[RouteEmptyResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteGetResponse:
|
||||
"""
|
||||
Get a specific Magic static route.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteGetResponse], ResultWrapper[RouteGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncRoutesResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -381,81 +214,6 @@ class AsyncRoutesResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[RouteCreateResponse], ResultWrapper[RouteCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
nexthop: str,
|
||||
prefix: str,
|
||||
priority: int,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
scope: ScopeParam | NotGiven = NOT_GIVEN,
|
||||
weight: int | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteUpdateResponse:
|
||||
"""Update a specific Magic static route.
|
||||
|
||||
Use `?validate_only=true` as an optional
|
||||
query parameter to run validation only without persisting changes.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
nexthop: The next-hop IP Address for the static route.
|
||||
|
||||
prefix: IP Prefix in Classless Inter-Domain Routing format.
|
||||
|
||||
priority: Priority of the static route.
|
||||
|
||||
description: An optional human provided description of the static route.
|
||||
|
||||
scope: Used only for ECMP routes.
|
||||
|
||||
weight: Optional weight of the ECMP scope - if provided.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"nexthop": nexthop,
|
||||
"prefix": prefix,
|
||||
"priority": priority,
|
||||
"description": description,
|
||||
"scope": scope,
|
||||
"weight": weight,
|
||||
},
|
||||
route_update_params.RouteUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteUpdateResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteUpdateResponse], ResultWrapper[RouteUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -495,50 +253,6 @@ class AsyncRoutesResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteDeleteResponse:
|
||||
"""
|
||||
Disable and remove a specific Magic static route.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteDeleteResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteDeleteResponse], ResultWrapper[RouteDeleteResponse]),
|
||||
)
|
||||
|
||||
async def empty(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -578,50 +292,6 @@ class AsyncRoutesResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[RouteEmptyResponse], ResultWrapper[RouteEmptyResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
route_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RouteGetResponse:
|
||||
"""
|
||||
Get a specific Magic static route.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
route_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not route_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `route_identifier` but received {route_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/magic/routes/{route_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[RouteGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RouteGetResponse], ResultWrapper[RouteGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class RoutesResourceWithRawResponse:
|
||||
def __init__(self, routes: RoutesResource) -> None:
|
||||
|
|
@ -630,21 +300,12 @@ class RoutesResourceWithRawResponse:
|
|||
self.create = to_raw_response_wrapper(
|
||||
routes.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
routes.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
routes.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
routes.delete,
|
||||
)
|
||||
self.empty = to_raw_response_wrapper(
|
||||
routes.empty,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
routes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRoutesResourceWithRawResponse:
|
||||
|
|
@ -654,21 +315,12 @@ class AsyncRoutesResourceWithRawResponse:
|
|||
self.create = async_to_raw_response_wrapper(
|
||||
routes.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
routes.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
routes.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
routes.delete,
|
||||
)
|
||||
self.empty = async_to_raw_response_wrapper(
|
||||
routes.empty,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
routes.get,
|
||||
)
|
||||
|
||||
|
||||
class RoutesResourceWithStreamingResponse:
|
||||
|
|
@ -678,21 +330,12 @@ class RoutesResourceWithStreamingResponse:
|
|||
self.create = to_streamed_response_wrapper(
|
||||
routes.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
routes.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
routes.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
routes.delete,
|
||||
)
|
||||
self.empty = to_streamed_response_wrapper(
|
||||
routes.empty,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
routes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRoutesResourceWithStreamingResponse:
|
||||
|
|
@ -702,18 +345,9 @@ class AsyncRoutesResourceWithStreamingResponse:
|
|||
self.create = async_to_streamed_response_wrapper(
|
||||
routes.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
routes.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
routes.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
routes.delete,
|
||||
)
|
||||
self.empty = async_to_streamed_response_wrapper(
|
||||
routes.empty,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
routes.get,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from ...._base_client import (
|
|||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.magic_transit.sites import acl_edit_params, acl_create_params, acl_update_params
|
||||
from ....types.magic_transit.sites import acl_create_params
|
||||
from ....types.magic_transit.sites.acl import ACL
|
||||
from ....types.magic_transit.sites.allowed_protocol import AllowedProtocol
|
||||
from ....types.magic_transit.sites.acl_configuration_param import ACLConfigurationParam
|
||||
|
|
@ -112,81 +112,6 @@ class ACLsResource(SyncAPIResource):
|
|||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
forward_locally: bool | NotGiven = NOT_GIVEN,
|
||||
lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
name: str | NotGiven = NOT_GIVEN,
|
||||
protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Update a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
description: Description for the ACL.
|
||||
|
||||
forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy
|
||||
will forward traffic to Cloudflare. If set to "true", the policy will forward
|
||||
traffic locally on the Magic Connector. If not included in request, will default
|
||||
to false.
|
||||
|
||||
name: The name of the ACL.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"forward_locally": forward_locally,
|
||||
"lan_1": lan_1,
|
||||
"lan_2": lan_2,
|
||||
"name": name,
|
||||
"protocols": protocols,
|
||||
},
|
||||
acl_update_params.ACLUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
site_id: str,
|
||||
|
|
@ -228,179 +153,6 @@ class ACLsResource(SyncAPIResource):
|
|||
model=ACL,
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Remove a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
def edit(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
forward_locally: bool | NotGiven = NOT_GIVEN,
|
||||
lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
name: str | NotGiven = NOT_GIVEN,
|
||||
protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Patch a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
description: Description for the ACL.
|
||||
|
||||
forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy
|
||||
will forward traffic to Cloudflare. If set to "true", the policy will forward
|
||||
traffic locally on the Magic Connector. If not included in request, will default
|
||||
to false.
|
||||
|
||||
name: The name of the ACL.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._patch(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"forward_locally": forward_locally,
|
||||
"lan_1": lan_1,
|
||||
"lan_2": lan_2,
|
||||
"name": name,
|
||||
"protocols": protocols,
|
||||
},
|
||||
acl_edit_params.ACLEditParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Get a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -481,81 +233,6 @@ class AsyncACLsResource(AsyncAPIResource):
|
|||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
forward_locally: bool | NotGiven = NOT_GIVEN,
|
||||
lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
name: str | NotGiven = NOT_GIVEN,
|
||||
protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Update a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
description: Description for the ACL.
|
||||
|
||||
forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy
|
||||
will forward traffic to Cloudflare. If set to "true", the policy will forward
|
||||
traffic locally on the Magic Connector. If not included in request, will default
|
||||
to false.
|
||||
|
||||
name: The name of the ACL.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"forward_locally": forward_locally,
|
||||
"lan_1": lan_1,
|
||||
"lan_2": lan_2,
|
||||
"name": name,
|
||||
"protocols": protocols,
|
||||
},
|
||||
acl_update_params.ACLUpdateParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
site_id: str,
|
||||
|
|
@ -597,179 +274,6 @@ class AsyncACLsResource(AsyncAPIResource):
|
|||
model=ACL,
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Remove a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
async def edit(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
description: str | NotGiven = NOT_GIVEN,
|
||||
forward_locally: bool | NotGiven = NOT_GIVEN,
|
||||
lan_1: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
lan_2: ACLConfigurationParam | NotGiven = NOT_GIVEN,
|
||||
name: str | NotGiven = NOT_GIVEN,
|
||||
protocols: List[AllowedProtocol] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Patch a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
description: Description for the ACL.
|
||||
|
||||
forward_locally: The desired forwarding action for this ACL policy. If set to "false", the policy
|
||||
will forward traffic to Cloudflare. If set to "true", the policy will forward
|
||||
traffic locally on the Magic Connector. If not included in request, will default
|
||||
to false.
|
||||
|
||||
name: The name of the ACL.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._patch(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"description": description,
|
||||
"forward_locally": forward_locally,
|
||||
"lan_1": lan_1,
|
||||
"lan_2": lan_2,
|
||||
"name": name,
|
||||
"protocols": protocols,
|
||||
},
|
||||
acl_edit_params.ACLEditParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_id: str,
|
||||
site_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ACL:
|
||||
"""
|
||||
Get a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
site_id: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not site_id:
|
||||
raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[ACL]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACL], ResultWrapper[ACL]),
|
||||
)
|
||||
|
||||
|
||||
class ACLsResourceWithRawResponse:
|
||||
def __init__(self, acls: ACLsResource) -> None:
|
||||
|
|
@ -778,21 +282,9 @@ class ACLsResourceWithRawResponse:
|
|||
self.create = to_raw_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.edit = to_raw_response_wrapper(
|
||||
acls.edit,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLsResourceWithRawResponse:
|
||||
|
|
@ -802,21 +294,9 @@ class AsyncACLsResourceWithRawResponse:
|
|||
self.create = async_to_raw_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.edit = async_to_raw_response_wrapper(
|
||||
acls.edit,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class ACLsResourceWithStreamingResponse:
|
||||
|
|
@ -826,21 +306,9 @@ class ACLsResourceWithStreamingResponse:
|
|||
self.create = to_streamed_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.edit = to_streamed_response_wrapper(
|
||||
acls.edit,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLsResourceWithStreamingResponse:
|
||||
|
|
@ -850,18 +318,6 @@ class AsyncACLsResourceWithStreamingResponse:
|
|||
self.create = async_to_streamed_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.edit = async_to_streamed_response_wrapper(
|
||||
acls.edit,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||
|
||||
from .site import Site as Site
|
||||
from .scope import Scope as Scope
|
||||
from .scope_param import ScopeParam as ScopeParam
|
||||
from .health_check import HealthCheck as HealthCheck
|
||||
from .psk_metadata import PSKMetadata as PSKMetadata
|
||||
from .site_location import SiteLocation as SiteLocation
|
||||
|
|
@ -16,7 +15,6 @@ from .app_update_params import AppUpdateParams as AppUpdateParams
|
|||
from .health_check_rate import HealthCheckRate as HealthCheckRate
|
||||
from .health_check_type import HealthCheckType as HealthCheckType
|
||||
from .health_check_param import HealthCheckParam as HealthCheckParam
|
||||
from .route_get_response import RouteGetResponse as RouteGetResponse
|
||||
from .site_create_params import SiteCreateParams as SiteCreateParams
|
||||
from .site_update_params import SiteUpdateParams as SiteUpdateParams
|
||||
from .app_create_response import AppCreateResponse as AppCreateResponse
|
||||
|
|
@ -24,35 +22,19 @@ from .app_delete_response import AppDeleteResponse as AppDeleteResponse
|
|||
from .app_update_response import AppUpdateResponse as AppUpdateResponse
|
||||
from .route_create_params import RouteCreateParams as RouteCreateParams
|
||||
from .route_list_response import RouteListResponse as RouteListResponse
|
||||
from .route_update_params import RouteUpdateParams as RouteUpdateParams
|
||||
from .site_location_param import SiteLocationParam as SiteLocationParam
|
||||
from .route_empty_response import RouteEmptyResponse as RouteEmptyResponse
|
||||
from .connector_edit_params import ConnectorEditParams as ConnectorEditParams
|
||||
from .route_create_response import RouteCreateResponse as RouteCreateResponse
|
||||
from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse
|
||||
from .route_update_response import RouteUpdateResponse as RouteUpdateResponse
|
||||
from .connector_get_response import ConnectorGetResponse as ConnectorGetResponse
|
||||
from .connector_edit_response import ConnectorEditResponse as ConnectorEditResponse
|
||||
from .connector_list_response import ConnectorListResponse as ConnectorListResponse
|
||||
from .connector_update_params import ConnectorUpdateParams as ConnectorUpdateParams
|
||||
from .gre_tunnel_get_response import GRETunnelGetResponse as GRETunnelGetResponse
|
||||
from .gre_tunnel_create_params import GRETunnelCreateParams as GRETunnelCreateParams
|
||||
from .gre_tunnel_list_response import GRETunnelListResponse as GRETunnelListResponse
|
||||
from .gre_tunnel_update_params import GRETunnelUpdateParams as GRETunnelUpdateParams
|
||||
from .connector_update_response import ConnectorUpdateResponse as ConnectorUpdateResponse
|
||||
from .ipsec_tunnel_get_response import IPSECTunnelGetResponse as IPSECTunnelGetResponse
|
||||
from .gre_tunnel_create_response import GRETunnelCreateResponse as GRETunnelCreateResponse
|
||||
from .gre_tunnel_delete_response import GRETunnelDeleteResponse as GRETunnelDeleteResponse
|
||||
from .gre_tunnel_update_response import GRETunnelUpdateResponse as GRETunnelUpdateResponse
|
||||
from .ipsec_tunnel_create_params import IPSECTunnelCreateParams as IPSECTunnelCreateParams
|
||||
from .ipsec_tunnel_list_response import IPSECTunnelListResponse as IPSECTunnelListResponse
|
||||
from .ipsec_tunnel_update_params import IPSECTunnelUpdateParams as IPSECTunnelUpdateParams
|
||||
from .cf_interconnect_get_response import CfInterconnectGetResponse as CfInterconnectGetResponse
|
||||
from .ipsec_tunnel_create_response import IPSECTunnelCreateResponse as IPSECTunnelCreateResponse
|
||||
from .ipsec_tunnel_delete_response import IPSECTunnelDeleteResponse as IPSECTunnelDeleteResponse
|
||||
from .ipsec_tunnel_update_response import IPSECTunnelUpdateResponse as IPSECTunnelUpdateResponse
|
||||
from .cf_interconnect_list_response import CfInterconnectListResponse as CfInterconnectListResponse
|
||||
from .cf_interconnect_update_params import CfInterconnectUpdateParams as CfInterconnectUpdateParams
|
||||
from .cf_interconnect_update_response import CfInterconnectUpdateResponse as CfInterconnectUpdateResponse
|
||||
from .ipsec_tunnel_psk_generate_params import IPSECTunnelPSKGenerateParams as IPSECTunnelPSKGenerateParams
|
||||
from .ipsec_tunnel_psk_generate_response import IPSECTunnelPSKGenerateResponse as IPSECTunnelPSKGenerateResponse
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["CfInterconnectGetResponse"]
|
||||
|
||||
|
||||
class CfInterconnectGetResponse(BaseModel):
|
||||
interconnect: Optional[object] = None
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .health_check_rate import HealthCheckRate
|
||||
from .health_check_type import HealthCheckType
|
||||
|
||||
__all__ = ["CfInterconnectUpdateParams", "GRE", "HealthCheck"]
|
||||
|
||||
|
||||
class CfInterconnectUpdateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
description: str
|
||||
"""An optional description of the interconnect."""
|
||||
|
||||
gre: GRE
|
||||
"""The configuration specific to GRE interconnects."""
|
||||
|
||||
health_check: HealthCheck
|
||||
|
||||
interface_address: str
|
||||
"""
|
||||
A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
"""
|
||||
|
||||
mtu: int
|
||||
"""The Maximum Transmission Unit (MTU) in bytes for the interconnect.
|
||||
|
||||
The minimum value is 576.
|
||||
"""
|
||||
|
||||
|
||||
class GRE(TypedDict, total=False):
|
||||
cloudflare_endpoint: str
|
||||
"""
|
||||
The IP address assigned to the Cloudflare side of the GRE tunnel created as part
|
||||
of the Interconnect.
|
||||
"""
|
||||
|
||||
|
||||
class HealthCheck(TypedDict, total=False):
|
||||
enabled: bool
|
||||
"""Determines whether to run healthchecks for a tunnel."""
|
||||
|
||||
rate: HealthCheckRate
|
||||
"""How frequent the health check is run. The default value is `mid`."""
|
||||
|
||||
target: str
|
||||
"""The destination address in a request type health check.
|
||||
|
||||
After the healthcheck is decapsulated at the customer end of the tunnel, the
|
||||
ICMP echo will be forwarded to this address. This field defaults to
|
||||
`customer_gre_endpoint address`.
|
||||
"""
|
||||
|
||||
type: HealthCheckType
|
||||
"""The type of healthcheck to run, reply or request. The default value is `reply`."""
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["CfInterconnectUpdateResponse"]
|
||||
|
||||
|
||||
class CfInterconnectUpdateResponse(BaseModel):
|
||||
modified: Optional[bool] = None
|
||||
|
||||
modified_interconnect: Optional[object] = None
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["GRETunnelDeleteResponse"]
|
||||
|
||||
|
||||
class GRETunnelDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_gre_tunnel: Optional[object] = None
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["GRETunnelGetResponse"]
|
||||
|
||||
|
||||
class GRETunnelGetResponse(BaseModel):
|
||||
gre_tunnel: Optional[object] = None
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .health_check_param import HealthCheckParam
|
||||
|
||||
__all__ = ["GRETunnelUpdateParams"]
|
||||
|
||||
|
||||
class GRETunnelUpdateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
cloudflare_gre_endpoint: Required[str]
|
||||
"""The IP address assigned to the Cloudflare side of the GRE tunnel."""
|
||||
|
||||
customer_gre_endpoint: Required[str]
|
||||
"""The IP address assigned to the customer side of the GRE tunnel."""
|
||||
|
||||
interface_address: Required[str]
|
||||
"""
|
||||
A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
"""
|
||||
|
||||
name: Required[str]
|
||||
"""The name of the tunnel.
|
||||
|
||||
The name cannot contain spaces or special characters, must be 15 characters or
|
||||
less, and cannot share a name with another GRE tunnel.
|
||||
"""
|
||||
|
||||
description: str
|
||||
"""An optional description of the GRE tunnel."""
|
||||
|
||||
health_check: HealthCheckParam
|
||||
|
||||
mtu: int
|
||||
"""Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
|
||||
|
||||
The minimum value is 576.
|
||||
"""
|
||||
|
||||
ttl: int
|
||||
"""Time To Live (TTL) in number of hops of the GRE tunnel."""
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["GRETunnelUpdateResponse"]
|
||||
|
||||
|
||||
class GRETunnelUpdateResponse(BaseModel):
|
||||
modified: Optional[bool] = None
|
||||
|
||||
modified_gre_tunnel: Optional[object] = None
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["IPSECTunnelDeleteResponse"]
|
||||
|
||||
|
||||
class IPSECTunnelDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_ipsec_tunnel: Optional[object] = None
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["IPSECTunnelGetResponse"]
|
||||
|
||||
|
||||
class IPSECTunnelGetResponse(BaseModel):
|
||||
ipsec_tunnel: Optional[object] = None
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["IPSECTunnelPSKGenerateParams"]
|
||||
|
||||
|
||||
class IPSECTunnelPSKGenerateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
body: Required[object]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
from .psk_metadata import PSKMetadata
|
||||
|
||||
__all__ = ["IPSECTunnelPSKGenerateResponse"]
|
||||
|
||||
|
||||
class IPSECTunnelPSKGenerateResponse(BaseModel):
|
||||
ipsec_tunnel_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
psk: Optional[str] = None
|
||||
"""A randomly generated or provided string for use in the IPsec tunnel."""
|
||||
|
||||
psk_metadata: Optional[PSKMetadata] = None
|
||||
"""The PSK metadata that includes when the PSK was generated."""
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .health_check_param import HealthCheckParam
|
||||
|
||||
__all__ = ["IPSECTunnelUpdateParams"]
|
||||
|
||||
|
||||
class IPSECTunnelUpdateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
cloudflare_endpoint: Required[str]
|
||||
"""The IP address assigned to the Cloudflare side of the IPsec tunnel."""
|
||||
|
||||
interface_address: Required[str]
|
||||
"""
|
||||
A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side
|
||||
of the tunnel. Select the subnet from the following private IP space:
|
||||
10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.
|
||||
"""
|
||||
|
||||
name: Required[str]
|
||||
"""The name of the IPsec tunnel. The name cannot share a name with other tunnels."""
|
||||
|
||||
customer_endpoint: str
|
||||
"""The IP address assigned to the customer side of the IPsec tunnel.
|
||||
|
||||
Not required, but must be set for proactive traceroutes to work.
|
||||
"""
|
||||
|
||||
description: str
|
||||
"""An optional description forthe IPsec tunnel."""
|
||||
|
||||
health_check: HealthCheckParam
|
||||
|
||||
psk: str
|
||||
"""A randomly generated or provided string for use in the IPsec tunnel."""
|
||||
|
||||
replay_protection: bool
|
||||
"""
|
||||
If `true`, then IPsec replay protection will be supported in the
|
||||
Cloudflare-to-customer direction.
|
||||
"""
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["IPSECTunnelUpdateResponse"]
|
||||
|
||||
|
||||
class IPSECTunnelUpdateResponse(BaseModel):
|
||||
modified: Optional[bool] = None
|
||||
|
||||
modified_ipsec_tunnel: Optional[object] = None
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["RouteDeleteResponse"]
|
||||
|
||||
|
||||
class RouteDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_route: Optional[object] = None
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["RouteGetResponse"]
|
||||
|
||||
|
||||
class RouteGetResponse(BaseModel):
|
||||
route: Optional[object] = None
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .scope_param import ScopeParam
|
||||
|
||||
__all__ = ["RouteUpdateParams"]
|
||||
|
||||
|
||||
class RouteUpdateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
nexthop: Required[str]
|
||||
"""The next-hop IP Address for the static route."""
|
||||
|
||||
prefix: Required[str]
|
||||
"""IP Prefix in Classless Inter-Domain Routing format."""
|
||||
|
||||
priority: Required[int]
|
||||
"""Priority of the static route."""
|
||||
|
||||
description: str
|
||||
"""An optional human provided description of the static route."""
|
||||
|
||||
scope: ScopeParam
|
||||
"""Used only for ECMP routes."""
|
||||
|
||||
weight: int
|
||||
"""Optional weight of the ECMP scope - if provided."""
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["RouteUpdateResponse"]
|
||||
|
||||
|
||||
class RouteUpdateResponse(BaseModel):
|
||||
modified: Optional[bool] = None
|
||||
|
||||
modified_route: Optional[object] = None
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
__all__ = ["ScopeParam"]
|
||||
|
||||
|
||||
class ScopeParam(TypedDict, total=False):
|
||||
colo_names: List[str]
|
||||
"""List of colo names for the ECMP scope."""
|
||||
|
||||
colo_regions: List[str]
|
||||
"""List of colo regions for the ECMP scope."""
|
||||
|
|
@ -12,14 +12,12 @@ from .dhcp_relay import DHCPRelay as DHCPRelay
|
|||
from .dhcp_server import DHCPServer as DHCPServer
|
||||
from .subnet_param import SubnetParam as SubnetParam
|
||||
from .routed_subnet import RoutedSubnet as RoutedSubnet
|
||||
from .acl_edit_params import ACLEditParams as ACLEditParams
|
||||
from .lan_edit_params import LANEditParams as LANEditParams
|
||||
from .wan_edit_params import WANEditParams as WANEditParams
|
||||
from .allowed_protocol import AllowedProtocol as AllowedProtocol
|
||||
from .dhcp_relay_param import DHCPRelayParam as DHCPRelayParam
|
||||
from .acl_configuration import ACLConfiguration as ACLConfiguration
|
||||
from .acl_create_params import ACLCreateParams as ACLCreateParams
|
||||
from .acl_update_params import ACLUpdateParams as ACLUpdateParams
|
||||
from .dhcp_server_param import DHCPServerParam as DHCPServerParam
|
||||
from .lan_create_params import LANCreateParams as LANCreateParams
|
||||
from .lan_update_params import LANUpdateParams as LANUpdateParams
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .allowed_protocol import AllowedProtocol
|
||||
from .acl_configuration_param import ACLConfigurationParam
|
||||
|
||||
__all__ = ["ACLEditParams"]
|
||||
|
||||
|
||||
class ACLEditParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
description: str
|
||||
"""Description for the ACL."""
|
||||
|
||||
forward_locally: bool
|
||||
"""The desired forwarding action for this ACL policy.
|
||||
|
||||
If set to "false", the policy will forward traffic to Cloudflare. If set to
|
||||
"true", the policy will forward traffic locally on the Magic Connector. If not
|
||||
included in request, will default to false.
|
||||
"""
|
||||
|
||||
lan_1: ACLConfigurationParam
|
||||
|
||||
lan_2: ACLConfigurationParam
|
||||
|
||||
name: str
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: List[AllowedProtocol]
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .allowed_protocol import AllowedProtocol
|
||||
from .acl_configuration_param import ACLConfigurationParam
|
||||
|
||||
__all__ = ["ACLUpdateParams"]
|
||||
|
||||
|
||||
class ACLUpdateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
description: str
|
||||
"""Description for the ACL."""
|
||||
|
||||
forward_locally: bool
|
||||
"""The desired forwarding action for this ACL policy.
|
||||
|
||||
If set to "false", the policy will forward traffic to Cloudflare. If set to
|
||||
"true", the policy will forward traffic locally on the Magic Connector. If not
|
||||
included in request, will default to false.
|
||||
"""
|
||||
|
||||
lan_1: ACLConfigurationParam
|
||||
|
||||
lan_2: ACLConfigurationParam
|
||||
|
||||
name: str
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: List[AllowedProtocol]
|
||||
|
|
@ -10,9 +10,7 @@ import pytest
|
|||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
ACL,
|
||||
)
|
||||
from cloudflare.types.magic_transit.sites import ACL
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -107,91 +105,6 @@ class TestACLs:
|
|||
name="PIN Pad - Cash Register",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Allows local traffic between PIN pads and cash register.",
|
||||
forward_locally=True,
|
||||
lan_1={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
lan_2={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
name="PIN Pad - Cash Register",
|
||||
protocols=["tcp", "udp", "icmp"],
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.list(
|
||||
|
|
@ -240,211 +153,6 @@ class TestACLs:
|
|||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_edit(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Allows local traffic between PIN pads and cash register.",
|
||||
forward_locally=True,
|
||||
lan_1={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
lan_2={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
name="PIN Pad - Cash Register",
|
||||
protocols=["tcp", "udp", "icmp"],
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_edit(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_edit(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_edit(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncACLs:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
|
@ -536,91 +244,6 @@ class TestAsyncACLs:
|
|||
name="PIN Pad - Cash Register",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Allows local traffic between PIN pads and cash register.",
|
||||
forward_locally=True,
|
||||
lan_1={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
lan_2={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
name="PIN Pad - Cash Register",
|
||||
protocols=["tcp", "udp", "icmp"],
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.list(
|
||||
|
|
@ -668,208 +291,3 @@ class TestAsyncACLs:
|
|||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Allows local traffic between PIN pads and cash register.",
|
||||
forward_locally=True,
|
||||
lan_1={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
lan_2={
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
name="PIN Pad - Cash Register",
|
||||
protocols=["tcp", "udp", "icmp"],
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.edit(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACL, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ import pytest
|
|||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit import (
|
||||
CfInterconnectGetResponse,
|
||||
CfInterconnectListResponse,
|
||||
CfInterconnectUpdateResponse,
|
||||
)
|
||||
from cloudflare.types.magic_transit import CfInterconnectListResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -21,72 +17,6 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|||
class TestCfInterconnects:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
cf_interconnect = client.magic_transit.cf_interconnects.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
cf_interconnect = client.magic_transit.cf_interconnects.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Tunnel for Interconnect to ORD",
|
||||
gre={"cloudflare_endpoint": "203.0.113.1"},
|
||||
health_check={
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
interface_address="192.0.2.0/31",
|
||||
mtu=0,
|
||||
)
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
cf_interconnect = response.parse()
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.cf_interconnects.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
cf_interconnect = response.parse()
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
cf_interconnect = client.magic_transit.cf_interconnects.list(
|
||||
|
|
@ -125,124 +55,10 @@ class TestCfInterconnects:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
cf_interconnect = client.magic_transit.cf_interconnects.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
cf_interconnect = response.parse()
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.cf_interconnects.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
cf_interconnect = response.parse()
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncCfInterconnects:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
cf_interconnect = await async_client.magic_transit.cf_interconnects.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
cf_interconnect = await async_client.magic_transit.cf_interconnects.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
description="Tunnel for Interconnect to ORD",
|
||||
gre={"cloudflare_endpoint": "203.0.113.1"},
|
||||
health_check={
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
interface_address="192.0.2.0/31",
|
||||
mtu=0,
|
||||
)
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
cf_interconnect = await response.parse()
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.cf_interconnects.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
cf_interconnect = await response.parse()
|
||||
assert_matches_type(CfInterconnectUpdateResponse, cf_interconnect, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.cf_interconnects.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
cf_interconnect = await async_client.magic_transit.cf_interconnects.list(
|
||||
|
|
@ -280,51 +96,3 @@ class TestAsyncCfInterconnects:
|
|||
await async_client.magic_transit.cf_interconnects.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
cf_interconnect = await async_client.magic_transit.cf_interconnects.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
cf_interconnect = await response.parse()
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.cf_interconnects.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
cf_interconnect = await response.parse()
|
||||
assert_matches_type(CfInterconnectGetResponse, cf_interconnect, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.cf_interconnects.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@ import pytest
|
|||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit import (
|
||||
GRETunnelGetResponse,
|
||||
GRETunnelListResponse,
|
||||
GRETunnelCreateResponse,
|
||||
GRETunnelDeleteResponse,
|
||||
GRETunnelUpdateResponse,
|
||||
)
|
||||
from cloudflare.types.magic_transit import GRETunnelListResponse, GRETunnelCreateResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -69,96 +63,6 @@ class TestGRETunnels:
|
|||
body={},
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
gre_tunnel = client.magic_transit.gre_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
gre_tunnel = client.magic_transit.gre_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
description="Tunnel for ISP X",
|
||||
health_check={
|
||||
"direction": "bidirectional",
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
mtu=0,
|
||||
ttl=0,
|
||||
)
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.gre_tunnels.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
gre_tunnel = client.magic_transit.gre_tunnels.list(
|
||||
|
|
@ -197,102 +101,6 @@ class TestGRETunnels:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
gre_tunnel = client.magic_transit.gre_tunnels.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.gre_tunnels.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
gre_tunnel = client.magic_transit.gre_tunnels.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.gre_tunnels.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = response.parse()
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncGRETunnels:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
|
@ -343,96 +151,6 @@ class TestAsyncGRETunnels:
|
|||
body={},
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
gre_tunnel = await async_client.magic_transit.gre_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
gre_tunnel = await async_client.magic_transit.gre_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
description="Tunnel for ISP X",
|
||||
health_check={
|
||||
"direction": "bidirectional",
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
mtu=0,
|
||||
ttl=0,
|
||||
)
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.gre_tunnels.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelUpdateResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_gre_endpoint="203.0.113.1",
|
||||
customer_gre_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="GRE_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
gre_tunnel = await async_client.magic_transit.gre_tunnels.list(
|
||||
|
|
@ -470,99 +188,3 @@ class TestAsyncGRETunnels:
|
|||
await async_client.magic_transit.gre_tunnels.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
gre_tunnel = await async_client.magic_transit.gre_tunnels.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.gre_tunnels.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelDeleteResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
gre_tunnel = await async_client.magic_transit.gre_tunnels.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.gre_tunnels.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
gre_tunnel = await response.parse()
|
||||
assert_matches_type(GRETunnelGetResponse, gre_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.gre_tunnels.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,12 +10,8 @@ import pytest
|
|||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit import (
|
||||
IPSECTunnelGetResponse,
|
||||
IPSECTunnelListResponse,
|
||||
IPSECTunnelCreateResponse,
|
||||
IPSECTunnelDeleteResponse,
|
||||
IPSECTunnelUpdateResponse,
|
||||
IPSECTunnelPSKGenerateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
|
@ -95,91 +91,6 @@ class TestIPSECTunnels:
|
|||
name="IPsec_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
customer_endpoint="203.0.113.1",
|
||||
description="Tunnel for ISP X",
|
||||
health_check={
|
||||
"direction": "bidirectional",
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
psk="O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy",
|
||||
replay_protection=False,
|
||||
)
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.ipsec_tunnels.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.list(
|
||||
|
|
@ -218,155 +129,6 @@ class TestIPSECTunnels:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.ipsec_tunnels.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.ipsec_tunnels.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_psk_generate(self, client: Cloudflare) -> None:
|
||||
ipsec_tunnel = client.magic_transit.ipsec_tunnels.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_psk_generate(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_psk_generate(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.ipsec_tunnels.with_streaming_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = response.parse()
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_psk_generate(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
body={},
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncIPSECTunnels:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
|
@ -442,91 +204,6 @@ class TestAsyncIPSECTunnels:
|
|||
name="IPsec_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
customer_endpoint="203.0.113.1",
|
||||
description="Tunnel for ISP X",
|
||||
health_check={
|
||||
"direction": "bidirectional",
|
||||
"enabled": True,
|
||||
"rate": "low",
|
||||
"target": "203.0.113.1",
|
||||
"type": "request",
|
||||
},
|
||||
psk="O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy",
|
||||
replay_protection=False,
|
||||
)
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelUpdateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
cloudflare_endpoint="203.0.113.1",
|
||||
interface_address="192.0.2.0/31",
|
||||
name="IPsec_1",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.list(
|
||||
|
|
@ -564,152 +241,3 @@ class TestAsyncIPSECTunnels:
|
|||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelDeleteResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelGetResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_psk_generate(self, async_client: AsyncCloudflare) -> None:
|
||||
ipsec_tunnel = await async_client.magic_transit.ipsec_tunnels.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_psk_generate(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_psk_generate(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.ipsec_tunnels.with_streaming_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
ipsec_tunnel = await response.parse()
|
||||
assert_matches_type(IPSECTunnelPSKGenerateResponse, ipsec_tunnel, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_psk_generate(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
body={},
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_identifier` but received ''"):
|
||||
await async_client.magic_transit.ipsec_tunnels.with_raw_response.psk_generate(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,12 +10,9 @@ import pytest
|
|||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit import (
|
||||
RouteGetResponse,
|
||||
RouteListResponse,
|
||||
RouteEmptyResponse,
|
||||
RouteCreateResponse,
|
||||
RouteDeleteResponse,
|
||||
RouteUpdateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
|
@ -70,86 +67,6 @@ class TestRoutes:
|
|||
body={},
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
description="New route for new prefix 203.0.113.1",
|
||||
scope={
|
||||
"colo_names": ["den01", "den01", "den01"],
|
||||
"colo_regions": ["APAC", "APAC", "APAC"],
|
||||
},
|
||||
weight=0,
|
||||
)
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.routes.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.routes.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.list(
|
||||
|
|
@ -188,54 +105,6 @@ class TestRoutes:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.routes.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.routes.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_empty(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.empty(
|
||||
|
|
@ -274,54 +143,6 @@ class TestRoutes:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
route = client.magic_transit.routes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.routes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.routes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = response.parse()
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
client.magic_transit.routes.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncRoutes:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
|
@ -372,86 +193,6 @@ class TestAsyncRoutes:
|
|||
body={},
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
description="New route for new prefix 203.0.113.1",
|
||||
scope={
|
||||
"colo_names": ["den01", "den01", "den01"],
|
||||
"colo_regions": ["APAC", "APAC", "APAC"],
|
||||
},
|
||||
weight=0,
|
||||
)
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.routes.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.routes.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteUpdateResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.update(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
nexthop="203.0.113.1",
|
||||
prefix="192.0.2.0/24",
|
||||
priority=0,
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.list(
|
||||
|
|
@ -490,54 +231,6 @@ class TestAsyncRoutes:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.routes.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.routes.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteDeleteResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_empty(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.empty(
|
||||
|
|
@ -575,51 +268,3 @@ class TestAsyncRoutes:
|
|||
await async_client.magic_transit.routes.with_raw_response.empty(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
route = await async_client.magic_transit.routes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.routes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.routes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
route = await response.parse()
|
||||
assert_matches_type(RouteGetResponse, route, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `route_identifier` but received ''"):
|
||||
await async_client.magic_transit.routes.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue