Skip to content

Commit 3c18fd3

Browse files
feat: docs(zero_trust_gateway_policy): add /rules/tenants endpoint to Gateway API docs
* docs(zero_trust_gateway_policy): add /rules/tenants endpoint to Gateway API docs
1 parent 9fd6645 commit 3c18fd3

4 files changed

Lines changed: 161 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1814
1+
configured_endpoints: 1815
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cceecd20dfd89884f795e75b433848994bed610b79802c65104f0c70d3ada54e.yml
33
openapi_spec_hash: c33c0e26e48c004c1781a36748d0144c
4-
config_hash: eab23d0b8fa818f1d1dc0e9e18de4266
4+
config_hash: e3e634649e3d70e58e153b878d29e446

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6849,6 +6849,7 @@ Methods:
68496849
- <code title="get /accounts/{account_id}/gateway/rules">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_rule.py">SyncSinglePage[GatewayRule]</a></code>
68506850
- <code title="delete /accounts/{account_id}/gateway/rules/{rule_id}">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">delete</a>(rule_id, \*, account_id) -> object</code>
68516851
- <code title="get /accounts/{account_id}/gateway/rules/{rule_id}">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">get</a>(rule_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_rule.py">Optional[GatewayRule]</a></code>
6852+
- <code title="get /accounts/{account_id}/gateway/rules/tenant">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">list_tenant</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_rule.py">SyncSinglePage[GatewayRule]</a></code>
68526853
- <code title="post /accounts/{account_id}/gateway/rules/{rule_id}/reset_expiration">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">reset_expiration</a>(rule_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_rule.py">Optional[GatewayRule]</a></code>
68536854

68546855
### Certificates

src/cloudflare/resources/zero_trust/gateway/rules.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,41 @@ def get(
432432
cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]),
433433
)
434434

