Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #1182

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1256
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cb76af21f6fcf485b7e41586c3076cd45d25d6d04971c77ec814523b894dcb97.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f86dcdd3b76e16dc467b91bfa22be2423bd847e93a59d892004b29812777d217.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def create(
ip_network_encoded: str,
*,
account_id: str,
tunnel_id: str,
comment: 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.
Expand All @@ -61,6 +62,8 @@ def create(

ip_network_encoded: IP/CIDR range in URL-encoded format

tunnel_id: UUID of the tunnel.

comment: Optional remark describing the route.

virtual_network_id: UUID of the virtual network.
Expand All @@ -81,6 +84,7 @@ def create(
f"/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}",
body=maybe_transform(
{
"tunnel_id": tunnel_id,
"comment": comment,
"virtual_network_id": virtual_network_id,
},
Expand Down Expand Up @@ -225,6 +229,7 @@ async def create(
ip_network_encoded: str,
*,
account_id: str,
tunnel_id: str,
comment: 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.
Expand All @@ -244,6 +249,8 @@ async def create(

ip_network_encoded: IP/CIDR range in URL-encoded format

tunnel_id: UUID of the tunnel.

comment: Optional remark describing the route.

virtual_network_id: UUID of the virtual network.
Expand All @@ -264,6 +271,7 @@ async def create(
f"/accounts/{account_id}/teamnet/routes/network/{ip_network_encoded}",
body=await async_maybe_transform(
{
"tunnel_id": tunnel_id,
"comment": comment,
"virtual_network_id": virtual_network_id,
},
Expand Down
16 changes: 16 additions & 0 deletions src/cloudflare/resources/zero_trust/networks/routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def create(
*,
account_id: str,
network: str,
tunnel_id: str,
comment: 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.
Expand All @@ -85,6 +86,8 @@ def create(

network: The private IPv4 or IPv6 range connected by the route, in CIDR notation.

tunnel_id: UUID of the tunnel.

comment: Optional remark describing the route.

virtual_network_id: UUID of the virtual network.
Expand All @@ -104,6 +107,7 @@ def create(
body=maybe_transform(
{
"network": network,
"tunnel_id": tunnel_id,
"comment": comment,
"virtual_network_id": virtual_network_id,
},
Expand Down Expand Up @@ -260,6 +264,7 @@ def edit(
account_id: str,
comment: str | NotGiven = NOT_GIVEN,
network: str | 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.
Expand All @@ -282,6 +287,8 @@ def edit(

network: The private IPv4 or IPv6 range connected by the route, in CIDR notation.

tunnel_id: UUID of the tunnel.

virtual_network_id: UUID of the virtual network.

extra_headers: Send extra headers
Expand All @@ -302,6 +309,7 @@ def edit(
{
"comment": comment,
"network": network,
"tunnel_id": tunnel_id,
"virtual_network_id": virtual_network_id,
},
route_edit_params.RouteEditParams,
Expand Down Expand Up @@ -339,6 +347,7 @@ async def create(
*,
account_id: str,
network: str,
tunnel_id: str,
comment: 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.
Expand All @@ -356,6 +365,8 @@ async def create(

network: The private IPv4 or IPv6 range connected by the route, in CIDR notation.

tunnel_id: UUID of the tunnel.

comment: Optional remark describing the route.

virtual_network_id: UUID of the virtual network.
Expand All @@ -375,6 +386,7 @@ async def create(
body=await async_maybe_transform(
{
"network": network,
"tunnel_id": tunnel_id,
"comment": comment,
"virtual_network_id": virtual_network_id,
},
Expand Down Expand Up @@ -531,6 +543,7 @@ async def edit(
account_id: str,
comment: str | NotGiven = NOT_GIVEN,
network: str | 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.
Expand All @@ -553,6 +566,8 @@ async def edit(

network: The private IPv4 or IPv6 range connected by the route, in CIDR notation.

tunnel_id: UUID of the tunnel.

virtual_network_id: UUID of the virtual network.

extra_headers: Send extra headers
Expand All @@ -573,6 +588,7 @@ async def edit(
{
"comment": comment,
"network": network,
"tunnel_id": tunnel_id,
"virtual_network_id": virtual_network_id,
},
route_edit_params.RouteEditParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class PrioritizeUpdateParams(TypedDict, total=False):


class Certificate(TypedDict, total=False):
id: str
"""Identifier"""

priority: float
"""The order/priority in which the certificate will be used in a request.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class RouteCreateParams(TypedDict, total=False):
network: Required[str]
"""The private IPv4 or IPv6 range connected by the route, in CIDR notation."""

tunnel_id: Required[str]
"""UUID of the tunnel."""

comment: str
"""Optional remark describing the route."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ class RouteEditParams(TypedDict, total=False):
network: str
"""The private IPv4 or IPv6 range connected by the route, in CIDR notation."""

tunnel_id: str
"""UUID of the tunnel."""

virtual_network_id: str
"""UUID of the virtual network."""
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class NetworkCreateParams(TypedDict, total=False):
account_id: Required[str]
"""Cloudflare account ID"""

tunnel_id: Required[str]
"""UUID of the tunnel."""

comment: str
"""Optional remark describing the route."""

Expand Down
12 changes: 12 additions & 0 deletions tests/api_resources/zero_trust/networks/routes/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_method_create(self, client: Cloudflare) -> None:
network = client.zero_trust.networks.routes.networks.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, network, path=["response"])

Expand All @@ -30,6 +31,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
network = client.zero_trust.networks.routes.networks.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
comment="Example comment for this route.",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
Expand All @@ -40,6 +42,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
response = client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

assert response.is_closed is True
Expand All @@ -52,6 +55,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
with client.zero_trust.networks.routes.networks.with_streaming_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -67,12 +71,14 @@ def test_path_params_create(self, client: Cloudflare) -> None:
client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_network_encoded` but received ''"):
client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

@parametrize
Expand Down Expand Up @@ -191,6 +197,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
network = await async_client.zero_trust.networks.routes.networks.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, network, path=["response"])

Expand All @@ -199,6 +206,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
network = await async_client.zero_trust.networks.routes.networks.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
comment="Example comment for this route.",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
Expand All @@ -209,6 +217,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
response = await async_client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

assert response.is_closed is True
Expand All @@ -221,6 +230,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
async with async_client.zero_trust.networks.routes.networks.with_streaming_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -236,12 +246,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
await async_client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="172.16.0.0%2F16",
account_id="",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

with pytest.raises(ValueError, match=r"Expected a non-empty value for `ip_network_encoded` but received ''"):
await async_client.zero_trust.networks.routes.networks.with_raw_response.create(
ip_network_encoded="",
account_id="699d98642c564d2e855e9661899b7252",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

@parametrize
Expand Down
12 changes: 12 additions & 0 deletions tests/api_resources/zero_trust/networks/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None:
route = client.zero_trust.networks.routes.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, route, path=["response"])

Expand All @@ -35,6 +36,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
route = client.zero_trust.networks.routes.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
comment="Example comment for this route.",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
Expand All @@ -45,6 +47,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
response = client.zero_trust.networks.routes.with_raw_response.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

assert response.is_closed is True
Expand All @@ -57,6 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
with client.zero_trust.networks.routes.with_streaming_response.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -72,6 +76,7 @@ def test_path_params_create(self, client: Cloudflare) -> None:
client.zero_trust.networks.routes.with_raw_response.create(
account_id="",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

@parametrize
Expand Down Expand Up @@ -193,6 +198,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",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, route, path=["response"])
Expand Down Expand Up @@ -246,6 +252,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
route = await async_client.zero_trust.networks.routes.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, route, path=["response"])

Expand All @@ -254,6 +261,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
route = await async_client.zero_trust.networks.routes.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
comment="Example comment for this route.",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
Expand All @@ -264,6 +272,7 @@ 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",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

assert response.is_closed is True
Expand All @@ -276,6 +285,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
async with async_client.zero_trust.networks.routes.with_streaming_response.create(
account_id="699d98642c564d2e855e9661899b7252",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -291,6 +301,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
await async_client.zero_trust.networks.routes.with_raw_response.create(
account_id="",
network="172.16.0.0/16",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)

@parametrize
Expand Down Expand Up @@ -412,6 +423,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",
tunnel_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
virtual_network_id="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415",
)
assert_matches_type(Route, route, path=["response"])
Expand Down