diff --git a/.stats.yml b/.stats.yml index 3935f1d496b..73afec50e30 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1411 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9310ae6fd17ecb7b743b6d9e34cd838d0a626af0f2a786c07c9d17085b7893ed.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d6dd7ea434d79d52578f28ebdc5ddd1fbf9e68526bf0e32285f1c3725ccacb4d.yml diff --git a/src/cloudflare/types/zero_trust/access_rule.py b/src/cloudflare/types/zero_trust/access_rule.py index 0b38dc8b6df..ead404b9196 100644 --- a/src/cloudflare/types/zero_trust/access_rule.py +++ b/src/cloudflare/types/zero_trust/access_rule.py @@ -4,6 +4,7 @@ from typing_extensions import TypeAlias from .ip_rule import IPRule +from ..._models import BaseModel from .email_rule import EmailRule from .group_rule import GroupRule from .domain_rule import DomainRule @@ -23,26 +24,59 @@ from .authentication_method_rule import AuthenticationMethodRule from .any_valid_service_token_rule import AnyValidServiceTokenRule -__all__ = ["AccessRule"] +__all__ = [ + "AccessRule", + "AccessAuthContextRule", + "AccessAuthContextRuleAuthContext", + "AccessCommonNameRule", + "AccessCommonNameRuleCommonName", +] + + +class AccessAuthContextRuleAuthContext(BaseModel): + id: str + """The ID of an Authentication context.""" + + ac_id: str + """The ACID of an Authentication context.""" + + identity_provider_id: str + """The ID of your Azure identity provider.""" + + +class AccessAuthContextRule(BaseModel): + auth_context: AccessAuthContextRuleAuthContext + + +class AccessCommonNameRuleCommonName(BaseModel): + common_name: str + """The common name to match.""" + + +class AccessCommonNameRule(BaseModel): + common_name: AccessCommonNameRuleCommonName + AccessRule: TypeAlias = Union[ - EmailRule, - EmailListRule, - DomainRule, - EveryoneRule, - IPRule, - IPListRule, - CertificateRule, GroupRule, + AnyValidServiceTokenRule, + AccessAuthContextRule, + AuthenticationMethodRule, AzureGroupRule, + CertificateRule, + AccessCommonNameRule, + CountryRule, + AccessDevicePostureRule, + DomainRule, + EmailListRule, + EmailRule, + EveryoneRule, + ExternalEvaluationRule, GitHubOrganizationRule, GSuiteGroupRule, + IPListRule, + IPRule, OktaGroupRule, SAMLGroupRule, ServiceTokenRule, - AnyValidServiceTokenRule, - ExternalEvaluationRule, - CountryRule, - AuthenticationMethodRule, - AccessDevicePostureRule, ] diff --git a/src/cloudflare/types/zero_trust/access_rule_param.py b/src/cloudflare/types/zero_trust/access_rule_param.py index 25817353326..7de72ff8ced 100644 --- a/src/cloudflare/types/zero_trust/access_rule_param.py +++ b/src/cloudflare/types/zero_trust/access_rule_param.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Union -from typing_extensions import TypeAlias +from typing_extensions import Required, TypeAlias, TypedDict from .ip_rule_param import IPRuleParam from .email_rule_param import EmailRuleParam @@ -25,26 +25,59 @@ from .authentication_method_rule_param import AuthenticationMethodRuleParam from .any_valid_service_token_rule_param import AnyValidServiceTokenRuleParam -__all__ = ["AccessRuleParam"] +__all__ = [ + "AccessRuleParam", + "AccessAuthContextRule", + "AccessAuthContextRuleAuthContext", + "AccessCommonNameRule", + "AccessCommonNameRuleCommonName", +] + + +class AccessAuthContextRuleAuthContext(TypedDict, total=False): + id: Required[str] + """The ID of an Authentication context.""" + + ac_id: Required[str] + """The ACID of an Authentication context.""" + + identity_provider_id: Required[str] + """The ID of your Azure identity provider.""" + + +class AccessAuthContextRule(TypedDict, total=False): + auth_context: Required[AccessAuthContextRuleAuthContext] + + +class AccessCommonNameRuleCommonName(TypedDict, total=False): + common_name: Required[str] + """The common name to match.""" + + +class AccessCommonNameRule(TypedDict, total=False): + common_name: Required[AccessCommonNameRuleCommonName] + AccessRuleParam: TypeAlias = Union[ - EmailRuleParam, - EmailListRuleParam, - DomainRuleParam, - EveryoneRuleParam, - IPRuleParam, - IPListRuleParam, - CertificateRuleParam, GroupRuleParam, + AnyValidServiceTokenRuleParam, + AccessAuthContextRule, + AuthenticationMethodRuleParam, AzureGroupRuleParam, + CertificateRuleParam, + AccessCommonNameRule, + CountryRuleParam, + AccessDevicePostureRuleParam, + DomainRuleParam, + EmailListRuleParam, + EmailRuleParam, + EveryoneRuleParam, + ExternalEvaluationRuleParam, GitHubOrganizationRuleParam, GSuiteGroupRuleParam, + IPListRuleParam, + IPRuleParam, OktaGroupRuleParam, SAMLGroupRuleParam, ServiceTokenRuleParam, - AnyValidServiceTokenRuleParam, - ExternalEvaluationRuleParam, - CountryRuleParam, - AuthenticationMethodRuleParam, - AccessDevicePostureRuleParam, ] diff --git a/src/cloudflare/types/zero_trust/github_organization_rule.py b/src/cloudflare/types/zero_trust/github_organization_rule.py index 21feb612790..1f46348cf2b 100644 --- a/src/cloudflare/types/zero_trust/github_organization_rule.py +++ b/src/cloudflare/types/zero_trust/github_organization_rule.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from pydantic import Field as FieldInfo @@ -15,6 +16,9 @@ class GitHubOrganization(BaseModel): name: str """The name of the organization.""" + team: Optional[str] = None + """The name of the team""" + class GitHubOrganizationRule(BaseModel): github_organization: GitHubOrganization = FieldInfo(alias="github-organization") diff --git a/src/cloudflare/types/zero_trust/github_organization_rule_param.py b/src/cloudflare/types/zero_trust/github_organization_rule_param.py index 762f638c6d2..6825165605c 100644 --- a/src/cloudflare/types/zero_trust/github_organization_rule_param.py +++ b/src/cloudflare/types/zero_trust/github_organization_rule_param.py @@ -16,6 +16,9 @@ class GitHubOrganization(TypedDict, total=False): name: Required[str] """The name of the organization.""" + team: str + """The name of the team""" + class GitHubOrganizationRuleParam(TypedDict, total=False): github_organization: Required[Annotated[GitHubOrganization, PropertyInfo(alias="github-organization")]] diff --git a/tests/api_resources/zero_trust/access/applications/test_policy_tests.py b/tests/api_resources/zero_trust/access/applications/test_policy_tests.py index 5cf0468a9f5..34cb5ec96f1 100755 --- a/tests/api_resources/zero_trust/access/applications/test_policy_tests.py +++ b/tests/api_resources/zero_trust/access/applications/test_policy_tests.py @@ -33,10 +33,10 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", - exclude=[{"email": {"email": "test@example.com"}}], - include=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(PolicyTestCreateResponse, policy_test, path=["response"]) @@ -136,10 +136,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", - exclude=[{"email": {"email": "test@example.com"}}], - include=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(PolicyTestCreateResponse, policy_test, path=["response"]) diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py index 9059d337f84..4ca45e92de6 100644 --- a/tests/api_resources/zero_trust/access/test_applications.py +++ b/tests/api_resources/zero_trust/access/test_applications.py @@ -984,10 +984,10 @@ def test_method_create_with_all_params_overload_9(self, client: Cloudflare) -> N policies=[ { "decision": "allow", - "include": [{"email": {"email": "test@example.com"}}], + "include": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], "name": "Allow devs", - "exclude": [{"email": {"email": "test@example.com"}}], - "require": [{"email": {"email": "test@example.com"}}], + "exclude": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + "require": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], } ], ) @@ -2131,10 +2131,10 @@ def test_method_update_with_all_params_overload_9(self, client: Cloudflare) -> N policies=[ { "decision": "allow", - "include": [{"email": {"email": "test@example.com"}}], + "include": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], "name": "Allow devs", - "exclude": [{"email": {"email": "test@example.com"}}], - "require": [{"email": {"email": "test@example.com"}}], + "exclude": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + "require": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], } ], ) @@ -3453,10 +3453,10 @@ async def test_method_create_with_all_params_overload_9(self, async_client: Asyn policies=[ { "decision": "allow", - "include": [{"email": {"email": "test@example.com"}}], + "include": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], "name": "Allow devs", - "exclude": [{"email": {"email": "test@example.com"}}], - "require": [{"email": {"email": "test@example.com"}}], + "exclude": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + "require": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], } ], ) @@ -4600,10 +4600,10 @@ async def test_method_update_with_all_params_overload_9(self, async_client: Asyn policies=[ { "decision": "allow", - "include": [{"email": {"email": "test@example.com"}}], + "include": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], "name": "Allow devs", - "exclude": [{"email": {"email": "test@example.com"}}], - "require": [{"email": {"email": "test@example.com"}}], + "exclude": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + "require": [{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], } ], ) diff --git a/tests/api_resources/zero_trust/access/test_groups.py b/tests/api_resources/zero_trust/access/test_groups.py index 95425f11889..f11474c5050 100644 --- a/tests/api_resources/zero_trust/access/test_groups.py +++ b/tests/api_resources/zero_trust/access/test_groups.py @@ -25,7 +25,7 @@ class TestGroups: @parametrize def test_method_create(self, client: Cloudflare) -> None: group = client.zero_trust.access.groups.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -35,12 +35,12 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: group = client.zero_trust.access.groups.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", - exclude=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], is_default=True, - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @@ -48,7 +48,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -62,7 +62,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.access.groups.with_streaming_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) as response: @@ -79,14 +79,14 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -96,7 +96,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: group = client.zero_trust.access.groups.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -107,12 +107,12 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: group = client.zero_trust.access.groups.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", - exclude=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], is_default=True, - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @@ -121,7 +121,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -136,7 +136,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.groups.with_streaming_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) as response: @@ -154,7 +154,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.zero_trust.access.groups.with_raw_response.update( group_id="", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -162,7 +162,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="", ) @@ -170,7 +170,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -374,7 +374,7 @@ class TestAsyncGroups: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: group = await async_client.zero_trust.access.groups.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -384,12 +384,12 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: group = await async_client.zero_trust.access.groups.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", - exclude=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], is_default=True, - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @@ -397,7 +397,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -411,7 +411,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.groups.with_streaming_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) as response: @@ -428,14 +428,14 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.create( - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -445,7 +445,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: group = await async_client.zero_trust.access.groups.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -456,12 +456,12 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: group = await async_client.zero_trust.access.groups.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", - exclude=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], is_default=True, - require=[{"email": {"email": "test@example.com"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[ZeroTrustGroup], group, path=["response"]) @@ -470,7 +470,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -485,7 +485,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.groups.with_streaming_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) as response: @@ -503,7 +503,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.update( group_id="", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) @@ -511,7 +511,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="", ) @@ -519,7 +519,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.update( group_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", account_id="account_id", ) diff --git a/tests/api_resources/zero_trust/access/test_policies.py b/tests/api_resources/zero_trust/access/test_policies.py index 2392aeef526..fd986e438f9 100644 --- a/tests/api_resources/zero_trust/access/test_policies.py +++ b/tests/api_resources/zero_trust/access/test_policies.py @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: policy = client.zero_trust.access.policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @@ -39,10 +39,10 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: policy = client.zero_trust.access.policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - exclude=[{"email": {"email": "test@example.com"}}], - require=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @@ -51,7 +51,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.access.policies.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -65,7 +65,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.access.policies.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) as response: assert not response.is_closed @@ -82,7 +82,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.zero_trust.access.policies.with_raw_response.create( account_id="", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -92,7 +92,7 @@ def test_method_update(self, client: Cloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @@ -103,10 +103,10 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - exclude=[{"email": {"email": "test@example.com"}}], - require=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @@ -116,7 +116,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -131,7 +131,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) as response: assert not response.is_closed @@ -149,7 +149,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -158,7 +158,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: policy_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -305,7 +305,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @@ -315,10 +315,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare policy = await async_client.zero_trust.access.policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - exclude=[{"email": {"email": "test@example.com"}}], - require=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @@ -327,7 +327,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.policies.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -341,7 +341,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.zero_trust.access.policies.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) as response: assert not response.is_closed @@ -358,7 +358,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.access.policies.with_raw_response.create( account_id="", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -368,7 +368,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @@ -379,10 +379,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", - exclude=[{"email": {"email": "test@example.com"}}], - require=[{"email": {"email": "test@example.com"}}], + exclude=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], + require=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], ) assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @@ -392,7 +392,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -407,7 +407,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) as response: assert not response.is_closed @@ -425,7 +425,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", ) @@ -434,7 +434,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: policy_id="", account_id="023e105f4ecef8ad9ca31a8372d0c353", decision="allow", - include=[{"email": {"email": "test@example.com"}}], + include=[{"group": {"id": "aa0a4aab-672b-4bdb-bc33-a59f1130a11f"}}], name="Allow devs", )