diff --git a/.stats.yml b/.stats.yml index cf68beefb0d..c1b84218a52 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1343 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-af1ecaabf305033e1f88b63fa9ff708149d2e8f79c0050c0e046d010c668038c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f5082157bb70165b34f3a552faa44b9693adacaa9613d4b887b251cd744d076f.yml diff --git a/api.md b/api.md index 8caf9c9dae6..1ecb3510f5f 100644 --- a/api.md +++ b/api.md @@ -233,6 +233,7 @@ Types: ```python from cloudflare.types.user import ( CIDRList, + Policy, Token, TokenCreateResponse, TokenUpdateResponse, diff --git a/src/cloudflare/resources/user/tokens/tokens.py b/src/cloudflare/resources/user/tokens/tokens.py index 4b3f1a41c26..877a4388e81 100644 --- a/src/cloudflare/resources/user/tokens/tokens.py +++ b/src/cloudflare/resources/user/tokens/tokens.py @@ -44,6 +44,7 @@ PermissionGroupsResourceWithStreamingResponse, AsyncPermissionGroupsResourceWithStreamingResponse, ) +from ....types.user.policy_param import PolicyParam from ....types.user.token_create_response import TokenCreateResponse from ....types.user.token_delete_response import TokenDeleteResponse from ....types.user.token_verify_response import TokenVerifyResponse @@ -72,7 +73,7 @@ def create( self, *, name: str, - policies: Iterable[token_create_params.Policy], + policies: Iterable[PolicyParam], condition: token_create_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, not_before: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -131,7 +132,7 @@ def update( token_id: object, *, name: str, - policies: Iterable[token_update_params.Policy], + policies: Iterable[PolicyParam], status: Literal["active", "disabled", "expired"], condition: token_update_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -355,7 +356,7 @@ async def create( self, *, name: str, - policies: Iterable[token_create_params.Policy], + policies: Iterable[PolicyParam], condition: token_create_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, not_before: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -414,7 +415,7 @@ async def update( token_id: object, *, name: str, - policies: Iterable[token_update_params.Policy], + policies: Iterable[PolicyParam], status: Literal["active", "disabled", "expired"], condition: token_update_params.Condition | NotGiven = NOT_GIVEN, expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py index 5b1b8c37ba1..fa5f8dd0d13 100644 --- a/src/cloudflare/types/user/__init__.py +++ b/src/cloudflare/types/user/__init__.py @@ -6,6 +6,7 @@ from .cidr_list import CIDRList as CIDRList from .rate_plan import RatePlan as RatePlan from .organization import Organization as Organization +from .policy_param import PolicyParam as PolicyParam from .subscription import Subscription as Subscription from .rate_plan_param import RatePlanParam as RatePlanParam from .user_edit_params import UserEditParams as UserEditParams diff --git a/src/cloudflare/types/user/policy_param.py b/src/cloudflare/types/user/policy_param.py new file mode 100644 index 00000000000..f6b62435dfe --- /dev/null +++ b/src/cloudflare/types/user/policy_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PolicyParam", "PermissionGroup"] + + +class PermissionGroup(TypedDict, total=False): + meta: object + """Attributes associated to the permission group.""" + + +class PolicyParam(TypedDict, total=False): + effect: Required[Literal["allow", "deny"]] + """Allow or deny operations against the resources.""" + + permission_groups: Required[Iterable[PermissionGroup]] + """A set of permission groups that are specified to the policy.""" + + resources: Required[object] + """A list of resource names that the policy applies to.""" diff --git a/src/cloudflare/types/user/token_create_params.py b/src/cloudflare/types/user/token_create_params.py index b10b10f24ca..4ab228c06c6 100644 --- a/src/cloudflare/types/user/token_create_params.py +++ b/src/cloudflare/types/user/token_create_params.py @@ -4,19 +4,20 @@ from typing import List, Union, Iterable from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo from .cidr_list import CIDRList +from .policy_param import PolicyParam -__all__ = ["TokenCreateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"] +__all__ = ["TokenCreateParams", "Condition", "ConditionRequestIP"] class TokenCreateParams(TypedDict, total=False): name: Required[str] """Token name.""" - policies: Required[Iterable[Policy]] + policies: Required[Iterable[PolicyParam]] """List of access policies assigned to the token.""" condition: Condition @@ -31,22 +32,6 @@ class TokenCreateParams(TypedDict, total=False): """The time before which the token MUST NOT be accepted for processing.""" -class PolicyPermissionGroup(TypedDict, total=False): - meta: object - """Attributes associated to the permission group.""" - - -class Policy(TypedDict, total=False): - effect: Required[Literal["allow", "deny"]] - """Allow or deny operations against the resources.""" - - permission_groups: Required[Iterable[PolicyPermissionGroup]] - """A set of permission groups that are specified to the policy.""" - - resources: Required[object] - """A list of resource names that the policy applies to.""" - - _ConditionRequestIPReservedKeywords = TypedDict( "_ConditionRequestIPReservedKeywords", { diff --git a/src/cloudflare/types/user/token_update_params.py b/src/cloudflare/types/user/token_update_params.py index 7cd89a8938a..d564213465b 100644 --- a/src/cloudflare/types/user/token_update_params.py +++ b/src/cloudflare/types/user/token_update_params.py @@ -8,15 +8,16 @@ from ..._utils import PropertyInfo from .cidr_list import CIDRList +from .policy_param import PolicyParam -__all__ = ["TokenUpdateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"] +__all__ = ["TokenUpdateParams", "Condition", "ConditionRequestIP"] class TokenUpdateParams(TypedDict, total=False): name: Required[str] """Token name.""" - policies: Required[Iterable[Policy]] + policies: Required[Iterable[PolicyParam]] """List of access policies assigned to the token.""" status: Required[Literal["active", "disabled", "expired"]] @@ -34,22 +35,6 @@ class TokenUpdateParams(TypedDict, total=False): """The time before which the token MUST NOT be accepted for processing.""" -class PolicyPermissionGroup(TypedDict, total=False): - meta: object - """Attributes associated to the permission group.""" - - -class Policy(TypedDict, total=False): - effect: Required[Literal["allow", "deny"]] - """Allow or deny operations against the resources.""" - - permission_groups: Required[Iterable[PolicyPermissionGroup]] - """A set of permission groups that are specified to the policy.""" - - resources: Required[object] - """A list of resource names that the policy applies to.""" - - _ConditionRequestIPReservedKeywords = TypedDict( "_ConditionRequestIPReservedKeywords", {