diff --git a/.stats.yml b/.stats.yml index 3d58470f948..d575e787796 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1365 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8ab175377b40ec09207fa70914e51f8bec9d6030f6f628635d56f4c3321d4809.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4593529df2c582c5e4de92308af748d9f8abbca6c92fff7e99e08bd463b7271e.yml diff --git a/api.md b/api.md index e00ed6f6ed5..f11b632178e 100644 --- a/api.md +++ b/api.md @@ -10,14 +10,12 @@ from cloudflare.types import ( ErrorData, Identifier, LoadBalancerPreview, - Member, PaginationInfo, Permission, PermissionGrant, RatePlan, ResponseInfo, Result, - Role, SortDirection, Subscription, SubscriptionComponent, @@ -48,7 +46,6 @@ Types: ```python from cloudflare.types.accounts import ( Status, - UserWithInviteCode, MemberCreateResponse, MemberUpdateResponse, MemberListResponse, @@ -70,13 +67,13 @@ Methods: Types: ```python -from cloudflare.types.accounts import RoleGetResponse +from cloudflare.types.accounts import RoleListResponse, RoleGetResponse ``` Methods: -- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] -- client.accounts.roles.get(role_id, \*, account_id) -> object +- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[RoleListResponse] +- client.accounts.roles.get(role_id, \*, account_id) -> Optional ## Subscriptions @@ -198,14 +195,14 @@ Methods: Types: ```python -from cloudflare.types.user import Invite, InviteEditResponse, InviteGetResponse +from cloudflare.types.user import Invite ``` Methods: - client.user.invites.list() -> SyncSinglePage[Invite] -- client.user.invites.edit(invite_id, \*\*params) -> object -- client.user.invites.get(invite_id) -> object +- client.user.invites.edit(invite_id, \*\*params) -> Optional +- client.user.invites.get(invite_id) -> Optional ## Organizations diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index 692cb7f4e2d..4eeb2856485 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -169,7 +169,7 @@ def update( member_id: str, *, account_id: str, - roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | 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, @@ -237,7 +237,7 @@ def update( member_id: str, *, account_id: str, - roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | NotGiven = NOT_GIVEN, policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | 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. @@ -557,7 +557,7 @@ async def update( member_id: str, *, account_id: str, - roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | 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, @@ -625,7 +625,7 @@ async def update( member_id: str, *, account_id: str, - roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | NotGiven = NOT_GIVEN, policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | 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. diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index fb493700320..22520e505d0 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -18,7 +18,8 @@ from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import AsyncPaginator, make_request_options -from ...types.shared.role import Role +from ...types.accounts.role_get_response import RoleGetResponse +from ...types.accounts.role_list_response import RoleListResponse __all__ = ["RolesResource", "AsyncRolesResource"] @@ -53,7 +54,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Role]: + ) -> SyncSinglePage[RoleListResponse]: """ Get all available roles for an account. @@ -72,11 +73,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/roles", - page=SyncSinglePage[Role], + page=SyncSinglePage[RoleListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Role, + model=RoleListResponse, ) def get( @@ -90,7 +91,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[RoleGetResponse]: """ Get information about a specific role for an account. @@ -118,9 +119,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[RoleGetResponse]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[RoleGetResponse]], ResultWrapper[RoleGetResponse]), ) @@ -154,7 +155,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Role, AsyncSinglePage[Role]]: + ) -> AsyncPaginator[RoleListResponse, AsyncSinglePage[RoleListResponse]]: """ Get all available roles for an account. @@ -173,11 +174,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/roles", - page=AsyncSinglePage[Role], + page=AsyncSinglePage[RoleListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Role, + model=RoleListResponse, ) async def get( @@ -191,7 +192,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[RoleGetResponse]: """ Get information about a specific role for an account. @@ -219,9 +220,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[RoleGetResponse]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[RoleGetResponse]], ResultWrapper[RoleGetResponse]), ) diff --git a/src/cloudflare/resources/user/invites.py b/src/cloudflare/resources/user/invites.py index d24a47a78ea..cd850871727 100644 --- a/src/cloudflare/resources/user/invites.py +++ b/src/cloudflare/resources/user/invites.py @@ -80,7 +80,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[Invite]: """ Responds to an invitation. @@ -107,9 +107,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[Invite]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]), ) def get( @@ -122,7 +122,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[Invite]: """ Gets the details of an invitation. @@ -146,9 +146,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[Invite]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]), ) @@ -203,7 +203,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[Invite]: """ Responds to an invitation. @@ -230,9 +230,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[Invite]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]), ) async def get( @@ -245,7 +245,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[Invite]: """ Gets the details of an invitation. @@ -269,9 +269,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[Optional[Invite]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]), ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index a241fecb148..3b9c7703182 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -4,8 +4,6 @@ from .shared import ( ASN as ASN, - Role as Role, - Member as Member, Result as Result, AuditLog as AuditLog, RatePlan as RatePlan, diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index 6478b80da2f..f77fc1abd60 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -4,7 +4,9 @@ from .status import Status as Status from .account import Account as Account +from .role_get_response import RoleGetResponse as RoleGetResponse from .member_list_params import MemberListParams as MemberListParams +from .role_list_response import RoleListResponse as RoleListResponse from .account_list_params import AccountListParams as AccountListParams from .member_get_response import MemberGetResponse as MemberGetResponse from .member_create_params import MemberCreateParams as MemberCreateParams diff --git a/src/cloudflare/types/accounts/account.py b/src/cloudflare/types/accounts/account.py index 1c26f03b23e..e84530707c2 100644 --- a/src/cloudflare/types/accounts/account.py +++ b/src/cloudflare/types/accounts/account.py @@ -25,6 +25,9 @@ class Settings(BaseModel): See [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) for more information. + + Deprecated in favor of + [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). """ enforce_twofactor: Optional[bool] = None @@ -38,7 +41,8 @@ class Settings(BaseModel): Indicates whether new zones should use the account-level custom nameservers by default. - Deprecated in favor of `default_nameservers`. + Deprecated in favor of + [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). """ diff --git a/src/cloudflare/types/accounts/account_update_params.py b/src/cloudflare/types/accounts/account_update_params.py index 21657deb084..42542ee73e0 100644 --- a/src/cloudflare/types/accounts/account_update_params.py +++ b/src/cloudflare/types/accounts/account_update_params.py @@ -34,6 +34,9 @@ class Settings(TypedDict, total=False): See [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) for more information. + + Deprecated in favor of + [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). """ enforce_twofactor: bool @@ -47,5 +50,6 @@ class Settings(TypedDict, total=False): Indicates whether new zones should use the account-level custom nameservers by default. - Deprecated in favor of `default_nameservers`. + Deprecated in favor of + [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). """ diff --git a/src/cloudflare/types/accounts/member_create_response.py b/src/cloudflare/types/accounts/member_create_response.py index 06b3835b944..b2417c2ca3f 100644 --- a/src/cloudflare/types/accounts/member_create_response.py +++ b/src/cloudflare/types/accounts/member_create_response.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..shared.role import Role +from ..shared.permission_grant import PermissionGrant __all__ = [ "MemberCreateResponse", @@ -15,6 +15,8 @@ "PolicyResourceGroupScope", "PolicyResourceGroupScopeObject", "PolicyResourceGroupMeta", + "Role", + "RolePermissions", "User", ] @@ -89,6 +91,45 @@ class Policy(BaseModel): """A list of resource groups that the policy applies to.""" +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + class User(BaseModel): email: str """The contact email address of the user.""" diff --git a/src/cloudflare/types/accounts/member_get_response.py b/src/cloudflare/types/accounts/member_get_response.py index a1469e7cfc6..83e2665af49 100644 --- a/src/cloudflare/types/accounts/member_get_response.py +++ b/src/cloudflare/types/accounts/member_get_response.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..shared.role import Role +from ..shared.permission_grant import PermissionGrant __all__ = [ "MemberGetResponse", @@ -15,6 +15,8 @@ "PolicyResourceGroupScope", "PolicyResourceGroupScopeObject", "PolicyResourceGroupMeta", + "Role", + "RolePermissions", "User", ] @@ -89,6 +91,45 @@ class Policy(BaseModel): """A list of resource groups that the policy applies to.""" +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + class User(BaseModel): email: str """The contact email address of the user.""" diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py index 84c4f7b4220..afc8a984763 100644 --- a/src/cloudflare/types/accounts/member_list_response.py +++ b/src/cloudflare/types/accounts/member_list_response.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..shared.role import Role +from ..shared.permission_grant import PermissionGrant __all__ = [ "MemberListResponse", @@ -15,6 +15,8 @@ "PolicyResourceGroupScope", "PolicyResourceGroupScopeObject", "PolicyResourceGroupMeta", + "Role", + "RolePermissions", "User", ] @@ -89,6 +91,45 @@ class Policy(BaseModel): """A list of resource groups that the policy applies to.""" +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + class User(BaseModel): email: str """The contact email address of the user.""" diff --git a/src/cloudflare/types/accounts/member_update_params.py b/src/cloudflare/types/accounts/member_update_params.py index accd387937f..92c4624483c 100644 --- a/src/cloudflare/types/accounts/member_update_params.py +++ b/src/cloudflare/types/accounts/member_update_params.py @@ -7,8 +7,8 @@ __all__ = [ "MemberUpdateParams", - "Member", - "MemberRole", + "IAMUpdateMemberWithRoles", + "IAMUpdateMemberWithRolesRole", "IAMUpdateMemberWithPolicies", "IAMUpdateMemberWithPoliciesPolicy", "IAMUpdateMemberWithPoliciesPolicyPermissionGroup", @@ -16,15 +16,15 @@ ] -class Member(TypedDict, total=False): +class IAMUpdateMemberWithRoles(TypedDict, total=False): account_id: Required[str] """Account identifier tag.""" - roles: Iterable[MemberRole] + roles: Iterable[IAMUpdateMemberWithRolesRole] """Roles assigned to this member.""" -class MemberRole(TypedDict, total=False): +class IAMUpdateMemberWithRolesRole(TypedDict, total=False): id: Required[str] """Role identifier tag.""" @@ -58,4 +58,4 @@ class IAMUpdateMemberWithPoliciesPolicy(TypedDict, total=False): """A list of resource groups that the policy applies to.""" -MemberUpdateParams: TypeAlias = Union[Member, IAMUpdateMemberWithPolicies] +MemberUpdateParams: TypeAlias = Union[IAMUpdateMemberWithRoles, IAMUpdateMemberWithPolicies] diff --git a/src/cloudflare/types/accounts/member_update_response.py b/src/cloudflare/types/accounts/member_update_response.py index 8c1ff8c99d2..fce9bcf0ea1 100644 --- a/src/cloudflare/types/accounts/member_update_response.py +++ b/src/cloudflare/types/accounts/member_update_response.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..shared.role import Role +from ..shared.permission_grant import PermissionGrant __all__ = [ "MemberUpdateResponse", @@ -15,6 +15,8 @@ "PolicyResourceGroupScope", "PolicyResourceGroupScopeObject", "PolicyResourceGroupMeta", + "Role", + "RolePermissions", "User", ] @@ -89,6 +91,45 @@ class Policy(BaseModel): """A list of resource groups that the policy applies to.""" +class RolePermissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class Role(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: RolePermissions + + class User(BaseModel): email: str """The contact email address of the user.""" diff --git a/src/cloudflare/types/accounts/role_get_response.py b/src/cloudflare/types/accounts/role_get_response.py new file mode 100644 index 00000000000..71af9eff87a --- /dev/null +++ b/src/cloudflare/types/accounts/role_get_response.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from ..shared.permission_grant import PermissionGrant + +__all__ = ["RoleGetResponse", "Permissions"] + + +class Permissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class RoleGetResponse(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: Permissions diff --git a/src/cloudflare/types/accounts/role_list_response.py b/src/cloudflare/types/accounts/role_list_response.py new file mode 100644 index 00000000000..a33e125a638 --- /dev/null +++ b/src/cloudflare/types/accounts/role_list_response.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from ..shared.permission_grant import PermissionGrant + +__all__ = ["RoleListResponse", "Permissions"] + + +class Permissions(BaseModel): + analytics: Optional[PermissionGrant] = None + + billing: Optional[PermissionGrant] = None + + cache_purge: Optional[PermissionGrant] = None + + dns: Optional[PermissionGrant] = None + + dns_records: Optional[PermissionGrant] = None + + lb: Optional[PermissionGrant] = None + + logs: Optional[PermissionGrant] = None + + organization: Optional[PermissionGrant] = None + + ssl: Optional[PermissionGrant] = None + + waf: Optional[PermissionGrant] = None + + zone_settings: Optional[PermissionGrant] = None + + zones: Optional[PermissionGrant] = None + + +class RoleListResponse(BaseModel): + id: str + """Role identifier tag.""" + + description: str + """Description of role's permissions.""" + + name: str + """Role name.""" + + permissions: Permissions diff --git a/src/cloudflare/types/memberships/membership.py b/src/cloudflare/types/memberships/membership.py index a7fb6720539..58d3be9f330 100644 --- a/src/cloudflare/types/memberships/membership.py +++ b/src/cloudflare/types/memberships/membership.py @@ -53,7 +53,7 @@ class Membership(BaseModel): """All access permissions for the user at the account.""" roles: Optional[List[str]] = None - """List of role names for the user at the account.""" + """List of role names the membership has for this account.""" status: Optional[Literal["accepted", "pending", "rejected"]] = None """Status of this membership.""" diff --git a/src/cloudflare/types/memberships/membership_get_response.py b/src/cloudflare/types/memberships/membership_get_response.py index 0ef830152b5..524eaa1ead9 100644 --- a/src/cloudflare/types/memberships/membership_get_response.py +++ b/src/cloudflare/types/memberships/membership_get_response.py @@ -136,7 +136,7 @@ class MembershipGetResponse(BaseModel): """Access policy for the membership""" roles: Optional[List[str]] = None - """List of role names for the user at the account.""" + """List of role names the membership has for this account.""" status: Optional[Literal["accepted", "pending", "rejected"]] = None """Status of this membership.""" diff --git a/src/cloudflare/types/memberships/membership_update_response.py b/src/cloudflare/types/memberships/membership_update_response.py index 196ccc5a781..7f6b238103c 100644 --- a/src/cloudflare/types/memberships/membership_update_response.py +++ b/src/cloudflare/types/memberships/membership_update_response.py @@ -136,7 +136,7 @@ class MembershipUpdateResponse(BaseModel): """Access policy for the membership""" roles: Optional[List[str]] = None - """List of role names for the user at the account.""" + """List of role names the membership has for this account.""" status: Optional[Literal["accepted", "pending", "rejected"]] = None """Status of this membership.""" diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py index 6610a90e94f..ed081cf82aa 100644 --- a/src/cloudflare/types/shared/__init__.py +++ b/src/cloudflare/types/shared/__init__.py @@ -1,8 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .asn import ASN as ASN -from .role import Role as Role -from .member import Member as Member from .result import Result as Result from .audit_log import AuditLog as AuditLog from .rate_plan import RatePlan as RatePlan diff --git a/src/cloudflare/types/shared/member.py b/src/cloudflare/types/shared/member.py deleted file mode 100644 index c4282582d50..00000000000 --- a/src/cloudflare/types/shared/member.py +++ /dev/null @@ -1,82 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .permission_grant import PermissionGrant - -__all__ = ["Member", "Role", "RolePermissions", "User"] - - -class RolePermissions(BaseModel): - analytics: Optional[PermissionGrant] = None - - billing: Optional[PermissionGrant] = None - - cache_purge: Optional[PermissionGrant] = None - - dns: Optional[PermissionGrant] = None - - dns_records: Optional[PermissionGrant] = None - - lb: Optional[PermissionGrant] = None - - logs: Optional[PermissionGrant] = None - - organization: Optional[PermissionGrant] = None - - ssl: Optional[PermissionGrant] = None - - waf: Optional[PermissionGrant] = None - - zone_settings: Optional[PermissionGrant] = None - - zones: Optional[PermissionGrant] = None - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role name.""" - - permissions: RolePermissions - - -class User(BaseModel): - email: str - """The contact email address of the user.""" - - id: Optional[str] = None - """Identifier""" - - first_name: Optional[str] = None - """User's first name""" - - last_name: Optional[str] = None - """User's last name""" - - two_factor_authentication_enabled: Optional[bool] = None - """Indicates whether two-factor authentication is enabled for the user account. - - Does not apply to API authentication. - """ - - -class Member(BaseModel): - id: Optional[str] = None - """Membership identifier tag.""" - - roles: Optional[List[Role]] = None - """Roles assigned to this member.""" - - status: Optional[Literal["accepted", "pending"]] = None - """A member's status in the account.""" - - user: Optional[User] = None - """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/shared/role.py b/src/cloudflare/types/shared/role.py deleted file mode 100644 index 8bfd1f8f6ae..00000000000 --- a/src/cloudflare/types/shared/role.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .permission import Permission - -__all__ = ["Role"] - - -class Role(BaseModel): - id: str - """Role identifier tag.""" - - description: str - """Description of role's permissions.""" - - name: str - """Role Name.""" - - permissions: List[Permission] - """Access permissions for this User.""" diff --git a/src/cloudflare/types/user/invite.py b/src/cloudflare/types/user/invite.py index 00c7cf5ce22..e671d8edb03 100644 --- a/src/cloudflare/types/user/invite.py +++ b/src/cloudflare/types/user/invite.py @@ -5,7 +5,6 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..shared.role import Role __all__ = ["Invite"] @@ -32,11 +31,13 @@ class Invite(BaseModel): invited_on: Optional[datetime] = None """When the invite was sent.""" + organization_is_enforcing_twofactor: Optional[bool] = None + organization_name: Optional[str] = None """Organization name.""" - roles: Optional[List[Role]] = None - """Roles to be assigned to this user.""" + roles: Optional[List[str]] = None + """List of role names the membership has for this account.""" status: Optional[Literal["pending", "accepted", "rejected", "expired"]] = None """Current status of the invitation.""" diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index a835713c904..dee54072f7b 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.shared import Role +from cloudflare.types.accounts import RoleGetResponse, RoleListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Cloudflare) -> None: role = client.accounts.roles.list( account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(SyncSinglePage[Role], role, path=["response"]) + assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -34,7 +34,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(SyncSinglePage[Role], role, path=["response"]) + assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -45,7 +45,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(SyncSinglePage[Role], role, path=["response"]) + assert_matches_type(SyncSinglePage[RoleListResponse], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -62,7 +62,7 @@ def test_method_get(self, client: Cloudflare) -> None: role_id="3536bcfad5faccb999b47003c79917fb", account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -74,7 +74,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,7 +113,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: role = await async_client.accounts.roles.list( account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) + assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -124,7 +124,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) + assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -135,7 +135,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) + assert_matches_type(AsyncSinglePage[RoleListResponse], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,7 +152,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: role_id="3536bcfad5faccb999b47003c79917fb", account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -164,7 +164,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -176,7 +176,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(Optional[RoleGetResponse], role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_invites.py b/tests/api_resources/user/test_invites.py index 9e47db517e9..d2bfd631da8 100644 --- a/tests/api_resources/user/test_invites.py +++ b/tests/api_resources/user/test_invites.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -49,7 +49,7 @@ def test_method_edit(self, client: Cloudflare) -> None: invite_id="4f5f0c14a2a41d5063dd301b2f829f04", status="accepted", ) - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -61,7 +61,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -73,7 +73,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +90,7 @@ def test_method_get(self, client: Cloudflare) -> None: invite = client.user.invites.get( "4f5f0c14a2a41d5063dd301b2f829f04", ) - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -101,7 +101,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -112,7 +112,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,7 +158,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: invite_id="4f5f0c14a2a41d5063dd301b2f829f04", status="accepted", ) - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -182,7 +182,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -199,7 +199,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: invite = await async_client.user.invites.get( "4f5f0c14a2a41d5063dd301b2f829f04", ) - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -210,7 +210,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -221,7 +221,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(object, invite, path=["response"]) + assert_matches_type(Optional[Invite], invite, path=["response"]) assert cast(Any, response.is_closed) is True