diff --git a/.stats.yml b/.stats.yml index d0e375fdcb3..c620a2a735f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1256 +configured_endpoints: 1255 diff --git a/api.md b/api.md index da6f6006749..db312e7674c 100644 --- a/api.md +++ b/api.md @@ -3410,18 +3410,6 @@ Methods: - client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> Optional - client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id) -> DelegationDeleteResponse -# AuditLogs - -Types: - -```python -from cloudflare.types import AuditLogListResponse -``` - -Methods: - -- client.audit_logs.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[AuditLogListResponse] - # Billing ## Profiles @@ -4370,7 +4358,6 @@ Types: ```python from cloudflare.types.alerting.v3.destinations import ( - AaaPagerduty, PagerdutyCreateResponse, PagerdutyDeleteResponse, PagerdutyGetResponse, @@ -4391,11 +4378,11 @@ Types: ```python from cloudflare.types.alerting.v3.destinations import ( - AaaWebhooks, WebhookCreateResponse, WebhookUpdateResponse, WebhookListResponse, WebhookDeleteResponse, + WebhookGetResponse, ) ``` @@ -4405,19 +4392,19 @@ Methods: - client.alerting.v3.destinations.webhooks.update(webhook_id, \*, account_id, \*\*params) -> WebhookUpdateResponse - client.alerting.v3.destinations.webhooks.list(\*, account_id) -> Optional - client.alerting.v3.destinations.webhooks.delete(webhook_id, \*, account_id) -> Optional -- client.alerting.v3.destinations.webhooks.get(webhook_id, \*, account_id) -> AaaWebhooks +- client.alerting.v3.destinations.webhooks.get(webhook_id, \*, account_id) -> WebhookGetResponse ### Histories Types: ```python -from cloudflare.types.alerting.v3 import AaaHistory +from cloudflare.types.alerting.v3 import HistoryListResponse ``` Methods: -- client.alerting.v3.histories.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AaaHistory] +- client.alerting.v3.histories.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[HistoryListResponse] ### Policies @@ -4425,11 +4412,11 @@ Types: ```python from cloudflare.types.alerting.v3 import ( - AaaPolicies, PolicyCreateResponse, PolicyUpdateResponse, PolicyListResponse, PolicyDeleteResponse, + PolicyGetResponse, ) ``` @@ -4439,7 +4426,7 @@ Methods: - client.alerting.v3.policies.update(policy_id, \*, account_id, \*\*params) -> PolicyUpdateResponse - client.alerting.v3.policies.list(\*, account_id) -> Optional - client.alerting.v3.policies.delete(policy_id, \*, account_id) -> Optional -- client.alerting.v3.policies.get(policy_id, \*, account_id) -> AaaPolicies +- client.alerting.v3.policies.get(policy_id, \*, account_id) -> PolicyGetResponse # D1 diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index b21891ec0cb..b80eea8c0db 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -91,7 +91,6 @@ class Cloudflare(SyncAPIClient): url_normalization: resources.URLNormalization spectrum: resources.Spectrum addressing: resources.Addressing - audit_logs: resources.AuditLogs billing: resources.Billing brand_protection: resources.BrandProtection diagnostics: resources.Diagnostics @@ -244,7 +243,6 @@ def __init__( self.url_normalization = resources.URLNormalization(self) self.spectrum = resources.Spectrum(self) self.addressing = resources.Addressing(self) - self.audit_logs = resources.AuditLogs(self) self.billing = resources.Billing(self) self.brand_protection = resources.BrandProtection(self) self.diagnostics = resources.Diagnostics(self) @@ -502,7 +500,6 @@ class AsyncCloudflare(AsyncAPIClient): url_normalization: resources.AsyncURLNormalization spectrum: resources.AsyncSpectrum addressing: resources.AsyncAddressing - audit_logs: resources.AsyncAuditLogs billing: resources.AsyncBilling brand_protection: resources.AsyncBrandProtection diagnostics: resources.AsyncDiagnostics @@ -655,7 +652,6 @@ def __init__( self.url_normalization = resources.AsyncURLNormalization(self) self.spectrum = resources.AsyncSpectrum(self) self.addressing = resources.AsyncAddressing(self) - self.audit_logs = resources.AsyncAuditLogs(self) self.billing = resources.AsyncBilling(self) self.brand_protection = resources.AsyncBrandProtection(self) self.diagnostics = resources.AsyncDiagnostics(self) @@ -914,7 +910,6 @@ def __init__(self, client: Cloudflare) -> None: self.url_normalization = resources.URLNormalizationWithRawResponse(client.url_normalization) self.spectrum = resources.SpectrumWithRawResponse(client.spectrum) self.addressing = resources.AddressingWithRawResponse(client.addressing) - self.audit_logs = resources.AuditLogsWithRawResponse(client.audit_logs) self.billing = resources.BillingWithRawResponse(client.billing) self.brand_protection = resources.BrandProtectionWithRawResponse(client.brand_protection) self.diagnostics = resources.DiagnosticsWithRawResponse(client.diagnostics) @@ -1002,7 +997,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.url_normalization = resources.AsyncURLNormalizationWithRawResponse(client.url_normalization) self.spectrum = resources.AsyncSpectrumWithRawResponse(client.spectrum) self.addressing = resources.AsyncAddressingWithRawResponse(client.addressing) - self.audit_logs = resources.AsyncAuditLogsWithRawResponse(client.audit_logs) self.billing = resources.AsyncBillingWithRawResponse(client.billing) self.brand_protection = resources.AsyncBrandProtectionWithRawResponse(client.brand_protection) self.diagnostics = resources.AsyncDiagnosticsWithRawResponse(client.diagnostics) @@ -1092,7 +1086,6 @@ def __init__(self, client: Cloudflare) -> None: self.url_normalization = resources.URLNormalizationWithStreamingResponse(client.url_normalization) self.spectrum = resources.SpectrumWithStreamingResponse(client.spectrum) self.addressing = resources.AddressingWithStreamingResponse(client.addressing) - self.audit_logs = resources.AuditLogsWithStreamingResponse(client.audit_logs) self.billing = resources.BillingWithStreamingResponse(client.billing) self.brand_protection = resources.BrandProtectionWithStreamingResponse(client.brand_protection) self.diagnostics = resources.DiagnosticsWithStreamingResponse(client.diagnostics) @@ -1184,7 +1177,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.url_normalization = resources.AsyncURLNormalizationWithStreamingResponse(client.url_normalization) self.spectrum = resources.AsyncSpectrumWithStreamingResponse(client.spectrum) self.addressing = resources.AsyncAddressingWithStreamingResponse(client.addressing) - self.audit_logs = resources.AsyncAuditLogsWithStreamingResponse(client.audit_logs) self.billing = resources.AsyncBillingWithStreamingResponse(client.billing) self.brand_protection = resources.AsyncBrandProtectionWithStreamingResponse(client.brand_protection) self.diagnostics = resources.AsyncDiagnosticsWithStreamingResponse(client.diagnostics) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 7ce862ee017..ed95721fcc5 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -328,14 +328,6 @@ AddressingWithStreamingResponse, AsyncAddressingWithStreamingResponse, ) -from .audit_logs import ( - AuditLogs, - AsyncAuditLogs, - AuditLogsWithRawResponse, - AsyncAuditLogsWithRawResponse, - AuditLogsWithStreamingResponse, - AsyncAuditLogsWithStreamingResponse, -) from .challenges import ( Challenges, AsyncChallenges, @@ -906,12 +898,6 @@ "AsyncAddressingWithRawResponse", "AddressingWithStreamingResponse", "AsyncAddressingWithStreamingResponse", - "AuditLogs", - "AsyncAuditLogs", - "AuditLogsWithRawResponse", - "AsyncAuditLogsWithRawResponse", - "AuditLogsWithStreamingResponse", - "AsyncAuditLogsWithStreamingResponse", "Billing", "AsyncBilling", "BillingWithRawResponse", diff --git a/src/cloudflare/resources/alerting/v3/destinations/pagerduty.py b/src/cloudflare/resources/alerting/v3/destinations/pagerduty.py index de094c27aa4..97788a2cdda 100644 --- a/src/cloudflare/resources/alerting/v3/destinations/pagerduty.py +++ b/src/cloudflare/resources/alerting/v3/destinations/pagerduty.py @@ -178,7 +178,7 @@ def link( Args: account_id: The account id - token_id: The token id + token_id: The token integration key extra_headers: Send extra headers @@ -354,7 +354,7 @@ async def link( Args: account_id: The account id - token_id: The token id + token_id: The token integration key extra_headers: Send extra headers diff --git a/src/cloudflare/resources/alerting/v3/destinations/webhooks.py b/src/cloudflare/resources/alerting/v3/destinations/webhooks.py index f595622f204..7e62b0eae66 100644 --- a/src/cloudflare/resources/alerting/v3/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/v3/destinations/webhooks.py @@ -24,7 +24,7 @@ make_request_options, ) from .....types.alerting.v3.destinations import ( - AaaWebhooks, + WebhookGetResponse, WebhookListResponse, WebhookCreateResponse, WebhookDeleteResponse, @@ -267,7 +267,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AaaWebhooks: + ) -> WebhookGetResponse: """ Get details for a single webhooks destination. @@ -297,7 +297,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AaaWebhooks], ResultWrapper[AaaWebhooks]), + cast_to=cast(Type[WebhookGetResponse], ResultWrapper[WebhookGetResponse]), ) @@ -532,7 +532,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AaaWebhooks: + ) -> WebhookGetResponse: """ Get details for a single webhooks destination. @@ -562,7 +562,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AaaWebhooks], ResultWrapper[AaaWebhooks]), + cast_to=cast(Type[WebhookGetResponse], ResultWrapper[WebhookGetResponse]), ) diff --git a/src/cloudflare/resources/alerting/v3/histories.py b/src/cloudflare/resources/alerting/v3/histories.py index 0e4f3399da4..6b05f723f7b 100644 --- a/src/cloudflare/resources/alerting/v3/histories.py +++ b/src/cloudflare/resources/alerting/v3/histories.py @@ -22,7 +22,7 @@ AsyncPaginator, make_request_options, ) -from ....types.alerting.v3 import AaaHistory, history_list_params +from ....types.alerting.v3 import HistoryListResponse, history_list_params __all__ = ["Histories", "AsyncHistories"] @@ -50,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AaaHistory]: + ) -> SyncV4PagePaginationArray[HistoryListResponse]: """Gets a list of history records for notifications sent to an account. The records @@ -82,7 +82,7 @@ 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}/alerting/v3/history", - page=SyncV4PagePaginationArray[AaaHistory], + page=SyncV4PagePaginationArray[HistoryListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -98,7 +98,7 @@ def list( history_list_params.HistoryListParams, ), ), - model=AaaHistory, + model=HistoryListResponse, ) @@ -125,7 +125,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AaaHistory, AsyncV4PagePaginationArray[AaaHistory]]: + ) -> AsyncPaginator[HistoryListResponse, AsyncV4PagePaginationArray[HistoryListResponse]]: """Gets a list of history records for notifications sent to an account. The records @@ -157,7 +157,7 @@ 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}/alerting/v3/history", - page=AsyncV4PagePaginationArray[AaaHistory], + page=AsyncV4PagePaginationArray[HistoryListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -173,7 +173,7 @@ def list( history_list_params.HistoryListParams, ), ), - model=AaaHistory, + model=HistoryListResponse, ) diff --git a/src/cloudflare/resources/alerting/v3/policies.py b/src/cloudflare/resources/alerting/v3/policies.py index efee91f3f7e..935119fd32f 100644 --- a/src/cloudflare/resources/alerting/v3/policies.py +++ b/src/cloudflare/resources/alerting/v3/policies.py @@ -25,7 +25,7 @@ make_request_options, ) from ....types.alerting.v3 import ( - AaaPolicies, + PolicyGetResponse, PolicyListResponse, PolicyCreateResponse, PolicyDeleteResponse, @@ -100,6 +100,7 @@ def create( "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -229,6 +230,7 @@ def update( "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -407,7 +409,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AaaPolicies: + ) -> PolicyGetResponse: """ Get details for a single policy. @@ -437,7 +439,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AaaPolicies], ResultWrapper[AaaPolicies]), + cast_to=cast(Type[PolicyGetResponse], ResultWrapper[PolicyGetResponse]), ) @@ -504,6 +506,7 @@ async def create( "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -633,6 +636,7 @@ async def update( "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -811,7 +815,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AaaPolicies: + ) -> PolicyGetResponse: """ Get details for a single policy. @@ -841,7 +845,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AaaPolicies], ResultWrapper[AaaPolicies]), + cast_to=cast(Type[PolicyGetResponse], ResultWrapper[PolicyGetResponse]), ) diff --git a/src/cloudflare/resources/audit_logs.py b/src/cloudflare/resources/audit_logs.py deleted file mode 100644 index 95a2a6857aa..00000000000 --- a/src/cloudflare/resources/audit_logs.py +++ /dev/null @@ -1,256 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from ..types import AuditLogListResponse, audit_log_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from .._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["AuditLogs", "AsyncAuditLogs"] - - -class AuditLogs(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AuditLogsWithRawResponse: - return AuditLogsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AuditLogsWithStreamingResponse: - return AuditLogsWithStreamingResponse(self) - - def list( - self, - account_identifier: str, - *, - id: str | NotGiven = NOT_GIVEN, - action: audit_log_list_params.Action | NotGiven = NOT_GIVEN, - actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN, - before: Union[str, datetime] | NotGiven = NOT_GIVEN, - direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - export: bool | NotGiven = NOT_GIVEN, - hide_user_logs: bool | NotGiven = NOT_GIVEN, - page: float | NotGiven = NOT_GIVEN, - per_page: float | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - zone: audit_log_list_params.Zone | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[AuditLogListResponse]: - """Gets a list of audit logs for an account. - - Can be filtered by who made the - change, on which zone, and the timeframe of the change. - - Args: - account_identifier: Identifier - - id: Finds a specific log by its ID. - - before: Limits the returned results to logs older than the specified date. This can be a - date string `2019-04-30` or an absolute timestamp that conforms to RFC3339. - - direction: Changes the direction of the chronological sorting. - - export: Indicates that this request is an export of logs in CSV format. - - hide_user_logs: Indicates whether or not to hide user level audit logs. - - page: Defines which page of results to return. - - per_page: Sets the number of results to return per page. - - since: Limits the returned results to logs newer than the specified date. This can be a - date string `2019-04-30` or an absolute timestamp that conforms to RFC3339. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get_api_list( - f"/accounts/{account_identifier}/audit_logs", - page=SyncV4PagePaginationArray[AuditLogListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "id": id, - "action": action, - "actor": actor, - "before": before, - "direction": direction, - "export": export, - "hide_user_logs": hide_user_logs, - "page": page, - "per_page": per_page, - "since": since, - "zone": zone, - }, - audit_log_list_params.AuditLogListParams, - ), - ), - model=AuditLogListResponse, - ) - - -class AsyncAuditLogs(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAuditLogsWithRawResponse: - return AsyncAuditLogsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAuditLogsWithStreamingResponse: - return AsyncAuditLogsWithStreamingResponse(self) - - def list( - self, - account_identifier: str, - *, - id: str | NotGiven = NOT_GIVEN, - action: audit_log_list_params.Action | NotGiven = NOT_GIVEN, - actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN, - before: Union[str, datetime] | NotGiven = NOT_GIVEN, - direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - export: bool | NotGiven = NOT_GIVEN, - hide_user_logs: bool | NotGiven = NOT_GIVEN, - page: float | NotGiven = NOT_GIVEN, - per_page: float | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - zone: audit_log_list_params.Zone | 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]: - """Gets a list of audit logs for an account. - - Can be filtered by who made the - change, on which zone, and the timeframe of the change. - - Args: - account_identifier: Identifier - - id: Finds a specific log by its ID. - - before: Limits the returned results to logs older than the specified date. This can be a - date string `2019-04-30` or an absolute timestamp that conforms to RFC3339. - - direction: Changes the direction of the chronological sorting. - - export: Indicates that this request is an export of logs in CSV format. - - hide_user_logs: Indicates whether or not to hide user level audit logs. - - page: Defines which page of results to return. - - per_page: Sets the number of results to return per page. - - since: Limits the returned results to logs newer than the specified date. This can be a - date string `2019-04-30` or an absolute timestamp that conforms to RFC3339. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get_api_list( - f"/accounts/{account_identifier}/audit_logs", - page=AsyncV4PagePaginationArray[AuditLogListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "id": id, - "action": action, - "actor": actor, - "before": before, - "direction": direction, - "export": export, - "hide_user_logs": hide_user_logs, - "page": page, - "per_page": per_page, - "since": since, - "zone": zone, - }, - audit_log_list_params.AuditLogListParams, - ), - ), - model=AuditLogListResponse, - ) - - -class AuditLogsWithRawResponse: - def __init__(self, audit_logs: AuditLogs) -> None: - self._audit_logs = audit_logs - - self.list = to_raw_response_wrapper( - audit_logs.list, - ) - - -class AsyncAuditLogsWithRawResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: - self._audit_logs = audit_logs - - self.list = async_to_raw_response_wrapper( - audit_logs.list, - ) - - -class AuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AuditLogs) -> None: - self._audit_logs = audit_logs - - self.list = to_streamed_response_wrapper( - audit_logs.list, - ) - - -class AsyncAuditLogsWithStreamingResponse: - def __init__(self, audit_logs: AsyncAuditLogs) -> None: - self._audit_logs = audit_logs - - self.list = async_to_streamed_response_wrapper( - audit_logs.list, - ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index ab606de8189..7e8f624f1ab 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -53,7 +53,6 @@ from .zone_create_response import ZoneCreateResponse as ZoneCreateResponse from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse from .account_update_params import AccountUpdateParams as AccountUpdateParams -from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret from .origin_ca_certificate import OriginCACertificate as OriginCACertificate from .pagerule_get_response import PageruleGetResponse as PageruleGetResponse @@ -75,7 +74,6 @@ from .rate_limit_edit_params import RateLimitEditParams as RateLimitEditParams from .rate_limit_list_params import RateLimitListParams as RateLimitListParams from .account_update_response import AccountUpdateResponse as AccountUpdateResponse -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams from .intel_phishing_url_info import IntelPhishingURLInfo as IntelPhishingURLInfo from .membership_get_response import MembershipGetResponse as MembershipGetResponse diff --git a/src/cloudflare/types/alerting/v3/__init__.py b/src/cloudflare/types/alerting/v3/__init__.py index 8d33feba037..864f58958fe 100644 --- a/src/cloudflare/types/alerting/v3/__init__.py +++ b/src/cloudflare/types/alerting/v3/__init__.py @@ -2,12 +2,12 @@ from __future__ import annotations -from .aaa_history import AaaHistory as AaaHistory -from .aaa_policies import AaaPolicies as AaaPolicies from .history_list_params import HistoryListParams as HistoryListParams +from .policy_get_response import PolicyGetResponse as PolicyGetResponse from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .history_list_response import HistoryListResponse as HistoryListResponse from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse diff --git a/src/cloudflare/types/alerting/v3/destinations/__init__.py b/src/cloudflare/types/alerting/v3/destinations/__init__.py index e6c8be3d2b2..e5eb6975de2 100644 --- a/src/cloudflare/types/alerting/v3/destinations/__init__.py +++ b/src/cloudflare/types/alerting/v3/destinations/__init__.py @@ -2,8 +2,7 @@ from __future__ import annotations -from .aaa_webhooks import AaaWebhooks as AaaWebhooks -from .aaa_pagerduty import AaaPagerduty as AaaPagerduty +from .webhook_get_response import WebhookGetResponse as WebhookGetResponse from .eligible_get_response import EligibleGetResponse as EligibleGetResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams from .webhook_list_response import WebhookListResponse as WebhookListResponse diff --git a/src/cloudflare/types/alerting/v3/destinations/aaa_pagerduty.py b/src/cloudflare/types/alerting/v3/destinations/aaa_pagerduty.py deleted file mode 100644 index 0e4dc6dd832..00000000000 --- a/src/cloudflare/types/alerting/v3/destinations/aaa_pagerduty.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from typing import Optional - -from ....._models import BaseModel - -__all__ = ["AaaPagerduty"] - - -class AaaPagerduty(BaseModel): - id: Optional[str] = None - """UUID""" - - name: Optional[str] = None - """The name of the pagerduty service.""" diff --git a/src/cloudflare/types/alerting/v3/destinations/pagerduty_create_response.py b/src/cloudflare/types/alerting/v3/destinations/pagerduty_create_response.py index 7d057611e33..33c03272497 100644 --- a/src/cloudflare/types/alerting/v3/destinations/pagerduty_create_response.py +++ b/src/cloudflare/types/alerting/v3/destinations/pagerduty_create_response.py @@ -9,4 +9,4 @@ class PagerdutyCreateResponse(BaseModel): id: Optional[str] = None - """UUID""" + """token in form of UUID""" diff --git a/src/cloudflare/types/alerting/v3/destinations/pagerduty_get_response.py b/src/cloudflare/types/alerting/v3/destinations/pagerduty_get_response.py index 38b479178b3..ca2aacc883f 100644 --- a/src/cloudflare/types/alerting/v3/destinations/pagerduty_get_response.py +++ b/src/cloudflare/types/alerting/v3/destinations/pagerduty_get_response.py @@ -1,9 +1,18 @@ # File generated from our OpenAPI spec by Stainless. -from typing import List +from typing import List, Optional -from .aaa_pagerduty import AaaPagerduty +from ....._models import BaseModel -__all__ = ["PagerdutyGetResponse"] +__all__ = ["PagerdutyGetResponse", "PagerdutyGetResponseItem"] -PagerdutyGetResponse = List[AaaPagerduty] + +class PagerdutyGetResponseItem(BaseModel): + id: Optional[str] = None + """UUID""" + + name: Optional[str] = None + """The name of the pagerduty service.""" + + +PagerdutyGetResponse = List[PagerdutyGetResponseItem] diff --git a/src/cloudflare/types/alerting/v3/destinations/aaa_webhooks.py b/src/cloudflare/types/alerting/v3/destinations/webhook_get_response.py similarity index 95% rename from src/cloudflare/types/alerting/v3/destinations/aaa_webhooks.py rename to src/cloudflare/types/alerting/v3/destinations/webhook_get_response.py index d946d3ccd31..36a3d6a9e3d 100644 --- a/src/cloudflare/types/alerting/v3/destinations/aaa_webhooks.py +++ b/src/cloudflare/types/alerting/v3/destinations/webhook_get_response.py @@ -6,10 +6,10 @@ from ....._models import BaseModel -__all__ = ["AaaWebhooks"] +__all__ = ["WebhookGetResponse"] -class AaaWebhooks(BaseModel): +class WebhookGetResponse(BaseModel): id: Optional[str] = None """The unique identifier of a webhook""" diff --git a/src/cloudflare/types/alerting/v3/destinations/webhook_list_response.py b/src/cloudflare/types/alerting/v3/destinations/webhook_list_response.py index dec65b851d0..874aca6ee0b 100644 --- a/src/cloudflare/types/alerting/v3/destinations/webhook_list_response.py +++ b/src/cloudflare/types/alerting/v3/destinations/webhook_list_response.py @@ -1,9 +1,52 @@ # File generated from our OpenAPI spec by Stainless. -from typing import List +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal -from .aaa_webhooks import AaaWebhooks +from ....._models import BaseModel -__all__ = ["WebhookListResponse"] +__all__ = ["WebhookListResponse", "WebhookListResponseItem"] -WebhookListResponse = List[AaaWebhooks] + +class WebhookListResponseItem(BaseModel): + id: Optional[str] = None + """The unique identifier of a webhook""" + + created_at: Optional[datetime] = None + """Timestamp of when the webhook destination was created.""" + + last_failure: Optional[datetime] = None + """ + Timestamp of the last time an attempt to dispatch a notification to this webhook + failed. + """ + + last_success: Optional[datetime] = None + """ + Timestamp of the last time Cloudflare was able to successfully dispatch a + notification using this webhook. + """ + + name: Optional[str] = None + """The name of the webhook destination. + + This will be included in the request body when you receive a webhook + notification. + """ + + secret: Optional[str] = None + """ + Optional secret that will be passed in the `cf-webhook-auth` header when + dispatching generic webhook notifications or formatted for supported + destinations. Secrets are not returned in any API response body. + """ + + type: Optional[Literal["slack", "generic", "gchat"]] = None + """Type of webhook endpoint.""" + + url: Optional[str] = None + """The POST endpoint to call when dispatching a notification.""" + + +WebhookListResponse = List[WebhookListResponseItem] diff --git a/src/cloudflare/types/alerting/v3/aaa_history.py b/src/cloudflare/types/alerting/v3/history_list_response.py similarity index 94% rename from src/cloudflare/types/alerting/v3/aaa_history.py rename to src/cloudflare/types/alerting/v3/history_list_response.py index ae07972bac8..dd9c1d26fcd 100644 --- a/src/cloudflare/types/alerting/v3/aaa_history.py +++ b/src/cloudflare/types/alerting/v3/history_list_response.py @@ -6,10 +6,10 @@ from ...._models import BaseModel -__all__ = ["AaaHistory"] +__all__ = ["HistoryListResponse"] -class AaaHistory(BaseModel): +class HistoryListResponse(BaseModel): id: Optional[str] = None """UUID""" diff --git a/src/cloudflare/types/alerting/v3/policy_create_params.py b/src/cloudflare/types/alerting/v3/policy_create_params.py index 62a51457a73..5d67bd62386 100644 --- a/src/cloudflare/types/alerting/v3/policy_create_params.py +++ b/src/cloudflare/types/alerting/v3/policy_create_params.py @@ -63,6 +63,7 @@ class PolicyCreateParams(TypedDict, total=False): "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -112,7 +113,10 @@ class Filters(TypedDict, total=False): """Used for configuring radar_notification""" affected_components: List[str] - """Used for configuring incident_alert""" + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ affected_locations: List[str] """Used for configuring radar_notification""" diff --git a/src/cloudflare/types/alerting/v3/aaa_policies.py b/src/cloudflare/types/alerting/v3/policy_get_response.py similarity index 97% rename from src/cloudflare/types/alerting/v3/aaa_policies.py rename to src/cloudflare/types/alerting/v3/policy_get_response.py index 2e865f6f1e0..20c421a9148 100644 --- a/src/cloudflare/types/alerting/v3/aaa_policies.py +++ b/src/cloudflare/types/alerting/v3/policy_get_response.py @@ -6,7 +6,7 @@ from ...._models import BaseModel -__all__ = ["AaaPolicies", "Filters", "Mechanisms"] +__all__ = ["PolicyGetResponse", "Filters", "Mechanisms"] class Filters(BaseModel): @@ -17,7 +17,10 @@ class Filters(BaseModel): """Used for configuring radar_notification""" affected_components: Optional[List[str]] = None - """Used for configuring incident_alert""" + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ affected_locations: Optional[List[str]] = None """Used for configuring radar_notification""" @@ -142,7 +145,7 @@ class Mechanisms(BaseModel): """UUID""" -class AaaPolicies(BaseModel): +class PolicyGetResponse(BaseModel): id: Optional[str] = None """The unique identifier of a notification policy""" @@ -197,6 +200,7 @@ class AaaPolicies(BaseModel): "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", diff --git a/src/cloudflare/types/alerting/v3/policy_list_response.py b/src/cloudflare/types/alerting/v3/policy_list_response.py index 184ef5948bf..ea077ccc19b 100644 --- a/src/cloudflare/types/alerting/v3/policy_list_response.py +++ b/src/cloudflare/types/alerting/v3/policy_list_response.py @@ -1,9 +1,249 @@ # File generated from our OpenAPI spec by Stainless. -from typing import List +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal -from .aaa_policies import AaaPolicies +from ...._models import BaseModel -__all__ = ["PolicyListResponse"] +__all__ = [ + "PolicyListResponse", + "PolicyListResponseItem", + "PolicyListResponseItemFilters", + "PolicyListResponseItemMechanisms", +] -PolicyListResponse = List[AaaPolicies] + +class PolicyListResponseItemFilters(BaseModel): + actions: Optional[List[str]] = None + """Usage depends on specific alert type""" + + affected_asns: Optional[List[str]] = None + """Used for configuring radar_notification""" + + affected_components: Optional[List[str]] = None + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ + + affected_locations: Optional[List[str]] = None + """Used for configuring radar_notification""" + + airport_code: Optional[List[str]] = None + """Used for configuring maintenance_event_notification""" + + alert_trigger_preferences: Optional[List[str]] = None + """Usage depends on specific alert type""" + + alert_trigger_preferences_value: Optional[List[Literal["99.0", "98.0", "97.0"]]] = None + """Used for configuring magic_tunnel_health_check_event""" + + enabled: Optional[List[str]] = None + """Used for configuring load_balancing_pool_enablement_alert""" + + environment: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + event: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + event_source: Optional[List[str]] = None + """Used for configuring load_balancing_health_alert""" + + event_type: Optional[List[str]] = None + """Usage depends on specific alert type""" + + group_by: Optional[List[str]] = None + """Usage depends on specific alert type""" + + health_check_id: Optional[List[str]] = None + """Used for configuring health_check_status_notification""" + + incident_impact: Optional[ + List[ + Literal[ + "INCIDENT_IMPACT_NONE", "INCIDENT_IMPACT_MINOR", "INCIDENT_IMPACT_MAJOR", "INCIDENT_IMPACT_CRITICAL" + ] + ] + ] = None + """Used for configuring incident_alert""" + + input_id: Optional[List[str]] = None + """Used for configuring stream_live_notifications""" + + limit: Optional[List[str]] = None + """Used for configuring billing_usage_alert""" + + logo_tag: Optional[List[str]] = None + """Used for configuring logo_match_alert""" + + megabits_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + new_health: Optional[List[str]] = None + """Used for configuring load_balancing_health_alert""" + + new_status: Optional[List[str]] = None + """Used for configuring tunnel_health_event""" + + packets_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + pool_id: Optional[List[str]] = None + """Usage depends on specific alert type""" + + product: Optional[List[str]] = None + """Used for configuring billing_usage_alert""" + + project_id: Optional[List[str]] = None + """Used for configuring pages_event_alert""" + + protocol: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + query_tag: Optional[List[str]] = None + """Usage depends on specific alert type""" + + requests_per_second: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + selectors: Optional[List[str]] = None + """Usage depends on specific alert type""" + + services: Optional[List[str]] = None + """Used for configuring clickhouse_alert_fw_ent_anomaly""" + + slo: Optional[List[str]] = None + """Usage depends on specific alert type""" + + status: Optional[List[str]] = None + """Used for configuring health_check_status_notification""" + + target_hostname: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + target_ip: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l4_alert""" + + target_zone_name: Optional[List[str]] = None + """Used for configuring advanced_ddos_attack_l7_alert""" + + traffic_exclusions: Optional[List[Literal["security_events"]]] = None + """Used for configuring traffic_anomalies_alert""" + + tunnel_id: Optional[List[str]] = None + """Used for configuring tunnel_health_event""" + + tunnel_name: Optional[List[str]] = None + """Used for configuring magic_tunnel_health_check_event""" + + where: Optional[List[str]] = None + """Usage depends on specific alert type""" + + zones: Optional[List[str]] = None + """Usage depends on specific alert type""" + + +class PolicyListResponseItemMechanisms(BaseModel): + id: Union[str, str, None] = None + """UUID""" + + +class PolicyListResponseItem(BaseModel): + id: Optional[str] = None + """The unique identifier of a notification policy""" + + alert_type: Optional[ + Literal[ + "access_custom_certificate_expiration_type", + "advanced_ddos_attack_l4_alert", + "advanced_ddos_attack_l7_alert", + "advanced_http_alert_error", + "bgp_hijack_notification", + "billing_usage_alert", + "block_notification_block_removed", + "block_notification_new_block", + "block_notification_review_rejected", + "brand_protection_alert", + "brand_protection_digest", + "clickhouse_alert_fw_anomaly", + "clickhouse_alert_fw_ent_anomaly", + "custom_ssl_certificate_event_type", + "dedicated_ssl_certificate_event_type", + "dos_attack_l4", + "dos_attack_l7", + "expiring_service_token_alert", + "failing_logpush_job_disabled_alert", + "fbm_auto_advertisement", + "fbm_dosd_attack", + "fbm_volumetric_attack", + "health_check_status_notification", + "hostname_aop_custom_certificate_expiration_type", + "http_alert_edge_error", + "http_alert_origin_error", + "incident_alert", + "load_balancing_health_alert", + "load_balancing_pool_enablement_alert", + "logo_match_alert", + "magic_tunnel_health_check_event", + "maintenance_event_notification", + "mtls_certificate_store_certificate_expiration_type", + "pages_event_alert", + "radar_notification", + "real_origin_monitoring", + "scriptmonitor_alert_new_code_change_detections", + "scriptmonitor_alert_new_hosts", + "scriptmonitor_alert_new_malicious_hosts", + "scriptmonitor_alert_new_malicious_scripts", + "scriptmonitor_alert_new_malicious_url", + "scriptmonitor_alert_new_max_length_resource_url", + "scriptmonitor_alert_new_resources", + "secondary_dns_all_primaries_failing", + "secondary_dns_primaries_failing", + "secondary_dns_zone_successfully_updated", + "secondary_dns_zone_validation_warning", + "sentinel_alert", + "stream_live_notifications", + "traffic_anomalies_alert", + "tunnel_health_event", + "tunnel_update_event", + "universal_ssl_event_type", + "web_analytics_metrics_update", + "zone_aop_custom_certificate_expiration_type", + ] + ] = None + """Refers to which event will trigger a Notification dispatch. + + You can use the endpoint to get available alert types which then will give you a + list of possible values. + """ + + created: Optional[datetime] = None + + description: Optional[str] = None + """Optional description for the Notification policy.""" + + enabled: Optional[bool] = None + """Whether or not the Notification policy is enabled.""" + + filters: Optional[PolicyListResponseItemFilters] = None + """ + Optional filters that allow you to be alerted only on a subset of events for + that alert type based on some criteria. This is only available for select alert + types. See alert type documentation for more details. + """ + + mechanisms: Optional[Dict[str, List[PolicyListResponseItemMechanisms]]] = None + """List of IDs that will be used when dispatching a notification. + + IDs for email type will be the email address. + """ + + modified: Optional[datetime] = None + + name: Optional[str] = None + """Name of the policy.""" + + +PolicyListResponse = List[PolicyListResponseItem] diff --git a/src/cloudflare/types/alerting/v3/policy_update_params.py b/src/cloudflare/types/alerting/v3/policy_update_params.py index f628760aeb9..b26a6fa027c 100644 --- a/src/cloudflare/types/alerting/v3/policy_update_params.py +++ b/src/cloudflare/types/alerting/v3/policy_update_params.py @@ -62,6 +62,7 @@ class PolicyUpdateParams(TypedDict, total=False): "secondary_dns_zone_validation_warning", "sentinel_alert", "stream_live_notifications", + "traffic_anomalies_alert", "tunnel_health_event", "tunnel_update_event", "universal_ssl_event_type", @@ -105,7 +106,10 @@ class Filters(TypedDict, total=False): """Used for configuring radar_notification""" affected_components: List[str] - """Used for configuring incident_alert""" + """Used for configuring incident_alert. + + A list of identifiers for each component to monitor. + """ affected_locations: List[str] """Used for configuring radar_notification""" diff --git a/src/cloudflare/types/audit_log_list_params.py b/src/cloudflare/types/audit_log_list_params.py deleted file mode 100644 index 1b40cf1bd66..00000000000 --- a/src/cloudflare/types/audit_log_list_params.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["AuditLogListParams", "Action", "Actor", "Zone"] - - -class AuditLogListParams(TypedDict, total=False): - id: str - """Finds a specific log by its ID.""" - - action: Action - - actor: Actor - - before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Limits the returned results to logs older than the specified date. - - This can be a date string `2019-04-30` or an absolute timestamp that conforms to - RFC3339. - """ - - direction: Literal["desc", "asc"] - """Changes the direction of the chronological sorting.""" - - export: bool - """Indicates that this request is an export of logs in CSV format.""" - - hide_user_logs: bool - """Indicates whether or not to hide user level audit logs.""" - - page: float - """Defines which page of results to return.""" - - per_page: float - """Sets the number of results to return per page.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Limits the returned results to logs newer than the specified date. - - This can be a date string `2019-04-30` or an absolute timestamp that conforms to - RFC3339. - """ - - zone: Zone - - -class Action(TypedDict, total=False): - type: str - """Filters by the action type.""" - - -class Actor(TypedDict, total=False): - email: str - """Filters by the email address of the actor that made the change.""" - - ip: str - """ - Filters by the IP address of the request that made the change by specific IP - address or valid CIDR Range. - """ - - -class Zone(TypedDict, total=False): - name: str - """Filters by the name of the zone associated to the change.""" diff --git a/src/cloudflare/types/audit_log_list_response.py b/src/cloudflare/types/audit_log_list_response.py deleted file mode 100644 index df04022ce07..00000000000 --- a/src/cloudflare/types/audit_log_list_response.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"] - - -class Action(BaseModel): - result: Optional[bool] = None - """A boolean that indicates if the action attempted was successful.""" - - type: Optional[str] = None - """A short string that describes the action that was performed.""" - - -class Actor(BaseModel): - id: Optional[str] = None - """The ID of the actor that performed the action. - - If a user performed the action, this will be their User ID. - """ - - email: Optional[str] = None - """The email of the user that performed the action.""" - - ip: Optional[str] = None - """The IP address of the request that performed the action.""" - - type: Optional[Literal["user", "admin", "Cloudflare"]] = None - """The type of actor, whether a User, Cloudflare Admin, or an Automated System.""" - - -class Owner(BaseModel): - id: Optional[str] = None - """Identifier""" - - -class Resource(BaseModel): - id: Optional[str] = None - """An identifier for the resource that was affected by the action.""" - - type: Optional[str] = None - """A short string that describes the resource that was affected by the action.""" - - -class AuditLogListResponse(BaseModel): - id: Optional[str] = None - """A string that uniquely identifies the audit log.""" - - action: Optional[Action] = None - - actor: Optional[Actor] = None - - interface: Optional[str] = None - """The source of the event.""" - - metadata: Optional[object] = None - """An object which can lend more context to the action being logged. - - This is a flexible value and varies between different actions. - """ - - new_value: Optional[str] = FieldInfo(alias="newValue", default=None) - """The new value of the resource that was modified.""" - - old_value: Optional[str] = FieldInfo(alias="oldValue", default=None) - """The value of the resource before it was modified.""" - - owner: Optional[Owner] = None - - resource: Optional[Resource] = None - - when: Optional[datetime] = None - """A UTC RFC3339 timestamp that specifies when the action being logged occured.""" diff --git a/tests/api_resources/alerting/v3/destinations/test_webhooks.py b/tests/api_resources/alerting/v3/destinations/test_webhooks.py index bf2dfea6daf..e42e20c99cc 100644 --- a/tests/api_resources/alerting/v3/destinations/test_webhooks.py +++ b/tests/api_resources/alerting/v3/destinations/test_webhooks.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types.alerting.v3.destinations import ( - AaaWebhooks, + WebhookGetResponse, WebhookListResponse, WebhookCreateResponse, WebhookDeleteResponse, @@ -259,7 +259,7 @@ def test_method_get(self, client: Cloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +272,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" webhook = response.parse() - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -544,7 +544,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -557,7 +557,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" webhook = await response.parse() - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -570,7 +570,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(AaaWebhooks, webhook, path=["response"]) + assert_matches_type(WebhookGetResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/v3/test_histories.py b/tests/api_resources/alerting/v3/test_histories.py index 34f5f07e015..ef3ea0d0275 100644 --- a/tests/api_resources/alerting/v3/test_histories.py +++ b/tests/api_resources/alerting/v3/test_histories.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.alerting.v3 import AaaHistory +from cloudflare.types.alerting.v3 import HistoryListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: history = client.alerting.v3.histories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, since=parse_datetime("2022-05-19T20:29:58.679897Z"), ) - assert_matches_type(SyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,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" history = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -83,7 +83,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: history = await async_client.alerting.v3.histories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -95,7 +95,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, since=parse_datetime("2022-05-19T20:29:58.679897Z"), ) - assert_matches_type(AsyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,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" history = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +119,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AaaHistory], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[HistoryListResponse], history, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/v3/test_policies.py b/tests/api_resources/alerting/v3/test_policies.py index 0ae10d7f205..bd7f0cf2d5e 100644 --- a/tests/api_resources/alerting/v3/test_policies.py +++ b/tests/api_resources/alerting/v3/test_policies.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types.alerting.v3 import ( - AaaPolicies, + PolicyGetResponse, PolicyListResponse, PolicyCreateResponse, PolicyDeleteResponse, @@ -369,7 +369,7 @@ def test_method_get(self, client: Cloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -382,7 +382,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" policy = response.parse() - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +395,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -764,7 +764,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -777,7 +777,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" policy = await response.parse() - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -790,7 +790,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(AaaPolicies, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_audit_logs.py b/tests/api_resources/test_audit_logs.py deleted file mode 100644 index a204006f8f8..00000000000 --- a/tests/api_resources/test_audit_logs.py +++ /dev/null @@ -1,152 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types import AuditLogListResponse -from cloudflare._utils import parse_datetime -from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAuditLogs: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - audit_log = client.audit_logs.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_list_with_all_params(self, client: Cloudflare) -> None: - audit_log = client.audit_logs.list( - "023e105f4ecef8ad9ca31a8372d0c353", - id="f174be97-19b1-40d6-954d-70cd5fbd52db", - action={"type": "add"}, - actor={ - "ip": "17.168.228.63", - "email": "alice@example.com", - }, - before=parse_datetime("2019-04-30T01:12:20Z"), - direction="desc", - export=True, - hide_user_logs=True, - page=50, - per_page=25, - since=parse_datetime("2019-04-30T01:12:20Z"), - zone={"name": "example.com"}, - ) - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.audit_logs.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.audit_logs.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - audit_log = response.parse() - assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.audit_logs.with_raw_response.list( - "", - ) - - -class TestAsyncAuditLogs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - audit_log = await async_client.audit_logs.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - audit_log = await async_client.audit_logs.list( - "023e105f4ecef8ad9ca31a8372d0c353", - id="f174be97-19b1-40d6-954d-70cd5fbd52db", - action={"type": "add"}, - actor={ - "ip": "17.168.228.63", - "email": "alice@example.com", - }, - before=parse_datetime("2019-04-30T01:12:20Z"), - direction="desc", - export=True, - hide_user_logs=True, - page=50, - per_page=25, - since=parse_datetime("2019-04-30T01:12:20Z"), - zone={"name": "example.com"}, - ) - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.audit_logs.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.audit_logs.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - audit_log = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.audit_logs.with_raw_response.list( - "", - )