diff --git a/api.md b/api.md index d8ad15a99ce..d1efa1129f7 100644 --- a/api.md +++ b/api.md @@ -96,7 +96,7 @@ from cloudflare.types.ips import IPs, JDCloudIPs, IPListResponse Methods: -- client.ips.list(\*\*params) -> IPListResponse +- client.ips.list(\*\*params) -> Optional # Memberships @@ -3230,11 +3230,11 @@ from cloudflare.types.addressing import ( Methods: -- client.addressing.address_maps.create(\*, account_id, \*\*params) -> AddressMapCreateResponse +- client.addressing.address_maps.create(\*, account_id, \*\*params) -> Optional - client.addressing.address_maps.list(\*, account_id) -> SyncSinglePage[AddressMap] - client.addressing.address_maps.delete(address_map_id, \*, account_id, \*\*params) -> Optional -- client.addressing.address_maps.edit(address_map_id, \*, account_id, \*\*params) -> AddressMap -- client.addressing.address_maps.get(address_map_id, \*, account_id) -> AddressMapGetResponse +- client.addressing.address_maps.edit(address_map_id, \*, account_id, \*\*params) -> Optional +- client.addressing.address_maps.get(address_map_id, \*, account_id) -> Optional ### Accounts @@ -3285,7 +3285,7 @@ from cloudflare.types.addressing import LOADocumentCreateResponse Methods: -- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> LOADocumentCreateResponse +- client.addressing.loa_documents.create(\*, account_id, \*\*params) -> Optional ### Downloads @@ -3309,11 +3309,11 @@ from cloudflare.types.addressing import Prefix, PrefixDeleteResponse Methods: -- client.addressing.prefixes.create(\*, account_id, \*\*params) -> Prefix +- client.addressing.prefixes.create(\*, account_id, \*\*params) -> Optional - client.addressing.prefixes.list(\*, account_id) -> SyncSinglePage[Prefix] - client.addressing.prefixes.delete(prefix_id, \*, account_id, \*\*params) -> Optional -- client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> Prefix -- client.addressing.prefixes.get(prefix_id, \*, account_id) -> Prefix +- client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.get(prefix_id, \*, account_id) -> Optional ### BGP @@ -3327,10 +3327,10 @@ from cloudflare.types.addressing.prefixes.bgp import ServiceBinding, BindingDele Methods: -- client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> ServiceBinding +- client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> Optional - client.addressing.prefixes.bgp.bindings.list(prefix_id, \*, account_id) -> SyncSinglePage[ServiceBinding] - client.addressing.prefixes.bgp.bindings.delete(binding_id, \*, account_id, prefix_id) -> BindingDeleteResponse -- client.addressing.prefixes.bgp.bindings.get(binding_id, \*, account_id, prefix_id) -> ServiceBinding +- client.addressing.prefixes.bgp.bindings.get(binding_id, \*, account_id, prefix_id) -> Optional #### Prefixes @@ -3343,8 +3343,8 @@ from cloudflare.types.addressing.prefixes.bgp import BGPPrefix Methods: - client.addressing.prefixes.bgp.prefixes.list(prefix_id, \*, account_id) -> SyncSinglePage[BGPPrefix] -- client.addressing.prefixes.bgp.prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> BGPPrefix -- client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> BGPPrefix +- client.addressing.prefixes.bgp.prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> Optional +- client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> Optional #### Statuses @@ -3356,8 +3356,8 @@ from cloudflare.types.addressing.prefixes.bgp import StatusEditResponse, StatusG Methods: -- client.addressing.prefixes.bgp.statuses.edit(prefix_id, \*, account_id, \*\*params) -> StatusEditResponse -- client.addressing.prefixes.bgp.statuses.get(prefix_id, \*, account_id) -> StatusGetResponse +- client.addressing.prefixes.bgp.statuses.edit(prefix_id, \*, account_id, \*\*params) -> Optional +- client.addressing.prefixes.bgp.statuses.get(prefix_id, \*, account_id) -> Optional ### Delegations @@ -3369,9 +3369,9 @@ from cloudflare.types.addressing.prefixes import Delegations, DelegationDeleteRe Methods: -- client.addressing.prefixes.delegations.create(prefix_id, \*, account_id, \*\*params) -> Delegations +- client.addressing.prefixes.delegations.create(prefix_id, \*, account_id, \*\*params) -> Optional - client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> SyncSinglePage[Delegations] -- client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id, \*\*params) -> DelegationDeleteResponse +- client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id, \*\*params) -> Optional # AuditLogs @@ -3836,50 +3836,32 @@ Methods: Types: ```python -from cloudflare.types.magic_transit import ( - Site, - SiteLocation, - SiteCreateResponse, - SiteUpdateResponse, - SiteListResponse, - SiteDeleteResponse, - SiteGetResponse, -) +from cloudflare.types.magic_transit import Site, SiteLocation ``` Methods: -- client.magic_transit.sites.create(\*, account_id, \*\*params) -> SiteCreateResponse -- client.magic_transit.sites.update(site_id, \*, account_id, \*\*params) -> SiteUpdateResponse -- client.magic_transit.sites.list(\*, account_id, \*\*params) -> SiteListResponse -- client.magic_transit.sites.delete(site_id, \*, account_id, \*\*params) -> SiteDeleteResponse -- client.magic_transit.sites.get(site_id, \*, account_id) -> SiteGetResponse +- client.magic_transit.sites.create(\*, account_id, \*\*params) -> Site +- client.magic_transit.sites.update(site_id, \*, account_id, \*\*params) -> Site +- client.magic_transit.sites.list(\*, account_id, \*\*params) -> SyncSinglePage[Site] +- client.magic_transit.sites.delete(site_id, \*, account_id, \*\*params) -> Site +- client.magic_transit.sites.get(site_id, \*, account_id) -> Site ### ACLs Types: ```python -from cloudflare.types.magic_transit.sites import ( - ACL, - ACLConfiguration, - AllowedProtocol, - Subnet, - ACLCreateResponse, - ACLUpdateResponse, - ACLListResponse, - ACLDeleteResponse, - ACLGetResponse, -) +from cloudflare.types.magic_transit.sites import ACL, ACLConfiguration, Subnet ``` Methods: -- client.magic_transit.sites.acls.create(site_id, \*, account_id, \*\*params) -> ACLCreateResponse -- client.magic_transit.sites.acls.update(acl_identifier, \*, account_id, site_id, \*\*params) -> ACLUpdateResponse -- client.magic_transit.sites.acls.list(site_id, \*, account_id) -> ACLListResponse -- client.magic_transit.sites.acls.delete(acl_identifier, \*, account_id, site_id, \*\*params) -> ACLDeleteResponse -- client.magic_transit.sites.acls.get(acl_identifier, \*, account_id, site_id) -> ACLGetResponse +- client.magic_transit.sites.acls.create(site_id, \*, account_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.update(acl_identifier, \*, account_id, site_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.list(site_id, \*, account_id) -> SyncSinglePage[ACL] +- client.magic_transit.sites.acls.delete(acl_identifier, \*, account_id, site_id, \*\*params) -> ACL +- client.magic_transit.sites.acls.get(acl_identifier, \*, account_id, site_id) -> ACL ### LANs @@ -3894,44 +3876,32 @@ from cloudflare.types.magic_transit.sites import ( Nat, RoutedSubnet, LANCreateResponse, - LANUpdateResponse, - LANListResponse, - LANDeleteResponse, - LANGetResponse, ) ``` Methods: - client.magic_transit.sites.lans.create(site_id, \*, account_id, \*\*params) -> LANCreateResponse -- client.magic_transit.sites.lans.update(lan_id, \*, account_id, site_id, \*\*params) -> LANUpdateResponse -- client.magic_transit.sites.lans.list(site_id, \*, account_id) -> LANListResponse -- client.magic_transit.sites.lans.delete(lan_id, \*, account_id, site_id, \*\*params) -> LANDeleteResponse -- client.magic_transit.sites.lans.get(lan_id, \*, account_id, site_id) -> LANGetResponse +- client.magic_transit.sites.lans.update(lan_id, \*, account_id, site_id, \*\*params) -> LAN +- client.magic_transit.sites.lans.list(site_id, \*, account_id) -> SyncSinglePage[LAN] +- client.magic_transit.sites.lans.delete(lan_id, \*, account_id, site_id, \*\*params) -> LAN +- client.magic_transit.sites.lans.get(lan_id, \*, account_id, site_id) -> LAN ### WANs Types: ```python -from cloudflare.types.magic_transit.sites import ( - WAN, - WANStaticAddressing, - WANCreateResponse, - WANUpdateResponse, - WANListResponse, - WANDeleteResponse, - WANGetResponse, -) +from cloudflare.types.magic_transit.sites import WAN, WANStaticAddressing, WANCreateResponse ``` Methods: - client.magic_transit.sites.wans.create(site_id, \*, account_id, \*\*params) -> WANCreateResponse -- client.magic_transit.sites.wans.update(wan_id, \*, account_id, site_id, \*\*params) -> WANUpdateResponse -- client.magic_transit.sites.wans.list(site_id, \*, account_id) -> WANListResponse -- client.magic_transit.sites.wans.delete(wan_id, \*, account_id, site_id, \*\*params) -> WANDeleteResponse -- client.magic_transit.sites.wans.get(wan_id, \*, account_id, site_id) -> WANGetResponse +- client.magic_transit.sites.wans.update(wan_id, \*, account_id, site_id, \*\*params) -> WAN +- client.magic_transit.sites.wans.list(site_id, \*, account_id) -> SyncSinglePage[WAN] +- client.magic_transit.sites.wans.delete(wan_id, \*, account_id, site_id, \*\*params) -> WAN +- client.magic_transit.sites.wans.get(wan_id, \*, account_id, site_id) -> WAN # MagicNetworkMonitoring diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py index db36fa37de7..7b7f606d93e 100644 --- a/src/cloudflare/resources/addressing/address_maps/accounts.py +++ b/src/cloudflare/resources/addressing/address_maps/accounts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -75,22 +75,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountUpdateResponse], - self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - body=maybe_transform(body, account_update_params.AccountUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=maybe_transform(body, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]), ) def delete( @@ -126,22 +121,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - body=maybe_transform(body, account_delete_params.AccountDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=maybe_transform(body, account_delete_params.AccountDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]), ) @@ -187,22 +177,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountUpdateResponse], - await self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - body=await async_maybe_transform(body, account_update_params.AccountUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=await async_maybe_transform(body, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]), ) async def delete( @@ -238,22 +223,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AccountDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", - body=await async_maybe_transform(body, account_delete_params.AccountDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}", + body=await async_maybe_transform(body, account_delete_params.AccountDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]), ) diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index b35106aa923..741b864fe4e 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -95,7 +95,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapCreateResponse: + ) -> Optional[AddressMapCreateResponse]: """ Create a new address map under the account. @@ -132,9 +132,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]), + cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]), ) def list( @@ -208,22 +208,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AddressMapDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", - body=maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AddressMapDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", + body=maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]), ) def edit( @@ -240,7 +235,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMap: + ) -> Optional[AddressMap]: """ Modify properties of an address map owned by the account. @@ -288,9 +283,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMap]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper, ), - cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]), + cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]), ) def get( @@ -304,7 +299,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapGetResponse: + ) -> Optional[AddressMapGetResponse]: """ Show a particular address map owned by the account. @@ -332,9 +327,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]), + cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]), ) @@ -371,7 +366,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapCreateResponse: + ) -> Optional[AddressMapCreateResponse]: """ Create a new address map under the account. @@ -408,9 +403,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]), + cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]), ) def list( @@ -484,22 +479,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[AddressMapDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", - body=await async_maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AddressMapDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}", + body=await async_maybe_transform(body, address_map_delete_params.AddressMapDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]), ) async def edit( @@ -516,7 +506,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMap: + ) -> Optional[AddressMap]: """ Modify properties of an address map owned by the account. @@ -564,9 +554,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMap]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper, ), - cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]), + cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]), ) async def get( @@ -580,7 +570,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AddressMapGetResponse: + ) -> Optional[AddressMapGetResponse]: """ Show a particular address map owned by the account. @@ -608,9 +598,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper, ), - cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]), + cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]), ) diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py index d7af8bb28e0..7fce9de32f4 100644 --- a/src/cloudflare/resources/addressing/address_maps/ips.py +++ b/src/cloudflare/resources/addressing/address_maps/ips.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -75,22 +75,17 @@ def update( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPUpdateResponse], - self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - body=maybe_transform(body, ip_update_params.IPUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=maybe_transform(body, ip_update_params.IPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPUpdateResponse]], ResultWrapper[IPUpdateResponse]), ) def delete( @@ -131,22 +126,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - body=maybe_transform(body, ip_delete_params.IPDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=maybe_transform(body, ip_delete_params.IPDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPDeleteResponse]], ResultWrapper[IPDeleteResponse]), ) @@ -197,22 +187,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPUpdateResponse], - await self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - body=await async_maybe_transform(body, ip_update_params.IPUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=await async_maybe_transform(body, ip_update_params.IPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPUpdateResponse]], ResultWrapper[IPUpdateResponse]), ) async def delete( @@ -253,22 +238,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") if not ip_address: raise ValueError(f"Expected a non-empty value for `ip_address` but received {ip_address!r}") - return cast( - Optional[IPDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", - body=await async_maybe_transform(body, ip_delete_params.IPDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IPDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/ips/{ip_address}", + body=await async_maybe_transform(body, ip_delete_params.IPDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[IPDeleteResponse]], ResultWrapper[IPDeleteResponse]), ) diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py index 85d2f06774e..6bc6ebd0ed6 100644 --- a/src/cloudflare/resources/addressing/address_maps/zones.py +++ b/src/cloudflare/resources/addressing/address_maps/zones.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -80,22 +80,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[ZoneUpdateResponse], - self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", - body=maybe_transform(body, zone_update_params.ZoneUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=maybe_transform(body, zone_update_params.ZoneUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneUpdateResponse]], ResultWrapper[ZoneUpdateResponse]), ) def delete( @@ -136,22 +131,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[ZoneDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", - body=maybe_transform(body, zone_delete_params.ZoneDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=maybe_transform(body, zone_delete_params.ZoneDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) @@ -202,22 +192,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[ZoneUpdateResponse], - await self._put( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", - body=await async_maybe_transform(body, zone_update_params.ZoneUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=await async_maybe_transform(body, zone_update_params.ZoneUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneUpdateResponse]], ResultWrapper[ZoneUpdateResponse]), ) async def delete( @@ -258,22 +243,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not address_map_id: raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}") - return cast( - Optional[ZoneDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", - body=await async_maybe_transform(body, zone_delete_params.ZoneDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ZoneDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/zones/{zone_id}", + body=await async_maybe_transform(body, zone_delete_params.ZoneDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ZoneDeleteResponse]], ResultWrapper[ZoneDeleteResponse]), ) diff --git a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents/loa_documents.py index 237d7148d6a..665dcd1afd5 100644 --- a/src/cloudflare/resources/addressing/loa_documents/loa_documents.py +++ b/src/cloudflare/resources/addressing/loa_documents/loa_documents.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -60,7 +60,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LOADocumentCreateResponse: + ) -> Optional[LOADocumentCreateResponse]: """ Submit LOA document (pdf format) under the account. @@ -87,9 +87,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LOADocumentCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[LOADocumentCreateResponse]]._unwrapper, ), - cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]), + cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) @@ -117,7 +117,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LOADocumentCreateResponse: + ) -> Optional[LOADocumentCreateResponse]: """ Submit LOA document (pdf format) under the account. @@ -146,9 +146,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LOADocumentCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[LOADocumentCreateResponse]]._unwrapper, ), - cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]), + cast_to=cast(Type[Optional[LOADocumentCreateResponse]], ResultWrapper[LOADocumentCreateResponse]), ) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py index 1a02d53d14f..69dcda37ac0 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Type, Optional, cast import httpx @@ -52,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceBinding: + ) -> Optional[ServiceBinding]: """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on @@ -94,9 +94,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ServiceBinding]._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[ServiceBinding], ResultWrapper[ServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) def list( @@ -183,21 +183,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") if not binding_id: raise ValueError(f"Expected a non-empty value for `binding_id` but received {binding_id!r}") - return cast( - BindingDeleteResponse, - self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BindingDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BindingDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=BindingDeleteResponse, ) def get( @@ -212,7 +203,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceBinding: + ) -> Optional[ServiceBinding]: """ Fetch a single Service Binding @@ -244,9 +235,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ServiceBinding]._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[ServiceBinding], ResultWrapper[ServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) @@ -272,7 +263,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceBinding: + ) -> Optional[ServiceBinding]: """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on @@ -314,9 +305,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ServiceBinding]._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[ServiceBinding], ResultWrapper[ServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) def list( @@ -403,21 +394,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") if not binding_id: raise ValueError(f"Expected a non-empty value for `binding_id` but received {binding_id!r}") - return cast( - BindingDeleteResponse, - await self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BindingDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BindingDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=BindingDeleteResponse, ) async def get( @@ -432,7 +414,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceBinding: + ) -> Optional[ServiceBinding]: """ Fetch a single Service Binding @@ -464,9 +446,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ServiceBinding]._unwrapper, + post_parser=ResultWrapper[Optional[ServiceBinding]]._unwrapper, ), - cast_to=cast(Type[ServiceBinding], ResultWrapper[ServiceBinding]), + cast_to=cast(Type[Optional[ServiceBinding]], ResultWrapper[ServiceBinding]), ) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py index 3f3a50732a6..98570b31be6 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -97,7 +97,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BGPPrefix: + ) -> Optional[BGPPrefix]: """ Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn). @@ -131,9 +131,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[BGPPrefix]._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[BGPPrefix], ResultWrapper[BGPPrefix]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) def get( @@ -148,7 +148,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BGPPrefix: + ) -> Optional[BGPPrefix]: """ Retrieve a single BGP Prefix according to its identifier @@ -180,9 +180,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[BGPPrefix]._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[BGPPrefix], ResultWrapper[BGPPrefix]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) @@ -253,7 +253,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BGPPrefix: + ) -> Optional[BGPPrefix]: """ Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn). @@ -287,9 +287,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[BGPPrefix]._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[BGPPrefix], ResultWrapper[BGPPrefix]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) async def get( @@ -304,7 +304,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BGPPrefix: + ) -> Optional[BGPPrefix]: """ Retrieve a single BGP Prefix according to its identifier @@ -336,9 +336,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[BGPPrefix]._unwrapper, + post_parser=ResultWrapper[Optional[BGPPrefix]]._unwrapper, ), - cast_to=cast(Type[BGPPrefix], ResultWrapper[BGPPrefix]), + cast_to=cast(Type[Optional[BGPPrefix]], ResultWrapper[BGPPrefix]), ) diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py b/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py index eac7ccea382..daf1bc5d23a 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/statuses.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -49,7 +49,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusEditResponse: + ) -> Optional[StatusEditResponse]: """ Advertise or withdraw BGP route for a prefix. @@ -80,9 +80,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[StatusEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, ), - cast_to=cast(Type[StatusEditResponse], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), ) def get( @@ -96,7 +96,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusGetResponse: + ) -> Optional[StatusGetResponse]: """ List the current advertisement state for a prefix. @@ -124,9 +124,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[StatusGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), ) @@ -151,7 +151,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusEditResponse: + ) -> Optional[StatusEditResponse]: """ Advertise or withdraw BGP route for a prefix. @@ -182,9 +182,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[StatusEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper, ), - cast_to=cast(Type[StatusEditResponse], ResultWrapper[StatusEditResponse]), + cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]), ) async def get( @@ -198,7 +198,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatusGetResponse: + ) -> Optional[StatusGetResponse]: """ List the current advertisement state for a prefix. @@ -226,9 +226,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[StatusGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper, ), - cast_to=cast(Type[StatusGetResponse], ResultWrapper[StatusGetResponse]), + cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]), ) diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index 3538a739e89..dba2371c2af 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> delegations.Delegations: + ) -> Optional[delegations.Delegations]: """ Create a new account delegation for a given IP prefix. @@ -96,9 +96,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[delegations.Delegations]._unwrapper, + post_parser=ResultWrapper[Optional[delegations.Delegations]]._unwrapper, ), - cast_to=cast(Type[delegations.Delegations], ResultWrapper[delegations.Delegations]), + cast_to=cast(Type[Optional[delegations.Delegations]], ResultWrapper[delegations.Delegations]), ) def list( @@ -155,7 +155,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DelegationDeleteResponse: + ) -> Optional[DelegationDeleteResponse]: """ Delete an account delegation for a given IP prefix. @@ -188,9 +188,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[DelegationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[DelegationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[DelegationDeleteResponse], ResultWrapper[DelegationDeleteResponse]), + cast_to=cast(Type[Optional[DelegationDeleteResponse]], ResultWrapper[DelegationDeleteResponse]), ) @@ -216,7 +216,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> delegations.Delegations: + ) -> Optional[delegations.Delegations]: """ Create a new account delegation for a given IP prefix. @@ -255,9 +255,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[delegations.Delegations]._unwrapper, + post_parser=ResultWrapper[Optional[delegations.Delegations]]._unwrapper, ), - cast_to=cast(Type[delegations.Delegations], ResultWrapper[delegations.Delegations]), + cast_to=cast(Type[Optional[delegations.Delegations]], ResultWrapper[delegations.Delegations]), ) def list( @@ -314,7 +314,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DelegationDeleteResponse: + ) -> Optional[DelegationDeleteResponse]: """ Delete an account delegation for a given IP prefix. @@ -347,9 +347,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[DelegationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[DelegationDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[DelegationDeleteResponse], ResultWrapper[DelegationDeleteResponse]), + cast_to=cast(Type[Optional[DelegationDeleteResponse]], ResultWrapper[DelegationDeleteResponse]), ) diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index 8bafe87e0ca..8b1c16448b6 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -83,7 +83,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ Add a new prefix under the account. @@ -121,9 +121,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def list( @@ -195,22 +195,17 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return cast( - Optional[PrefixDeleteResponse], - self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", - body=maybe_transform(body, prefix_delete_params.PrefixDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PrefixDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", + body=maybe_transform(body, prefix_delete_params.PrefixDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PrefixDeleteResponse]], ResultWrapper[PrefixDeleteResponse]), ) def edit( @@ -225,7 +220,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ Modify the description for a prefix owned by the account. @@ -256,9 +251,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def get( @@ -272,7 +267,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ List a particular prefix owned by the account. @@ -300,9 +295,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) @@ -336,7 +331,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ Add a new prefix under the account. @@ -374,9 +369,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) def list( @@ -448,22 +443,17 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return cast( - Optional[PrefixDeleteResponse], - await self._delete( - f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", - body=await async_maybe_transform(body, prefix_delete_params.PrefixDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PrefixDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/addressing/prefixes/{prefix_id}", + body=await async_maybe_transform(body, prefix_delete_params.PrefixDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PrefixDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PrefixDeleteResponse]], ResultWrapper[PrefixDeleteResponse]), ) async def edit( @@ -478,7 +468,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ Modify the description for a prefix owned by the account. @@ -509,9 +499,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) async def get( @@ -525,7 +515,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Prefix: + ) -> Optional[Prefix]: """ List a particular prefix owned by the account. @@ -553,9 +543,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Prefix]._unwrapper, + post_parser=ResultWrapper[Optional[Prefix]]._unwrapper, ), - cast_to=cast(Type[Prefix], ResultWrapper[Prefix]), + cast_to=cast(Type[Optional[Prefix]], ResultWrapper[Prefix]), ) diff --git a/src/cloudflare/resources/ips.py b/src/cloudflare/resources/ips.py index e42bf0b278e..d4cfc566d67 100644 --- a/src/cloudflare/resources/ips.py +++ b/src/cloudflare/resources/ips.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -47,7 +47,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPListResponse: + ) -> Optional[IPListResponse]: """ Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or @@ -66,7 +66,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return cast( - IPListResponse, + Optional[IPListResponse], self._get( "/ips", options=make_request_options( @@ -75,7 +75,7 @@ def list( extra_body=extra_body, timeout=timeout, query=maybe_transform({"networks": networks}, ip_list_params.IPListParams), - post_parser=ResultWrapper[IPListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IPListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IPListResponse] @@ -103,7 +103,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPListResponse: + ) -> Optional[IPListResponse]: """ Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or @@ -122,7 +122,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return cast( - IPListResponse, + Optional[IPListResponse], await self._get( "/ips", options=make_request_options( @@ -131,7 +131,7 @@ async def list( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"networks": networks}, ip_list_params.IPListParams), - post_parser=ResultWrapper[IPListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IPListResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IPListResponse] diff --git a/src/cloudflare/resources/magic_transit/sites/acls.py b/src/cloudflare/resources/magic_transit/sites/acls.py index 13b0fac0f54..e96cbd5473e 100644 --- a/src/cloudflare/resources/magic_transit/sites/acls.py +++ b/src/cloudflare/resources/magic_transit/sites/acls.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Type, cast +from typing import List, Type, cast +from typing_extensions import Literal import httpx @@ -20,15 +21,14 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit.sites import ( - ACLGetResponse, - ACLListResponse, - ACLCreateResponse, - ACLDeleteResponse, - ACLUpdateResponse, + ACL, + ACLConfigurationParam, acl_create_params, acl_delete_params, acl_update_params, @@ -51,14 +51,19 @@ def create( site_id: str, *, account_id: str, - acl: acl_create_params.ACL | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam, + lan_2: ACLConfigurationParam, + name: str, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + protocols: List[Literal["tcp", "udp", "icmp"]] | 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, - ) -> ACLCreateResponse: + ) -> ACL: """ Creates a new Site ACL. @@ -67,6 +72,15 @@ def create( site_id: Identifier + name: The name of the ACL. + + 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 WAN Connector. If not included in request, will + default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -81,15 +95,25 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/acls", - body=maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams), + body=maybe_transform( + { + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "description": description, + "forward_locally": forward_locally, + "protocols": protocols, + }, + acl_create_params.ACLCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLCreateResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def update( @@ -98,14 +122,19 @@ def update( *, account_id: str, site_id: str, - acl: acl_update_params.ACL | NotGiven = NOT_GIVEN, + 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[Literal["tcp", "udp", "icmp"]] | 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, - ) -> ACLUpdateResponse: + ) -> ACL: """ Update a specific Site ACL. @@ -116,6 +145,15 @@ def update( 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 WAN 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 @@ -132,15 +170,25 @@ def update( 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({"acl": acl}, acl_update_params.ACLUpdateParams), + 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[ACLUpdateResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def list( @@ -154,7 +202,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLListResponse: + ) -> SyncSinglePage[ACL]: """ Lists Site ACLs associated with an account. @@ -175,16 +223,13 @@ def list( 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}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/acls", + page=SyncSinglePage[ACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ACLListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]), + model=ACL, ) def delete( @@ -200,7 +245,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> ACL: """ Remove a specific Site ACL. @@ -233,9 +278,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLDeleteResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) def get( @@ -250,7 +295,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLGetResponse: + ) -> ACL: """ Get a specific Site ACL. @@ -282,9 +327,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLGetResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) @@ -302,14 +347,19 @@ async def create( site_id: str, *, account_id: str, - acl: acl_create_params.ACL | NotGiven = NOT_GIVEN, + lan_1: ACLConfigurationParam, + lan_2: ACLConfigurationParam, + name: str, + description: str | NotGiven = NOT_GIVEN, + forward_locally: bool | NotGiven = NOT_GIVEN, + protocols: List[Literal["tcp", "udp", "icmp"]] | 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, - ) -> ACLCreateResponse: + ) -> ACL: """ Creates a new Site ACL. @@ -318,6 +368,15 @@ async def create( site_id: Identifier + name: The name of the ACL. + + 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 WAN Connector. If not included in request, will + default to false. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -332,15 +391,25 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/acls", - body=await async_maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams), + body=await async_maybe_transform( + { + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "description": description, + "forward_locally": forward_locally, + "protocols": protocols, + }, + acl_create_params.ACLCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLCreateResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) async def update( @@ -349,14 +418,19 @@ async def update( *, account_id: str, site_id: str, - acl: acl_update_params.ACL | NotGiven = NOT_GIVEN, + 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[Literal["tcp", "udp", "icmp"]] | 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, - ) -> ACLUpdateResponse: + ) -> ACL: """ Update a specific Site ACL. @@ -367,6 +441,15 @@ async def update( 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 WAN 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 @@ -383,18 +466,28 @@ async def update( 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({"acl": acl}, acl_update_params.ACLUpdateParams), + 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[ACLUpdateResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) - async def list( + def list( self, site_id: str, *, @@ -405,7 +498,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLListResponse: + ) -> AsyncPaginator[ACL, AsyncSinglePage[ACL]]: """ Lists Site ACLs associated with an account. @@ -426,16 +519,13 @@ async def list( 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}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/acls", + page=AsyncSinglePage[ACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ACLListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]), + model=ACL, ) async def delete( @@ -451,7 +541,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLDeleteResponse: + ) -> ACL: """ Remove a specific Site ACL. @@ -484,9 +574,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLDeleteResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) async def get( @@ -501,7 +591,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ACLGetResponse: + ) -> ACL: """ Get a specific Site ACL. @@ -533,9 +623,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ACLGetResponse]._unwrapper, + post_parser=ResultWrapper[ACL]._unwrapper, ), - cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) diff --git a/src/cloudflare/resources/magic_transit/sites/lans.py b/src/cloudflare/resources/magic_transit/sites/lans.py index ec25b842857..ddf4c5c9ced 100644 --- a/src/cloudflare/resources/magic_transit/sites/lans.py +++ b/src/cloudflare/resources/magic_transit/sites/lans.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Iterable, cast import httpx @@ -20,15 +20,17 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit.sites import ( - LANGetResponse, - LANListResponse, + LAN, + NatParam, LANCreateResponse, - LANDeleteResponse, - LANUpdateResponse, + RoutedSubnetParam, + LANStaticAddressingParam, lan_create_params, lan_delete_params, lan_update_params, @@ -51,7 +53,13 @@ def create( site_id: str, *, account_id: str, - lan: lan_create_params.LAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + ha_link: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | 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, @@ -69,6 +77,15 @@ def create( site_id: Identifier + vlan_tag: VLAN port number. + + ha_link: mark true to use this LAN for HA probing. only works for site with HA turned on. + only one LAN can be set as the ha_link. + + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -83,7 +100,18 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/lans", - body=maybe_transform({"lan": lan}, lan_create_params.LANCreateParams), + body=maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "ha_link": ha_link, + "name": name, + "nat": nat, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + }, + lan_create_params.LANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -100,14 +128,19 @@ def update( *, account_id: str, site_id: str, - lan: lan_update_params.LAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: 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, - ) -> LANUpdateResponse: + ) -> LAN: """ Update a specific LAN. @@ -118,6 +151,12 @@ def update( lan_id: Identifier + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -134,15 +173,25 @@ def update( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", - body=maybe_transform({"lan": lan}, lan_update_params.LANUpdateParams), + body=maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_update_params.LANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANUpdateResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANUpdateResponse], ResultWrapper[LANUpdateResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) def list( @@ -156,7 +205,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANListResponse: + ) -> SyncSinglePage[LAN]: """ Lists LANs associated with an account and site. @@ -177,16 +226,13 @@ def list( 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}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/lans", + page=SyncSinglePage[LAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[LANListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[LANListResponse], ResultWrapper[LANListResponse]), + model=LAN, ) def delete( @@ -202,7 +248,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANDeleteResponse: + ) -> LAN: """ Remove a specific LAN. @@ -235,9 +281,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANDeleteResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANDeleteResponse], ResultWrapper[LANDeleteResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) def get( @@ -252,7 +298,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANGetResponse: + ) -> LAN: """ Get a specific LAN. @@ -284,9 +330,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANGetResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANGetResponse], ResultWrapper[LANGetResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) @@ -304,7 +350,13 @@ async def create( site_id: str, *, account_id: str, - lan: lan_create_params.LAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + ha_link: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | 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, @@ -322,6 +374,15 @@ async def create( site_id: Identifier + vlan_tag: VLAN port number. + + ha_link: mark true to use this LAN for HA probing. only works for site with HA turned on. + only one LAN can be set as the ha_link. + + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -336,7 +397,18 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/lans", - body=await async_maybe_transform({"lan": lan}, lan_create_params.LANCreateParams), + body=await async_maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "ha_link": ha_link, + "name": name, + "nat": nat, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + }, + lan_create_params.LANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -353,14 +425,19 @@ async def update( *, account_id: str, site_id: str, - lan: lan_update_params.LAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + nat: NatParam | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + routed_subnets: Iterable[RoutedSubnetParam] | NotGiven = NOT_GIVEN, + static_addressing: LANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: 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, - ) -> LANUpdateResponse: + ) -> LAN: """ Update a specific LAN. @@ -371,6 +448,12 @@ async def update( lan_id: Identifier + static_addressing: If the site is not configured in high availability mode, this configuration is + optional (if omitted, use DHCP). However, if in high availability mode, + static_address is required along with secondary and virtual address. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -387,18 +470,28 @@ async def update( raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", - body=await async_maybe_transform({"lan": lan}, lan_update_params.LANUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_update_params.LANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANUpdateResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANUpdateResponse], ResultWrapper[LANUpdateResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) - async def list( + def list( self, site_id: str, *, @@ -409,7 +502,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANListResponse: + ) -> AsyncPaginator[LAN, AsyncSinglePage[LAN]]: """ Lists LANs associated with an account and site. @@ -430,16 +523,13 @@ async def list( 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}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/lans", + page=AsyncSinglePage[LAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[LANListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[LANListResponse], ResultWrapper[LANListResponse]), + model=LAN, ) async def delete( @@ -455,7 +545,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANDeleteResponse: + ) -> LAN: """ Remove a specific LAN. @@ -488,9 +578,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANDeleteResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANDeleteResponse], ResultWrapper[LANDeleteResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) async def get( @@ -505,7 +595,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LANGetResponse: + ) -> LAN: """ Get a specific LAN. @@ -537,9 +627,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[LANGetResponse]._unwrapper, + post_parser=ResultWrapper[LAN]._unwrapper, ), - cast_to=cast(Type[LANGetResponse], ResultWrapper[LANGetResponse]), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) diff --git a/src/cloudflare/resources/magic_transit/sites/sites.py b/src/cloudflare/resources/magic_transit/sites/sites.py index a6adc4f4c94..dd5e94179bb 100644 --- a/src/cloudflare/resources/magic_transit/sites/sites.py +++ b/src/cloudflare/resources/magic_transit/sites/sites.py @@ -44,15 +44,14 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit import ( - SiteGetResponse, - SiteListResponse, - SiteCreateResponse, - SiteDeleteResponse, - SiteUpdateResponse, + Site, + SiteLocationParam, site_list_params, site_create_params, site_delete_params, @@ -87,20 +86,36 @@ def create( self, *, account_id: str, - site: site_create_params.Site | NotGiven = NOT_GIVEN, + name: str, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + ha_mode: bool | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + secondary_connector_id: str | 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, - ) -> SiteCreateResponse: + ) -> Site: """ Creates a new Site Args: account_id: Identifier + name: The name of the site. + + connector_id: Magic WAN Connector identifier tag. + + ha_mode: Site high availability mode. If set to true, the site can have two connectors + and runs in high availability mode. + + location: Location of site in latitude and longitude. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -113,15 +128,25 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/magic/sites", - body=maybe_transform({"site": site}, site_create_params.SiteCreateParams), + body=maybe_transform( + { + "name": name, + "connector_id": connector_id, + "description": description, + "ha_mode": ha_mode, + "location": location, + "secondary_connector_id": secondary_connector_id, + }, + site_create_params.SiteCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteCreateResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def update( @@ -129,14 +154,18 @@ def update( site_id: str, *, account_id: str, - site: site_update_params.Site | NotGiven = NOT_GIVEN, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secondary_connector_id: str | 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, - ) -> SiteUpdateResponse: + ) -> Site: """ Update a specific Site. @@ -145,6 +174,14 @@ def update( site_id: Identifier + connector_id: Magic WAN Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -159,15 +196,24 @@ def update( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}", - body=maybe_transform({"site": site}, site_update_params.SiteUpdateParams), + body=maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_update_params.SiteUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def list( @@ -181,7 +227,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteListResponse: + ) -> SyncSinglePage[Site]: """Lists Sites associated with an account. Use connector_identifier query param to @@ -203,17 +249,17 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites", + page=SyncSinglePage[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({"connector_identifier": connector_identifier}, site_list_params.SiteListParams), - post_parser=ResultWrapper[SiteListResponse]._unwrapper, ), - cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]), + model=Site, ) def delete( @@ -228,7 +274,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteDeleteResponse: + ) -> Site: """ Remove a specific Site. @@ -257,9 +303,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) def get( @@ -273,7 +319,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteGetResponse: + ) -> Site: """ Get a specific Site. @@ -301,9 +347,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteGetResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) @@ -332,20 +378,36 @@ async def create( self, *, account_id: str, - site: site_create_params.Site | NotGiven = NOT_GIVEN, + name: str, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + ha_mode: bool | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + secondary_connector_id: str | 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, - ) -> SiteCreateResponse: + ) -> Site: """ Creates a new Site Args: account_id: Identifier + name: The name of the site. + + connector_id: Magic WAN Connector identifier tag. + + ha_mode: Site high availability mode. If set to true, the site can have two connectors + and runs in high availability mode. + + location: Location of site in latitude and longitude. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -358,15 +420,25 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites", - body=await async_maybe_transform({"site": site}, site_create_params.SiteCreateParams), + body=await async_maybe_transform( + { + "name": name, + "connector_id": connector_id, + "description": description, + "ha_mode": ha_mode, + "location": location, + "secondary_connector_id": secondary_connector_id, + }, + site_create_params.SiteCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteCreateResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) async def update( @@ -374,14 +446,18 @@ async def update( site_id: str, *, account_id: str, - site: site_update_params.Site | NotGiven = NOT_GIVEN, + connector_id: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + location: SiteLocationParam | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secondary_connector_id: str | 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, - ) -> SiteUpdateResponse: + ) -> Site: """ Update a specific Site. @@ -390,6 +466,14 @@ async def update( site_id: Identifier + connector_id: Magic WAN Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic WAN Connector identifier tag. Used when high availability mode is on. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -404,18 +488,27 @@ async def update( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}", - body=await async_maybe_transform({"site": site}, site_update_params.SiteUpdateParams), + body=await async_maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_update_params.SiteUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) - async def list( + def list( self, *, account_id: str, @@ -426,7 +519,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteListResponse: + ) -> AsyncPaginator[Site, AsyncSinglePage[Site]]: """Lists Sites associated with an account. Use connector_identifier query param to @@ -448,19 +541,17 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites", + page=AsyncSinglePage[Site], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - {"connector_identifier": connector_identifier}, site_list_params.SiteListParams - ), - post_parser=ResultWrapper[SiteListResponse]._unwrapper, + query=maybe_transform({"connector_identifier": connector_identifier}, site_list_params.SiteListParams), ), - cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]), + model=Site, ) async def delete( @@ -475,7 +566,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteDeleteResponse: + ) -> Site: """ Remove a specific Site. @@ -504,9 +595,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) async def get( @@ -520,7 +611,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SiteGetResponse: + ) -> Site: """ Get a specific Site. @@ -548,9 +639,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SiteGetResponse]._unwrapper, + post_parser=ResultWrapper[Site]._unwrapper, ), - cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]), + cast_to=cast(Type[Site], ResultWrapper[Site]), ) diff --git a/src/cloudflare/resources/magic_transit/sites/wans.py b/src/cloudflare/resources/magic_transit/sites/wans.py index 61358dbad44..1bcf19c8094 100644 --- a/src/cloudflare/resources/magic_transit/sites/wans.py +++ b/src/cloudflare/resources/magic_transit/sites/wans.py @@ -20,15 +20,15 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.magic_transit.sites import ( - WANGetResponse, - WANListResponse, + WAN, WANCreateResponse, - WANDeleteResponse, - WANUpdateResponse, + WANStaticAddressingParam, wan_create_params, wan_delete_params, wan_update_params, @@ -51,7 +51,11 @@ def create( site_id: str, *, account_id: str, - wan: wan_create_params.WAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + name: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | 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, @@ -67,6 +71,11 @@ def create( site_id: Identifier + vlan_tag: VLAN port number. + + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -81,7 +90,16 @@ def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return self._post( f"/accounts/{account_id}/magic/sites/{site_id}/wans", - body=maybe_transform({"wan": wan}, wan_create_params.WANCreateParams), + body=maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "name": name, + "priority": priority, + "static_addressing": static_addressing, + }, + wan_create_params.WANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -98,14 +116,18 @@ def update( *, account_id: str, site_id: str, - wan: wan_update_params.WAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: 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, - ) -> WANUpdateResponse: + ) -> WAN: """ Update a specific WAN. @@ -116,6 +138,11 @@ def update( wan_id: Identifier + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -132,15 +159,24 @@ def update( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return self._put( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", - body=maybe_transform({"wan": wan}, wan_update_params.WANUpdateParams), + body=maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_update_params.WANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANUpdateResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANUpdateResponse], ResultWrapper[WANUpdateResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) def list( @@ -154,7 +190,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANListResponse: + ) -> SyncSinglePage[WAN]: """ Lists WANs associated with an account and site. @@ -175,16 +211,13 @@ def list( 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}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/wans", + page=SyncSinglePage[WAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[WANListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WANListResponse], ResultWrapper[WANListResponse]), + model=WAN, ) def delete( @@ -200,7 +233,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANDeleteResponse: + ) -> WAN: """ Remove a specific WAN. @@ -233,9 +266,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANDeleteResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANDeleteResponse], ResultWrapper[WANDeleteResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) def get( @@ -250,7 +283,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANGetResponse: + ) -> WAN: """ Get a specific WAN. @@ -282,9 +315,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANGetResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANGetResponse], ResultWrapper[WANGetResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) @@ -302,7 +335,11 @@ async def create( site_id: str, *, account_id: str, - wan: wan_create_params.WAN | NotGiven = NOT_GIVEN, + physport: int, + vlan_tag: int, + name: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | 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, @@ -318,6 +355,11 @@ async def create( site_id: Identifier + vlan_tag: VLAN port number. + + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -332,7 +374,16 @@ async def create( raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") return await self._post( f"/accounts/{account_id}/magic/sites/{site_id}/wans", - body=await async_maybe_transform({"wan": wan}, wan_create_params.WANCreateParams), + body=await async_maybe_transform( + { + "physport": physport, + "vlan_tag": vlan_tag, + "name": name, + "priority": priority, + "static_addressing": static_addressing, + }, + wan_create_params.WANCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -349,14 +400,18 @@ async def update( *, account_id: str, site_id: str, - wan: wan_update_params.WAN | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + physport: int | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + static_addressing: WANStaticAddressingParam | NotGiven = NOT_GIVEN, + vlan_tag: 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, - ) -> WANUpdateResponse: + ) -> WAN: """ Update a specific WAN. @@ -367,6 +422,11 @@ async def update( wan_id: Identifier + static_addressing: (optional) if omitted, use DHCP. Submit secondary_address when site is in high + availability mode. + + vlan_tag: VLAN port number. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -383,18 +443,27 @@ async def update( raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") return await self._put( f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", - body=await async_maybe_transform({"wan": wan}, wan_update_params.WANUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_update_params.WANUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANUpdateResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANUpdateResponse], ResultWrapper[WANUpdateResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) - async def list( + def list( self, site_id: str, *, @@ -405,7 +474,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANListResponse: + ) -> AsyncPaginator[WAN, AsyncSinglePage[WAN]]: """ Lists WANs associated with an account and site. @@ -426,16 +495,13 @@ async def list( 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}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/magic/sites/{site_id}/wans", + page=AsyncSinglePage[WAN], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[WANListResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WANListResponse], ResultWrapper[WANListResponse]), + model=WAN, ) async def delete( @@ -451,7 +517,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANDeleteResponse: + ) -> WAN: """ Remove a specific WAN. @@ -484,9 +550,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANDeleteResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANDeleteResponse], ResultWrapper[WANDeleteResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) async def get( @@ -501,7 +567,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WANGetResponse: + ) -> WAN: """ Get a specific WAN. @@ -533,9 +599,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WANGetResponse]._unwrapper, + post_parser=ResultWrapper[WAN]._unwrapper, ), - cast_to=cast(Type[WANGetResponse], ResultWrapper[WANGetResponse]), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) diff --git a/src/cloudflare/resources/warp_connector.py b/src/cloudflare/resources/warp_connector.py index bfd07878f23..c5d57177152 100644 --- a/src/cloudflare/resources/warp_connector.py +++ b/src/cloudflare/resources/warp_connector.py @@ -69,7 +69,7 @@ def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. extra_headers: Send extra headers @@ -252,7 +252,7 @@ def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -420,7 +420,7 @@ async def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. extra_headers: Send extra headers @@ -605,7 +605,7 @@ async def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. diff --git a/src/cloudflare/resources/zero_trust/networks/routes/ips.py b/src/cloudflare/resources/zero_trust/networks/routes/ips.py index 9a9ccbf1836..c6c13df0ded 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/ips.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/ips.py @@ -43,7 +43,7 @@ def get( ip: str, *, account_id: str, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -57,9 +57,7 @@ def get( Args: account_id: Cloudflare account ID - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -101,7 +99,7 @@ async def get( ip: str, *, account_id: str, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -115,9 +113,7 @@ async def get( Args: account_id: Cloudflare account ID - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/zero_trust/networks/routes/networks.py b/src/cloudflare/resources/zero_trust/networks/routes/networks.py index fd0fc8b845d..0d11f42eac5 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/networks.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/networks.py @@ -45,7 +45,7 @@ def create( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -65,9 +65,7 @@ def create( comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -230,7 +228,7 @@ async def create( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -250,9 +248,7 @@ async def create( comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/zero_trust/networks/routes/routes.py b/src/cloudflare/resources/zero_trust/networks/routes/routes.py index 58bf8332879..7d4ff3d434d 100644 --- a/src/cloudflare/resources/zero_trust/networks/routes/routes.py +++ b/src/cloudflare/resources/zero_trust/networks/routes/routes.py @@ -2,8 +2,8 @@ from __future__ import annotations -from typing import Type, cast -from typing_extensions import Literal +from typing import Type, Union, cast +from datetime import datetime import httpx @@ -68,9 +68,9 @@ def create( self, *, account_id: str, - ip_network: str, + network: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -84,13 +84,11 @@ def create( Args: account_id: Cloudflare account ID - ip_network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. + network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -106,7 +104,7 @@ def create( f"/accounts/{account_id}/teamnet/routes", body=maybe_transform( { - "ip_network": ip_network, + "network": network, "comment": comment, "virtual_network_id": virtual_network_id, }, @@ -127,16 +125,16 @@ def list( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - existed_at: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, - network_subset: object | NotGiven = NOT_GIVEN, - network_superset: object | NotGiven = NOT_GIVEN, + existed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, + network_subset: str | NotGiven = NOT_GIVEN, + network_superset: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, route_id: str | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -152,8 +150,8 @@ def list( comment: Optional remark describing the route. - existed_at: If provided, include only routes that were created (and not deleted) before this - time. + existed_at: If provided, include only tunnels that were created (and not deleted) before + this time. is_deleted: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. @@ -170,11 +168,9 @@ def list( tun_types: The types of tunnels to filter separated by a comma. - tunnel_id: UUID of the Cloudflare Tunnel serving the route. + tunnel_id: UUID of the tunnel. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -265,9 +261,7 @@ def edit( account_id: str, comment: str | NotGiven = NOT_GIVEN, network: str | NotGiven = NOT_GIVEN, - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -289,13 +283,7 @@ def edit( network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - tun_type: The type of tunnel. - - tunnel_id: UUID of the Cloudflare Tunnel serving the route. - - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -315,8 +303,6 @@ def edit( { "comment": comment, "network": network, - "tun_type": tun_type, - "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, }, route_edit_params.RouteEditParams, @@ -353,9 +339,9 @@ async def create( self, *, account_id: str, - ip_network: str, + network: str, comment: str | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -369,13 +355,11 @@ async def create( Args: account_id: Cloudflare account ID - ip_network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. + network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. comment: Optional remark describing the route. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -391,7 +375,7 @@ async def create( f"/accounts/{account_id}/teamnet/routes", body=await async_maybe_transform( { - "ip_network": ip_network, + "network": network, "comment": comment, "virtual_network_id": virtual_network_id, }, @@ -412,16 +396,16 @@ def list( *, account_id: str, comment: str | NotGiven = NOT_GIVEN, - existed_at: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, - network_subset: object | NotGiven = NOT_GIVEN, - network_superset: object | NotGiven = NOT_GIVEN, + existed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, + network_subset: str | NotGiven = NOT_GIVEN, + network_superset: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, route_id: str | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + tunnel_id: str | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -437,8 +421,8 @@ def list( comment: Optional remark describing the route. - existed_at: If provided, include only routes that were created (and not deleted) before this - time. + existed_at: If provided, include only tunnels that were created (and not deleted) before + this time. is_deleted: If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. @@ -455,11 +439,9 @@ def list( tun_types: The types of tunnels to filter separated by a comma. - tunnel_id: UUID of the Cloudflare Tunnel serving the route. + tunnel_id: UUID of the tunnel. - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -550,9 +532,7 @@ async def edit( account_id: str, comment: str | NotGiven = NOT_GIVEN, network: str | NotGiven = NOT_GIVEN, - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] | NotGiven = NOT_GIVEN, - tunnel_id: object | NotGiven = NOT_GIVEN, - virtual_network_id: object | NotGiven = NOT_GIVEN, + virtual_network_id: str | 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, @@ -574,13 +554,7 @@ async def edit( network: The private IPv4 or IPv6 range connected by the route, in CIDR notation. - tun_type: The type of tunnel. - - tunnel_id: UUID of the Cloudflare Tunnel serving the route. - - virtual_network_id: UUID of the Tunnel Virtual Network this route belongs to. If no virtual networks - are configured, the route is assigned to the default virtual network of the - account. + virtual_network_id: UUID of the virtual network. extra_headers: Send extra headers @@ -600,8 +574,6 @@ async def edit( { "comment": comment, "network": network, - "tun_type": tun_type, - "tunnel_id": tunnel_id, "virtual_network_id": virtual_network_id, }, route_edit_params.RouteEditParams, diff --git a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py index 040fdd6006e..1d066df2ba2 100644 --- a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py +++ b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py @@ -113,11 +113,10 @@ def list( self, *, account_id: str, - is_default: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + is_default: bool | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - vnet_id: str | NotGiven = NOT_GIVEN, - vnet_name: str | 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, @@ -131,6 +130,8 @@ def list( Args: account_id: Cloudflare account ID + id: UUID of the virtual network. + is_default: If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. @@ -139,10 +140,6 @@ def list( name: A user-friendly name for the virtual network. - vnet_id: UUID of the virtual network. - - vnet_name: A user-friendly name for the virtual network. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -163,11 +160,10 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "is_default": is_default, "is_deleted": is_deleted, "name": name, - "vnet_id": vnet_id, - "vnet_name": vnet_name, }, virtual_network_list_params.VirtualNetworkListParams, ), @@ -367,11 +363,10 @@ def list( self, *, account_id: str, - is_default: object | NotGiven = NOT_GIVEN, - is_deleted: object | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + is_default: bool | NotGiven = NOT_GIVEN, + is_deleted: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - vnet_id: str | NotGiven = NOT_GIVEN, - vnet_name: str | 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, @@ -385,6 +380,8 @@ def list( Args: account_id: Cloudflare account ID + id: UUID of the virtual network. + is_default: If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. @@ -393,10 +390,6 @@ def list( name: A user-friendly name for the virtual network. - vnet_id: UUID of the virtual network. - - vnet_name: A user-friendly name for the virtual network. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -417,11 +410,10 @@ def list( timeout=timeout, query=maybe_transform( { + "id": id, "is_default": is_default, "is_deleted": is_deleted, "name": name, - "vnet_id": vnet_id, - "vnet_name": vnet_name, }, virtual_network_list_params.VirtualNetworkListParams, ), diff --git a/src/cloudflare/resources/zero_trust/tunnels/configurations.py b/src/cloudflare/resources/zero_trust/tunnels/configurations.py index b6be6a3b085..f048c1c312d 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/configurations.py +++ b/src/cloudflare/resources/zero_trust/tunnels/configurations.py @@ -58,7 +58,7 @@ def update( Adds or updates the configuration for a remotely-managed tunnel. Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -110,7 +110,7 @@ def get( Gets the configuration for a remotely-managed tunnel Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -170,7 +170,7 @@ async def update( Adds or updates the configuration for a remotely-managed tunnel. Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. @@ -224,7 +224,7 @@ async def get( Gets the configuration for a remotely-managed tunnel Args: - account_id: Identifier + account_id: Cloudflare account ID tunnel_id: UUID of the tunnel. diff --git a/src/cloudflare/resources/zero_trust/tunnels/connectors.py b/src/cloudflare/resources/zero_trust/tunnels/connectors.py index 933925958b5..cb88abec33e 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/connectors.py +++ b/src/cloudflare/resources/zero_trust/tunnels/connectors.py @@ -54,7 +54,7 @@ def get( tunnel_id: UUID of the tunnel. - connector_id: UUID of the Cloudflare Tunnel client. + connector_id: UUID of the Cloudflare Tunnel connector. extra_headers: Send extra headers @@ -113,7 +113,7 @@ async def get( tunnel_id: UUID of the tunnel. - connector_id: UUID of the Cloudflare Tunnel client. + connector_id: UUID of the Cloudflare Tunnel connector. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py index 9ebff07fe58..e990d14ff10 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py +++ b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py @@ -115,7 +115,7 @@ def create( *, account_id: str, name: str, - tunnel_secret: object, + tunnel_secret: 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, @@ -129,10 +129,10 @@ def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. - tunnel_secret: Sets the password required to run the tunnel. Must be at least 32 bytes and - encoded as a base64 string. + tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 + bytes and encoded as a base64 string. extra_headers: Send extra headers @@ -313,7 +313,7 @@ def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. @@ -433,7 +433,7 @@ async def create( *, account_id: str, name: str, - tunnel_secret: object, + tunnel_secret: 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, @@ -447,10 +447,10 @@ async def create( Args: account_id: Cloudflare account ID - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. - tunnel_secret: Sets the password required to run the tunnel. Must be at least 32 bytes and - encoded as a base64 string. + tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 + bytes and encoded as a base64 string. extra_headers: Send extra headers @@ -631,7 +631,7 @@ async def edit( tunnel_id: UUID of the tunnel. - name: A user-friendly name for the tunnel. + name: A user-friendly name for a tunnel. tunnel_secret: Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. diff --git a/src/cloudflare/types/addressing/address_map_delete_response.py b/src/cloudflare/types/addressing/address_map_delete_response.py index 57b879481e2..f9c7d73ddf8 100644 --- a/src/cloudflare/types/addressing/address_map_delete_response.py +++ b/src/cloudflare/types/addressing/address_map_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AddressMapDeleteResponse"] -AddressMapDeleteResponse = Union[List[object], str, object, None] +AddressMapDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/account_delete_response.py b/src/cloudflare/types/addressing/address_maps/account_delete_response.py index 3ddf76cafe9..30142d8d8e1 100644 --- a/src/cloudflare/types/addressing/address_maps/account_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/account_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AccountDeleteResponse"] -AccountDeleteResponse = Union[List[object], str, object, None] +AccountDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/account_update_response.py b/src/cloudflare/types/addressing/address_maps/account_update_response.py index 53831e97698..946503210f5 100644 --- a/src/cloudflare/types/addressing/address_maps/account_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/account_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["AccountUpdateResponse"] -AccountUpdateResponse = Union[List[object], str, object, None] +AccountUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_delete_response.py b/src/cloudflare/types/addressing/address_maps/ip_delete_response.py index 9cb4b12b353..1559d31d584 100644 --- a/src/cloudflare/types/addressing/address_maps/ip_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/ip_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["IPDeleteResponse"] -IPDeleteResponse = Union[List[object], str, object, None] +IPDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/ip_update_response.py b/src/cloudflare/types/addressing/address_maps/ip_update_response.py index d4b874c9522..6db8b575a14 100644 --- a/src/cloudflare/types/addressing/address_maps/ip_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/ip_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["IPUpdateResponse"] -IPUpdateResponse = Union[List[object], str, object, None] +IPUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_delete_response.py b/src/cloudflare/types/addressing/address_maps/zone_delete_response.py index 6fdbcc03fa7..c03361c6def 100644 --- a/src/cloudflare/types/addressing/address_maps/zone_delete_response.py +++ b/src/cloudflare/types/addressing/address_maps/zone_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["ZoneDeleteResponse"] -ZoneDeleteResponse = Union[List[object], str, object, None] +ZoneDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/address_maps/zone_update_response.py b/src/cloudflare/types/addressing/address_maps/zone_update_response.py index 1f488961e0d..40c1da23a29 100644 --- a/src/cloudflare/types/addressing/address_maps/zone_update_response.py +++ b/src/cloudflare/types/addressing/address_maps/zone_update_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["ZoneUpdateResponse"] -ZoneUpdateResponse = Union[List[object], str, object, None] +ZoneUpdateResponse = List[object] diff --git a/src/cloudflare/types/addressing/prefix_delete_response.py b/src/cloudflare/types/addressing/prefix_delete_response.py index cf2acba9231..333f820274b 100644 --- a/src/cloudflare/types/addressing/prefix_delete_response.py +++ b/src/cloudflare/types/addressing/prefix_delete_response.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List __all__ = ["PrefixDeleteResponse"] -PrefixDeleteResponse = Union[List[object], str, object, None] +PrefixDeleteResponse = List[object] diff --git a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py b/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py index e2afa483e21..e893f88f10c 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py +++ b/src/cloudflare/types/addressing/prefixes/bgp/binding_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ....shared import ResponseInfo +from ....._models import BaseModel __all__ = ["BindingDeleteResponse"] -BindingDeleteResponse = Union[List[object], str, object] + +class BindingDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/magic_transit/__init__.py b/src/cloudflare/types/magic_transit/__init__.py index 3e711ee7547..ab997685622 100644 --- a/src/cloudflare/types/magic_transit/__init__.py +++ b/src/cloudflare/types/magic_transit/__init__.py @@ -15,13 +15,11 @@ from .colo_region_param import ColoRegionParam as ColoRegionParam from .health_check_rate import HealthCheckRate as HealthCheckRate from .health_check_type import HealthCheckType as HealthCheckType -from .site_get_response import SiteGetResponse as SiteGetResponse from .health_check_param import HealthCheckParam as HealthCheckParam from .route_empty_params import RouteEmptyParams as RouteEmptyParams from .route_get_response import RouteGetResponse as RouteGetResponse from .site_create_params import SiteCreateParams as SiteCreateParams from .site_delete_params import SiteDeleteParams as SiteDeleteParams -from .site_list_response import SiteListResponse as SiteListResponse from .site_update_params import SiteUpdateParams as SiteUpdateParams from .route_create_params import RouteCreateParams as RouteCreateParams from .route_delete_params import RouteDeleteParams as RouteDeleteParams @@ -29,9 +27,6 @@ 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 .site_create_response import SiteCreateResponse as SiteCreateResponse -from .site_delete_response import SiteDeleteResponse as SiteDeleteResponse -from .site_update_response import SiteUpdateResponse as SiteUpdateResponse from .route_create_response import RouteCreateResponse as RouteCreateResponse from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse from .route_update_response import RouteUpdateResponse as RouteUpdateResponse diff --git a/src/cloudflare/types/magic_transit/site_create_params.py b/src/cloudflare/types/magic_transit/site_create_params.py index 45142eff085..410981caead 100644 --- a/src/cloudflare/types/magic_transit/site_create_params.py +++ b/src/cloudflare/types/magic_transit/site_create_params.py @@ -6,17 +6,13 @@ from .site_location_param import SiteLocationParam -__all__ = ["SiteCreateParams", "Site"] +__all__ = ["SiteCreateParams"] class SiteCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - site: Site - - -class Site(TypedDict, total=False): name: Required[str] """The name of the site.""" diff --git a/src/cloudflare/types/magic_transit/site_create_response.py b/src/cloudflare/types/magic_transit/site_create_response.py deleted file mode 100644 index 55e109409b1..00000000000 --- a/src/cloudflare/types/magic_transit/site_create_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .site import Site -from ..._models import BaseModel - -__all__ = ["SiteCreateResponse"] - - -class SiteCreateResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/site_delete_response.py b/src/cloudflare/types/magic_transit/site_delete_response.py deleted file mode 100644 index b602d7591ea..00000000000 --- a/src/cloudflare/types/magic_transit/site_delete_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .site import Site -from ..._models import BaseModel - -__all__ = ["SiteDeleteResponse"] - - -class SiteDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/site_get_response.py b/src/cloudflare/types/magic_transit/site_get_response.py deleted file mode 100644 index fae4bb9bc83..00000000000 --- a/src/cloudflare/types/magic_transit/site_get_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .site import Site -from ..._models import BaseModel - -__all__ = ["SiteGetResponse"] - - -class SiteGetResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/site_list_response.py b/src/cloudflare/types/magic_transit/site_list_response.py deleted file mode 100644 index 97d6db7246f..00000000000 --- a/src/cloudflare/types/magic_transit/site_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .site import Site -from ..._models import BaseModel - -__all__ = ["SiteListResponse"] - - -class SiteListResponse(BaseModel): - sites: Optional[List[Site]] = None diff --git a/src/cloudflare/types/magic_transit/site_update_params.py b/src/cloudflare/types/magic_transit/site_update_params.py index 9d4dd320968..1843cba18ff 100644 --- a/src/cloudflare/types/magic_transit/site_update_params.py +++ b/src/cloudflare/types/magic_transit/site_update_params.py @@ -6,17 +6,13 @@ from .site_location_param import SiteLocationParam -__all__ = ["SiteUpdateParams", "Site"] +__all__ = ["SiteUpdateParams"] class SiteUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - site: Site - - -class Site(TypedDict, total=False): connector_id: str """Magic WAN Connector identifier tag.""" diff --git a/src/cloudflare/types/magic_transit/site_update_response.py b/src/cloudflare/types/magic_transit/site_update_response.py deleted file mode 100644 index caf438d0f77..00000000000 --- a/src/cloudflare/types/magic_transit/site_update_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .site import Site -from ..._models import BaseModel - -__all__ = ["SiteUpdateResponse"] - - -class SiteUpdateResponse(BaseModel): - site: Optional[Site] = None diff --git a/src/cloudflare/types/magic_transit/sites/__init__.py b/src/cloudflare/types/magic_transit/sites/__init__.py index 6809949d08d..d4082759794 100644 --- a/src/cloudflare/types/magic_transit/sites/__init__.py +++ b/src/cloudflare/types/magic_transit/sites/__init__.py @@ -12,35 +12,21 @@ from .dhcp_server import DHCPServer as DHCPServer from .subnet_param import SubnetParam as SubnetParam from .routed_subnet import RoutedSubnet as RoutedSubnet -from .acl_get_response import ACLGetResponse as ACLGetResponse -from .allowed_protocol import AllowedProtocol as AllowedProtocol from .dhcp_relay_param import DHCPRelayParam as DHCPRelayParam -from .lan_get_response import LANGetResponse as LANGetResponse -from .wan_get_response import WANGetResponse as WANGetResponse from .acl_configuration import ACLConfiguration as ACLConfiguration from .acl_create_params import ACLCreateParams as ACLCreateParams from .acl_delete_params import ACLDeleteParams as ACLDeleteParams -from .acl_list_response import ACLListResponse as ACLListResponse 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_delete_params import LANDeleteParams as LANDeleteParams -from .lan_list_response import LANListResponse as LANListResponse from .lan_update_params import LANUpdateParams as LANUpdateParams from .wan_create_params import WANCreateParams as WANCreateParams from .wan_delete_params import WANDeleteParams as WANDeleteParams -from .wan_list_response import WANListResponse as WANListResponse from .wan_update_params import WANUpdateParams as WANUpdateParams -from .acl_create_response import ACLCreateResponse as ACLCreateResponse -from .acl_delete_response import ACLDeleteResponse as ACLDeleteResponse -from .acl_update_response import ACLUpdateResponse as ACLUpdateResponse from .lan_create_response import LANCreateResponse as LANCreateResponse -from .lan_delete_response import LANDeleteResponse as LANDeleteResponse -from .lan_update_response import LANUpdateResponse as LANUpdateResponse from .routed_subnet_param import RoutedSubnetParam as RoutedSubnetParam from .wan_create_response import WANCreateResponse as WANCreateResponse -from .wan_delete_response import WANDeleteResponse as WANDeleteResponse -from .wan_update_response import WANUpdateResponse as WANUpdateResponse from .lan_static_addressing import LANStaticAddressing as LANStaticAddressing from .wan_static_addressing import WANStaticAddressing as WANStaticAddressing from .acl_configuration_param import ACLConfigurationParam as ACLConfigurationParam diff --git a/src/cloudflare/types/magic_transit/sites/acl.py b/src/cloudflare/types/magic_transit/sites/acl.py index 01bcf9e4b55..b8b077c43b6 100644 --- a/src/cloudflare/types/magic_transit/sites/acl.py +++ b/src/cloudflare/types/magic_transit/sites/acl.py @@ -1,9 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from typing_extensions import Literal from ...._models import BaseModel -from .allowed_protocol import AllowedProtocol from .acl_configuration import ACLConfiguration __all__ = ["ACL"] @@ -31,4 +31,4 @@ class ACL(BaseModel): name: Optional[str] = None """The name of the ACL.""" - protocols: Optional[List[AllowedProtocol]] = None + protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl_create_params.py b/src/cloudflare/types/magic_transit/sites/acl_create_params.py index ae1176846f2..c5619618283 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_create_params.py @@ -3,22 +3,17 @@ from __future__ import annotations from typing import List -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict -from .allowed_protocol import AllowedProtocol from .acl_configuration_param import ACLConfigurationParam -__all__ = ["ACLCreateParams", "ACL"] +__all__ = ["ACLCreateParams"] class ACLCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - acl: ACL - - -class ACL(TypedDict, total=False): lan_1: Required[ACLConfigurationParam] lan_2: Required[ACLConfigurationParam] @@ -37,4 +32,4 @@ class ACL(TypedDict, total=False): not included in request, will default to false. """ - protocols: List[AllowedProtocol] + protocols: List[Literal["tcp", "udp", "icmp"]] diff --git a/src/cloudflare/types/magic_transit/sites/acl_create_response.py b/src/cloudflare/types/magic_transit/sites/acl_create_response.py deleted file mode 100644 index f189c818561..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_create_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .acl import ACL -from ...._models import BaseModel - -__all__ = ["ACLCreateResponse"] - - -class ACLCreateResponse(BaseModel): - acls: Optional[List[ACL]] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl_delete_response.py b/src/cloudflare/types/magic_transit/sites/acl_delete_response.py deleted file mode 100644 index b1c32352183..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .acl import ACL -from ...._models import BaseModel - -__all__ = ["ACLDeleteResponse"] - - -class ACLDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_acl: Optional[ACL] = None - """Bidirectional ACL policy for network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/acl_get_response.py b/src/cloudflare/types/magic_transit/sites/acl_get_response.py deleted file mode 100644 index b6e0ab4afac..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_get_response.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .acl import ACL -from ...._models import BaseModel - -__all__ = ["ACLGetResponse"] - - -class ACLGetResponse(BaseModel): - acl: Optional[ACL] = None - """Bidirectional ACL policy for network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/acl_list_response.py b/src/cloudflare/types/magic_transit/sites/acl_list_response.py deleted file mode 100644 index 28d1a4eabe7..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .acl import ACL -from ...._models import BaseModel - -__all__ = ["ACLListResponse"] - - -class ACLListResponse(BaseModel): - acls: Optional[List[ACL]] = None diff --git a/src/cloudflare/types/magic_transit/sites/acl_update_params.py b/src/cloudflare/types/magic_transit/sites/acl_update_params.py index d875fc1d23f..c0514f44017 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_update_params.py @@ -3,12 +3,11 @@ from __future__ import annotations from typing import List -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict -from .allowed_protocol import AllowedProtocol from .acl_configuration_param import ACLConfigurationParam -__all__ = ["ACLUpdateParams", "ACL"] +__all__ = ["ACLUpdateParams"] class ACLUpdateParams(TypedDict, total=False): @@ -18,10 +17,6 @@ class ACLUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - acl: ACL - - -class ACL(TypedDict, total=False): description: str """Description for the ACL.""" @@ -40,4 +35,4 @@ class ACL(TypedDict, total=False): name: str """The name of the ACL.""" - protocols: List[AllowedProtocol] + protocols: List[Literal["tcp", "udp", "icmp"]] diff --git a/src/cloudflare/types/magic_transit/sites/acl_update_response.py b/src/cloudflare/types/magic_transit/sites/acl_update_response.py deleted file mode 100644 index 34d4f1a7102..00000000000 --- a/src/cloudflare/types/magic_transit/sites/acl_update_response.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .acl import ACL -from ...._models import BaseModel - -__all__ = ["ACLUpdateResponse"] - - -class ACLUpdateResponse(BaseModel): - acl: Optional[ACL] = None - """Bidirectional ACL policy for network traffic within a site.""" diff --git a/src/cloudflare/types/magic_transit/sites/allowed_protocol.py b/src/cloudflare/types/magic_transit/sites/allowed_protocol.py deleted file mode 100644 index cce3a21021e..00000000000 --- a/src/cloudflare/types/magic_transit/sites/allowed_protocol.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -__all__ = ["AllowedProtocol"] - -AllowedProtocol = Literal["tcp", "udp", "icmp"] diff --git a/src/cloudflare/types/magic_transit/sites/lan.py b/src/cloudflare/types/magic_transit/sites/lan.py index da2d71ada09..6df37634b0d 100644 --- a/src/cloudflare/types/magic_transit/sites/lan.py +++ b/src/cloudflare/types/magic_transit/sites/lan.py @@ -14,14 +14,14 @@ class LAN(BaseModel): id: Optional[str] = None """Identifier""" - description: Optional[str] = None - ha_link: Optional[bool] = None """mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. """ + name: Optional[str] = None + nat: Optional[Nat] = None physport: Optional[int] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_create_params.py b/src/cloudflare/types/magic_transit/sites/lan_create_params.py index 0dd95aa37de..16ca5e81832 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/lan_create_params.py @@ -9,30 +9,26 @@ from .routed_subnet_param import RoutedSubnetParam from .lan_static_addressing_param import LANStaticAddressingParam -__all__ = ["LANCreateParams", "LAN"] +__all__ = ["LANCreateParams"] class LANCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - lan: LAN - - -class LAN(TypedDict, total=False): physport: Required[int] vlan_tag: Required[int] """VLAN port number.""" - description: str - ha_link: bool """mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link. """ + name: str + nat: NatParam routed_subnets: Iterable[RoutedSubnetParam] diff --git a/src/cloudflare/types/magic_transit/sites/lan_create_response.py b/src/cloudflare/types/magic_transit/sites/lan_create_response.py index 3f52c951771..87939756ba3 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_create_response.py +++ b/src/cloudflare/types/magic_transit/sites/lan_create_response.py @@ -1,12 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from .lan import LAN -from ...._models import BaseModel __all__ = ["LANCreateResponse"] - -class LANCreateResponse(BaseModel): - lans: Optional[List[LAN]] = None +LANCreateResponse = List[LAN] diff --git a/src/cloudflare/types/magic_transit/sites/lan_delete_response.py b/src/cloudflare/types/magic_transit/sites/lan_delete_response.py deleted file mode 100644 index 99c8d636305..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_delete_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .lan import LAN -from ...._models import BaseModel - -__all__ = ["LANDeleteResponse"] - - -class LANDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_lan: Optional[LAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_get_response.py b/src/cloudflare/types/magic_transit/sites/lan_get_response.py deleted file mode 100644 index d8fcc33573d..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_get_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .lan import LAN -from ...._models import BaseModel - -__all__ = ["LANGetResponse"] - - -class LANGetResponse(BaseModel): - lan: Optional[LAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_list_response.py b/src/cloudflare/types/magic_transit/sites/lan_list_response.py deleted file mode 100644 index 9d839b066e9..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .lan import LAN -from ...._models import BaseModel - -__all__ = ["LANListResponse"] - - -class LANListResponse(BaseModel): - lans: Optional[List[LAN]] = None diff --git a/src/cloudflare/types/magic_transit/sites/lan_update_params.py b/src/cloudflare/types/magic_transit/sites/lan_update_params.py index 6254d89bcc8..0dea4f2b81c 100644 --- a/src/cloudflare/types/magic_transit/sites/lan_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/lan_update_params.py @@ -9,7 +9,7 @@ from .routed_subnet_param import RoutedSubnetParam from .lan_static_addressing_param import LANStaticAddressingParam -__all__ = ["LANUpdateParams", "LAN"] +__all__ = ["LANUpdateParams"] class LANUpdateParams(TypedDict, total=False): @@ -19,11 +19,7 @@ class LANUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - lan: LAN - - -class LAN(TypedDict, total=False): - description: str + name: str nat: NatParam diff --git a/src/cloudflare/types/magic_transit/sites/lan_update_response.py b/src/cloudflare/types/magic_transit/sites/lan_update_response.py deleted file mode 100644 index 3e40d93453f..00000000000 --- a/src/cloudflare/types/magic_transit/sites/lan_update_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .lan import LAN -from ...._models import BaseModel - -__all__ = ["LANUpdateResponse"] - - -class LANUpdateResponse(BaseModel): - lan: Optional[LAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan.py b/src/cloudflare/types/magic_transit/sites/wan.py index bf4969efd20..1148e9f087f 100644 --- a/src/cloudflare/types/magic_transit/sites/wan.py +++ b/src/cloudflare/types/magic_transit/sites/wan.py @@ -12,7 +12,7 @@ class WAN(BaseModel): id: Optional[str] = None """Identifier""" - description: Optional[str] = None + name: Optional[str] = None physport: Optional[int] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_create_params.py b/src/cloudflare/types/magic_transit/sites/wan_create_params.py index a1fc6a2a4aa..f8bcb240d5f 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/wan_create_params.py @@ -6,23 +6,19 @@ from .wan_static_addressing_param import WANStaticAddressingParam -__all__ = ["WANCreateParams", "WAN"] +__all__ = ["WANCreateParams"] class WANCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - wan: WAN - - -class WAN(TypedDict, total=False): physport: Required[int] vlan_tag: Required[int] """VLAN port number.""" - description: str + name: str priority: int diff --git a/src/cloudflare/types/magic_transit/sites/wan_create_response.py b/src/cloudflare/types/magic_transit/sites/wan_create_response.py index bc4c93c3024..40806aa462e 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_create_response.py +++ b/src/cloudflare/types/magic_transit/sites/wan_create_response.py @@ -1,12 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from .wan import WAN -from ...._models import BaseModel __all__ = ["WANCreateResponse"] - -class WANCreateResponse(BaseModel): - wans: Optional[List[WAN]] = None +WANCreateResponse = List[WAN] diff --git a/src/cloudflare/types/magic_transit/sites/wan_delete_response.py b/src/cloudflare/types/magic_transit/sites/wan_delete_response.py deleted file mode 100644 index 0b99cd41c3f..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_delete_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .wan import WAN -from ...._models import BaseModel - -__all__ = ["WANDeleteResponse"] - - -class WANDeleteResponse(BaseModel): - deleted: Optional[bool] = None - - deleted_wan: Optional[WAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_get_response.py b/src/cloudflare/types/magic_transit/sites/wan_get_response.py deleted file mode 100644 index f87bac75af1..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_get_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .wan import WAN -from ...._models import BaseModel - -__all__ = ["WANGetResponse"] - - -class WANGetResponse(BaseModel): - wan: Optional[WAN] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_list_response.py b/src/cloudflare/types/magic_transit/sites/wan_list_response.py deleted file mode 100644 index 94d7deb35b7..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_list_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .wan import WAN -from ...._models import BaseModel - -__all__ = ["WANListResponse"] - - -class WANListResponse(BaseModel): - wans: Optional[List[WAN]] = None diff --git a/src/cloudflare/types/magic_transit/sites/wan_update_params.py b/src/cloudflare/types/magic_transit/sites/wan_update_params.py index 531a41472a8..6b1a92759d5 100644 --- a/src/cloudflare/types/magic_transit/sites/wan_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/wan_update_params.py @@ -6,7 +6,7 @@ from .wan_static_addressing_param import WANStaticAddressingParam -__all__ = ["WANUpdateParams", "WAN"] +__all__ = ["WANUpdateParams"] class WANUpdateParams(TypedDict, total=False): @@ -16,11 +16,7 @@ class WANUpdateParams(TypedDict, total=False): site_id: Required[str] """Identifier""" - wan: WAN - - -class WAN(TypedDict, total=False): - description: str + name: str physport: int diff --git a/src/cloudflare/types/magic_transit/sites/wan_update_response.py b/src/cloudflare/types/magic_transit/sites/wan_update_response.py deleted file mode 100644 index d151da49b39..00000000000 --- a/src/cloudflare/types/magic_transit/sites/wan_update_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .wan import WAN -from ...._models import BaseModel - -__all__ = ["WANUpdateResponse"] - - -class WANUpdateResponse(BaseModel): - wan: Optional[WAN] = None diff --git a/src/cloudflare/types/shared/cloudflare_tunnel.py b/src/cloudflare/types/shared/cloudflare_tunnel.py index 4e42ab3182d..63f80cc424a 100644 --- a/src/cloudflare/types/shared/cloudflare_tunnel.py +++ b/src/cloudflare/types/shared/cloudflare_tunnel.py @@ -13,8 +13,8 @@ class Connection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -63,19 +63,19 @@ class CloudflareTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" remote_config: Optional[bool] = None """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. diff --git a/src/cloudflare/types/warp_connector/warp_connector_create_params.py b/src/cloudflare/types/warp_connector/warp_connector_create_params.py index 30a1cf2999c..79206222a60 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_create_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_create_params.py @@ -12,4 +12,4 @@ class WARPConnectorCreateParams(TypedDict, total=False): """Cloudflare account ID""" name: Required[str] - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" diff --git a/src/cloudflare/types/warp_connector/warp_connector_create_response.py b/src/cloudflare/types/warp_connector/warp_connector_create_response.py index ef3af32565c..1346bb88f10 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_create_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_create_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py index 1f059abb987..57d62b9a4bc 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_delete_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_edit_params.py b/src/cloudflare/types/warp_connector/warp_connector_edit_params.py index c61bff80432..86d2f3b97b9 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_edit_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_edit_params.py @@ -12,7 +12,7 @@ class WARPConnectorEditParams(TypedDict, total=False): """Cloudflare account ID""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" tunnel_secret: str """Sets the password required to run a locally-managed tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py index 17b39aa461d..8b8564a0c94 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_edit_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_get_response.py b/src/cloudflare/types/warp_connector/warp_connector_get_response.py index 77f9eb18a4c..7db3c258a29 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_get_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_get_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/warp_connector/warp_connector_list_response.py b/src/cloudflare/types/warp_connector/warp_connector_list_response.py index 303c631c0fd..78635affe5e 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_list_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_list_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/zero_trust/networks/route.py b/src/cloudflare/types/zero_trust/networks/route.py index b51af42cdfc..bbfa9994665 100644 --- a/src/cloudflare/types/zero_trust/networks/route.py +++ b/src/cloudflare/types/zero_trust/networks/route.py @@ -15,24 +15,20 @@ class Route(BaseModel): comment: Optional[str] = None """Optional remark describing the route.""" - created_at: Optional[object] = None - """Timestamp of when the route was created.""" + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the route was deleted. + """Timestamp of when the resource was deleted. - If `null`, the route has not been deleted. + If `null`, the resource has not been deleted. """ network: Optional[str] = None """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - tunnel_id: Optional[object] = None - """UUID of the Cloudflare Tunnel serving the route.""" + tunnel_id: Optional[str] = None + """UUID of the tunnel.""" - virtual_network_id: Optional[object] = None - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: Optional[str] = None + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_create_params.py b/src/cloudflare/types/zero_trust/networks/route_create_params.py index 007ff171323..1d2fe28479d 100644 --- a/src/cloudflare/types/zero_trust/networks/route_create_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_create_params.py @@ -11,15 +11,11 @@ class RouteCreateParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - ip_network: Required[str] + network: Required[str] """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" comment: str """Optional remark describing the route.""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_edit_params.py b/src/cloudflare/types/zero_trust/networks/route_edit_params.py index 9bb5ad3ceb6..1640ce2c28b 100644 --- a/src/cloudflare/types/zero_trust/networks/route_edit_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_edit_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict __all__ = ["RouteEditParams"] @@ -17,15 +17,5 @@ class RouteEditParams(TypedDict, total=False): network: str """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] - """The type of tunnel.""" - - tunnel_id: object - """UUID of the Cloudflare Tunnel serving the route.""" - - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_list_params.py b/src/cloudflare/types/zero_trust/networks/route_list_params.py index 6b456b4d39a..15a5e7bb478 100644 --- a/src/cloudflare/types/zero_trust/networks/route_list_params.py +++ b/src/cloudflare/types/zero_trust/networks/route_list_params.py @@ -2,7 +2,11 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["RouteListParams"] @@ -14,22 +18,22 @@ class RouteListParams(TypedDict, total=False): comment: str """Optional remark describing the route.""" - existed_at: object + existed_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - If provided, include only routes that were created (and not deleted) before this - time. + If provided, include only tunnels that were created (and not deleted) before + this time. """ - is_deleted: object + is_deleted: bool """If `true`, only include deleted routes. If `false`, exclude deleted routes. If empty, all routes will be included. """ - network_subset: object + network_subset: str """If set, only list routes that are contained within this IP range.""" - network_superset: object + network_superset: str """If set, only list routes that contain this IP range.""" page: float @@ -44,12 +48,8 @@ class RouteListParams(TypedDict, total=False): tun_types: str """The types of tunnels to filter separated by a comma.""" - tunnel_id: object - """UUID of the Cloudflare Tunnel serving the route.""" - - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. + tunnel_id: str + """UUID of the tunnel.""" - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/route_param.py b/src/cloudflare/types/zero_trust/networks/route_param.py index d47433fe082..8fa3a2b483e 100644 --- a/src/cloudflare/types/zero_trust/networks/route_param.py +++ b/src/cloudflare/types/zero_trust/networks/route_param.py @@ -2,7 +2,11 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["RouteParam"] @@ -11,18 +15,17 @@ class RouteParam(TypedDict, total=False): comment: str """Optional remark describing the route.""" - created_at: object - """Timestamp of when the route was created.""" + created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Timestamp of when the resource was created.""" - network: str - """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" + deleted_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Timestamp of when the resource was deleted. - tunnel_id: object - """UUID of the Cloudflare Tunnel serving the route.""" + If `null`, the resource has not been deleted. + """ - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. + network: str + """The private IPv4 or IPv6 range connected by the route, in CIDR notation.""" - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py b/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py index 5d4f7f932a2..2e0092ae453 100644 --- a/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py +++ b/src/cloudflare/types/zero_trust/networks/routes/ip_get_params.py @@ -11,9 +11,5 @@ class IPGetParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py b/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py index c2faad3a12c..5f145557ca0 100644 --- a/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py +++ b/src/cloudflare/types/zero_trust/networks/routes/network_create_params.py @@ -14,9 +14,5 @@ class NetworkCreateParams(TypedDict, total=False): comment: str """Optional remark describing the route.""" - virtual_network_id: object - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: str + """UUID of the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/teamnet.py b/src/cloudflare/types/zero_trust/networks/teamnet.py index 4624c64d4a1..768b4564a71 100644 --- a/src/cloudflare/types/zero_trust/networks/teamnet.py +++ b/src/cloudflare/types/zero_trust/networks/teamnet.py @@ -16,13 +16,13 @@ class Teamnet(BaseModel): comment: Optional[str] = None """Optional remark describing the route.""" - created_at: Optional[object] = None - """Timestamp of when the route was created.""" + created_at: Optional[datetime] = None + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the route was deleted. + """Timestamp of when the resource was deleted. - If `null`, the route has not been deleted. + If `null`, the resource has not been deleted. """ network: Optional[str] = None @@ -31,18 +31,14 @@ class Teamnet(BaseModel): tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None """The type of tunnel.""" - tunnel_id: Optional[object] = None - """UUID of the Cloudflare Tunnel serving the route.""" + tunnel_id: Optional[str] = None + """UUID of the tunnel.""" - tunnel_name: Optional[object] = None - """The user-friendly name of the Cloudflare Tunnel serving the route.""" + tunnel_name: Optional[str] = None + """A user-friendly name for a tunnel.""" - virtual_network_id: Optional[object] = None - """UUID of the Tunnel Virtual Network this route belongs to. - - If no virtual networks are configured, the route is assigned to the default - virtual network of the account. - """ + virtual_network_id: Optional[str] = None + """UUID of the virtual network.""" virtual_network_name: Optional[str] = None """A user-friendly name for the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network.py b/src/cloudflare/types/zero_trust/networks/virtual_network.py index bb3493b9b39..f6b70152188 100644 --- a/src/cloudflare/types/zero_trust/networks/virtual_network.py +++ b/src/cloudflare/types/zero_trust/networks/virtual_network.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from ...._models import BaseModel @@ -14,8 +15,8 @@ class VirtualNetwork(BaseModel): comment: str """Optional remark describing the virtual network.""" - created_at: object - """Timestamp of when the virtual network was created.""" + created_at: datetime + """Timestamp of when the resource was created.""" is_default_network: bool """If `true`, this virtual network is the default for the account.""" @@ -23,8 +24,8 @@ class VirtualNetwork(BaseModel): name: str """A user-friendly name for the virtual network.""" - deleted_at: Optional[object] = None - """Timestamp of when the virtual network was deleted. + deleted_at: Optional[datetime] = None + """Timestamp of when the resource was deleted. - If `null`, the virtual network has not been deleted. + If `null`, the resource has not been deleted. """ diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py b/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py index 6c74f6ac908..3168639a9d1 100644 --- a/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py +++ b/src/cloudflare/types/zero_trust/networks/virtual_network_list_params.py @@ -11,14 +11,17 @@ class VirtualNetworkListParams(TypedDict, total=False): account_id: Required[str] """Cloudflare account ID""" - is_default: object + id: str + """UUID of the virtual network.""" + + is_default: bool """If `true`, only include the default virtual network. If `false`, exclude the default virtual network. If empty, all virtual networks will be included. """ - is_deleted: object + is_deleted: bool """If `true`, only include deleted virtual networks. If `false`, exclude deleted virtual networks. If empty, all virtual networks @@ -27,9 +30,3 @@ class VirtualNetworkListParams(TypedDict, total=False): name: str """A user-friendly name for the virtual network.""" - - vnet_id: str - """UUID of the virtual network.""" - - vnet_name: str - """A user-friendly name for the virtual network.""" diff --git a/src/cloudflare/types/zero_trust/tunnel_create_params.py b/src/cloudflare/types/zero_trust/tunnel_create_params.py index 892756ccac4..dfc1ee811cc 100644 --- a/src/cloudflare/types/zero_trust/tunnel_create_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_create_params.py @@ -12,10 +12,10 @@ class TunnelCreateParams(TypedDict, total=False): """Cloudflare account ID""" name: Required[str] - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" - tunnel_secret: Required[object] - """Sets the password required to run the tunnel. + tunnel_secret: Required[str] + """Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string. """ diff --git a/src/cloudflare/types/zero_trust/tunnel_create_response.py b/src/cloudflare/types/zero_trust/tunnel_create_response.py index 73f35896d9f..b39079e78e2 100644 --- a/src/cloudflare/types/zero_trust/tunnel_create_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_create_response.py @@ -17,13 +17,13 @@ class TunnelCreateResponse(BaseModel): """The tunnel connections between your origin and Cloudflare's edge.""" created_at: datetime - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ diff --git a/src/cloudflare/types/zero_trust/tunnel_delete_response.py b/src/cloudflare/types/zero_trust/tunnel_delete_response.py index 0a3106becf0..b26adb49ef0 100644 --- a/src/cloudflare/types/zero_trust/tunnel_delete_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_delete_response.py @@ -17,13 +17,13 @@ class TunnelDeleteResponse(BaseModel): """The tunnel connections between your origin and Cloudflare's edge.""" created_at: datetime - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_params.py b/src/cloudflare/types/zero_trust/tunnel_edit_params.py index 20fb9f8da8e..b8174879460 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_params.py @@ -12,7 +12,7 @@ class TunnelEditParams(TypedDict, total=False): """Cloudflare account ID""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" tunnel_secret: str """Sets the password required to run a locally-managed tunnel. diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py index 9b0f909d402..e81f229fd37 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/zero_trust/tunnel_get_response.py b/src/cloudflare/types/zero_trust/tunnel_get_response.py index 8803a86547c..58be38689ff 100644 --- a/src/cloudflare/types/zero_trust/tunnel_get_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_get_response.py @@ -17,13 +17,13 @@ class TunnelGetResponse(BaseModel): """The tunnel connections between your origin and Cloudflare's edge.""" created_at: datetime - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" name: str - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ diff --git a/src/cloudflare/types/zero_trust/tunnel_list_response.py b/src/cloudflare/types/zero_trust/tunnel_list_response.py index da85f0ca4b7..7329efadedc 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py @@ -14,8 +14,8 @@ class TunnelWARPConnectorTunnelConnection(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" @@ -64,19 +64,19 @@ class TunnelWARPConnectorTunnel(BaseModel): """ created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" + """Timestamp of when the resource was created.""" deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + """Timestamp of when the resource was deleted. - If `null`, the tunnel has not been deleted. + If `null`, the resource has not been deleted. """ metadata: Optional[object] = None """Metadata associated with the tunnel.""" name: Optional[str] = None - """A user-friendly name for the tunnel.""" + """A user-friendly name for a tunnel.""" status: Optional[str] = None """The status of the tunnel. diff --git a/src/cloudflare/types/zero_trust/tunnels/client.py b/src/cloudflare/types/zero_trust/tunnels/client.py index 1c18c5ff6f2..2e8e5b973fc 100644 --- a/src/cloudflare/types/zero_trust/tunnels/client.py +++ b/src/cloudflare/types/zero_trust/tunnels/client.py @@ -12,8 +12,8 @@ class Conn(BaseModel): id: Optional[str] = None """UUID of the Cloudflare Tunnel connection.""" - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" + client_id: Optional[str] = None + """UUID of the Cloudflare Tunnel connector.""" client_version: Optional[str] = None """The cloudflared version used to establish this connection.""" diff --git a/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py b/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py index f2e306a4899..d01c0015e5c 100644 --- a/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py +++ b/src/cloudflare/types/zero_trust/tunnels/configuration_update_params.py @@ -21,7 +21,7 @@ class ConfigurationUpdateParams(TypedDict, total=False): account_id: Required[str] - """Identifier""" + """Cloudflare account ID""" config: Config """The tunnel configuration and ingress rules.""" @@ -128,7 +128,10 @@ class ConfigIngress(TypedDict, total=False): """ origin_request: Annotated[ConfigIngressOriginRequest, PropertyInfo(alias="originRequest")] - """Configuration parameters of connection between cloudflared and origin server.""" + """ + Configuration parameters for the public hostname specific connection settings + between cloudflared and origin server. + """ path: str """Requests with this path route to this public hostname.""" @@ -231,7 +234,10 @@ class Config(TypedDict, total=False): """List of public hostname definitions""" origin_request: Annotated[ConfigOriginRequest, PropertyInfo(alias="originRequest")] - """Configuration parameters of connection between cloudflared and origin server.""" + """ + Configuration parameters for the public hostname specific connection settings + between cloudflared and origin server. + """ warp_routing: Annotated[ConfigWARPRouting, PropertyInfo(alias="warp-routing")] """Enable private network access from WARP users to private network routes""" diff --git a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py index ceb620a6d1a..857b59c2c6b 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", service_id="2db684ee7ca04e159946fd05b99e1bcd", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +62,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -205,7 +205,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +219,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +233,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -272,7 +272,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -283,7 +283,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare cidr="192.0.2.0/24", service_id="2db684ee7ca04e159946fd05b99e1bcd", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +296,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +309,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -452,7 +452,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -466,7 +466,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,7 +480,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(ServiceBinding, binding, path=["response"]) + assert_matches_type(Optional[ServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py index f0a7190e494..a1f54805881 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -78,7 +78,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,7 +89,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: prefix_id="023e105f4ecef8ad9ca31a8372d0c353", on_demand={"advertised": True}, ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,7 +153,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +167,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -181,7 +181,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -273,7 +273,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -284,7 +284,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) prefix_id="023e105f4ecef8ad9ca31a8372d0c353", on_demand={"advertised": True}, ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,7 +312,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -348,7 +348,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", prefix_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +376,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(BGPPrefix, prefix, path=["response"]) + assert_matches_type(Optional[BGPPrefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py b/tests/api_resources/addressing/prefixes/bgp/test_statuses.py index a54d8bb4d77..064d464963c 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_statuses.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_statuses.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", advertised=True, ) - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +81,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +138,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", advertised=True, ) - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +152,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +166,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusEditResponse, status, path=["response"]) + assert_matches_type(Optional[StatusEditResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +194,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +207,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) @pytest.mark.skip() @parametrize @@ -220,7 +220,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusGetResponse, status, path=["response"]) + assert_matches_type(Optional[StatusGetResponse], status, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/test_delegations.py b/tests/api_resources/addressing/prefixes/test_delegations.py index cc48cc0b00b..e9b5d033d66 100644 --- a/tests/api_resources/addressing/prefixes/test_delegations.py +++ b/tests/api_resources/addressing/prefixes/test_delegations.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +144,7 @@ def test_method_delete(self, client: Cloudflare) -> None: prefix_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +159,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -218,7 +218,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: cidr="192.0.2.0/24", delegated_account_id="b1946ac92492d2347c6235b4d2611184", ) - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +233,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +248,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(Delegations, delegation, path=["response"]) + assert_matches_type(Optional[Delegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -332,7 +332,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: prefix_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -347,7 +347,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(DelegationDeleteResponse, delegation, path=["response"]) + assert_matches_type(Optional[DelegationDeleteResponse], delegation, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_address_maps.py b/tests/api_resources/addressing/test_address_maps.py index 7536f76aea4..298e15b849e 100644 --- a/tests/api_resources/addressing/test_address_maps.py +++ b/tests/api_resources/addressing/test_address_maps.py @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +181,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +219,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,7 +245,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +258,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -271,7 +271,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -300,7 +300,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -310,7 +310,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -322,7 +322,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,7 +334,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapCreateResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -452,7 +452,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -464,7 +464,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) description="My Ecommerce zones", enabled=True, ) - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -477,7 +477,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -490,7 +490,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMap, address_map, path=["response"]) + assert_matches_type(Optional[AddressMap], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -516,7 +516,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -529,7 +529,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -542,7 +542,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(AddressMapGetResponse, address_map, path=["response"]) + assert_matches_type(Optional[AddressMapGetResponse], address_map, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_loa_documents.py b/tests/api_resources/addressing/test_loa_documents.py index c2e4033f38e..7fb62037c87 100644 --- a/tests/api_resources/addressing/test_loa_documents.py +++ b/tests/api_resources/addressing/test_loa_documents.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", loa_document="@document.pdf", ) - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", loa_document="@document.pdf", ) - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = await response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" loa_document = await response.parse() - assert_matches_type(LOADocumentCreateResponse, loa_document, path=["response"]) + assert_matches_type(Optional[LOADocumentCreateResponse], loa_document, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_prefixes.py b/tests/api_resources/addressing/test_prefixes.py index 8c570378484..097f86f970b 100644 --- a/tests/api_resources/addressing/test_prefixes.py +++ b/tests/api_resources/addressing/test_prefixes.py @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,7 +182,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="Internal test prefix", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +196,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -210,7 +210,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +238,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +251,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +264,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,7 +296,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: cidr="192.0.2.0/24", loa_document_id="d933b1530bc56c9953cf8ce166da8004", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +311,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +326,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -448,7 +448,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="Internal test prefix", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -462,7 +462,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -476,7 +476,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -504,7 +504,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -517,7 +517,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -530,7 +530,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Prefix, prefix, path=["response"]) + assert_matches_type(Optional[Prefix], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/sites/test_acls.py b/tests/api_resources/magic_transit/sites/test_acls.py index 97709ac7ee2..c55c565aa3e 100644 --- a/tests/api_resources/magic_transit/sites/test_acls.py +++ b/tests/api_resources/magic_transit/sites/test_acls.py @@ -9,12 +9,9 @@ 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 ( - ACLGetResponse, - ACLListResponse, - ACLCreateResponse, - ACLDeleteResponse, - ACLUpdateResponse, + ACL, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,8 +26,11 @@ def test_method_create(self, client: Cloudflare) -> None: acl = client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,26 +38,24 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: acl = client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "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"], + 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", + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -65,12 +63,15 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -78,12 +79,15 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.acls.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -94,12 +98,18 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.acls.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) @pytest.mark.skip() @@ -110,7 +120,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,26 +129,24 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "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"], + 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(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +160,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +174,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -201,7 +209,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -214,7 +222,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -227,7 +235,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(SyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -255,7 +263,7 @@ def test_method_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -270,7 +278,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +293,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -324,7 +332,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -338,7 +346,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -352,7 +360,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -390,8 +398,11 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: acl = await async_client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -399,26 +410,24 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare acl = await async_client.magic_transit.sites.acls.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "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"], + 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", + description="Allows local traffic between PIN pads and cash register.", + forward_locally=True, + protocols=["tcp", "udp", "icmp"], ) - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -426,12 +435,15 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -439,12 +451,15 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.acls.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLCreateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -455,12 +470,18 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.acls.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) 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.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lan_1={"lan_id": "string"}, + lan_2={"lan_id": "string"}, + name="PIN Pad - Cash Register", ) @pytest.mark.skip() @@ -471,7 +492,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -480,26 +501,24 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - acl={ - "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"], + 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(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +532,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -527,7 +546,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLUpdateResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -562,7 +581,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -575,7 +594,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +607,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLListResponse, acl, path=["response"]) + assert_matches_type(AsyncSinglePage[ACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -616,7 +635,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -631,7 +650,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -646,7 +665,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLDeleteResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -685,7 +704,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -699,7 +718,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -713,7 +732,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(ACLGetResponse, acl, path=["response"]) + assert_matches_type(ACL, acl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/sites/test_lans.py b/tests/api_resources/magic_transit/sites/test_lans.py index c32b860414a..17828b6e628 100644 --- a/tests/api_resources/magic_transit/sites/test_lans.py +++ b/tests/api_resources/magic_transit/sites/test_lans.py @@ -9,12 +9,10 @@ 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 ( - LANGetResponse, - LANListResponse, + LAN, LANCreateResponse, - LANDeleteResponse, - LANUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,6 +27,8 @@ def test_method_create(self, client: Cloudflare) -> None: lan = client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -38,44 +38,42 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: lan = client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "ha_link": True, - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + physport=1, + vlan_tag=0, + ha_link=True, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -86,6 +84,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -99,6 +99,8 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.lans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -115,12 +117,16 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.lans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -131,7 +137,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,46 +146,44 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + physport=1, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +197,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +211,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +246,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -255,7 +259,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +272,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(SyncSinglePage[LAN], lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,7 +300,7 @@ def test_method_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +315,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +330,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,7 +369,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -379,7 +383,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -393,7 +397,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -431,6 +435,8 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: lan = await async_client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -440,44 +446,42 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare lan = await async_client.magic_transit.sites.lans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "ha_link": True, - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + physport=1, + vlan_tag=0, + ha_link=True, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, ) assert_matches_type(LANCreateResponse, lan, path=["response"]) @@ -488,6 +492,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -501,6 +507,8 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.lans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -517,12 +525,16 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.lans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.lans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -533,7 +545,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -542,46 +554,44 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - lan={ - "description": "string", - "nat": {"static_prefix": "192.0.2.0/24"}, - "physport": 1, - "routed_subnets": [ - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - { - "nat": {"static_prefix": "192.0.2.0/24"}, - "next_hop": "192.0.2.1", - "prefix": "192.0.2.0/24", - }, - ], - "static_addressing": { - "address": "192.0.2.0/24", - "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, - "dhcp_server": { - "dhcp_pool_end": "192.0.2.1", - "dhcp_pool_start": "192.0.2.1", - "dns_server": "192.0.2.1", - "reservations": { - "00:11:22:33:44:55": "192.0.2.100", - "AA:BB:CC:DD:EE:FF": "192.168.1.101", - }, + name="string", + nat={"static_prefix": "192.0.2.0/24"}, + physport=1, + routed_subnets=[ + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + { + "nat": {"static_prefix": "192.0.2.0/24"}, + "next_hop": "192.0.2.1", + "prefix": "192.0.2.0/24", + }, + ], + static_addressing={ + "address": "192.0.2.0/24", + "dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]}, + "dhcp_server": { + "dhcp_pool_end": "192.0.2.1", + "dhcp_pool_start": "192.0.2.1", + "dns_server": "192.0.2.1", + "reservations": { + "00:11:22:33:44:55": "192.0.2.100", + "AA:BB:CC:DD:EE:FF": "192.168.1.101", }, - "secondary_address": "192.0.2.0/24", - "virtual_address": "192.0.2.0/24", }, - "vlan_tag": 0, + "secondary_address": "192.0.2.0/24", + "virtual_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -595,7 +605,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -609,7 +619,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANUpdateResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -644,7 +654,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -657,7 +667,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -670,7 +680,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANListResponse, lan, path=["response"]) + assert_matches_type(AsyncSinglePage[LAN], lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -698,7 +708,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -713,7 +723,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -728,7 +738,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANDeleteResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -767,7 +777,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -781,7 +791,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) @pytest.mark.skip() @parametrize @@ -795,7 +805,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" lan = await response.parse() - assert_matches_type(LANGetResponse, lan, path=["response"]) + assert_matches_type(LAN, lan, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/sites/test_wans.py b/tests/api_resources/magic_transit/sites/test_wans.py index 163a1a1d6f5..f047cf34b72 100644 --- a/tests/api_resources/magic_transit/sites/test_wans.py +++ b/tests/api_resources/magic_transit/sites/test_wans.py @@ -9,12 +9,10 @@ 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 ( - WANGetResponse, - WANListResponse, + WAN, WANCreateResponse, - WANDeleteResponse, - WANUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,6 +27,8 @@ def test_method_create(self, client: Cloudflare) -> None: wan = client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -38,16 +38,14 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: wan = client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + physport=1, + vlan_tag=0, + name="string", + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -58,6 +56,8 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -71,6 +71,8 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.wans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -87,12 +89,16 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): client.magic_transit.sites.wans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -103,7 +109,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,19 +118,17 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + name="string", + physport=1, + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +142,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +156,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +191,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +204,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +217,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(SyncSinglePage[WAN], wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -241,7 +245,7 @@ def test_method_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +260,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -271,7 +275,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -310,7 +314,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -324,7 +328,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -338,7 +342,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -376,6 +380,8 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: wan = await async_client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -385,16 +391,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare wan = await async_client.magic_transit.sites.wans.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + physport=1, + vlan_tag=0, + name="string", + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, ) assert_matches_type(WANCreateResponse, wan, path=["response"]) @@ -405,6 +409,8 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) assert response.is_closed is True @@ -418,6 +424,8 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.magic_transit.sites.wans.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -434,12 +442,16 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.magic_transit.sites.wans.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", account_id="", + physport=1, + vlan_tag=0, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): await async_client.magic_transit.sites.wans.with_raw_response.create( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + physport=1, + vlan_tag=0, ) @pytest.mark.skip() @@ -450,7 +462,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,19 +471,17 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", - wan={ - "description": "string", - "physport": 1, - "priority": 0, - "static_addressing": { - "address": "192.0.2.0/24", - "gateway_address": "192.0.2.1", - "secondary_address": "192.0.2.0/24", - }, - "vlan_tag": 0, + name="string", + physport=1, + priority=0, + static_addressing={ + "address": "192.0.2.0/24", + "gateway_address": "192.0.2.1", + "secondary_address": "192.0.2.0/24", }, + vlan_tag=0, ) - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -485,7 +495,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -499,7 +509,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANUpdateResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -534,7 +544,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -547,7 +557,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -560,7 +570,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANListResponse, wan, path=["response"]) + assert_matches_type(AsyncSinglePage[WAN], wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -588,7 +598,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -603,7 +613,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -618,7 +628,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANDeleteResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -657,7 +667,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", site_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -671,7 +681,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) @pytest.mark.skip() @parametrize @@ -685,7 +695,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" wan = await response.parse() - assert_matches_type(WANGetResponse, wan, path=["response"]) + assert_matches_type(WAN, wan, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/test_sites.py b/tests/api_resources/magic_transit/test_sites.py index d3c2faa8f48..caa3e57c277 100644 --- a/tests/api_resources/magic_transit/test_sites.py +++ b/tests/api_resources/magic_transit/test_sites.py @@ -9,12 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.magic_transit import ( - SiteGetResponse, - SiteListResponse, - SiteCreateResponse, - SiteDeleteResponse, - SiteUpdateResponse, + Site, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,51 +25,52 @@ class TestSites: def test_method_create(self, client: Cloudflare) -> None: site = client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: site = client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "ha_mode": True, - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + name="site_1", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + ha_mode=True, + location={ + "lat": "string", + "lon": "string", }, + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.magic_transit.sites.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.magic_transit.sites.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,6 +80,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.magic_transit.sites.with_raw_response.create( account_id="", + name="site_1", ) @pytest.mark.skip() @@ -91,7 +90,7 @@ def test_method_update(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,18 +98,16 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: site = client.magic_transit.sites.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "string", + "lon": "string", }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +120,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -136,7 +133,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +158,7 @@ def test_method_list(self, client: Cloudflare) -> None: site = client.magic_transit.sites.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +167,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", connector_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +179,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +191,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(SyncSinglePage[Site], site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -214,7 +211,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -228,7 +225,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +239,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -270,7 +267,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -283,7 +280,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -296,7 +293,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -324,51 +321,52 @@ class TestAsyncSites: async def test_method_create(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "ha_mode": True, - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + name="site_1", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + ha_mode=True, + location={ + "lat": "string", + "lon": "string", }, + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.magic_transit.sites.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.magic_transit.sites.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="site_1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteCreateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -378,6 +376,7 @@ async def test_path_params_create(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.with_raw_response.create( account_id="", + name="site_1", ) @pytest.mark.skip() @@ -387,7 +386,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,18 +394,16 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare site = await async_client.magic_transit.sites.update( "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", - site={ - "connector_id": "ac60d3d0435248289d446cedd870bcf4", - "description": "string", - "location": { - "lat": "string", - "lon": "string", - }, - "name": "site_1", - "secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "string", + "lon": "string", }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", ) - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -419,7 +416,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +429,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteUpdateResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -457,7 +454,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -466,7 +463,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", connector_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -478,7 +475,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) @pytest.mark.skip() @parametrize @@ -490,7 +487,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteListResponse, site, path=["response"]) + assert_matches_type(AsyncSinglePage[Site], site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -510,7 +507,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -524,7 +521,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -538,7 +535,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteDeleteResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True @@ -566,7 +563,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -579,7 +576,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) @pytest.mark.skip() @parametrize @@ -592,7 +589,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" site = await response.parse() - assert_matches_type(SiteGetResponse, site, path=["response"]) + assert_matches_type(Site, site, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_ips.py b/tests/api_resources/test_ips.py index b1aeb0d230a..6d5ecbb730f 100644 --- a/tests/api_resources/test_ips.py +++ b/tests/api_resources/test_ips.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -21,7 +21,7 @@ class TestIPs: @parametrize def test_method_list(self, client: Cloudflare) -> None: ip = client.ips.list() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -29,7 +29,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: ip = client.ips.list( networks="string", ) - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,7 +61,7 @@ class TestAsyncIPs: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: ip = await async_client.ips.list() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +69,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) ip = await async_client.ips.list( networks="string", ) - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -79,7 +79,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = await response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) @pytest.mark.skip() @parametrize @@ -89,6 +89,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip = await response.parse() - assert_matches_type(IPListResponse, ip, path=["response"]) + assert_matches_type(Optional[IPListResponse], ip, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/routes/test_ips.py b/tests/api_resources/zero_trust/networks/routes/test_ips.py index a7017c04eb0..855684c7b80 100644 --- a/tests/api_resources/zero_trust/networks/routes/test_ips.py +++ b/tests/api_resources/zero_trust/networks/routes/test_ips.py @@ -32,7 +32,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: ip = client.zero_trust.networks.routes.ips.get( "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Teamnet, ip, path=["response"]) @@ -98,7 +98,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - ip = await async_client.zero_trust.networks.routes.ips.get( "10.1.0.137", account_id="699d98642c564d2e855e9661899b7252", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Teamnet, ip, path=["response"]) diff --git a/tests/api_resources/zero_trust/networks/routes/test_networks.py b/tests/api_resources/zero_trust/networks/routes/test_networks.py index b441734789b..954d3bfed6f 100644 --- a/tests/api_resources/zero_trust/networks/routes/test_networks.py +++ b/tests/api_resources/zero_trust/networks/routes/test_networks.py @@ -33,7 +33,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, network, path=["response"]) @@ -216,7 +216,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "172.16.0.0%2F16", account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, network, path=["response"]) diff --git a/tests/api_resources/zero_trust/networks/test_routes.py b/tests/api_resources/zero_trust/networks/test_routes.py index 851dd4ec855..c788dc68199 100644 --- a/tests/api_resources/zero_trust/networks/test_routes.py +++ b/tests/api_resources/zero_trust/networks/test_routes.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.zero_trust.networks import ( Route, @@ -26,7 +27,7 @@ class TestRoutes: def test_method_create(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert_matches_type(Route, route, path=["response"]) @@ -35,9 +36,9 @@ def test_method_create(self, client: Cloudflare) -> None: def test_method_create_with_all_params(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, route, path=["response"]) @@ -46,7 +47,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.networks.routes.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert response.is_closed is True @@ -59,7 +60,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.networks.routes.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -75,7 +76,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.networks.routes.with_raw_response.create( account_id="", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) @pytest.mark.skip() @@ -92,16 +93,16 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: route = client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - existed_at={}, - is_deleted={}, - network_subset={}, - network_superset={}, + existed_at=parse_datetime("2019-10-12T07:20:50.52Z"), + is_deleted=True, + network_subset="172.16.0.0/16", + network_superset="172.16.0.0/16", page=1, per_page=1, route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", tun_types="cfd_tunnel,warp_connector", - tunnel_id={}, - virtual_network_id={}, + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(SyncV4PagePaginationArray[Teamnet], route, path=["response"]) @@ -208,9 +209,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", network="172.16.0.0/16", - tun_type="cfd_tunnel", - tunnel_id={}, - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, route, path=["response"]) @@ -266,7 +265,7 @@ class TestAsyncRoutes: async def test_method_create(self, async_client: AsyncCloudflare) -> None: route = await async_client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert_matches_type(Route, route, path=["response"]) @@ -275,9 +274,9 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: route = await async_client.zero_trust.networks.routes.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", comment="Example comment for this route.", - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, route, path=["response"]) @@ -286,7 +285,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.networks.routes.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) assert response.is_closed is True @@ -299,7 +298,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.networks.routes.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -315,7 +314,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.networks.routes.with_raw_response.create( account_id="", - ip_network="172.16.0.0/16", + network="172.16.0.0/16", ) @pytest.mark.skip() @@ -332,16 +331,16 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) route = await async_client.zero_trust.networks.routes.list( account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", - existed_at={}, - is_deleted={}, - network_subset={}, - network_superset={}, + existed_at=parse_datetime("2019-10-12T07:20:50.52Z"), + is_deleted=True, + network_subset="172.16.0.0/16", + network_superset="172.16.0.0/16", page=1, per_page=1, route_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", tun_types="cfd_tunnel,warp_connector", - tunnel_id={}, - virtual_network_id={}, + tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(AsyncV4PagePaginationArray[Teamnet], route, path=["response"]) @@ -448,9 +447,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) account_id="699d98642c564d2e855e9661899b7252", comment="Example comment for this route.", network="172.16.0.0/16", - tun_type="cfd_tunnel", - tunnel_id={}, - virtual_network_id={}, + virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Route, route, path=["response"]) diff --git a/tests/api_resources/zero_trust/networks/test_virtual_networks.py b/tests/api_resources/zero_trust/networks/test_virtual_networks.py index c785cf1fb63..823898d7d15 100644 --- a/tests/api_resources/zero_trust/networks/test_virtual_networks.py +++ b/tests/api_resources/zero_trust/networks/test_virtual_networks.py @@ -93,11 +93,10 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: virtual_network = client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", - is_default={}, - is_deleted={}, + id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + is_default=True, + is_deleted=True, name="us-east-1-vpc", - vnet_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - vnet_name="us-east-1-vpc", ) assert_matches_type(SyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) @@ -330,11 +329,10 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: virtual_network = await async_client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", - is_default={}, - is_deleted={}, + id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", + is_default=True, + is_deleted=True, name="us-east-1-vpc", - vnet_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - vnet_name="us-east-1-vpc", ) assert_matches_type(AsyncSinglePage[VirtualNetwork], virtual_network, path=["response"]) diff --git a/tests/api_resources/zero_trust/test_tunnels.py b/tests/api_resources/zero_trust/test_tunnels.py index 57a9292c8fc..c5198ec7d4c 100644 --- a/tests/api_resources/zero_trust/test_tunnels.py +++ b/tests/api_resources/zero_trust/test_tunnels.py @@ -31,7 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None: tunnel = client.zero_trust.tunnels.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @@ -41,7 +41,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert response.is_closed is True @@ -55,7 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -72,7 +72,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.zero_trust.tunnels.with_raw_response.create( account_id="", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) @pytest.mark.skip() @@ -318,7 +318,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: tunnel = await async_client.zero_trust.tunnels.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @@ -328,7 +328,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.with_raw_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) assert response.is_closed is True @@ -342,7 +342,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.tunnels.with_streaming_response.create( account_id="699d98642c564d2e855e9661899b7252", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,7 +359,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.tunnels.with_raw_response.create( account_id="", name="blog", - tunnel_secret={}, + tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) @pytest.mark.skip() diff --git a/tests/api_resources/zero_trust/tunnels/test_configurations.py b/tests/api_resources/zero_trust/tunnels/test_configurations.py index 3b66ce60c1d..13e89aa70ac 100644 --- a/tests/api_resources/zero_trust/tunnels/test_configurations.py +++ b/tests/api_resources/zero_trust/tunnels/test_configurations.py @@ -25,7 +25,7 @@ class TestConfigurations: def test_method_update(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) @@ -34,7 +34,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", config={ "ingress": [ { @@ -143,7 +143,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.configurations.with_raw_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -156,7 +156,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.configurations.with_streaming_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,7 +178,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): client.zero_trust.tunnels.configurations.with_raw_response.update( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @pytest.mark.skip() @@ -186,7 +186,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: configuration = client.zero_trust.tunnels.configurations.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) @@ -195,7 +195,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.tunnels.configurations.with_raw_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -208,7 +208,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.tunnels.configurations.with_streaming_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,7 +230,7 @@ def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): client.zero_trust.tunnels.configurations.with_raw_response.get( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @@ -242,7 +242,7 @@ class TestAsyncConfigurations: async def test_method_update(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) @@ -251,7 +251,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", config={ "ingress": [ { @@ -360,7 +360,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.configurations.with_raw_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -373,7 +373,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.tunnels.configurations.with_streaming_response.update( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -395,7 +395,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): await async_client.zero_trust.tunnels.configurations.with_raw_response.update( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) @pytest.mark.skip() @@ -403,7 +403,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: configuration = await async_client.zero_trust.tunnels.configurations.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(ConfigurationGetResponse, configuration, path=["response"]) @@ -412,7 +412,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.tunnels.configurations.with_raw_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -425,7 +425,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.tunnels.configurations.with_streaming_response.get( "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -447,5 +447,5 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): await async_client.zero_trust.tunnels.configurations.with_raw_response.get( "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", )