mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-16 23:01:03 +00:00
feat(api): OpenAPI spec update via Stainless API (#148)
This commit is contained in:
parent
cfb5305aa1
commit
9f3a5e7f01
30 changed files with 1 additions and 2431 deletions
|
|
@ -1 +1 @@
|
|||
configured_endpoints: 1288
|
||||
configured_endpoints: 1284
|
||||
|
|
|
|||
40
api.md
40
api.md
|
|
@ -1688,32 +1688,6 @@ Methods:
|
|||
- <code title="post /zones/{zone_id}/dns_records/import">client.dns.records.<a href="./src/cloudflare/resources/dns/records.py">import\_</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/dns/record_import_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/record_import_response.py">RecordImportResponse</a></code>
|
||||
- <code title="post /zones/{zone_id}/dns_records/scan">client.dns.records.<a href="./src/cloudflare/resources/dns/records.py">scan</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dns/record_scan_response.py">RecordScanResponse</a></code>
|
||||
|
||||
## Analytics
|
||||
|
||||
### Reports
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /zones/{identifier}/dns_analytics/report">client.dns.analytics.reports.<a href="./src/cloudflare/resources/dns/analytics/reports/reports.py">get</a>(identifier, \*\*<a href="src/cloudflare/types/dns/analytics/report_get_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py">DNSDNSAnalyticsAPIReport</a></code>
|
||||
|
||||
#### Bytimes
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /zones/{identifier}/dns_analytics/report/bytime">client.dns.analytics.reports.bytimes.<a href="./src/cloudflare/resources/dns/analytics/reports/bytimes.py">get</a>(identifier, \*\*<a href="src/cloudflare/types/dns/analytics/reports/bytime_get_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py">DNSDNSAnalyticsAPIReportBytime</a></code>
|
||||
|
||||
## Firewall
|
||||
|
||||
Types:
|
||||
|
|
@ -1730,20 +1704,6 @@ Methods:
|
|||
- <code title="patch /accounts/{account_id}/dns_firewall/{dns_firewall_id}">client.dns.firewall.<a href="./src/cloudflare/resources/dns/firewall/firewall.py">edit</a>(dns_firewall_id, \*, account_id, \*\*<a href="src/cloudflare/types/dns/firewall_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/dns_firewall_dns_firewall.py">DNSFirewallDNSFirewall</a></code>
|
||||
- <code title="get /accounts/{account_id}/dns_firewall/{dns_firewall_id}">client.dns.firewall.<a href="./src/cloudflare/resources/dns/firewall/firewall.py">get</a>(dns_firewall_id, \*, account_id) -> <a href="./src/cloudflare/types/dns/dns_firewall_dns_firewall.py">DNSFirewallDNSFirewall</a></code>
|
||||
|
||||
### Analytics
|
||||
|
||||
#### Reports
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report">client.dns.firewall.analytics.reports.<a href="./src/cloudflare/resources/dns/firewall/analytics/reports/reports.py">get</a>(identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/dns/firewall/analytics/report_get_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py">DNSDNSAnalyticsAPIReport</a></code>
|
||||
|
||||
##### Bytimes
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime">client.dns.firewall.analytics.reports.bytimes.<a href="./src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py">get</a>(identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/dns/firewall/analytics/reports/bytime_get_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py">DNSDNSAnalyticsAPIReportBytime</a></code>
|
||||
|
||||
# DNSSEC
|
||||
|
||||
Types:
|
||||
|
|
|
|||
|
|
@ -24,14 +24,6 @@ from .firewall import (
|
|||
FirewallWithStreamingResponse,
|
||||
AsyncFirewallWithStreamingResponse,
|
||||
)
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Records",
|
||||
|
|
@ -40,12 +32,6 @@ __all__ = [
|
|||
"AsyncRecordsWithRawResponse",
|
||||
"RecordsWithStreamingResponse",
|
||||
"AsyncRecordsWithStreamingResponse",
|
||||
"Analytics",
|
||||
"AsyncAnalytics",
|
||||
"AnalyticsWithRawResponse",
|
||||
"AsyncAnalyticsWithRawResponse",
|
||||
"AnalyticsWithStreamingResponse",
|
||||
"AsyncAnalyticsWithStreamingResponse",
|
||||
"Firewall",
|
||||
"AsyncFirewall",
|
||||
"FirewallWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Reports",
|
||||
"AsyncReports",
|
||||
"ReportsWithRawResponse",
|
||||
"AsyncReportsWithRawResponse",
|
||||
"ReportsWithStreamingResponse",
|
||||
"AsyncReportsWithStreamingResponse",
|
||||
"Analytics",
|
||||
"AsyncAnalytics",
|
||||
"AnalyticsWithRawResponse",
|
||||
"AsyncAnalyticsWithRawResponse",
|
||||
"AnalyticsWithStreamingResponse",
|
||||
"AsyncAnalyticsWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .reports.reports import Reports, AsyncReports
|
||||
|
||||
__all__ = ["Analytics", "AsyncAnalytics"]
|
||||
|
||||
|
||||
class Analytics(SyncAPIResource):
|
||||
@cached_property
|
||||
def reports(self) -> Reports:
|
||||
return Reports(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AnalyticsWithRawResponse:
|
||||
return AnalyticsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AnalyticsWithStreamingResponse:
|
||||
return AnalyticsWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AsyncAnalytics(AsyncAPIResource):
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReports:
|
||||
return AsyncReports(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncAnalyticsWithRawResponse:
|
||||
return AsyncAnalyticsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse:
|
||||
return AsyncAnalyticsWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AnalyticsWithRawResponse:
|
||||
def __init__(self, analytics: Analytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> ReportsWithRawResponse:
|
||||
return ReportsWithRawResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AsyncAnalyticsWithRawResponse:
|
||||
def __init__(self, analytics: AsyncAnalytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReportsWithRawResponse:
|
||||
return AsyncReportsWithRawResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AnalyticsWithStreamingResponse:
|
||||
def __init__(self, analytics: Analytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> ReportsWithStreamingResponse:
|
||||
return ReportsWithStreamingResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AsyncAnalyticsWithStreamingResponse:
|
||||
def __init__(self, analytics: AsyncAnalytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReportsWithStreamingResponse:
|
||||
return AsyncReportsWithStreamingResponse(self._analytics.reports)
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .bytimes import (
|
||||
Bytimes,
|
||||
AsyncBytimes,
|
||||
BytimesWithRawResponse,
|
||||
AsyncBytimesWithRawResponse,
|
||||
BytimesWithStreamingResponse,
|
||||
AsyncBytimesWithStreamingResponse,
|
||||
)
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Bytimes",
|
||||
"AsyncBytimes",
|
||||
"BytimesWithRawResponse",
|
||||
"AsyncBytimesWithRawResponse",
|
||||
"BytimesWithStreamingResponse",
|
||||
"AsyncBytimesWithStreamingResponse",
|
||||
"Reports",
|
||||
"AsyncReports",
|
||||
"ReportsWithRawResponse",
|
||||
"AsyncReportsWithRawResponse",
|
||||
"ReportsWithStreamingResponse",
|
||||
"AsyncReportsWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -1,250 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Union, cast
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ....._utils import (
|
||||
maybe_transform,
|
||||
async_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 ....._wrappers import ResultWrapper
|
||||
from ....._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from .....types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime, bytime_get_params
|
||||
|
||||
__all__ = ["Bytimes", "AsyncBytimes"]
|
||||
|
||||
|
||||
class Bytimes(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> BytimesWithRawResponse:
|
||||
return BytimesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> BytimesWithStreamingResponse:
|
||||
return BytimesWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReportBytime:
|
||||
"""
|
||||
Retrieves a list of aggregate metrics grouped by time interval.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
time_delta: Unit of time to group data by.
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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 identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return self._get(
|
||||
f"/zones/{identifier}/dns_analytics/report/bytime",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"time_delta": time_delta,
|
||||
"until": until,
|
||||
},
|
||||
bytime_get_params.BytimeGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimes(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncBytimesWithRawResponse:
|
||||
return AsyncBytimesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse:
|
||||
return AsyncBytimesWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReportBytime:
|
||||
"""
|
||||
Retrieves a list of aggregate metrics grouped by time interval.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
time_delta: Unit of time to group data by.
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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 identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return await self._get(
|
||||
f"/zones/{identifier}/dns_analytics/report/bytime",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"time_delta": time_delta,
|
||||
"until": until,
|
||||
},
|
||||
bytime_get_params.BytimeGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]),
|
||||
)
|
||||
|
||||
|
||||
class BytimesWithRawResponse:
|
||||
def __init__(self, bytimes: Bytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimesWithRawResponse:
|
||||
def __init__(self, bytimes: AsyncBytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class BytimesWithStreamingResponse:
|
||||
def __init__(self, bytimes: Bytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimesWithStreamingResponse:
|
||||
def __init__(self, bytimes: AsyncBytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
|
@ -1,271 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Union, cast
|
||||
from datetime import datetime
|
||||
|
||||
import httpx
|
||||
|
||||
from .bytimes import (
|
||||
Bytimes,
|
||||
AsyncBytimes,
|
||||
BytimesWithRawResponse,
|
||||
AsyncBytimesWithRawResponse,
|
||||
BytimesWithStreamingResponse,
|
||||
AsyncBytimesWithStreamingResponse,
|
||||
)
|
||||
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ....._utils import (
|
||||
maybe_transform,
|
||||
async_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 ....._wrappers import ResultWrapper
|
||||
from ....._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from .....types.dns.analytics import DNSDNSAnalyticsAPIReport, report_get_params
|
||||
|
||||
__all__ = ["Reports", "AsyncReports"]
|
||||
|
||||
|
||||
class Reports(SyncAPIResource):
|
||||
@cached_property
|
||||
def bytimes(self) -> Bytimes:
|
||||
return Bytimes(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> ReportsWithRawResponse:
|
||||
return ReportsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> ReportsWithStreamingResponse:
|
||||
return ReportsWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReport:
|
||||
"""
|
||||
Retrieves a list of summarised aggregate metrics over a given time period.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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 identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return self._get(
|
||||
f"/zones/{identifier}/dns_analytics/report",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"until": until,
|
||||
},
|
||||
report_get_params.ReportGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncReports(AsyncAPIResource):
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimes:
|
||||
return AsyncBytimes(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncReportsWithRawResponse:
|
||||
return AsyncReportsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncReportsWithStreamingResponse:
|
||||
return AsyncReportsWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReport:
|
||||
"""
|
||||
Retrieves a list of summarised aggregate metrics over a given time period.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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 identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return await self._get(
|
||||
f"/zones/{identifier}/dns_analytics/report",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"until": until,
|
||||
},
|
||||
report_get_params.ReportGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]),
|
||||
)
|
||||
|
||||
|
||||
class ReportsWithRawResponse:
|
||||
def __init__(self, reports: Reports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> BytimesWithRawResponse:
|
||||
return BytimesWithRawResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class AsyncReportsWithRawResponse:
|
||||
def __init__(self, reports: AsyncReports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimesWithRawResponse:
|
||||
return AsyncBytimesWithRawResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class ReportsWithStreamingResponse:
|
||||
def __init__(self, reports: Reports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> BytimesWithStreamingResponse:
|
||||
return BytimesWithStreamingResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class AsyncReportsWithStreamingResponse:
|
||||
def __init__(self, reports: AsyncReports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimesWithStreamingResponse:
|
||||
return AsyncBytimesWithStreamingResponse(self._reports.bytimes)
|
||||
|
|
@ -19,17 +19,8 @@ from .firewall import (
|
|||
AsyncFirewallWithStreamingResponse,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
from ..._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .firewall.firewall import Firewall, AsyncFirewall
|
||||
from .analytics.analytics import Analytics, AsyncAnalytics
|
||||
|
||||
__all__ = ["DNS", "AsyncDNS"]
|
||||
|
||||
|
|
@ -39,10 +30,6 @@ class DNS(SyncAPIResource):
|
|||
def records(self) -> Records:
|
||||
return Records(self._client)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> Analytics:
|
||||
return Analytics(self._client)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> Firewall:
|
||||
return Firewall(self._client)
|
||||
|
|
@ -61,10 +48,6 @@ class AsyncDNS(AsyncAPIResource):
|
|||
def records(self) -> AsyncRecords:
|
||||
return AsyncRecords(self._client)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalytics:
|
||||
return AsyncAnalytics(self._client)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> AsyncFirewall:
|
||||
return AsyncFirewall(self._client)
|
||||
|
|
@ -86,10 +69,6 @@ class DNSWithRawResponse:
|
|||
def records(self) -> RecordsWithRawResponse:
|
||||
return RecordsWithRawResponse(self._dns.records)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AnalyticsWithRawResponse:
|
||||
return AnalyticsWithRawResponse(self._dns.analytics)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> FirewallWithRawResponse:
|
||||
return FirewallWithRawResponse(self._dns.firewall)
|
||||
|
|
@ -103,10 +82,6 @@ class AsyncDNSWithRawResponse:
|
|||
def records(self) -> AsyncRecordsWithRawResponse:
|
||||
return AsyncRecordsWithRawResponse(self._dns.records)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalyticsWithRawResponse:
|
||||
return AsyncAnalyticsWithRawResponse(self._dns.analytics)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> AsyncFirewallWithRawResponse:
|
||||
return AsyncFirewallWithRawResponse(self._dns.firewall)
|
||||
|
|
@ -120,10 +95,6 @@ class DNSWithStreamingResponse:
|
|||
def records(self) -> RecordsWithStreamingResponse:
|
||||
return RecordsWithStreamingResponse(self._dns.records)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AnalyticsWithStreamingResponse:
|
||||
return AnalyticsWithStreamingResponse(self._dns.analytics)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> FirewallWithStreamingResponse:
|
||||
return FirewallWithStreamingResponse(self._dns.firewall)
|
||||
|
|
@ -137,10 +108,6 @@ class AsyncDNSWithStreamingResponse:
|
|||
def records(self) -> AsyncRecordsWithStreamingResponse:
|
||||
return AsyncRecordsWithStreamingResponse(self._dns.records)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalyticsWithStreamingResponse:
|
||||
return AsyncAnalyticsWithStreamingResponse(self._dns.analytics)
|
||||
|
||||
@cached_property
|
||||
def firewall(self) -> AsyncFirewallWithStreamingResponse:
|
||||
return AsyncFirewallWithStreamingResponse(self._dns.firewall)
|
||||
|
|
|
|||
|
|
@ -8,22 +8,8 @@ from .firewall import (
|
|||
FirewallWithStreamingResponse,
|
||||
AsyncFirewallWithStreamingResponse,
|
||||
)
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Analytics",
|
||||
"AsyncAnalytics",
|
||||
"AnalyticsWithRawResponse",
|
||||
"AsyncAnalyticsWithRawResponse",
|
||||
"AnalyticsWithStreamingResponse",
|
||||
"AsyncAnalyticsWithStreamingResponse",
|
||||
"Firewall",
|
||||
"AsyncFirewall",
|
||||
"FirewallWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Reports",
|
||||
"AsyncReports",
|
||||
"ReportsWithRawResponse",
|
||||
"AsyncReportsWithRawResponse",
|
||||
"ReportsWithStreamingResponse",
|
||||
"AsyncReportsWithStreamingResponse",
|
||||
"Analytics",
|
||||
"AsyncAnalytics",
|
||||
"AnalyticsWithRawResponse",
|
||||
"AsyncAnalyticsWithRawResponse",
|
||||
"AnalyticsWithStreamingResponse",
|
||||
"AsyncAnalyticsWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
from ....._compat import cached_property
|
||||
from ....._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .reports.reports import Reports, AsyncReports
|
||||
|
||||
__all__ = ["Analytics", "AsyncAnalytics"]
|
||||
|
||||
|
||||
class Analytics(SyncAPIResource):
|
||||
@cached_property
|
||||
def reports(self) -> Reports:
|
||||
return Reports(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AnalyticsWithRawResponse:
|
||||
return AnalyticsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AnalyticsWithStreamingResponse:
|
||||
return AnalyticsWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AsyncAnalytics(AsyncAPIResource):
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReports:
|
||||
return AsyncReports(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncAnalyticsWithRawResponse:
|
||||
return AsyncAnalyticsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse:
|
||||
return AsyncAnalyticsWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AnalyticsWithRawResponse:
|
||||
def __init__(self, analytics: Analytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> ReportsWithRawResponse:
|
||||
return ReportsWithRawResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AsyncAnalyticsWithRawResponse:
|
||||
def __init__(self, analytics: AsyncAnalytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReportsWithRawResponse:
|
||||
return AsyncReportsWithRawResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AnalyticsWithStreamingResponse:
|
||||
def __init__(self, analytics: Analytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> ReportsWithStreamingResponse:
|
||||
return ReportsWithStreamingResponse(self._analytics.reports)
|
||||
|
||||
|
||||
class AsyncAnalyticsWithStreamingResponse:
|
||||
def __init__(self, analytics: AsyncAnalytics) -> None:
|
||||
self._analytics = analytics
|
||||
|
||||
@cached_property
|
||||
def reports(self) -> AsyncReportsWithStreamingResponse:
|
||||
return AsyncReportsWithStreamingResponse(self._analytics.reports)
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .bytimes import (
|
||||
Bytimes,
|
||||
AsyncBytimes,
|
||||
BytimesWithRawResponse,
|
||||
AsyncBytimesWithRawResponse,
|
||||
BytimesWithStreamingResponse,
|
||||
AsyncBytimesWithStreamingResponse,
|
||||
)
|
||||
from .reports import (
|
||||
Reports,
|
||||
AsyncReports,
|
||||
ReportsWithRawResponse,
|
||||
AsyncReportsWithRawResponse,
|
||||
ReportsWithStreamingResponse,
|
||||
AsyncReportsWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Bytimes",
|
||||
"AsyncBytimes",
|
||||
"BytimesWithRawResponse",
|
||||
"AsyncBytimesWithRawResponse",
|
||||
"BytimesWithStreamingResponse",
|
||||
"AsyncBytimesWithStreamingResponse",
|
||||
"Reports",
|
||||
"AsyncReports",
|
||||
"ReportsWithRawResponse",
|
||||
"AsyncReportsWithRawResponse",
|
||||
"ReportsWithStreamingResponse",
|
||||
"AsyncReportsWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Union, cast
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ......_utils import (
|
||||
maybe_transform,
|
||||
async_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 ......_wrappers import ResultWrapper
|
||||
from ......_base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ......types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime
|
||||
from ......types.dns.firewall.analytics.reports import bytime_get_params
|
||||
|
||||
__all__ = ["Bytimes", "AsyncBytimes"]
|
||||
|
||||
|
||||
class Bytimes(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> BytimesWithRawResponse:
|
||||
return BytimesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> BytimesWithStreamingResponse:
|
||||
return BytimesWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReportBytime:
|
||||
"""
|
||||
Retrieves a list of aggregate metrics grouped by time interval.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
time_delta: Unit of time to group data by.
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"time_delta": time_delta,
|
||||
"until": until,
|
||||
},
|
||||
bytime_get_params.BytimeGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimes(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncBytimesWithRawResponse:
|
||||
return AsyncBytimesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse:
|
||||
return AsyncBytimesWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReportBytime:
|
||||
"""
|
||||
Retrieves a list of aggregate metrics grouped by time interval.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
time_delta: Unit of time to group data by.
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"time_delta": time_delta,
|
||||
"until": until,
|
||||
},
|
||||
bytime_get_params.BytimeGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]),
|
||||
)
|
||||
|
||||
|
||||
class BytimesWithRawResponse:
|
||||
def __init__(self, bytimes: Bytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimesWithRawResponse:
|
||||
def __init__(self, bytimes: AsyncBytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class BytimesWithStreamingResponse:
|
||||
def __init__(self, bytimes: Bytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncBytimesWithStreamingResponse:
|
||||
def __init__(self, bytimes: AsyncBytimes) -> None:
|
||||
self._bytimes = bytimes
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
bytimes.get,
|
||||
)
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Union, cast
|
||||
from datetime import datetime
|
||||
|
||||
import httpx
|
||||
|
||||
from .bytimes import (
|
||||
Bytimes,
|
||||
AsyncBytimes,
|
||||
BytimesWithRawResponse,
|
||||
AsyncBytimesWithRawResponse,
|
||||
BytimesWithStreamingResponse,
|
||||
AsyncBytimesWithStreamingResponse,
|
||||
)
|
||||
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ......_utils import (
|
||||
maybe_transform,
|
||||
async_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 ......_wrappers import ResultWrapper
|
||||
from ......_base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ......types.dns.analytics import DNSDNSAnalyticsAPIReport
|
||||
from ......types.dns.firewall.analytics import report_get_params
|
||||
|
||||
__all__ = ["Reports", "AsyncReports"]
|
||||
|
||||
|
||||
class Reports(SyncAPIResource):
|
||||
@cached_property
|
||||
def bytimes(self) -> Bytimes:
|
||||
return Bytimes(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> ReportsWithRawResponse:
|
||||
return ReportsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> ReportsWithStreamingResponse:
|
||||
return ReportsWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReport:
|
||||
"""
|
||||
Retrieves a list of summarised aggregate metrics over a given time period.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"until": until,
|
||||
},
|
||||
report_get_params.ReportGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncReports(AsyncAPIResource):
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimes:
|
||||
return AsyncBytimes(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncReportsWithRawResponse:
|
||||
return AsyncReportsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncReportsWithStreamingResponse:
|
||||
return AsyncReportsWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
dimensions: str | NotGiven = NOT_GIVEN,
|
||||
filters: str | NotGiven = NOT_GIVEN,
|
||||
limit: int | NotGiven = NOT_GIVEN,
|
||||
metrics: str | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
sort: str | NotGiven = NOT_GIVEN,
|
||||
until: Union[str, datetime] | 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,
|
||||
) -> DNSDNSAnalyticsAPIReport:
|
||||
"""
|
||||
Retrieves a list of summarised aggregate metrics over a given time period.
|
||||
|
||||
See
|
||||
[Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
|
||||
for detailed information about the available query parameters.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
identifier: Identifier
|
||||
|
||||
dimensions: A comma-separated list of dimensions to group results by.
|
||||
|
||||
filters: Segmentation filter in 'attribute operator value' format.
|
||||
|
||||
limit: Limit number of returned metrics.
|
||||
|
||||
metrics: A comma-separated list of metrics to query.
|
||||
|
||||
since: Start date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
sort: A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
|
||||
until: End date and time of requesting data period in ISO 8601 format.
|
||||
|
||||
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}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dimensions": dimensions,
|
||||
"filters": filters,
|
||||
"limit": limit,
|
||||
"metrics": metrics,
|
||||
"since": since,
|
||||
"sort": sort,
|
||||
"until": until,
|
||||
},
|
||||
report_get_params.ReportGetParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]),
|
||||
)
|
||||
|
||||
|
||||
class ReportsWithRawResponse:
|
||||
def __init__(self, reports: Reports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> BytimesWithRawResponse:
|
||||
return BytimesWithRawResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class AsyncReportsWithRawResponse:
|
||||
def __init__(self, reports: AsyncReports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimesWithRawResponse:
|
||||
return AsyncBytimesWithRawResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class ReportsWithStreamingResponse:
|
||||
def __init__(self, reports: Reports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> BytimesWithStreamingResponse:
|
||||
return BytimesWithStreamingResponse(self._reports.bytimes)
|
||||
|
||||
|
||||
class AsyncReportsWithStreamingResponse:
|
||||
def __init__(self, reports: AsyncReports) -> None:
|
||||
self._reports = reports
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
reports.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def bytimes(self) -> AsyncBytimesWithStreamingResponse:
|
||||
return AsyncBytimesWithStreamingResponse(self._reports.bytimes)
|
||||
|
|
@ -11,14 +11,6 @@ from ...._utils import (
|
|||
maybe_transform,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from .analytics import (
|
||||
Analytics,
|
||||
AsyncAnalytics,
|
||||
AnalyticsWithRawResponse,
|
||||
AsyncAnalyticsWithRawResponse,
|
||||
AnalyticsWithStreamingResponse,
|
||||
AsyncAnalyticsWithStreamingResponse,
|
||||
)
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
|
|
@ -40,16 +32,11 @@ from ...._base_client import (
|
|||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from .analytics.analytics import Analytics, AsyncAnalytics
|
||||
|
||||
__all__ = ["Firewall", "AsyncFirewall"]
|
||||
|
||||
|
||||
class Firewall(SyncAPIResource):
|
||||
@cached_property
|
||||
def analytics(self) -> Analytics:
|
||||
return Analytics(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> FirewallWithRawResponse:
|
||||
return FirewallWithRawResponse(self)
|
||||
|
|
@ -383,10 +370,6 @@ class Firewall(SyncAPIResource):
|
|||
|
||||
|
||||
class AsyncFirewall(AsyncAPIResource):
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalytics:
|
||||
return AsyncAnalytics(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncFirewallWithRawResponse:
|
||||
return AsyncFirewallWithRawResponse(self)
|
||||
|
|
@ -739,10 +722,6 @@ class FirewallWithRawResponse:
|
|||
firewall.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AnalyticsWithRawResponse:
|
||||
return AnalyticsWithRawResponse(self._firewall.analytics)
|
||||
|
||||
|
||||
class AsyncFirewallWithRawResponse:
|
||||
def __init__(self, firewall: AsyncFirewall) -> None:
|
||||
|
|
@ -764,10 +743,6 @@ class AsyncFirewallWithRawResponse:
|
|||
firewall.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalyticsWithRawResponse:
|
||||
return AsyncAnalyticsWithRawResponse(self._firewall.analytics)
|
||||
|
||||
|
||||
class FirewallWithStreamingResponse:
|
||||
def __init__(self, firewall: Firewall) -> None:
|
||||
|
|
@ -789,10 +764,6 @@ class FirewallWithStreamingResponse:
|
|||
firewall.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AnalyticsWithStreamingResponse:
|
||||
return AnalyticsWithStreamingResponse(self._firewall.analytics)
|
||||
|
||||
|
||||
class AsyncFirewallWithStreamingResponse:
|
||||
def __init__(self, firewall: AsyncFirewall) -> None:
|
||||
|
|
@ -813,7 +784,3 @@ class AsyncFirewallWithStreamingResponse:
|
|||
self.get = async_to_streamed_response_wrapper(
|
||||
firewall.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def analytics(self) -> AsyncAnalyticsWithStreamingResponse:
|
||||
return AsyncAnalyticsWithStreamingResponse(self._firewall.analytics)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .report_get_params import ReportGetParams as ReportGetParams
|
||||
from .dns_dns_analytics_api_report import DNSDNSAnalyticsAPIReport as DNSDNSAnalyticsAPIReport
|
||||
|
|
|
|||
|
|
@ -1,79 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["DNSDNSAnalyticsAPIReport", "Data", "Query"]
|
||||
|
||||
|
||||
class Data(BaseModel):
|
||||
dimensions: List[str]
|
||||
"""
|
||||
Array of dimension values, representing the combination of dimension values
|
||||
corresponding to this row.
|
||||
"""
|
||||
|
||||
metrics: List[float]
|
||||
"""Array with one item per requested metric. Each item is a single value."""
|
||||
|
||||
|
||||
class Query(BaseModel):
|
||||
dimensions: List[str]
|
||||
"""Array of dimension names."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: List[str]
|
||||
"""Array of metric names."""
|
||||
|
||||
since: datetime
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
until: datetime
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
filters: Optional[str] = None
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
sort: Optional[List[str]] = None
|
||||
"""
|
||||
Array of dimensions to sort by, where each dimension may be prefixed by -
|
||||
(descending) or + (ascending).
|
||||
"""
|
||||
|
||||
|
||||
class DNSDNSAnalyticsAPIReport(BaseModel):
|
||||
data: List[Data]
|
||||
"""Array with one row per combination of dimension values."""
|
||||
|
||||
data_lag: float
|
||||
"""
|
||||
Number of seconds between current time and last processed event, in another
|
||||
words how many seconds of data could be missing.
|
||||
"""
|
||||
|
||||
max: object
|
||||
"""Maximum results for each metric (object mapping metric names to values).
|
||||
|
||||
Currently always an empty object.
|
||||
"""
|
||||
|
||||
min: object
|
||||
"""Minimum results for each metric (object mapping metric names to values).
|
||||
|
||||
Currently always an empty object.
|
||||
"""
|
||||
|
||||
query: Query
|
||||
|
||||
rows: float
|
||||
"""Total number of rows in the result."""
|
||||
|
||||
totals: object
|
||||
"""
|
||||
Total results for metrics across all data (object mapping metric names to
|
||||
values).
|
||||
"""
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
from ...._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ReportGetParams"]
|
||||
|
||||
|
||||
class ReportGetParams(TypedDict, total=False):
|
||||
dimensions: str
|
||||
"""A comma-separated list of dimensions to group results by."""
|
||||
|
||||
filters: str
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: str
|
||||
"""A comma-separated list of metrics to query."""
|
||||
|
||||
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
sort: str
|
||||
"""
|
||||
A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
"""
|
||||
|
||||
until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .bytime_get_params import BytimeGetParams as BytimeGetParams
|
||||
from .dns_dns_analytics_api_report_bytime import DNSDNSAnalyticsAPIReportBytime as DNSDNSAnalyticsAPIReportBytime
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal, Annotated, TypedDict
|
||||
|
||||
from ....._utils import PropertyInfo
|
||||
|
||||
__all__ = ["BytimeGetParams"]
|
||||
|
||||
|
||||
class BytimeGetParams(TypedDict, total=False):
|
||||
dimensions: str
|
||||
"""A comma-separated list of dimensions to group results by."""
|
||||
|
||||
filters: str
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: str
|
||||
"""A comma-separated list of metrics to query."""
|
||||
|
||||
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
sort: str
|
||||
"""
|
||||
A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
"""
|
||||
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
"""Unit of time to group data by."""
|
||||
|
||||
until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ....._models import BaseModel
|
||||
|
||||
__all__ = ["DNSDNSAnalyticsAPIReportBytime", "Data", "Query"]
|
||||
|
||||
|
||||
class Data(BaseModel):
|
||||
dimensions: List[str]
|
||||
"""
|
||||
Array of dimension values, representing the combination of dimension values
|
||||
corresponding to this row.
|
||||
"""
|
||||
|
||||
metrics: List[List[object]]
|
||||
"""Array with one item per requested metric.
|
||||
|
||||
Each item is an array of values, broken down by time interval.
|
||||
"""
|
||||
|
||||
|
||||
class Query(BaseModel):
|
||||
dimensions: List[str]
|
||||
"""Array of dimension names."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: List[str]
|
||||
"""Array of metric names."""
|
||||
|
||||
since: datetime
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
"""Unit of time to group data by."""
|
||||
|
||||
until: datetime
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
filters: Optional[str] = None
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
sort: Optional[List[str]] = None
|
||||
"""
|
||||
Array of dimensions to sort by, where each dimension may be prefixed by -
|
||||
(descending) or + (ascending).
|
||||
"""
|
||||
|
||||
|
||||
class DNSDNSAnalyticsAPIReportBytime(BaseModel):
|
||||
data: List[Data]
|
||||
"""Array with one row per combination of dimension values."""
|
||||
|
||||
data_lag: float
|
||||
"""
|
||||
Number of seconds between current time and last processed event, in another
|
||||
words how many seconds of data could be missing.
|
||||
"""
|
||||
|
||||
max: object
|
||||
"""Maximum results for each metric (object mapping metric names to values).
|
||||
|
||||
Currently always an empty object.
|
||||
"""
|
||||
|
||||
min: object
|
||||
"""Minimum results for each metric (object mapping metric names to values).
|
||||
|
||||
Currently always an empty object.
|
||||
"""
|
||||
|
||||
query: Query
|
||||
|
||||
rows: float
|
||||
"""Total number of rows in the result."""
|
||||
|
||||
time_intervals: List[List[datetime]]
|
||||
"""Array of time intervals in the response data.
|
||||
|
||||
Each interval is represented as an array containing two values: the start time,
|
||||
and the end time.
|
||||
"""
|
||||
|
||||
totals: object
|
||||
"""
|
||||
Total results for metrics across all data (object mapping metric names to
|
||||
values).
|
||||
"""
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .report_get_params import ReportGetParams as ReportGetParams
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Required, Annotated, TypedDict
|
||||
|
||||
from ....._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ReportGetParams"]
|
||||
|
||||
|
||||
class ReportGetParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dimensions: str
|
||||
"""A comma-separated list of dimensions to group results by."""
|
||||
|
||||
filters: str
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: str
|
||||
"""A comma-separated list of metrics to query."""
|
||||
|
||||
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
sort: str
|
||||
"""
|
||||
A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
"""
|
||||
|
||||
until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .bytime_get_params import BytimeGetParams as BytimeGetParams
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ......_utils import PropertyInfo
|
||||
|
||||
__all__ = ["BytimeGetParams"]
|
||||
|
||||
|
||||
class BytimeGetParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dimensions: str
|
||||
"""A comma-separated list of dimensions to group results by."""
|
||||
|
||||
filters: str
|
||||
"""Segmentation filter in 'attribute operator value' format."""
|
||||
|
||||
limit: int
|
||||
"""Limit number of returned metrics."""
|
||||
|
||||
metrics: str
|
||||
"""A comma-separated list of metrics to query."""
|
||||
|
||||
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Start date and time of requesting data period in ISO 8601 format."""
|
||||
|
||||
sort: str
|
||||
"""
|
||||
A comma-separated list of dimensions to sort by, where each dimension may be
|
||||
prefixed by - (descending) or + (ascending).
|
||||
"""
|
||||
|
||||
time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"]
|
||||
"""Unit of time to group data by."""
|
||||
|
||||
until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""End date and time of requesting data period in ISO 8601 format."""
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
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._utils import parse_datetime
|
||||
from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestBytimes:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
bytime = client.dns.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
|
||||
bytime = client.dns.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
time_delta="hour",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.dns.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
bytime = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.dns.analytics.reports.bytimes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
bytime = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
client.dns.analytics.reports.bytimes.with_raw_response.get(
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncBytimes:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
bytime = await async_client.dns.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
bytime = await async_client.dns.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
time_delta="hour",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.dns.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
bytime = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.dns.analytics.reports.bytimes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
bytime = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
await async_client.dns.analytics.reports.bytimes.with_raw_response.get(
|
||||
"",
|
||||
)
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
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._utils import parse_datetime
|
||||
from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestReports:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
report = client.dns.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
|
||||
report = client.dns.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.dns.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
report = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.dns.analytics.reports.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
report = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
client.dns.analytics.reports.with_raw_response.get(
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncReports:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
report = await async_client.dns.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
report = await async_client.dns.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.dns.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
report = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.dns.analytics.reports.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
report = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
await async_client.dns.analytics.reports.with_raw_response.get(
|
||||
"",
|
||||
)
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
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._utils import parse_datetime
|
||||
from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestBytimes:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
bytime = client.dns.firewall.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
|
||||
bytime = client.dns.firewall.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
time_delta="hour",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
bytime = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.dns.firewall.analytics.reports.bytimes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
bytime = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncBytimes:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
bytime = await async_client.dns.firewall.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
bytime = await async_client.dns.firewall.analytics.reports.bytimes.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
time_delta="hour",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
bytime = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.dns.firewall.analytics.reports.bytimes.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
bytime = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
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._utils import parse_datetime
|
||||
from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestReports:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
report = client.dns.firewall.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
|
||||
report = client.dns.firewall.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
report = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.dns.firewall.analytics.reports.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
report = response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncReports:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
report = await async_client.dns.firewall.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
report = await async_client.dns.firewall.analytics.reports.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dimensions="queryType",
|
||||
filters="responseCode==NOERROR,queryType==A",
|
||||
limit=100,
|
||||
metrics="queryCount,uncachedCount",
|
||||
since=parse_datetime("2023-11-11T12:00:00Z"),
|
||||
sort="+responseCode,-queryName",
|
||||
until=parse_datetime("2023-11-11T13:00:00Z"),
|
||||
)
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
report = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.dns.firewall.analytics.reports.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
report = await response.parse()
|
||||
assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
await async_client.dns.firewall.analytics.reports.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue