mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-17 07:10:37 +00:00
feat(api): update via SDK Studio (#1089)
This commit is contained in:
parent
0d97401137
commit
b02a3a6c0f
28 changed files with 2336 additions and 49 deletions
|
|
@ -1,2 +1,2 @@
|
|||
configured_endpoints: 1348
|
||||
configured_endpoints: 1356
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-08b201ef13ebb4bdf13a4d2e2165229fc6e5a369c64cf4a108835b65996cd957.yml
|
||||
|
|
|
|||
50
api.md
50
api.md
|
|
@ -4637,6 +4637,7 @@ from cloudflare.types.stream.captions import LanguageDeleteResponse
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/stream/{identifier}/captions/{language}/generate">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">create</a>(language, \*, account_id, identifier) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>
|
||||
- <code title="put /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">update</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/captions/language_update_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>
|
||||
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">delete</a>(language, \*, account_id, identifier) -> <a href="./src/cloudflare/types/stream/captions/language_delete_response.py">str</a></code>
|
||||
- <code title="get /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">get</a>(language, \*, account_id, identifier) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>
|
||||
|
|
@ -6165,6 +6166,26 @@ Methods:
|
|||
- <code title="delete /accounts/{account_id}/gateway/rules/{rule_id}">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">delete</a>(rule_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/rule_delete_response.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_id}/gateway/rules/{rule_id}">client.zero_trust.gateway.rules.<a href="./src/cloudflare/resources/zero_trust/gateway/rules.py">get</a>(rule_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/gateway_rule.py">Optional</a></code>
|
||||
|
||||
### Certificates
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.zero_trust.gateway import (
|
||||
CertificateCreateResponse,
|
||||
CertificateListResponse,
|
||||
CertificateDeleteResponse,
|
||||
CertificateGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/gateway/certificates">client.zero_trust.gateway.certificates.<a href="./src/cloudflare/resources/zero_trust/gateway/certificates.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/gateway/certificate_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/gateway/certificate_create_response.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_id}/gateway/certificates">client.zero_trust.gateway.certificates.<a href="./src/cloudflare/resources/zero_trust/gateway/certificates.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/certificate_list_response.py">SyncSinglePage[CertificateListResponse]</a></code>
|
||||
- <code title="delete /accounts/{account_id}/gateway/certificates/{certificate_id}">client.zero_trust.gateway.certificates.<a href="./src/cloudflare/resources/zero_trust/gateway/certificates.py">delete</a>(certificate_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/certificate_delete_response.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_id}/gateway/certificates/{certificate_id}">client.zero_trust.gateway.certificates.<a href="./src/cloudflare/resources/zero_trust/gateway/certificates.py">get</a>(certificate_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/gateway/certificate_get_response.py">Optional</a></code>
|
||||
|
||||
## Networks
|
||||
|
||||
### Routes
|
||||
|
|
@ -7865,12 +7886,37 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway import LogGetResponse
|
||||
from cloudflare.types.ai_gateway import LogListResponse, LogGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs">client.ai_gateway.logs.<a href="./src/cloudflare/resources/ai_gateway/logs.py">get</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/ai_gateway/log_get_params.py">params</a>) -> <a href="./src/cloudflare/types/ai_gateway/log_get_response.py">LogGetResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs">client.ai_gateway.logs.<a href="./src/cloudflare/resources/ai_gateway/logs/logs.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/ai_gateway/log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/ai_gateway/log_list_response.py">SyncV4PagePaginationArray[LogListResponse]</a></code>
|
||||
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}">client.ai_gateway.logs.<a href="./src/cloudflare/resources/ai_gateway/logs/logs.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/log_get_response.py">LogGetResponse</a></code>
|
||||
|
||||
### Request
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway.logs import RequestGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}/request">client.ai_gateway.logs.request.<a href="./src/cloudflare/resources/ai_gateway/logs/request.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/logs/request_get_response.py">object</a></code>
|
||||
|
||||
### Response
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway.logs import ResponseGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}/response">client.ai_gateway.logs.response.<a href="./src/cloudflare/resources/ai_gateway/logs/response.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/logs/response_get_response.py">object</a></code>
|
||||
|
||||
# IAM
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ from ..._utils import (
|
|||
async_maybe_transform,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
from .logs.logs import LogsResource, AsyncLogsResource
|
||||
from ..._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ..._response import (
|
||||
to_raw_response_wrapper,
|
||||
|
|
|
|||
47
src/cloudflare/resources/ai_gateway/logs/__init__.py
Normal file
47
src/cloudflare/resources/ai_gateway/logs/__init__.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .logs import (
|
||||
LogsResource,
|
||||
AsyncLogsResource,
|
||||
LogsResourceWithRawResponse,
|
||||
AsyncLogsResourceWithRawResponse,
|
||||
LogsResourceWithStreamingResponse,
|
||||
AsyncLogsResourceWithStreamingResponse,
|
||||
)
|
||||
from .request import (
|
||||
RequestResource,
|
||||
AsyncRequestResource,
|
||||
RequestResourceWithRawResponse,
|
||||
AsyncRequestResourceWithRawResponse,
|
||||
RequestResourceWithStreamingResponse,
|
||||
AsyncRequestResourceWithStreamingResponse,
|
||||
)
|
||||
from .response import (
|
||||
ResponseResource,
|
||||
AsyncResponseResource,
|
||||
ResponseResourceWithRawResponse,
|
||||
AsyncResponseResourceWithRawResponse,
|
||||
ResponseResourceWithStreamingResponse,
|
||||
AsyncResponseResourceWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"RequestResource",
|
||||
"AsyncRequestResource",
|
||||
"RequestResourceWithRawResponse",
|
||||
"AsyncRequestResourceWithRawResponse",
|
||||
"RequestResourceWithStreamingResponse",
|
||||
"AsyncRequestResourceWithStreamingResponse",
|
||||
"ResponseResource",
|
||||
"AsyncResponseResource",
|
||||
"ResponseResourceWithRawResponse",
|
||||
"AsyncResponseResourceWithRawResponse",
|
||||
"ResponseResourceWithStreamingResponse",
|
||||
"AsyncResponseResourceWithStreamingResponse",
|
||||
"LogsResource",
|
||||
"AsyncLogsResource",
|
||||
"LogsResourceWithRawResponse",
|
||||
"AsyncLogsResourceWithRawResponse",
|
||||
"LogsResourceWithStreamingResponse",
|
||||
"AsyncLogsResourceWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -8,30 +8,54 @@ 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 .request import (
|
||||
RequestResource,
|
||||
AsyncRequestResource,
|
||||
RequestResourceWithRawResponse,
|
||||
AsyncRequestResourceWithRawResponse,
|
||||
RequestResourceWithStreamingResponse,
|
||||
AsyncRequestResourceWithStreamingResponse,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
from ..._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ..._response import (
|
||||
from .response import (
|
||||
ResponseResource,
|
||||
AsyncResponseResource,
|
||||
ResponseResourceWithRawResponse,
|
||||
AsyncResponseResourceWithRawResponse,
|
||||
ResponseResourceWithStreamingResponse,
|
||||
AsyncResponseResourceWithStreamingResponse,
|
||||
)
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._utils import maybe_transform
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ..._wrappers import ResultWrapper
|
||||
from ..._base_client import (
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
from ...._base_client import (
|
||||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from ...types.ai_gateway import log_get_params
|
||||
from ...types.ai_gateway.log_get_response import LogGetResponse
|
||||
from ....types.ai_gateway import log_list_params
|
||||
from ....types.ai_gateway.log_get_response import LogGetResponse
|
||||
from ....types.ai_gateway.log_list_response import LogListResponse
|
||||
|
||||
__all__ = ["LogsResource", "AsyncLogsResource"]
|
||||
|
||||
|
||||
class LogsResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def request(self) -> RequestResource:
|
||||
return RequestResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResource:
|
||||
return ResponseResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> LogsResourceWithRawResponse:
|
||||
return LogsResourceWithRawResponse(self)
|
||||
|
|
@ -40,7 +64,7 @@ class LogsResource(SyncAPIResource):
|
|||
def with_streaming_response(self) -> LogsResourceWithStreamingResponse:
|
||||
return LogsResourceWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
def list(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
|
|
@ -60,7 +84,7 @@ class LogsResource(SyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> LogGetResponse:
|
||||
) -> SyncV4PagePaginationArray[LogListResponse]:
|
||||
"""
|
||||
List Gateway Logs
|
||||
|
||||
|
|
@ -79,8 +103,9 @@ class LogsResource(SyncAPIResource):
|
|||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return self._get(
|
||||
return self._get_api_list(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs",
|
||||
page=SyncV4PagePaginationArray[LogListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
|
|
@ -98,8 +123,52 @@ class LogsResource(SyncAPIResource):
|
|||
"start_date": start_date,
|
||||
"success": success,
|
||||
},
|
||||
log_get_params.LogGetParams,
|
||||
log_list_params.LogListParams,
|
||||
),
|
||||
),
|
||||
model=LogListResponse,
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> LogGetResponse:
|
||||
"""
|
||||
Get Gateway Log Detail
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[LogGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LogGetResponse], ResultWrapper[LogGetResponse]),
|
||||
|
|
@ -107,6 +176,14 @@ class LogsResource(SyncAPIResource):
|
|||
|
||||
|
||||
class AsyncLogsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResource:
|
||||
return AsyncRequestResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResource:
|
||||
return AsyncResponseResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse:
|
||||
return AsyncLogsResourceWithRawResponse(self)
|
||||
|
|
@ -115,7 +192,7 @@ class AsyncLogsResource(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse:
|
||||
return AsyncLogsResourceWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
def list(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
|
|
@ -135,7 +212,7 @@ class AsyncLogsResource(AsyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> LogGetResponse:
|
||||
) -> AsyncPaginator[LogListResponse, AsyncV4PagePaginationArray[LogListResponse]]:
|
||||
"""
|
||||
List Gateway Logs
|
||||
|
||||
|
|
@ -154,14 +231,15 @@ class AsyncLogsResource(AsyncAPIResource):
|
|||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return await self._get(
|
||||
return self._get_api_list(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs",
|
||||
page=AsyncV4PagePaginationArray[LogListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
query=maybe_transform(
|
||||
{
|
||||
"cached": cached,
|
||||
"direction": direction,
|
||||
|
|
@ -173,8 +251,52 @@ class AsyncLogsResource(AsyncAPIResource):
|
|||
"start_date": start_date,
|
||||
"success": success,
|
||||
},
|
||||
log_get_params.LogGetParams,
|
||||
log_list_params.LogListParams,
|
||||
),
|
||||
),
|
||||
model=LogListResponse,
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> LogGetResponse:
|
||||
"""
|
||||
Get Gateway Log Detail
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[LogGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LogGetResponse], ResultWrapper[LogGetResponse]),
|
||||
|
|
@ -185,33 +307,77 @@ class LogsResourceWithRawResponse:
|
|||
def __init__(self, logs: LogsResource) -> None:
|
||||
self._logs = logs
|
||||
|
||||
self.list = to_raw_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> RequestResourceWithRawResponse:
|
||||
return RequestResourceWithRawResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResourceWithRawResponse:
|
||||
return ResponseResourceWithRawResponse(self._logs.response)
|
||||
|
||||
|
||||
class AsyncLogsResourceWithRawResponse:
|
||||
def __init__(self, logs: AsyncLogsResource) -> None:
|
||||
self._logs = logs
|
||||
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResourceWithRawResponse:
|
||||
return AsyncRequestResourceWithRawResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResourceWithRawResponse:
|
||||
return AsyncResponseResourceWithRawResponse(self._logs.response)
|
||||
|
||||
|
||||
class LogsResourceWithStreamingResponse:
|
||||
def __init__(self, logs: LogsResource) -> None:
|
||||
self._logs = logs
|
||||
|
||||
self.list = to_streamed_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> RequestResourceWithStreamingResponse:
|
||||
return RequestResourceWithStreamingResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResourceWithStreamingResponse:
|
||||
return ResponseResourceWithStreamingResponse(self._logs.response)
|
||||
|
||||
|
||||
class AsyncLogsResourceWithStreamingResponse:
|
||||
def __init__(self, logs: AsyncLogsResource) -> None:
|
||||
self._logs = logs
|
||||
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResourceWithStreamingResponse:
|
||||
return AsyncRequestResourceWithStreamingResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResourceWithStreamingResponse:
|
||||
return AsyncResponseResourceWithStreamingResponse(self._logs.response)
|
||||
158
src/cloudflare/resources/ai_gateway/logs/request.py
Normal file
158
src/cloudflare/resources/ai_gateway/logs/request.py
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
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 ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
|
||||
__all__ = ["RequestResource", "AsyncRequestResource"]
|
||||
|
||||
|
||||
class RequestResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> RequestResourceWithRawResponse:
|
||||
return RequestResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> RequestResourceWithStreamingResponse:
|
||||
return RequestResourceWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Request
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/request",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncRequestResourceWithRawResponse:
|
||||
return AsyncRequestResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncRequestResourceWithStreamingResponse:
|
||||
return AsyncRequestResourceWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Request
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/request",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class RequestResourceWithRawResponse:
|
||||
def __init__(self, request: RequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResourceWithRawResponse:
|
||||
def __init__(self, request: AsyncRequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class RequestResourceWithStreamingResponse:
|
||||
def __init__(self, request: RequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResourceWithStreamingResponse:
|
||||
def __init__(self, request: AsyncRequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
158
src/cloudflare/resources/ai_gateway/logs/response.py
Normal file
158
src/cloudflare/resources/ai_gateway/logs/response.py
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
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 ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
|
||||
__all__ = ["ResponseResource", "AsyncResponseResource"]
|
||||
|
||||
|
||||
class ResponseResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> ResponseResourceWithRawResponse:
|
||||
return ResponseResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> ResponseResourceWithStreamingResponse:
|
||||
return ResponseResourceWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Response
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/response",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncResponseResourceWithRawResponse:
|
||||
return AsyncResponseResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncResponseResourceWithStreamingResponse:
|
||||
return AsyncResponseResourceWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# 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,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Response
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/response",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class ResponseResourceWithRawResponse:
|
||||
def __init__(self, response: ResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResourceWithRawResponse:
|
||||
def __init__(self, response: AsyncResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class ResponseResourceWithStreamingResponse:
|
||||
def __init__(self, response: ResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResourceWithStreamingResponse:
|
||||
def __init__(self, response: AsyncResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
|
@ -51,6 +51,55 @@ class LanguageResource(SyncAPIResource):
|
|||
def with_streaming_response(self) -> LanguageResourceWithStreamingResponse:
|
||||
return LanguageResourceWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
language: str,
|
||||
*,
|
||||
account_id: str,
|
||||
identifier: str,
|
||||
# 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,
|
||||
) -> Optional[Caption]:
|
||||
"""
|
||||
Generate captions or subtitles for provided language via AI.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
identifier: A Cloudflare-generated unique identifier for a media item.
|
||||
|
||||
language: The language tag in BCP 47 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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
if not language:
|
||||
raise ValueError(f"Expected a non-empty value for `language` but received {language!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/stream/{identifier}/captions/{language}/generate",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[Caption]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
language: str,
|
||||
|
|
@ -217,6 +266,55 @@ class AsyncLanguageResource(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncLanguageResourceWithStreamingResponse:
|
||||
return AsyncLanguageResourceWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
language: str,
|
||||
*,
|
||||
account_id: str,
|
||||
identifier: str,
|
||||
# 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,
|
||||
) -> Optional[Caption]:
|
||||
"""
|
||||
Generate captions or subtitles for provided language via AI.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
identifier: A Cloudflare-generated unique identifier for a media item.
|
||||
|
||||
language: The language tag in BCP 47 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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
|
||||
if not language:
|
||||
raise ValueError(f"Expected a non-empty value for `language` but received {language!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/stream/{identifier}/captions/{language}/generate",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[Caption]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[Caption]], ResultWrapper[Caption]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
language: str,
|
||||
|
|
@ -374,6 +472,9 @@ class LanguageResourceWithRawResponse:
|
|||
def __init__(self, language: LanguageResource) -> None:
|
||||
self._language = language
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
language.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
language.update,
|
||||
)
|
||||
|
|
@ -393,6 +494,9 @@ class AsyncLanguageResourceWithRawResponse:
|
|||
def __init__(self, language: AsyncLanguageResource) -> None:
|
||||
self._language = language
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
language.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
language.update,
|
||||
)
|
||||
|
|
@ -412,6 +516,9 @@ class LanguageResourceWithStreamingResponse:
|
|||
def __init__(self, language: LanguageResource) -> None:
|
||||
self._language = language
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
language.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
language.update,
|
||||
)
|
||||
|
|
@ -431,6 +538,9 @@ class AsyncLanguageResourceWithStreamingResponse:
|
|||
def __init__(self, language: AsyncLanguageResource) -> None:
|
||||
self._language = language
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
language.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
language.update,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ from .categories import (
|
|||
CategoriesResourceWithStreamingResponse,
|
||||
AsyncCategoriesResourceWithStreamingResponse,
|
||||
)
|
||||
from .certificates import (
|
||||
CertificatesResource,
|
||||
AsyncCertificatesResource,
|
||||
CertificatesResourceWithRawResponse,
|
||||
AsyncCertificatesResourceWithRawResponse,
|
||||
CertificatesResourceWithStreamingResponse,
|
||||
AsyncCertificatesResourceWithStreamingResponse,
|
||||
)
|
||||
from .configurations import (
|
||||
ConfigurationsResource,
|
||||
AsyncConfigurationsResource,
|
||||
|
|
@ -136,6 +144,12 @@ __all__ = [
|
|||
"AsyncRulesResourceWithRawResponse",
|
||||
"RulesResourceWithStreamingResponse",
|
||||
"AsyncRulesResourceWithStreamingResponse",
|
||||
"CertificatesResource",
|
||||
"AsyncCertificatesResource",
|
||||
"CertificatesResourceWithRawResponse",
|
||||
"AsyncCertificatesResourceWithRawResponse",
|
||||
"CertificatesResourceWithStreamingResponse",
|
||||
"AsyncCertificatesResourceWithStreamingResponse",
|
||||
"GatewayResource",
|
||||
"AsyncGatewayResource",
|
||||
"GatewayResourceWithRawResponse",
|
||||
|
|
|
|||
450
src/cloudflare/resources/zero_trust/gateway/certificates.py
Normal file
450
src/cloudflare/resources/zero_trust/gateway/certificates.py
Normal file
|
|
@ -0,0 +1,450 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Optional, cast
|
||||
|
||||
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 ....pagination import SyncSinglePage, AsyncSinglePage
|
||||
from ...._base_client import (
|
||||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.zero_trust.gateway import certificate_create_params
|
||||
from ....types.zero_trust.gateway.certificate_get_response import CertificateGetResponse
|
||||
from ....types.zero_trust.gateway.certificate_list_response import CertificateListResponse
|
||||
from ....types.zero_trust.gateway.certificate_create_response import CertificateCreateResponse
|
||||
from ....types.zero_trust.gateway.certificate_delete_response import CertificateDeleteResponse
|
||||
|
||||
__all__ = ["CertificatesResource", "AsyncCertificatesResource"]
|
||||
|
||||
|
||||
class CertificatesResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> CertificatesResourceWithRawResponse:
|
||||
return CertificatesResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse:
|
||||
return CertificatesResourceWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
validity_period_days: int | 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,
|
||||
) -> Optional[CertificateCreateResponse]:
|
||||
"""
|
||||
Creates a new Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
validity_period_days: Number of days the generated certificate will be valid, minimum 1 day and
|
||||
maximum 30 years. Defaults to 5 years.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/gateway/certificates",
|
||||
body=maybe_transform(
|
||||
{"validity_period_days": validity_period_days}, certificate_create_params.CertificateCreateParams
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateCreateResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateCreateResponse]], ResultWrapper[CertificateCreateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
# 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,
|
||||
) -> SyncSinglePage[CertificateListResponse]:
|
||||
"""
|
||||
Fetches all Zero Trust certificates for an account.
|
||||
|
||||
Args:
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
return self._get_api_list(
|
||||
f"/accounts/{account_id}/gateway/certificates",
|
||||
page=SyncSinglePage[CertificateListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
model=CertificateListResponse,
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
certificate_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# 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,
|
||||
) -> Optional[CertificateDeleteResponse]:
|
||||
"""
|
||||
Deletes a gateway-managed Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
certificate_id: Certificate UUID tag.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not certificate_id:
|
||||
raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/gateway/certificates/{certificate_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
certificate_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# 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,
|
||||
) -> Optional[CertificateGetResponse]:
|
||||
"""
|
||||
Fetches a single Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
certificate_id: Certificate UUID tag.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not certificate_id:
|
||||
raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/gateway/certificates/{certificate_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateGetResponse]], ResultWrapper[CertificateGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncCertificatesResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse:
|
||||
return AsyncCertificatesResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse:
|
||||
return AsyncCertificatesResourceWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
validity_period_days: int | 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,
|
||||
) -> Optional[CertificateCreateResponse]:
|
||||
"""
|
||||
Creates a new Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
validity_period_days: Number of days the generated certificate will be valid, minimum 1 day and
|
||||
maximum 30 years. Defaults to 5 years.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/gateway/certificates",
|
||||
body=await async_maybe_transform(
|
||||
{"validity_period_days": validity_period_days}, certificate_create_params.CertificateCreateParams
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateCreateResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateCreateResponse]], ResultWrapper[CertificateCreateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AsyncPaginator[CertificateListResponse, AsyncSinglePage[CertificateListResponse]]:
|
||||
"""
|
||||
Fetches all Zero Trust certificates for an account.
|
||||
|
||||
Args:
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
return self._get_api_list(
|
||||
f"/accounts/{account_id}/gateway/certificates",
|
||||
page=AsyncSinglePage[CertificateListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
model=CertificateListResponse,
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
certificate_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# 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,
|
||||
) -> Optional[CertificateDeleteResponse]:
|
||||
"""
|
||||
Deletes a gateway-managed Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
certificate_id: Certificate UUID tag.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not certificate_id:
|
||||
raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/gateway/certificates/{certificate_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateDeleteResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateDeleteResponse]], ResultWrapper[CertificateDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
certificate_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
# 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,
|
||||
) -> Optional[CertificateGetResponse]:
|
||||
"""
|
||||
Fetches a single Zero Trust certificate.
|
||||
|
||||
Args:
|
||||
certificate_id: Certificate UUID tag.
|
||||
|
||||
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_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not certificate_id:
|
||||
raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/gateway/certificates/{certificate_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[Optional[CertificateGetResponse]], ResultWrapper[CertificateGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class CertificatesResourceWithRawResponse:
|
||||
def __init__(self, certificates: CertificatesResource) -> None:
|
||||
self._certificates = certificates
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
certificates.create,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
certificates.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
certificates.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
certificates.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncCertificatesResourceWithRawResponse:
|
||||
def __init__(self, certificates: AsyncCertificatesResource) -> None:
|
||||
self._certificates = certificates
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
certificates.create,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
certificates.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
certificates.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
certificates.get,
|
||||
)
|
||||
|
||||
|
||||
class CertificatesResourceWithStreamingResponse:
|
||||
def __init__(self, certificates: CertificatesResource) -> None:
|
||||
self._certificates = certificates
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
certificates.create,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
certificates.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
certificates.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
certificates.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncCertificatesResourceWithStreamingResponse:
|
||||
def __init__(self, certificates: AsyncCertificatesResource) -> None:
|
||||
self._certificates = certificates
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
certificates.create,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
certificates.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
certificates.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
certificates.get,
|
||||
)
|
||||
|
|
@ -65,6 +65,14 @@ from ...._response import (
|
|||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from .certificates import (
|
||||
CertificatesResource,
|
||||
AsyncCertificatesResource,
|
||||
CertificatesResourceWithRawResponse,
|
||||
AsyncCertificatesResourceWithRawResponse,
|
||||
CertificatesResourceWithStreamingResponse,
|
||||
AsyncCertificatesResourceWithStreamingResponse,
|
||||
)
|
||||
from .configurations import (
|
||||
ConfigurationsResource,
|
||||
AsyncConfigurationsResource,
|
||||
|
|
@ -135,6 +143,10 @@ class GatewayResource(SyncAPIResource):
|
|||
def rules(self) -> RulesResource:
|
||||
return RulesResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> CertificatesResource:
|
||||
return CertificatesResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> GatewayResourceWithRawResponse:
|
||||
return GatewayResourceWithRawResponse(self)
|
||||
|
|
@ -255,6 +267,10 @@ class AsyncGatewayResource(AsyncAPIResource):
|
|||
def rules(self) -> AsyncRulesResource:
|
||||
return AsyncRulesResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> AsyncCertificatesResource:
|
||||
return AsyncCertificatesResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncGatewayResourceWithRawResponse:
|
||||
return AsyncGatewayResourceWithRawResponse(self)
|
||||
|
|
@ -385,6 +401,10 @@ class GatewayResourceWithRawResponse:
|
|||
def rules(self) -> RulesResourceWithRawResponse:
|
||||
return RulesResourceWithRawResponse(self._gateway.rules)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> CertificatesResourceWithRawResponse:
|
||||
return CertificatesResourceWithRawResponse(self._gateway.certificates)
|
||||
|
||||
|
||||
class AsyncGatewayResourceWithRawResponse:
|
||||
def __init__(self, gateway: AsyncGatewayResource) -> None:
|
||||
|
|
@ -433,6 +453,10 @@ class AsyncGatewayResourceWithRawResponse:
|
|||
def rules(self) -> AsyncRulesResourceWithRawResponse:
|
||||
return AsyncRulesResourceWithRawResponse(self._gateway.rules)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> AsyncCertificatesResourceWithRawResponse:
|
||||
return AsyncCertificatesResourceWithRawResponse(self._gateway.certificates)
|
||||
|
||||
|
||||
class GatewayResourceWithStreamingResponse:
|
||||
def __init__(self, gateway: GatewayResource) -> None:
|
||||
|
|
@ -481,6 +505,10 @@ class GatewayResourceWithStreamingResponse:
|
|||
def rules(self) -> RulesResourceWithStreamingResponse:
|
||||
return RulesResourceWithStreamingResponse(self._gateway.rules)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> CertificatesResourceWithStreamingResponse:
|
||||
return CertificatesResourceWithStreamingResponse(self._gateway.certificates)
|
||||
|
||||
|
||||
class AsyncGatewayResourceWithStreamingResponse:
|
||||
def __init__(self, gateway: AsyncGatewayResource) -> None:
|
||||
|
|
@ -528,3 +556,7 @@ class AsyncGatewayResourceWithStreamingResponse:
|
|||
@cached_property
|
||||
def rules(self) -> AsyncRulesResourceWithStreamingResponse:
|
||||
return AsyncRulesResourceWithStreamingResponse(self._gateway.rules)
|
||||
|
||||
@cached_property
|
||||
def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse:
|
||||
return AsyncCertificatesResourceWithStreamingResponse(self._gateway.certificates)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from .log_get_params import LogGetParams as LogGetParams
|
||||
from .log_list_params import LogListParams as LogListParams
|
||||
from .log_get_response import LogGetResponse as LogGetResponse
|
||||
from .log_list_response import LogListResponse as LogListResponse
|
||||
from .ai_gateway_list_params import AIGatewayListParams as AIGatewayListParams
|
||||
from .ai_gateway_get_response import AIGatewayGetResponse as AIGatewayGetResponse
|
||||
from .ai_gateway_create_params import AIGatewayCreateParams as AIGatewayCreateParams
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["LogGetResponse", "LogGetResponseItem"]
|
||||
__all__ = ["LogGetResponse"]
|
||||
|
||||
|
||||
class LogGetResponseItem(BaseModel):
|
||||
class LogGetResponse(BaseModel):
|
||||
id: str
|
||||
|
||||
cached: bool
|
||||
|
|
@ -44,6 +44,3 @@ class LogGetResponseItem(BaseModel):
|
|||
status_code: Optional[int] = None
|
||||
|
||||
step: Optional[int] = None
|
||||
|
||||
|
||||
LogGetResponse = List[LogGetResponseItem]
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from typing_extensions import Literal, Required, Annotated, TypedDict
|
|||
|
||||
from ..._utils import PropertyInfo
|
||||
|
||||
__all__ = ["LogGetParams"]
|
||||
__all__ = ["LogListParams"]
|
||||
|
||||
|
||||
class LogGetParams(TypedDict, total=False):
|
||||
class LogListParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
|
||||
cached: bool
|
||||
46
src/cloudflare/types/ai_gateway/log_list_response.py
Normal file
46
src/cloudflare/types/ai_gateway/log_list_response.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["LogListResponse"]
|
||||
|
||||
|
||||
class LogListResponse(BaseModel):
|
||||
id: str
|
||||
|
||||
cached: bool
|
||||
|
||||
created_at: datetime
|
||||
|
||||
duration: int
|
||||
|
||||
model: str
|
||||
|
||||
path: str
|
||||
|
||||
provider: str
|
||||
|
||||
request: str
|
||||
|
||||
response: str
|
||||
|
||||
success: bool
|
||||
|
||||
tokens_in: int
|
||||
|
||||
tokens_out: int
|
||||
|
||||
metadata: Optional[str] = None
|
||||
|
||||
request_content_type: Optional[str] = None
|
||||
|
||||
request_type: Optional[str] = None
|
||||
|
||||
response_content_type: Optional[str] = None
|
||||
|
||||
status_code: Optional[int] = None
|
||||
|
||||
step: Optional[int] = None
|
||||
3
src/cloudflare/types/ai_gateway/logs/__init__.py
Normal file
3
src/cloudflare/types/ai_gateway/logs/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -43,17 +43,22 @@ from .location_create_params import LocationCreateParams as LocationCreateParams
|
|||
from .location_network_param import LocationNetworkParam as LocationNetworkParam
|
||||
from .location_update_params import LocationUpdateParams as LocationUpdateParams
|
||||
from .extended_email_matching import ExtendedEmailMatching as ExtendedEmailMatching
|
||||
from .certificate_get_response import CertificateGetResponse as CertificateGetResponse
|
||||
from .dns_resolver_settings_v4 import DNSResolverSettingsV4 as DNSResolverSettingsV4
|
||||
from .dns_resolver_settings_v6 import DNSResolverSettingsV6 as DNSResolverSettingsV6
|
||||
from .location_delete_response import LocationDeleteResponse as LocationDeleteResponse
|
||||
from .protocol_detection_param import ProtocolDetectionParam as ProtocolDetectionParam
|
||||
from .anti_virus_settings_param import AntiVirusSettingsParam as AntiVirusSettingsParam
|
||||
from .block_page_settings_param import BlockPageSettingsParam as BlockPageSettingsParam
|
||||
from .certificate_create_params import CertificateCreateParams as CertificateCreateParams
|
||||
from .certificate_list_response import CertificateListResponse as CertificateListResponse
|
||||
from .configuration_edit_params import ConfigurationEditParams as ConfigurationEditParams
|
||||
from .browser_isolation_settings import BrowserIsolationSettings as BrowserIsolationSettings
|
||||
from .configuration_get_response import ConfigurationGetResponse as ConfigurationGetResponse
|
||||
from .proxy_endpoint_edit_params import ProxyEndpointEditParams as ProxyEndpointEditParams
|
||||
from .activity_log_settings_param import ActivityLogSettingsParam as ActivityLogSettingsParam
|
||||
from .certificate_create_response import CertificateCreateResponse as CertificateCreateResponse
|
||||
from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse
|
||||
from .configuration_edit_response import ConfigurationEditResponse as ConfigurationEditResponse
|
||||
from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams
|
||||
from .custom_certificate_settings import CustomCertificateSettings as CustomCertificateSettings
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["CertificateCreateParams"]
|
||||
|
||||
|
||||
class CertificateCreateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
|
||||
validity_period_days: int
|
||||
"""
|
||||
Number of days the generated certificate will be valid, minimum 1 day and
|
||||
maximum 30 years. Defaults to 5 years.
|
||||
"""
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["CertificateCreateResponse"]
|
||||
|
||||
|
||||
class CertificateCreateResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Certificate UUID tag."""
|
||||
|
||||
binding_status: Optional[Literal["pending_deployment", "active", "pending_deletion", "inactive"]] = None
|
||||
"""The deployment status of the certificate on Cloudflare's edge."""
|
||||
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Use this certificate for Gateway TLS interception"""
|
||||
|
||||
expires_on: Optional[datetime] = None
|
||||
|
||||
type: Optional[Literal["custom", "gateway_managed"]] = None
|
||||
"""The type of certificate, either BYO-PKI (custom) or Gateway-managed."""
|
||||
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
uploaded_on: Optional[datetime] = None
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["CertificateDeleteResponse"]
|
||||
|
||||
|
||||
class CertificateDeleteResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Certificate UUID tag."""
|
||||
|
||||
binding_status: Optional[Literal["pending_deployment", "active", "pending_deletion", "inactive"]] = None
|
||||
"""The deployment status of the certificate on Cloudflare's edge."""
|
||||
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Use this certificate for Gateway TLS interception"""
|
||||
|
||||
expires_on: Optional[datetime] = None
|
||||
|
||||
type: Optional[Literal["custom", "gateway_managed"]] = None
|
||||
"""The type of certificate, either BYO-PKI (custom) or Gateway-managed."""
|
||||
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
uploaded_on: Optional[datetime] = None
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["CertificateGetResponse"]
|
||||
|
||||
|
||||
class CertificateGetResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Certificate UUID tag."""
|
||||
|
||||
binding_status: Optional[Literal["pending_deployment", "active", "pending_deletion", "inactive"]] = None
|
||||
"""The deployment status of the certificate on Cloudflare's edge."""
|
||||
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Use this certificate for Gateway TLS interception"""
|
||||
|
||||
expires_on: Optional[datetime] = None
|
||||
|
||||
type: Optional[Literal["custom", "gateway_managed"]] = None
|
||||
"""The type of certificate, either BYO-PKI (custom) or Gateway-managed."""
|
||||
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
uploaded_on: Optional[datetime] = None
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["CertificateListResponse"]
|
||||
|
||||
|
||||
class CertificateListResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Certificate UUID tag."""
|
||||
|
||||
binding_status: Optional[Literal["pending_deployment", "active", "pending_deletion", "inactive"]] = None
|
||||
"""The deployment status of the certificate on Cloudflare's edge."""
|
||||
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Use this certificate for Gateway TLS interception"""
|
||||
|
||||
expires_on: Optional[datetime] = None
|
||||
|
||||
type: Optional[Literal["custom", "gateway_managed"]] = None
|
||||
"""The type of certificate, either BYO-PKI (custom) or Gateway-managed."""
|
||||
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
uploaded_on: Optional[datetime] = None
|
||||
1
tests/api_resources/ai_gateway/logs/__init__.py
Normal file
1
tests/api_resources/ai_gateway/logs/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
141
tests/api_resources/ai_gateway/logs/test_request.py
Normal file
141
tests/api_resources/ai_gateway/logs/test_request.py
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
# 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
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestRequest:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
request = client.ai_gateway.logs.request.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
request = response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.request.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
request = response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncRequest:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
request = await async_client.ai_gateway.logs.request.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
request = await response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.request.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
request = await response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@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_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
141
tests/api_resources/ai_gateway/logs/test_response.py
Normal file
141
tests/api_resources/ai_gateway/logs/test_response.py
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
# 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
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestResponse:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
http_response = client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert http_response.is_closed is True
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
response = http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.response.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as http_response:
|
||||
assert not http_response.is_closed
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
response = http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
assert cast(Any, http_response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncResponse:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
http_response = await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert http_response.is_closed is True
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
response = await http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.response.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as http_response:
|
||||
assert not http_response.is_closed
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
response = await http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
assert cast(Any, http_response.is_closed) is True
|
||||
|
||||
@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_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
|
@ -10,7 +10,8 @@ import pytest
|
|||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare._utils import parse_datetime
|
||||
from cloudflare.types.ai_gateway import LogGetResponse
|
||||
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
from cloudflare.types.ai_gateway import LogGetResponse, LogListResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -19,16 +20,16 @@ class TestLogs:
|
|||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.get(
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
assert_matches_type(SyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.get(
|
||||
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
cached=True,
|
||||
|
|
@ -41,13 +42,63 @@ class TestLogs:
|
|||
start_date=parse_datetime("2019-12-27T18:11:19.117Z"),
|
||||
success=True,
|
||||
)
|
||||
assert_matches_type(SyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.with_raw_response.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
log = response.parse()
|
||||
assert_matches_type(SyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.with_streaming_response.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
log = response.parse()
|
||||
assert_matches_type(SyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.list(
|
||||
"my-gateway",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.list(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.with_raw_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
|
|
@ -58,8 +109,9 @@ class TestLogs:
|
|||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.with_streaming_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
|
@ -73,14 +125,23 @@ class TestLogs:
|
|||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -88,16 +149,16 @@ class TestAsyncLogs:
|
|||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.get(
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
assert_matches_type(AsyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.get(
|
||||
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
cached=True,
|
||||
|
|
@ -110,13 +171,63 @@ class TestAsyncLogs:
|
|||
start_date=parse_datetime("2019-12-27T18:11:19.117Z"),
|
||||
success=True,
|
||||
)
|
||||
assert_matches_type(AsyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.with_raw_response.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
log = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.with_streaming_response.list(
|
||||
"my-gateway",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
log = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePaginationArray[LogListResponse], log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.list(
|
||||
"my-gateway",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.list(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
|
|
@ -127,8 +238,9 @@ class TestAsyncLogs:
|
|||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.with_streaming_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
|
@ -142,12 +254,21 @@ class TestAsyncLogs:
|
|||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"my-gateway",
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,66 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|||
class TestLanguage:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
language = client.stream.captions.language.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
language = response.parse()
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.stream.captions.language.with_streaming_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
language = response.parse()
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"):
|
||||
client.stream.captions.language.with_raw_response.create(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
@pytest.mark.skip(reason="TODO: investigate broken test")
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
|
|
@ -211,6 +271,66 @@ class TestLanguage:
|
|||
class TestAsyncLanguage:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
language = await async_client.stream.captions.language.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
language = await response.parse()
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.stream.captions.language.with_streaming_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
language = await response.parse()
|
||||
assert_matches_type(Optional[Caption], language, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"):
|
||||
await async_client.stream.captions.language.with_raw_response.create(
|
||||
"tr",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `language` but received ''"):
|
||||
await async_client.stream.captions.language.with_raw_response.create(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
identifier="ea95132c15732412d22c1476fa83f27a",
|
||||
)
|
||||
|
||||
@pytest.mark.skip(reason="TODO: investigate broken test")
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
|
|
|
|||
388
tests/api_resources/zero_trust/gateway/test_certificates.py
Normal file
388
tests/api_resources/zero_trust/gateway/test_certificates.py
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, Optional, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
|
||||
from cloudflare.types.zero_trust.gateway import (
|
||||
CertificateGetResponse,
|
||||
CertificateListResponse,
|
||||
CertificateCreateResponse,
|
||||
CertificateDeleteResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestCertificates:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
certificate = client.zero_trust.gateway.certificates.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
certificate = client.zero_trust.gateway.certificates.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
validity_period_days=1826,
|
||||
)
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.zero_trust.gateway.certificates.with_raw_response.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.zero_trust.gateway.certificates.with_streaming_response.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.create(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
certificate = client.zero_trust.gateway.certificates.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(SyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.zero_trust.gateway.certificates.with_raw_response.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = response.parse()
|
||||
assert_matches_type(SyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.zero_trust.gateway.certificates.with_streaming_response.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = response.parse()
|
||||
assert_matches_type(SyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
certificate = client.zero_trust.gateway.certificates.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.zero_trust.gateway.certificates.with_streaming_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
certificate = client.zero_trust.gateway.certificates.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.zero_trust.gateway.certificates.with_streaming_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = response.parse()
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"):
|
||||
client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncCertificates:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
certificate = await async_client.zero_trust.gateway.certificates.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
certificate = await async_client.zero_trust.gateway.certificates.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
validity_period_days=1826,
|
||||
)
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.zero_trust.gateway.certificates.with_raw_response.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.zero_trust.gateway.certificates.with_streaming_response.create(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateCreateResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.create(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
certificate = await async_client.zero_trust.gateway.certificates.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(AsyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.zero_trust.gateway.certificates.with_raw_response.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(AsyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.zero_trust.gateway.certificates.with_streaming_response.list(
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(AsyncSinglePage[CertificateListResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
certificate = await async_client.zero_trust.gateway.certificates.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.zero_trust.gateway.certificates.with_streaming_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateDeleteResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.delete(
|
||||
"",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
certificate = await async_client.zero_trust.gateway.certificates.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.zero_trust.gateway.certificates.with_streaming_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
certificate = await response.parse()
|
||||
assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@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_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"):
|
||||
await async_client.zero_trust.gateway.certificates.with_raw_response.get(
|
||||
"",
|
||||
account_id="699d98642c564d2e855e9661899b7252",
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue