diff --git a/api.md b/api.md index f4cb8fc108a..0b7174c7b49 100644 --- a/api.md +++ b/api.md @@ -3687,6 +3687,7 @@ Types: ```python from cloudflare.types.intel.attack_surface_report import ( IssueClass, + IssueType, Product, SeverityQueryParam, Subject, @@ -5404,16 +5405,24 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import Connection, Tunnel, TunnelListResponse, TunnelEditResponse +from cloudflare.types.zero_trust import ( + Connection, + Tunnel, + TunnelCreateResponse, + TunnelListResponse, + TunnelDeleteResponse, + TunnelEditResponse, + TunnelGetResponse, +) ``` Methods: -- client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> Tunnel +- client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> TunnelCreateResponse - client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelListResponse] -- client.zero_trust.tunnels.delete(tunnel_id, \*, account_id, \*\*params) -> Tunnel +- client.zero_trust.tunnels.delete(tunnel_id, \*, account_id, \*\*params) -> TunnelDeleteResponse - client.zero_trust.tunnels.edit(tunnel_id, \*, account_id, \*\*params) -> TunnelEditResponse -- client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> Tunnel +- client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> TunnelGetResponse ### Configurations diff --git a/src/cloudflare/resources/intel/attack_surface_report/issues.py b/src/cloudflare/resources/intel/attack_surface_report/issues.py index 08732afbdce..972383702c5 100644 --- a/src/cloudflare/resources/intel/attack_surface_report/issues.py +++ b/src/cloudflare/resources/intel/attack_surface_report/issues.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Any, List, Type, cast -from typing_extensions import Literal import httpx @@ -27,6 +26,7 @@ make_request_options, ) from ....types.intel.attack_surface_report import ( + IssueType, ProductParam, SubjectParam, IssueClassParam, @@ -62,26 +62,8 @@ def list( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, @@ -154,26 +136,8 @@ def class_( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, @@ -287,26 +251,8 @@ def severity( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, @@ -371,26 +317,8 @@ def type( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, @@ -465,26 +393,8 @@ def list( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, @@ -557,26 +467,8 @@ async def class_( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, @@ -690,26 +582,8 @@ async def severity( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, @@ -774,26 +648,8 @@ async def type( dismissed: bool | NotGiven = NOT_GIVEN, issue_class: IssueClassParam | NotGiven = NOT_GIVEN, issue_class_neq: IssueClassParam | NotGiven = NOT_GIVEN, - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, - issue_type_neq: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - | NotGiven = NOT_GIVEN, + issue_type: List[IssueType] | NotGiven = NOT_GIVEN, + issue_type_neq: List[IssueType] | NotGiven = NOT_GIVEN, product: ProductParam | NotGiven = NOT_GIVEN, product_neq: ProductParam | NotGiven = NOT_GIVEN, severity: List[SeverityQueryParam] | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py index 1797bf9d824..85e05561e42 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py +++ b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py @@ -67,9 +67,11 @@ make_request_options, ) from ....types.zero_trust import ( - Tunnel, + TunnelGetResponse, TunnelEditResponse, TunnelListResponse, + TunnelCreateResponse, + TunnelDeleteResponse, tunnel_edit_params, tunnel_list_params, tunnel_create_params, @@ -120,7 +122,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelCreateResponse: """ Creates a new Argo Tunnel in an account. @@ -158,7 +160,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelCreateResponse], ResultWrapper[TunnelCreateResponse]), ) def list( @@ -255,7 +257,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelDeleteResponse: """ Deletes an Argo Tunnel from an account. @@ -286,7 +288,7 @@ def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelDeleteResponse], ResultWrapper[TunnelDeleteResponse]), ) def edit( @@ -363,7 +365,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelGetResponse: """ Fetches a single Argo Tunnel. @@ -393,7 +395,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelGetResponse], ResultWrapper[TunnelGetResponse]), ) @@ -438,7 +440,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelCreateResponse: """ Creates a new Argo Tunnel in an account. @@ -476,7 +478,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelCreateResponse], ResultWrapper[TunnelCreateResponse]), ) def list( @@ -573,7 +575,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelDeleteResponse: """ Deletes an Argo Tunnel from an account. @@ -604,7 +606,7 @@ async def delete( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelDeleteResponse], ResultWrapper[TunnelDeleteResponse]), ) async def edit( @@ -681,7 +683,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Tunnel: + ) -> TunnelGetResponse: """ Fetches a single Argo Tunnel. @@ -711,7 +713,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Tunnel], ResultWrapper[Tunnel]), + cast_to=cast(Type[TunnelGetResponse], ResultWrapper[TunnelGetResponse]), ) diff --git a/src/cloudflare/types/intel/attack_surface_report/__init__.py b/src/cloudflare/types/intel/attack_surface_report/__init__.py index 2e6d50dc5c7..65bb5364128 100644 --- a/src/cloudflare/types/intel/attack_surface_report/__init__.py +++ b/src/cloudflare/types/intel/attack_surface_report/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .issue_type import IssueType as IssueType from .product_param import ProductParam as ProductParam from .subject_param import SubjectParam as SubjectParam from .issue_class_param import IssueClassParam as IssueClassParam diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py index 93d5c4a8312..dba6dbee763 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_class_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType from .product_param import ProductParam from .subject_param import SubjectParam from .issue_class_param import IssueClassParam @@ -24,28 +25,9 @@ class IssueClassParams(TypedDict, total=False): issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type: List[IssueType] + + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] product: ProductParam diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py index 11c87f5d89e..8a29f8fb941 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_list_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType from .product_param import ProductParam from .subject_param import SubjectParam from .issue_class_param import IssueClassParam @@ -24,28 +25,9 @@ class IssueListParams(TypedDict, total=False): issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type: List[IssueType] + + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] page: int """Current page within paginated list of results""" diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py index fadee1e71c1..7eab3a44454 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType from .product_param import ProductParam from .subject_param import SubjectParam from .issue_class_param import IssueClassParam @@ -24,28 +25,9 @@ class IssueSeverityParams(TypedDict, total=False): issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type: List[IssueType] + + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] product: ProductParam diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_type.py b/src/cloudflare/types/intel/attack_surface_report/issue_type.py new file mode 100644 index 00000000000..72d55104624 --- /dev/null +++ b/src/cloudflare/types/intel/attack_surface_report/issue_type.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["IssueType"] + +IssueType = Literal[ + "compliance_violation", "email_security", "exposed_infrastructure", "insecure_configuration", "weak_authentication" +] diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py b/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py index 03671c107ef..6f7e7d888d7 100644 --- a/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py +++ b/src/cloudflare/types/intel/attack_surface_report/issue_type_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import List -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo +from .issue_type import IssueType from .product_param import ProductParam from .subject_param import SubjectParam from .issue_class_param import IssueClassParam @@ -24,28 +25,9 @@ class IssueTypeParams(TypedDict, total=False): issue_class_neq: Annotated[IssueClassParam, PropertyInfo(alias="issue_class~neq")] - issue_type: List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ] - - issue_type_neq: Annotated[ - List[ - Literal[ - "compliance_violation", - "email_security", - "exposed_infrastructure", - "insecure_configuration", - "weak_authentication", - ] - ], - PropertyInfo(alias="issue_type~neq"), - ] + issue_type: List[IssueType] + + issue_type_neq: Annotated[List[IssueType], PropertyInfo(alias="issue_type~neq")] product: ProductParam diff --git a/src/cloudflare/types/warp_connector_create_response.py b/src/cloudflare/types/warp_connector_create_response.py index 41358493acb..6af0fd7e768 100644 --- a/src/cloudflare/types/warp_connector_create_response.py +++ b/src/cloudflare/types/warp_connector_create_response.py @@ -5,65 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import Connection +from .zero_trust import Tunnel, Connection -__all__ = ["WARPConnectorCreateResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["WARPConnectorCreateResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +60,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnectorCreateResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorCreateResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector_delete_response.py index 586aa9cd45b..fa3ab386da8 100644 --- a/src/cloudflare/types/warp_connector_delete_response.py +++ b/src/cloudflare/types/warp_connector_delete_response.py @@ -5,65 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import Connection +from .zero_trust import Tunnel, Connection -__all__ = ["WARPConnectorDeleteResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["WARPConnectorDeleteResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +60,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnectorDeleteResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorDeleteResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector_edit_response.py index 73539b4b093..cd29bec5094 100644 --- a/src/cloudflare/types/warp_connector_edit_response.py +++ b/src/cloudflare/types/warp_connector_edit_response.py @@ -5,65 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import Connection +from .zero_trust import Tunnel, Connection -__all__ = ["WARPConnectorEditResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["WARPConnectorEditResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +60,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnectorEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorEditResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_get_response.py b/src/cloudflare/types/warp_connector_get_response.py index 2bd57b79a44..a8da274c312 100644 --- a/src/cloudflare/types/warp_connector_get_response.py +++ b/src/cloudflare/types/warp_connector_get_response.py @@ -5,65 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import Connection +from .zero_trust import Tunnel, Connection -__all__ = ["WARPConnectorGetResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["WARPConnectorGetResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +60,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnectorGetResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorGetResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_list_response.py b/src/cloudflare/types/warp_connector_list_response.py index 5b8753eb03c..54cd870205e 100644 --- a/src/cloudflare/types/warp_connector_list_response.py +++ b/src/cloudflare/types/warp_connector_list_response.py @@ -5,65 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import Connection +from .zero_trust import Tunnel, Connection -__all__ = ["WARPConnectorListResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["WARPConnectorListResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +60,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnectorListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorListResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index 19bcaf6ee16..3efb80f492b 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -44,6 +44,7 @@ from .tunnel_list_params import TunnelListParams as TunnelListParams from .device_get_response import DeviceGetResponse as DeviceGetResponse from .everyone_rule_param import EveryoneRuleParam as EveryoneRuleParam +from .tunnel_get_response import TunnelGetResponse as TunnelGetResponse from .generic_oauth_config import GenericOAuthConfig as GenericOAuthConfig from .tunnel_create_params import TunnelCreateParams as TunnelCreateParams from .tunnel_delete_params import TunnelDeleteParams as TunnelDeleteParams @@ -56,6 +57,8 @@ from .azure_group_rule_param import AzureGroupRuleParam as AzureGroupRuleParam from .certificate_rule_param import CertificateRuleParam as CertificateRuleParam from .identity_provider_type import IdentityProviderType as IdentityProviderType +from .tunnel_create_response import TunnelCreateResponse as TunnelCreateResponse +from .tunnel_delete_response import TunnelDeleteResponse as TunnelDeleteResponse from .gateway_create_response import GatewayCreateResponse as GatewayCreateResponse from .gsuite_group_rule_param import GSuiteGroupRuleParam as GSuiteGroupRuleParam from .external_evaluation_rule import ExternalEvaluationRule as ExternalEvaluationRule diff --git a/src/cloudflare/types/zero_trust/tunnel.py b/src/cloudflare/types/zero_trust/tunnel.py index 3293d3e5eab..349d5e1d3c6 100644 --- a/src/cloudflare/types/zero_trust/tunnel.py +++ b/src/cloudflare/types/zero_trust/tunnel.py @@ -1,44 +1,66 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel +from .connection import Connection -__all__ = ["Tunnel", "Connection"] +__all__ = ["Tunnel"] -class Connection(BaseModel): - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" +class Tunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" - is_pending_reconnect: Optional[bool] = None + connections: Optional[Connection] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. """ - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" -class Tunnel(BaseModel): - id: str - """UUID of the tunnel.""" + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. - connections: List[Connection] - """The tunnel connections between your origin and Cloudflare's edge.""" + If `null`, the tunnel has not been deleted. + """ - created_at: datetime - """Timestamp of when the tunnel was created.""" + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" - name: str + name: Optional[str] = None """A user-friendly name for the tunnel.""" - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - If `null`, the tunnel has not been deleted. + If `false`, the tunnel must be configured locally on the origin machine. """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" diff --git a/src/cloudflare/types/zero_trust/tunnel_create_response.py b/src/cloudflare/types/zero_trust/tunnel_create_response.py new file mode 100644 index 00000000000..c3534bf5635 --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_create_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["TunnelCreateResponse", "Connection"] + + +class Connection(BaseModel): + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelCreateResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the tunnel was created.""" + + name: str + """A user-friendly name for the tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel 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 new file mode 100644 index 00000000000..cb4d1611d6e --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_delete_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["TunnelDeleteResponse", "Connection"] + + +class Connection(BaseModel): + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelDeleteResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the tunnel was created.""" + + name: str + """A user-friendly name for the tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py index 025abb9aeac..4caa7a0e6cf 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py @@ -4,66 +4,11 @@ from datetime import datetime from typing_extensions import Literal +from .tunnel import Tunnel from ..._models import BaseModel from .connection import Connection -__all__ = ["TunnelEditResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["TunnelEditResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +61,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -TunnelEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +TunnelEditResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/tunnel_get_response.py b/src/cloudflare/types/zero_trust/tunnel_get_response.py new file mode 100644 index 00000000000..f7abe1db802 --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_get_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["TunnelGetResponse", "Connection"] + + +class Connection(BaseModel): + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelGetResponse(BaseModel): + id: str + """UUID of the tunnel.""" + + connections: List[Connection] + """The tunnel connections between your origin and Cloudflare's edge.""" + + created_at: datetime + """Timestamp of when the tunnel was created.""" + + name: str + """A user-friendly name for the tunnel.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel 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 a1f0a11c707..d1bc02ff669 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py @@ -4,66 +4,11 @@ from datetime import datetime from typing_extensions import Literal +from .tunnel import Tunnel from ..._models import BaseModel from .connection import Connection -__all__ = ["TunnelListResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] - - -class TunnelCfdTunnel(BaseModel): - id: Optional[str] = None - """UUID of the tunnel.""" - - account_tag: Optional[str] = None - """Cloudflare account ID""" - - connections: Optional[Connection] = None - """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - - conns_active_at: Optional[datetime] = None - """ - Timestamp of when the tunnel established at least one connection to Cloudflare's - edge. If `null`, the tunnel is inactive. - """ - - conns_inactive_at: Optional[datetime] = None - """ - Timestamp of when the tunnel became inactive (no connections to Cloudflare's - edge). If `null`, the tunnel is active. - """ - - created_at: Optional[datetime] = None - """Timestamp of when the tunnel was created.""" - - deleted_at: Optional[datetime] = None - """Timestamp of when the tunnel was deleted. - - If `null`, the tunnel has not been deleted. - """ - - metadata: Optional[object] = None - """Metadata associated with the tunnel.""" - - name: Optional[str] = None - """A user-friendly name for the tunnel.""" - - remote_config: Optional[bool] = None - """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. - - If `false`, the tunnel must be configured locally on the origin machine. - """ - - status: Optional[str] = None - """The status of the tunnel. - - Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is - active and able to serve traffic but in an unhealthy state), `healthy` (tunnel - is active and able to serve traffic), or `down` (tunnel can not serve traffic as - it has no connections to the Cloudflare Edge). - """ - - tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None - """The type of tunnel.""" +__all__ = ["TunnelListResponse", "TunnelWARPConnectorTunnel"] class TunnelWARPConnectorTunnel(BaseModel): @@ -116,4 +61,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -TunnelListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +TunnelListResponse = Union[Tunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/tunnel_param.py b/src/cloudflare/types/zero_trust/tunnel_param.py index bca3336c2c2..6af384596d6 100644 --- a/src/cloudflare/types/zero_trust/tunnel_param.py +++ b/src/cloudflare/types/zero_trust/tunnel_param.py @@ -2,40 +2,64 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Union from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from ..._utils import PropertyInfo +from .connection import Connection -__all__ = ["TunnelParam", "Connection"] +__all__ = ["TunnelParam"] -class Connection(TypedDict, total=False): - colo_name: str - """The Cloudflare data center used for this connection.""" +class TunnelParam(TypedDict, total=False): + account_tag: str + """Cloudflare account ID""" + + connections: Connection + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" - is_pending_reconnect: bool + conns_active_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. """ + conns_inactive_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ -class TunnelParam(TypedDict, total=False): - connections: Required[Iterable[Connection]] - """The tunnel connections between your origin and Cloudflare's edge.""" - - created_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """Timestamp of when the tunnel was created.""" - name: Required[str] - """A user-friendly name for the tunnel.""" - deleted_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been deleted. """ + + metadata: object + """Metadata associated with the tunnel.""" + + name: str + """A user-friendly name for the tunnel.""" + + remote_config: bool + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: str + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"] + """The type of tunnel.""" diff --git a/tests/api_resources/zero_trust/test_tunnels.py b/tests/api_resources/zero_trust/test_tunnels.py index c0afd309b36..57a9292c8fc 100644 --- a/tests/api_resources/zero_trust/test_tunnels.py +++ b/tests/api_resources/zero_trust/test_tunnels.py @@ -12,9 +12,11 @@ from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.zero_trust import ( - Tunnel, + TunnelGetResponse, TunnelEditResponse, TunnelListResponse, + TunnelCreateResponse, + TunnelDeleteResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -31,7 +33,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="blog", tunnel_secret={}, ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +47,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" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -142,7 +144,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +158,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" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +172,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -261,7 +263,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -274,7 +276,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" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -287,7 +289,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -318,7 +320,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="blog", tunnel_secret={}, ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -332,7 +334,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" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -346,7 +348,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelCreateResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -429,7 +431,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +445,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" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +459,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelDeleteResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -548,7 +550,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -561,7 +563,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" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -574,7 +576,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(Tunnel, tunnel, path=["response"]) + assert_matches_type(TunnelGetResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True