From bb958239243ec5bed89615884104cba1df4543e6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:46:47 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1184) --- .stats.yml | 2 +- api.md | 2 +- .../resources/zero_trust/gateway/locations.py | 49 ++++++- .../types/zero_trust/gateway/__init__.py | 2 - .../types/zero_trust/gateway/location.py | 122 +++++++++++++++++- .../gateway/location_create_params.py | 26 +++- .../zero_trust/gateway/location_network.py | 12 -- .../gateway/location_network_param.py | 12 -- .../gateway/location_update_params.py | 26 +++- .../zero_trust/gateway/test_locations.py | 4 + 10 files changed, 210 insertions(+), 47 deletions(-) delete mode 100644 src/cloudflare/types/zero_trust/gateway/location_network.py delete mode 100644 src/cloudflare/types/zero_trust/gateway/location_network_param.py diff --git a/.stats.yml b/.stats.yml index 8a797e552c6..60b6da89c5d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1256 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ba6989e092ceb9b2700a5005e1b79d3de9fb5a8abf6d73406bece08a7662171c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-376cc25a50d22c4ac996448cf4e073f8b1065424b312a46422d1eb663491e28a.yml diff --git a/api.md b/api.md index f55013739bb..9418685f613 100644 --- a/api.md +++ b/api.md @@ -5496,7 +5496,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.gateway import Location, LocationNetwork, LocationDeleteResponse +from cloudflare.types.zero_trust.gateway import Location, LocationDeleteResponse ``` Methods: diff --git a/src/cloudflare/resources/zero_trust/gateway/locations.py b/src/cloudflare/resources/zero_trust/gateway/locations.py index 806538130b4..dfbdc58aa72 100644 --- a/src/cloudflare/resources/zero_trust/gateway/locations.py +++ b/src/cloudflare/resources/zero_trust/gateway/locations.py @@ -24,7 +24,6 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.zero_trust.gateway import location_create_params, location_update_params from ....types.zero_trust.gateway.location import Location -from ....types.zero_trust.gateway.location_network_param import LocationNetworkParam from ....types.zero_trust.gateway.location_delete_response import LocationDeleteResponse __all__ = ["LocationsResource", "AsyncLocationsResource"] @@ -45,8 +44,9 @@ def create( account_id: str, name: str, client_default: bool | NotGiven = NOT_GIVEN, + dns_destination_ips_id: str | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[LocationNetworkParam] | NotGiven = NOT_GIVEN, + networks: Iterable[location_create_params.Network] | 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, @@ -62,9 +62,17 @@ def create( client_default: True if the location is the default location. + dns_destination_ips_id: The identifier of the pair of IPv4 addresses assigned to this location. When + creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + ecs_support: True if the location needs to resolve EDNS queries. networks: A list of network ranges that requests from this location would originate from. + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. extra_headers: Send extra headers @@ -82,6 +90,7 @@ def create( { "name": name, "client_default": client_default, + "dns_destination_ips_id": dns_destination_ips_id, "ecs_support": ecs_support, "networks": networks, }, @@ -104,8 +113,9 @@ def update( account_id: str, name: str, client_default: bool | NotGiven = NOT_GIVEN, + dns_destination_ips_id: str | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[LocationNetworkParam] | NotGiven = NOT_GIVEN, + networks: Iterable[location_update_params.Network] | 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, @@ -121,9 +131,17 @@ def update( client_default: True if the location is the default location. + dns_destination_ips_id: The identifier of the pair of IPv4 addresses assigned to this location. When + creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + ecs_support: True if the location needs to resolve EDNS queries. networks: A list of network ranges that requests from this location would originate from. + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. extra_headers: Send extra headers @@ -143,6 +161,7 @@ def update( { "name": name, "client_default": client_default, + "dns_destination_ips_id": dns_destination_ips_id, "ecs_support": ecs_support, "networks": networks, }, @@ -293,8 +312,9 @@ async def create( account_id: str, name: str, client_default: bool | NotGiven = NOT_GIVEN, + dns_destination_ips_id: str | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[LocationNetworkParam] | NotGiven = NOT_GIVEN, + networks: Iterable[location_create_params.Network] | 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, @@ -310,9 +330,17 @@ async def create( client_default: True if the location is the default location. + dns_destination_ips_id: The identifier of the pair of IPv4 addresses assigned to this location. When + creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + ecs_support: True if the location needs to resolve EDNS queries. networks: A list of network ranges that requests from this location would originate from. + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. extra_headers: Send extra headers @@ -330,6 +358,7 @@ async def create( { "name": name, "client_default": client_default, + "dns_destination_ips_id": dns_destination_ips_id, "ecs_support": ecs_support, "networks": networks, }, @@ -352,8 +381,9 @@ async def update( account_id: str, name: str, client_default: bool | NotGiven = NOT_GIVEN, + dns_destination_ips_id: str | NotGiven = NOT_GIVEN, ecs_support: bool | NotGiven = NOT_GIVEN, - networks: Iterable[LocationNetworkParam] | NotGiven = NOT_GIVEN, + networks: Iterable[location_update_params.Network] | 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,9 +399,17 @@ async def update( client_default: True if the location is the default location. + dns_destination_ips_id: The identifier of the pair of IPv4 addresses assigned to this location. When + creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + ecs_support: True if the location needs to resolve EDNS queries. networks: A list of network ranges that requests from this location would originate from. + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. extra_headers: Send extra headers @@ -391,6 +429,7 @@ async def update( { "name": name, "client_default": client_default, + "dns_destination_ips_id": dns_destination_ips_id, "ecs_support": ecs_support, "networks": networks, }, diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index e0f7ea5cf69..e9187691b1f 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -20,7 +20,6 @@ from .gateway_settings import GatewaySettings as GatewaySettings from .list_edit_params import ListEditParams as ListEditParams from .list_list_params import ListListParams as ListListParams -from .location_network import LocationNetwork as LocationNetwork from .gateway_item_param import GatewayItemParam as GatewayItemParam from .list_create_params import ListCreateParams as ListCreateParams from .list_update_params import ListUpdateParams as ListUpdateParams @@ -40,7 +39,6 @@ from .notification_settings import NotificationSettings as NotificationSettings from .body_scanning_settings import BodyScanningSettings as BodyScanningSettings from .location_create_params import LocationCreateParams as LocationCreateParams -from .location_network_param import LocationNetworkParam as LocationNetworkParam from .location_update_params import LocationUpdateParams as LocationUpdateParams from .extended_email_matching import ExtendedEmailMatching as ExtendedEmailMatching from .certificate_get_response import CertificateGetResponse as CertificateGetResponse diff --git a/src/cloudflare/types/zero_trust/gateway/location.py b/src/cloudflare/types/zero_trust/gateway/location.py index cf69688dc8b..4b76f631fc4 100644 --- a/src/cloudflare/types/zero_trust/gateway/location.py +++ b/src/cloudflare/types/zero_trust/gateway/location.py @@ -4,9 +4,97 @@ from datetime import datetime from ...._models import BaseModel -from .location_network import LocationNetwork -__all__ = ["Location"] +__all__ = [ + "Location", + "Endpoints", + "EndpointsDoh", + "EndpointsDohNetwork", + "EndpointsDot", + "EndpointsDotNetwork", + "EndpointsIPV4", + "EndpointsIPV6", + "EndpointsIPV6Network", + "Network", +] + + +class EndpointsDohNetwork(BaseModel): + network: str + """The IP address or IP CIDR.""" + + +class EndpointsDoh(BaseModel): + enabled: Optional[bool] = None + """True if the endpoint is enabled for this location.""" + + networks: Optional[List[EndpointsDohNetwork]] = None + """A list of allowed source IP network ranges for this endpoint. + + When empty, all source IPs are allowed. A non-empty list is only effective if + the endpoint is enabled for this location. + """ + + require_token: Optional[bool] = None + """ + True if the endpoint requires + [user identity](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/agentless/dns/dns-over-https/#filter-doh-requests-by-user) + authentication. + """ + + +class EndpointsDotNetwork(BaseModel): + network: str + """The IP address or IP CIDR.""" + + +class EndpointsDot(BaseModel): + enabled: Optional[bool] = None + """True if the endpoint is enabled for this location.""" + + networks: Optional[List[EndpointsDotNetwork]] = None + """A list of allowed source IP network ranges for this endpoint. + + When empty, all source IPs are allowed. A non-empty list is only effective if + the endpoint is enabled for this location. + """ + + +class EndpointsIPV4(BaseModel): + enabled: Optional[bool] = None + """True if the endpoint is enabled for this location.""" + + +class EndpointsIPV6Network(BaseModel): + network: str + """The IPv6 address or IPv6 CIDR.""" + + +class EndpointsIPV6(BaseModel): + enabled: Optional[bool] = None + """True if the endpoint is enabled for this location.""" + + networks: Optional[List[EndpointsIPV6Network]] = None + """A list of allowed source IPv6 network ranges for this endpoint. + + When empty, all source IPs are allowed. A non-empty list is only effective if + the endpoint is enabled for this location. + """ + + +class Endpoints(BaseModel): + doh: Optional[EndpointsDoh] = None + + dot: Optional[EndpointsDot] = None + + ipv4: Optional[EndpointsIPV4] = None + + ipv6: Optional[EndpointsIPV6] = None + + +class Network(BaseModel): + network: str + """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" class Location(BaseModel): @@ -17,6 +105,9 @@ class Location(BaseModel): created_at: Optional[datetime] = None + dns_destination_ips_id: Optional[str] = None + """The identifier of the pair of IPv4 addresses assigned to this location.""" + doh_subdomain: Optional[str] = None """The DNS over HTTPS domain to send DNS requests to. @@ -26,6 +117,13 @@ class Location(BaseModel): ecs_support: Optional[bool] = None """True if the location needs to resolve EDNS queries.""" + endpoints: Optional[Endpoints] = None + """The destination endpoints configured for this location. + + When updating a location, if this field is absent or set with null, the + endpoints configuration remains unchanged. + """ + ip: Optional[str] = None """IPV6 destination ip assigned to this location. @@ -33,10 +131,26 @@ class Location(BaseModel): This field is auto-generated by Gateway. """ + ipv4_destination: Optional[str] = None + """ + The primary destination IPv4 address from the pair identified by the + dns_destination_ips_id. This field is read-only. + """ + + ipv4_destination_backup: Optional[str] = None + """ + The backup destination IPv4 address from the pair identified by the + dns_destination_ips_id. This field is read-only. + """ + name: Optional[str] = None """The name of the location.""" - networks: Optional[List[LocationNetwork]] = None - """A list of network ranges that requests from this location would originate from.""" + networks: Optional[List[Network]] = None + """A list of network ranges that requests from this location would originate from. + + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. + """ updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/gateway/location_create_params.py b/src/cloudflare/types/zero_trust/gateway/location_create_params.py index 183da6b0292..4fe3e12d541 100644 --- a/src/cloudflare/types/zero_trust/gateway/location_create_params.py +++ b/src/cloudflare/types/zero_trust/gateway/location_create_params.py @@ -5,9 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .location_network_param import LocationNetworkParam - -__all__ = ["LocationCreateParams"] +__all__ = ["LocationCreateParams", "Network"] class LocationCreateParams(TypedDict, total=False): @@ -19,8 +17,26 @@ class LocationCreateParams(TypedDict, total=False): client_default: bool """True if the location is the default location.""" + dns_destination_ips_id: str + """The identifier of the pair of IPv4 addresses assigned to this location. + + When creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + """ + ecs_support: bool """True if the location needs to resolve EDNS queries.""" - networks: Iterable[LocationNetworkParam] - """A list of network ranges that requests from this location would originate from.""" + networks: Iterable[Network] + """A list of network ranges that requests from this location would originate from. + + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. + """ + + +class Network(TypedDict, total=False): + network: Required[str] + """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_network.py b/src/cloudflare/types/zero_trust/gateway/location_network.py deleted file mode 100644 index 448729f3f29..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/location_network.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ...._models import BaseModel - -__all__ = ["LocationNetwork"] - - -class LocationNetwork(BaseModel): - network: str - """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_network_param.py b/src/cloudflare/types/zero_trust/gateway/location_network_param.py deleted file mode 100644 index e0328ee41ca..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/location_network_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["LocationNetworkParam"] - - -class LocationNetworkParam(TypedDict, total=False): - network: Required[str] - """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/src/cloudflare/types/zero_trust/gateway/location_update_params.py b/src/cloudflare/types/zero_trust/gateway/location_update_params.py index f563e09fa0f..5878d373749 100644 --- a/src/cloudflare/types/zero_trust/gateway/location_update_params.py +++ b/src/cloudflare/types/zero_trust/gateway/location_update_params.py @@ -5,9 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -from .location_network_param import LocationNetworkParam - -__all__ = ["LocationUpdateParams"] +__all__ = ["LocationUpdateParams", "Network"] class LocationUpdateParams(TypedDict, total=False): @@ -19,8 +17,26 @@ class LocationUpdateParams(TypedDict, total=False): client_default: bool """True if the location is the default location.""" + dns_destination_ips_id: str + """The identifier of the pair of IPv4 addresses assigned to this location. + + When creating a location, if this field is absent or set with null, the pair of + shared IPv4 addresses (0e4a32c6-6fb8-4858-9296-98f51631e8e6) is auto-assigned. + When updating a location, if the field is absent or set with null, the + pre-assigned pair remains unchanged. + """ + ecs_support: bool """True if the location needs to resolve EDNS queries.""" - networks: Iterable[LocationNetworkParam] - """A list of network ranges that requests from this location would originate from.""" + networks: Iterable[Network] + """A list of network ranges that requests from this location would originate from. + + A non-empty list is only effective if the ipv4 endpoint is enabled for this + location. + """ + + +class Network(TypedDict, total=False): + network: Required[str] + """The IPv4 address or IPv4 CIDR. IPv4 CIDRs are limited to a maximum of /24.""" diff --git a/tests/api_resources/zero_trust/gateway/test_locations.py b/tests/api_resources/zero_trust/gateway/test_locations.py index 9cc5069d7ef..7855e8d9089 100644 --- a/tests/api_resources/zero_trust/gateway/test_locations.py +++ b/tests/api_resources/zero_trust/gateway/test_locations.py @@ -35,6 +35,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", client_default=False, + dns_destination_ips_id="0e4a32c6-6fb8-4858-9296-98f51631e8e6", ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) @@ -90,6 +91,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", client_default=False, + dns_destination_ips_id="0e4a32c6-6fb8-4858-9296-98f51631e8e6", ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) @@ -291,6 +293,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", client_default=False, + dns_destination_ips_id="0e4a32c6-6fb8-4858-9296-98f51631e8e6", ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], ) @@ -346,6 +349,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id="699d98642c564d2e855e9661899b7252", name="Austin Office Location", client_default=False, + dns_destination_ips_id="0e4a32c6-6fb8-4858-9296-98f51631e8e6", ecs_support=False, networks=[{"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}, {"network": "192.0.2.1/32"}], )