435+
def list_tenant(
436+
self,
437+
*,
438+
account_id: str,
439+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
440+
# The extra values given here take precedence over values defined on the client or passed to this method.
441+
extra_headers: Headers | None = None,
442+
extra_query: Query | None = None,
443+
extra_body: Body | None = None,
444+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
445+
) -> SyncSinglePage[GatewayRule]:
446+
"""
447+
List Zero Trust Gateway rules for the parent account of an account in the MSP
448+
configuration.
449+
450+
Args:
451+
extra_headers: Send extra headers
452+
453+
extra_query: Add additional query parameters to the request
454+
455+
extra_body: Add additional JSON properties to the request
456+
457+
timeout: Override the client-level default timeout for this request, in seconds
458+
"""
459+
if not account_id:
460+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
461+
return self._get_api_list(
462+
f"/accounts/{account_id}/gateway/rules/tenant",
463+
page=SyncSinglePage[GatewayRule],
464+
options=make_request_options(
465+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
466+
),
467+
model=GatewayRule,
468+
)
469+
435470
def reset_expiration(
436471
self,
437472
rule_id: str,
@@ -880,6 +915,41 @@ async def get(
880915
cast_to=cast(Type[Optional[GatewayRule]], ResultWrapper[GatewayRule]),
881916
)
882917

918+
def list_tenant(
919+
self,
920+
*,
921+
account_id: str,
922+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
923+
# The extra values given here take precedence over values defined on the client or passed to this method.
924+
extra_headers: Headers | None = None,
925+
extra_query: Query | None = None,
926+
extra_body: Body | None = None,
927+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
928+
) -> AsyncPaginator[GatewayRule, AsyncSinglePage[GatewayRule]]:
929+
"""
930+
List Zero Trust Gateway rules for the parent account of an account in the MSP
931+
configuration.
932+
933+
Args:
934+
extra_headers: Send extra headers
935+
936+
extra_query: Add additional query parameters to the request
937+
938+
extra_body: Add additional JSON properties to the request
939+
940+
timeout: Override the client-level default timeout for this request, in seconds
941+
"""
942+
if not account_id:
943+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
944+
return self._get_api_list(
945+
f"/accounts/{account_id}/gateway/rules/tenant",
946+
page=AsyncSinglePage[GatewayRule],
947+
options=make_request_options(
948+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
949+
),
950+
model=GatewayRule,
951+
)
952+
883953
async def reset_expiration(
884954
self,
885955
rule_id: str,
@@ -944,6 +1014,9 @@ def __init__(self, rules: RulesResource) -> None:
9441014
self.get = to_raw_response_wrapper(
9451015
rules.get,
9461016
)
1017+
self.list_tenant = to_raw_response_wrapper(
1018+
rules.list_tenant,
1019+
)
9471020
self.reset_expiration = to_raw_response_wrapper(
9481021
rules.reset_expiration,
9491022
)
@@ -968,6 +1041,9 @@ def __init__(self, rules: AsyncRulesResource) -> None:
9681041
self.get = async_to_raw_response_wrapper(
9691042
rules.get,
9701043
)
1044+
self.list_tenant = async_to_raw_response_wrapper(
1045+
rules.list_tenant,
1046+
)
9711047
self.reset_expiration = async_to_raw_response_wrapper(
9721048
rules.reset_expiration,
9731049
)
@@ -992,6 +1068,9 @@ def __init__(self, rules: RulesResource) -> None:
9921068
self.get = to_streamed_response_wrapper(
9931069
rules.get,
9941070
)
1071+
self.list_tenant = to_streamed_response_wrapper(
1072+
rules.list_tenant,
1073+
)
9951074
self.reset_expiration = to_streamed_response_wrapper(
9961075
rules.reset_expiration,
9971076
)
@@ -1016,6 +1095,9 @@ def __init__(self, rules: AsyncRulesResource) -> None:
10161095
self.get = async_to_streamed_response_wrapper(
10171096
rules.get,
10181097
)
1098+
self.list_tenant = async_to_streamed_response_wrapper(
1099+
rules.list_tenant,
1100+
)
10191101
self.reset_expiration = async_to_streamed_response_wrapper(
10201102
rules.reset_expiration,
10211103
)

tests/api_resources/zero_trust/gateway/test_rules.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,44 @@ def test_path_params_get(self, client: Cloudflare) -> None:
490490
account_id="699d98642c564d2e855e9661899b7252",
491491
)
492492

493+
@parametrize
494+
def test_method_list_tenant(self, client: Cloudflare) -> None:
495+
rule = client.zero_trust.gateway.rules.list_tenant(
496+
account_id="699d98642c564d2e855e9661899b7252",
497+
)
498+
assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"])
499+
500+
@parametrize
501+
def test_raw_response_list_tenant(self, client: Cloudflare) -> None:
502+
response = client.zero_trust.gateway.rules.with_raw_response.list_tenant(
503+
account_id="699d98642c564d2e855e9661899b7252",
504+
)
505+
506+
assert response.is_closed is True
507+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
508+
rule = response.parse()
509+
assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"])
510+
511+
@parametrize
512+
def test_streaming_response_list_tenant(self, client: Cloudflare) -> None:
513+
with client.zero_trust.gateway.rules.with_streaming_response.list_tenant(
514+
account_id="699d98642c564d2e855e9661899b7252",
515+
) as response:
516+
assert not response.is_closed
517+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
518+
519+
rule = response.parse()
520+
assert_matches_type(SyncSinglePage[GatewayRule], rule, path=["response"])
521+
522+
assert cast(Any, response.is_closed) is True
523+
524+
@parametrize
525+
def test_path_params_list_tenant(self, client: Cloudflare) -> None:
526+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
527+
client.zero_trust.gateway.rules.with_raw_response.list_tenant(
528+
account_id="",
529+
)
530+
493531
@parametrize
494532
def test_method_reset_expiration(self, client: Cloudflare) -> None:
495533
rule = client.zero_trust.gateway.rules.reset_expiration(
@@ -1013,6 +1051,44 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
10131051
account_id="699d98642c564d2e855e9661899b7252",
10141052
)
10151053

1054+
@parametrize
1055+
async def test_method_list_tenant(self, async_client: AsyncCloudflare) -> None:
1056+
rule = await async_client.zero_trust.gateway.rules.list_tenant(
1057+
account_id="699d98642c564d2e855e9661899b7252",
1058+
)
1059+
assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"])
1060+
1061+
@parametrize
1062+
async def test_raw_response_list_tenant(self, async_client: AsyncCloudflare) -> None:
1063+
response = await async_client.zero_trust.gateway.rules.with_raw_response.list_tenant(
1064+
account_id="699d98642c564d2e855e9661899b7252",
1065+
)
1066+
1067+
assert response.is_closed is True
1068+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1069+
rule = await response.parse()
1070+
assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"])
1071+
1072+
@parametrize
1073+
async def test_streaming_response_list_tenant(self, async_client: AsyncCloudflare) -> None:
1074+
async with async_client.zero_trust.gateway.rules.with_streaming_response.list_tenant(
1075+
account_id="699d98642c564d2e855e9661899b7252",
1076+
) as response:
1077+
assert not response.is_closed
1078+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1079+
1080+
rule = await response.parse()
1081+
assert_matches_type(AsyncSinglePage[GatewayRule], rule, path=["response"])
1082+
1083+
assert cast(Any, response.is_closed) is True
1084+
1085+
@parametrize
1086+
async def test_path_params_list_tenant(self, async_client: AsyncCloudflare) -> None:
1087+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
1088+
await async_client.zero_trust.gateway.rules.with_raw_response.list_tenant(
1089+
account_id="",
1090+
)
1091+
10161092
@parametrize
10171093
async def test_method_reset_expiration(self, async_client: AsyncCloudflare) -> None:
10181094
rule = await async_client.zero_trust.gateway.rules.reset_expiration(

0 commit comments

Comments
 (0)