mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-16 23:01:03 +00:00
feat: update via SDK Studio (#108)
This commit is contained in:
parent
f63bfc1b8e
commit
0dd744d065
82 changed files with 11930 additions and 1 deletions
|
|
@ -1 +1 @@
|
|||
configured_endpoints: 1255
|
||||
configured_endpoints: 1288
|
||||
|
|
|
|||
61
README.md
61
README.md
|
|
@ -81,6 +81,67 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|||
|
||||
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
||||
|
||||
## Pagination
|
||||
|
||||
List methods in the Cloudflare API are paginated.
|
||||
|
||||
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
|
||||
|
||||
```python
|
||||
import cloudflare
|
||||
|
||||
client = Cloudflare()
|
||||
|
||||
all_accounts = []
|
||||
# Automatically fetches more pages as needed.
|
||||
for account in client.accounts.list():
|
||||
# Do something with account here
|
||||
all_accounts.append(account)
|
||||
print(all_accounts)
|
||||
```
|
||||
|
||||
Or, asynchronously:
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
import cloudflare
|
||||
|
||||
client = AsyncCloudflare()
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
all_accounts = []
|
||||
# Iterate through items across all pages, issuing requests as needed.
|
||||
async for account in client.accounts.list():
|
||||
all_accounts.append(account)
|
||||
print(all_accounts)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
|
||||
|
||||
```python
|
||||
first_page = await client.accounts.list()
|
||||
if first_page.has_next_page():
|
||||
print(f"will fetch next page using these details: {first_page.next_page_info()}")
|
||||
next_page = await first_page.get_next_page()
|
||||
print(f"number of items we just fetched: {len(next_page.result)}")
|
||||
|
||||
# Remove `await` for non-async usage.
|
||||
```
|
||||
|
||||
Or just work directly with the returned data:
|
||||
|
||||
```python
|
||||
first_page = await client.accounts.list()
|
||||
for account in first_page.result:
|
||||
print(account)
|
||||
|
||||
# Remove `await` for non-async usage.
|
||||
```
|
||||
|
||||
## Handling errors
|
||||
|
||||
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `cloudflare.APIConnectionError` is raised.
|
||||
|
|
|
|||
156
api.md
156
api.md
|
|
@ -3410,6 +3410,18 @@ Methods:
|
|||
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations">client.addressing.prefixes.delegations.<a href="./src/cloudflare/resources/addressing/prefixes/delegations.py">list</a>(prefix_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/prefixes/delegation_list_response.py">Optional</a></code>
|
||||
- <code title="delete /accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations/{delegation_id}">client.addressing.prefixes.delegations.<a href="./src/cloudflare/resources/addressing/prefixes/delegations.py">delete</a>(delegation_id, \*, account_id, prefix_id) -> <a href="./src/cloudflare/types/addressing/prefixes/delegation_delete_response.py">DelegationDeleteResponse</a></code>
|
||||
|
||||
# AuditLogs
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types import AuditLogListResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/audit_logs">client.audit_logs.<a href="./src/cloudflare/resources/audit_logs.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/audit_log_list_response.py">SyncV4PagePaginationArray[AuditLogListResponse]</a></code>
|
||||
|
||||
# Billing
|
||||
|
||||
## Profiles
|
||||
|
|
@ -3479,7 +3491,9 @@ from cloudflare.types.images.v1 import ImagesImageKeys
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="put /accounts/{account_id}/images/v1/keys/{signing_key_name}">client.images.v1.keys.<a href="./src/cloudflare/resources/images/v1/keys.py">update</a>(signing_key_name, \*, account_id) -> <a href="./src/cloudflare/types/images/v1/images_image_keys.py">ImagesImageKeys</a></code>
|
||||
- <code title="get /accounts/{account_id}/images/v1/keys">client.images.v1.keys.<a href="./src/cloudflare/resources/images/v1/keys.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/images/v1/images_image_keys.py">ImagesImageKeys</a></code>
|
||||
- <code title="delete /accounts/{account_id}/images/v1/keys/{signing_key_name}">client.images.v1.keys.<a href="./src/cloudflare/resources/images/v1/keys.py">delete</a>(signing_key_name, \*, account_id) -> <a href="./src/cloudflare/types/images/v1/images_image_keys.py">ImagesImageKeys</a></code>
|
||||
|
||||
### Stats
|
||||
|
||||
|
|
@ -3713,6 +3727,42 @@ Methods:
|
|||
|
||||
- <code title="get /accounts/{account_id}/intel/sinkholes">client.intel.sinkholes.<a href="./src/cloudflare/resources/intel/sinkholes.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/intel/sinkhole_list_response.py">SinkholeListResponse</a></code>
|
||||
|
||||
## AttackSurfaceReport
|
||||
|
||||
### IssueTypes
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.intel.attack_surface_report import IssueTypeGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issue-types">client.intel.attack_surface_report.issue_types.<a href="./src/cloudflare/resources/intel/attack_surface_report/issue_types.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_get_response.py">IssueTypeGetResponse</a></code>
|
||||
|
||||
### Issues
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.intel.attack_surface_report import (
|
||||
IssueListResponse,
|
||||
IssueClassResponse,
|
||||
IssueDismissResponse,
|
||||
IssueSeverityResponse,
|
||||
IssueTypeResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[IssueListResponse]</a></code>
|
||||
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/class">client.intel.attack*surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">class*</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_class_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_class_response.py">IssueClassResponse</a></code>
|
||||
- <code title="put /accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">dismiss</a>(issue_id, \*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_dismiss_response.py">IssueDismissResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/severity">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">severity</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_severity_response.py">IssueSeverityResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/type">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">type</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_type_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_response.py">IssueTypeResponse</a></code>
|
||||
|
||||
# MagicTransit
|
||||
|
||||
## CfInterconnects
|
||||
|
|
@ -3803,6 +3853,94 @@ Methods:
|
|||
- <code title="delete /accounts/{account_identifier}/magic/routes">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">empty</a>(account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/route_empty_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/route_empty_response.py">RouteEmptyResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/routes/{route_identifier}">client.magic_transit.routes.<a href="./src/cloudflare/resources/magic_transit/routes.py">get</a>(route_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/route_get_response.py">RouteGetResponse</a></code>
|
||||
|
||||
## Sites
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit import (
|
||||
SiteCreateResponse,
|
||||
SiteUpdateResponse,
|
||||
SiteListResponse,
|
||||
SiteDeleteResponse,
|
||||
SiteGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/magic/sites">client.magic_transit.sites.<a href="./src/cloudflare/resources/magic_transit/sites/sites.py">create</a>(account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/site_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/site_create_response.py">SiteCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/magic/sites/{site_identifier}">client.magic_transit.sites.<a href="./src/cloudflare/resources/magic_transit/sites/sites.py">update</a>(site_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/site_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/site_update_response.py">SiteUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites">client.magic_transit.sites.<a href="./src/cloudflare/resources/magic_transit/sites/sites.py">list</a>(account_identifier) -> <a href="./src/cloudflare/types/magic_transit/site_list_response.py">SiteListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/magic/sites/{site_identifier}">client.magic_transit.sites.<a href="./src/cloudflare/resources/magic_transit/sites/sites.py">delete</a>(site_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/site_delete_response.py">SiteDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}">client.magic_transit.sites.<a href="./src/cloudflare/resources/magic_transit/sites/sites.py">get</a>(site_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/site_get_response.py">SiteGetResponse</a></code>
|
||||
|
||||
### ACLs
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
ACLCreateResponse,
|
||||
ACLUpdateResponse,
|
||||
ACLListResponse,
|
||||
ACLDeleteResponse,
|
||||
ACLGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/magic/sites/{site_identifier}/acls">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">create</a>(site_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/acl_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/acl_create_response.py">ACLCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">update</a>(acl_identifier, \*, account_identifier, site_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/acl_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/acl_update_response.py">ACLUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/acls">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">list</a>(site_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/acl_list_response.py">ACLListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">delete</a>(acl_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/acl_delete_response.py">ACLDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}">client.magic_transit.sites.acls.<a href="./src/cloudflare/resources/magic_transit/sites/acls.py">get</a>(acl_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/acl_get_response.py">ACLGetResponse</a></code>
|
||||
|
||||
### Lans
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
LanCreateResponse,
|
||||
LanUpdateResponse,
|
||||
LanListResponse,
|
||||
LanDeleteResponse,
|
||||
LanGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/magic/sites/{site_identifier}/lans">client.magic_transit.sites.lans.<a href="./src/cloudflare/resources/magic_transit/sites/lans.py">create</a>(site_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/lan_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/lan_create_response.py">LanCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}">client.magic_transit.sites.lans.<a href="./src/cloudflare/resources/magic_transit/sites/lans.py">update</a>(lan_identifier, \*, account_identifier, site_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/lan_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/lan_update_response.py">LanUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/lans">client.magic_transit.sites.lans.<a href="./src/cloudflare/resources/magic_transit/sites/lans.py">list</a>(site_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/lan_list_response.py">LanListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}">client.magic_transit.sites.lans.<a href="./src/cloudflare/resources/magic_transit/sites/lans.py">delete</a>(lan_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/lan_delete_response.py">LanDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}">client.magic_transit.sites.lans.<a href="./src/cloudflare/resources/magic_transit/sites/lans.py">get</a>(lan_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/lan_get_response.py">LanGetResponse</a></code>
|
||||
|
||||
### Wans
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
WanCreateResponse,
|
||||
WanUpdateResponse,
|
||||
WanListResponse,
|
||||
WanDeleteResponse,
|
||||
WanGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/magic/sites/{site_identifier}/wans">client.magic_transit.sites.wans.<a href="./src/cloudflare/resources/magic_transit/sites/wans.py">create</a>(site_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/wan_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/wan_create_response.py">WanCreateResponse</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}">client.magic_transit.sites.wans.<a href="./src/cloudflare/resources/magic_transit/sites/wans.py">update</a>(wan_identifier, \*, account_identifier, site_identifier, \*\*<a href="src/cloudflare/types/magic_transit/sites/wan_update_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/sites/wan_update_response.py">WanUpdateResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/wans">client.magic_transit.sites.wans.<a href="./src/cloudflare/resources/magic_transit/sites/wans.py">list</a>(site_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/wan_list_response.py">WanListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}">client.magic_transit.sites.wans.<a href="./src/cloudflare/resources/magic_transit/sites/wans.py">delete</a>(wan_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/wan_delete_response.py">WanDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}">client.magic_transit.sites.wans.<a href="./src/cloudflare/resources/magic_transit/sites/wans.py">get</a>(wan_identifier, \*, account_identifier, site_identifier) -> <a href="./src/cloudflare/types/magic_transit/sites/wan_get_response.py">WanGetResponse</a></code>
|
||||
|
||||
# MagicNetworkMonitoring
|
||||
|
||||
## Configs
|
||||
|
|
@ -4513,6 +4651,24 @@ Methods:
|
|||
|
||||
### Namespaces
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.workers_for_platforms.dispatch import (
|
||||
NamespaceCreateResponse,
|
||||
NamespaceListResponse,
|
||||
NamespaceDeleteResponse,
|
||||
NamespaceGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_id}/workers/dispatch/namespaces">client.workers_for_platforms.dispatch.namespaces.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespace_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespace_create_response.py">NamespaceCreateResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces">client.workers_for_platforms.dispatch.namespaces.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespace_list_response.py">NamespaceListResponse</a></code>
|
||||
- <code title="delete /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}">client.workers_for_platforms.dispatch.namespaces.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py">delete</a>(dispatch_namespace, \*, account_id) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespace_delete_response.py">object</a></code>
|
||||
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}">client.workers_for_platforms.dispatch.namespaces.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py">get</a>(dispatch_namespace, \*, account_id) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespace_get_response.py">NamespaceGetResponse</a></code>
|
||||
|
||||
#### Scripts
|
||||
|
||||
Types:
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class Cloudflare(SyncAPIClient):
|
|||
url_normalization: resources.URLNormalization
|
||||
spectrum: resources.Spectrum
|
||||
addressing: resources.Addressing
|
||||
audit_logs: resources.AuditLogs
|
||||
billing: resources.Billing
|
||||
brand_protection: resources.BrandProtection
|
||||
diagnostics: resources.Diagnostics
|
||||
|
|
@ -243,6 +244,7 @@ class Cloudflare(SyncAPIClient):
|
|||
self.url_normalization = resources.URLNormalization(self)
|
||||
self.spectrum = resources.Spectrum(self)
|
||||
self.addressing = resources.Addressing(self)
|
||||
self.audit_logs = resources.AuditLogs(self)
|
||||
self.billing = resources.Billing(self)
|
||||
self.brand_protection = resources.BrandProtection(self)
|
||||
self.diagnostics = resources.Diagnostics(self)
|
||||
|
|
@ -500,6 +502,7 @@ class AsyncCloudflare(AsyncAPIClient):
|
|||
url_normalization: resources.AsyncURLNormalization
|
||||
spectrum: resources.AsyncSpectrum
|
||||
addressing: resources.AsyncAddressing
|
||||
audit_logs: resources.AsyncAuditLogs
|
||||
billing: resources.AsyncBilling
|
||||
brand_protection: resources.AsyncBrandProtection
|
||||
diagnostics: resources.AsyncDiagnostics
|
||||
|
|
@ -652,6 +655,7 @@ class AsyncCloudflare(AsyncAPIClient):
|
|||
self.url_normalization = resources.AsyncURLNormalization(self)
|
||||
self.spectrum = resources.AsyncSpectrum(self)
|
||||
self.addressing = resources.AsyncAddressing(self)
|
||||
self.audit_logs = resources.AsyncAuditLogs(self)
|
||||
self.billing = resources.AsyncBilling(self)
|
||||
self.brand_protection = resources.AsyncBrandProtection(self)
|
||||
self.diagnostics = resources.AsyncDiagnostics(self)
|
||||
|
|
@ -910,6 +914,7 @@ class CloudflareWithRawResponse:
|
|||
self.url_normalization = resources.URLNormalizationWithRawResponse(client.url_normalization)
|
||||
self.spectrum = resources.SpectrumWithRawResponse(client.spectrum)
|
||||
self.addressing = resources.AddressingWithRawResponse(client.addressing)
|
||||
self.audit_logs = resources.AuditLogsWithRawResponse(client.audit_logs)
|
||||
self.billing = resources.BillingWithRawResponse(client.billing)
|
||||
self.brand_protection = resources.BrandProtectionWithRawResponse(client.brand_protection)
|
||||
self.diagnostics = resources.DiagnosticsWithRawResponse(client.diagnostics)
|
||||
|
|
@ -997,6 +1002,7 @@ class AsyncCloudflareWithRawResponse:
|
|||
self.url_normalization = resources.AsyncURLNormalizationWithRawResponse(client.url_normalization)
|
||||
self.spectrum = resources.AsyncSpectrumWithRawResponse(client.spectrum)
|
||||
self.addressing = resources.AsyncAddressingWithRawResponse(client.addressing)
|
||||
self.audit_logs = resources.AsyncAuditLogsWithRawResponse(client.audit_logs)
|
||||
self.billing = resources.AsyncBillingWithRawResponse(client.billing)
|
||||
self.brand_protection = resources.AsyncBrandProtectionWithRawResponse(client.brand_protection)
|
||||
self.diagnostics = resources.AsyncDiagnosticsWithRawResponse(client.diagnostics)
|
||||
|
|
@ -1086,6 +1092,7 @@ class CloudflareWithStreamedResponse:
|
|||
self.url_normalization = resources.URLNormalizationWithStreamingResponse(client.url_normalization)
|
||||
self.spectrum = resources.SpectrumWithStreamingResponse(client.spectrum)
|
||||
self.addressing = resources.AddressingWithStreamingResponse(client.addressing)
|
||||
self.audit_logs = resources.AuditLogsWithStreamingResponse(client.audit_logs)
|
||||
self.billing = resources.BillingWithStreamingResponse(client.billing)
|
||||
self.brand_protection = resources.BrandProtectionWithStreamingResponse(client.brand_protection)
|
||||
self.diagnostics = resources.DiagnosticsWithStreamingResponse(client.diagnostics)
|
||||
|
|
@ -1177,6 +1184,7 @@ class AsyncCloudflareWithStreamedResponse:
|
|||
self.url_normalization = resources.AsyncURLNormalizationWithStreamingResponse(client.url_normalization)
|
||||
self.spectrum = resources.AsyncSpectrumWithStreamingResponse(client.spectrum)
|
||||
self.addressing = resources.AsyncAddressingWithStreamingResponse(client.addressing)
|
||||
self.audit_logs = resources.AsyncAuditLogsWithStreamingResponse(client.audit_logs)
|
||||
self.billing = resources.AsyncBillingWithStreamingResponse(client.billing)
|
||||
self.brand_protection = resources.AsyncBrandProtectionWithStreamingResponse(client.brand_protection)
|
||||
self.diagnostics = resources.AsyncDiagnosticsWithStreamingResponse(client.diagnostics)
|
||||
|
|
|
|||
|
|
@ -328,6 +328,14 @@ from .addressing import (
|
|||
AddressingWithStreamingResponse,
|
||||
AsyncAddressingWithStreamingResponse,
|
||||
)
|
||||
from .audit_logs import (
|
||||
AuditLogs,
|
||||
AsyncAuditLogs,
|
||||
AuditLogsWithRawResponse,
|
||||
AsyncAuditLogsWithRawResponse,
|
||||
AuditLogsWithStreamingResponse,
|
||||
AsyncAuditLogsWithStreamingResponse,
|
||||
)
|
||||
from .challenges import (
|
||||
Challenges,
|
||||
AsyncChallenges,
|
||||
|
|
@ -898,6 +906,12 @@ __all__ = [
|
|||
"AsyncAddressingWithRawResponse",
|
||||
"AddressingWithStreamingResponse",
|
||||
"AsyncAddressingWithStreamingResponse",
|
||||
"AuditLogs",
|
||||
"AsyncAuditLogs",
|
||||
"AuditLogsWithRawResponse",
|
||||
"AsyncAuditLogsWithRawResponse",
|
||||
"AuditLogsWithStreamingResponse",
|
||||
"AsyncAuditLogsWithStreamingResponse",
|
||||
"Billing",
|
||||
"AsyncBilling",
|
||||
"BillingWithRawResponse",
|
||||
|
|
|
|||
256
src/cloudflare/resources/audit_logs.py
Normal file
256
src/cloudflare/resources/audit_logs.py
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import AuditLogListResponse, audit_log_list_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ..pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
from .._base_client import (
|
||||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
|
||||
__all__ = ["AuditLogs", "AsyncAuditLogs"]
|
||||
|
||||
|
||||
class AuditLogs(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AuditLogsWithRawResponse:
|
||||
return AuditLogsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AuditLogsWithStreamingResponse:
|
||||
return AuditLogsWithStreamingResponse(self)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str | NotGiven = NOT_GIVEN,
|
||||
action: audit_log_list_params.Action | NotGiven = NOT_GIVEN,
|
||||
actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN,
|
||||
before: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
|
||||
export: bool | NotGiven = NOT_GIVEN,
|
||||
hide_user_logs: bool | NotGiven = NOT_GIVEN,
|
||||
page: float | NotGiven = NOT_GIVEN,
|
||||
per_page: float | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
zone: audit_log_list_params.Zone | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> SyncV4PagePaginationArray[AuditLogListResponse]:
|
||||
"""Gets a list of audit logs for an account.
|
||||
|
||||
Can be filtered by who made the
|
||||
change, on which zone, and the timeframe of the change.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
id: Finds a specific log by its ID.
|
||||
|
||||
before: Limits the returned results to logs older than the specified date. This can be a
|
||||
date string `2019-04-30` or an absolute timestamp that conforms to RFC3339.
|
||||
|
||||
direction: Changes the direction of the chronological sorting.
|
||||
|
||||
export: Indicates that this request is an export of logs in CSV format.
|
||||
|
||||
hide_user_logs: Indicates whether or not to hide user level audit logs.
|
||||
|
||||
page: Defines which page of results to return.
|
||||
|
||||
per_page: Sets the number of results to return per page.
|
||||
|
||||
since: Limits the returned results to logs newer than the specified date. This can be a
|
||||
date string `2019-04-30` or an absolute timestamp that conforms to RFC3339.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_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}/audit_logs",
|
||||
page=SyncV4PagePaginationArray[AuditLogListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"id": id,
|
||||
"action": action,
|
||||
"actor": actor,
|
||||
"before": before,
|
||||
"direction": direction,
|
||||
"export": export,
|
||||
"hide_user_logs": hide_user_logs,
|
||||
"page": page,
|
||||
"per_page": per_page,
|
||||
"since": since,
|
||||
"zone": zone,
|
||||
},
|
||||
audit_log_list_params.AuditLogListParams,
|
||||
),
|
||||
),
|
||||
model=AuditLogListResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAuditLogs(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncAuditLogsWithRawResponse:
|
||||
return AsyncAuditLogsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncAuditLogsWithStreamingResponse:
|
||||
return AsyncAuditLogsWithStreamingResponse(self)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str | NotGiven = NOT_GIVEN,
|
||||
action: audit_log_list_params.Action | NotGiven = NOT_GIVEN,
|
||||
actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN,
|
||||
before: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
|
||||
export: bool | NotGiven = NOT_GIVEN,
|
||||
hide_user_logs: bool | NotGiven = NOT_GIVEN,
|
||||
page: float | NotGiven = NOT_GIVEN,
|
||||
per_page: float | NotGiven = NOT_GIVEN,
|
||||
since: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
zone: audit_log_list_params.Zone | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]:
|
||||
"""Gets a list of audit logs for an account.
|
||||
|
||||
Can be filtered by who made the
|
||||
change, on which zone, and the timeframe of the change.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
id: Finds a specific log by its ID.
|
||||
|
||||
before: Limits the returned results to logs older than the specified date. This can be a
|
||||
date string `2019-04-30` or an absolute timestamp that conforms to RFC3339.
|
||||
|
||||
direction: Changes the direction of the chronological sorting.
|
||||
|
||||
export: Indicates that this request is an export of logs in CSV format.
|
||||
|
||||
hide_user_logs: Indicates whether or not to hide user level audit logs.
|
||||
|
||||
page: Defines which page of results to return.
|
||||
|
||||
per_page: Sets the number of results to return per page.
|
||||
|
||||
since: Limits the returned results to logs newer than the specified date. This can be a
|
||||
date string `2019-04-30` or an absolute timestamp that conforms to RFC3339.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_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}/audit_logs",
|
||||
page=AsyncV4PagePaginationArray[AuditLogListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"id": id,
|
||||
"action": action,
|
||||
"actor": actor,
|
||||
"before": before,
|
||||
"direction": direction,
|
||||
"export": export,
|
||||
"hide_user_logs": hide_user_logs,
|
||||
"page": page,
|
||||
"per_page": per_page,
|
||||
"since": since,
|
||||
"zone": zone,
|
||||
},
|
||||
audit_log_list_params.AuditLogListParams,
|
||||
),
|
||||
),
|
||||
model=AuditLogListResponse,
|
||||
)
|
||||
|
||||
|
||||
class AuditLogsWithRawResponse:
|
||||
def __init__(self, audit_logs: AuditLogs) -> None:
|
||||
self._audit_logs = audit_logs
|
||||
|
||||
self.list = to_raw_response_wrapper(
|
||||
audit_logs.list,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAuditLogsWithRawResponse:
|
||||
def __init__(self, audit_logs: AsyncAuditLogs) -> None:
|
||||
self._audit_logs = audit_logs
|
||||
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
audit_logs.list,
|
||||
)
|
||||
|
||||
|
||||
class AuditLogsWithStreamingResponse:
|
||||
def __init__(self, audit_logs: AuditLogs) -> None:
|
||||
self._audit_logs = audit_logs
|
||||
|
||||
self.list = to_streamed_response_wrapper(
|
||||
audit_logs.list,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAuditLogsWithStreamingResponse:
|
||||
def __init__(self, audit_logs: AsyncAuditLogs) -> None:
|
||||
self._audit_logs = audit_logs
|
||||
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
audit_logs.list,
|
||||
)
|
||||
|
|
@ -33,6 +33,47 @@ class Keys(SyncAPIResource):
|
|||
def with_streaming_response(self) -> KeysWithStreamingResponse:
|
||||
return KeysWithStreamingResponse(self)
|
||||
|
||||
def update(
|
||||
self,
|
||||
signing_key_name: object,
|
||||
*,
|
||||
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,
|
||||
) -> ImagesImageKeys:
|
||||
"""Create a new signing key with specified name.
|
||||
|
||||
Returns all keys available.
|
||||
|
||||
Args:
|
||||
account_id: Account identifier 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}")
|
||||
return self._put(
|
||||
f"/accounts/{account_id}/images/v1/keys/{signing_key_name}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -73,6 +114,48 @@ class Keys(SyncAPIResource):
|
|||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
signing_key_name: object,
|
||||
*,
|
||||
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,
|
||||
) -> ImagesImageKeys:
|
||||
"""Delete signing key with specified name.
|
||||
|
||||
Returns all keys available. When last
|
||||
key is removed, a new default signing key will be generated.
|
||||
|
||||
Args:
|
||||
account_id: Account identifier 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}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/images/v1/keys/{signing_key_name}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncKeys(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -83,6 +166,47 @@ class AsyncKeys(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncKeysWithStreamingResponse:
|
||||
return AsyncKeysWithStreamingResponse(self)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
signing_key_name: object,
|
||||
*,
|
||||
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,
|
||||
) -> ImagesImageKeys:
|
||||
"""Create a new signing key with specified name.
|
||||
|
||||
Returns all keys available.
|
||||
|
||||
Args:
|
||||
account_id: Account identifier 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}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_id}/images/v1/keys/{signing_key_name}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -123,38 +247,104 @@ class AsyncKeys(AsyncAPIResource):
|
|||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
signing_key_name: object,
|
||||
*,
|
||||
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,
|
||||
) -> ImagesImageKeys:
|
||||
"""Delete signing key with specified name.
|
||||
|
||||
Returns all keys available. When last
|
||||
key is removed, a new default signing key will be generated.
|
||||
|
||||
Args:
|
||||
account_id: Account identifier 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}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/images/v1/keys/{signing_key_name}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ImagesImageKeys], ResultWrapper[ImagesImageKeys]),
|
||||
)
|
||||
|
||||
|
||||
class KeysWithRawResponse:
|
||||
def __init__(self, keys: Keys) -> None:
|
||||
self._keys = keys
|
||||
|
||||
self.update = to_raw_response_wrapper(
|
||||
keys.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
keys.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
keys.delete,
|
||||
)
|
||||
|
||||
|
||||
class AsyncKeysWithRawResponse:
|
||||
def __init__(self, keys: AsyncKeys) -> None:
|
||||
self._keys = keys
|
||||
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
keys.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
keys.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
keys.delete,
|
||||
)
|
||||
|
||||
|
||||
class KeysWithStreamingResponse:
|
||||
def __init__(self, keys: Keys) -> None:
|
||||
self._keys = keys
|
||||
|
||||
self.update = to_streamed_response_wrapper(
|
||||
keys.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
keys.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
keys.delete,
|
||||
)
|
||||
|
||||
|
||||
class AsyncKeysWithStreamingResponse:
|
||||
def __init__(self, keys: AsyncKeys) -> None:
|
||||
self._keys = keys
|
||||
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
keys.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
keys.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
keys.delete,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,14 @@ from .miscategorizations import (
|
|||
MiscategorizationsWithStreamingResponse,
|
||||
AsyncMiscategorizationsWithStreamingResponse,
|
||||
)
|
||||
from .attack_surface_report import (
|
||||
AttackSurfaceReport,
|
||||
AsyncAttackSurfaceReport,
|
||||
AttackSurfaceReportWithRawResponse,
|
||||
AsyncAttackSurfaceReportWithRawResponse,
|
||||
AttackSurfaceReportWithStreamingResponse,
|
||||
AsyncAttackSurfaceReportWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ASN",
|
||||
|
|
@ -150,6 +158,12 @@ __all__ = [
|
|||
"AsyncSinkholesWithRawResponse",
|
||||
"SinkholesWithStreamingResponse",
|
||||
"AsyncSinkholesWithStreamingResponse",
|
||||
"AttackSurfaceReport",
|
||||
"AsyncAttackSurfaceReport",
|
||||
"AttackSurfaceReportWithRawResponse",
|
||||
"AsyncAttackSurfaceReportWithRawResponse",
|
||||
"AttackSurfaceReportWithStreamingResponse",
|
||||
"AsyncAttackSurfaceReportWithStreamingResponse",
|
||||
"Intel",
|
||||
"AsyncIntel",
|
||||
"IntelWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from .issues import (
|
||||
Issues,
|
||||
AsyncIssues,
|
||||
IssuesWithRawResponse,
|
||||
AsyncIssuesWithRawResponse,
|
||||
IssuesWithStreamingResponse,
|
||||
AsyncIssuesWithStreamingResponse,
|
||||
)
|
||||
from .issue_types import (
|
||||
IssueTypes,
|
||||
AsyncIssueTypes,
|
||||
IssueTypesWithRawResponse,
|
||||
AsyncIssueTypesWithRawResponse,
|
||||
IssueTypesWithStreamingResponse,
|
||||
AsyncIssueTypesWithStreamingResponse,
|
||||
)
|
||||
from .attack_surface_report import (
|
||||
AttackSurfaceReport,
|
||||
AsyncAttackSurfaceReport,
|
||||
AttackSurfaceReportWithRawResponse,
|
||||
AsyncAttackSurfaceReportWithRawResponse,
|
||||
AttackSurfaceReportWithStreamingResponse,
|
||||
AsyncAttackSurfaceReportWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"IssueTypes",
|
||||
"AsyncIssueTypes",
|
||||
"IssueTypesWithRawResponse",
|
||||
"AsyncIssueTypesWithRawResponse",
|
||||
"IssueTypesWithStreamingResponse",
|
||||
"AsyncIssueTypesWithStreamingResponse",
|
||||
"Issues",
|
||||
"AsyncIssues",
|
||||
"IssuesWithRawResponse",
|
||||
"AsyncIssuesWithRawResponse",
|
||||
"IssuesWithStreamingResponse",
|
||||
"AsyncIssuesWithStreamingResponse",
|
||||
"AttackSurfaceReport",
|
||||
"AsyncAttackSurfaceReport",
|
||||
"AttackSurfaceReportWithRawResponse",
|
||||
"AsyncAttackSurfaceReportWithRawResponse",
|
||||
"AttackSurfaceReportWithStreamingResponse",
|
||||
"AsyncAttackSurfaceReportWithStreamingResponse",
|
||||
]
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .issues import (
|
||||
Issues,
|
||||
AsyncIssues,
|
||||
IssuesWithRawResponse,
|
||||
AsyncIssuesWithRawResponse,
|
||||
IssuesWithStreamingResponse,
|
||||
AsyncIssuesWithStreamingResponse,
|
||||
)
|
||||
from ...._compat import cached_property
|
||||
from .issue_types import (
|
||||
IssueTypes,
|
||||
AsyncIssueTypes,
|
||||
IssueTypesWithRawResponse,
|
||||
AsyncIssueTypesWithRawResponse,
|
||||
IssueTypesWithStreamingResponse,
|
||||
AsyncIssueTypesWithStreamingResponse,
|
||||
)
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
|
||||
__all__ = ["AttackSurfaceReport", "AsyncAttackSurfaceReport"]
|
||||
|
||||
|
||||
class AttackSurfaceReport(SyncAPIResource):
|
||||
@cached_property
|
||||
def issue_types(self) -> IssueTypes:
|
||||
return IssueTypes(self._client)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> Issues:
|
||||
return Issues(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AttackSurfaceReportWithRawResponse:
|
||||
return AttackSurfaceReportWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AttackSurfaceReportWithStreamingResponse:
|
||||
return AttackSurfaceReportWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AsyncAttackSurfaceReport(AsyncAPIResource):
|
||||
@cached_property
|
||||
def issue_types(self) -> AsyncIssueTypes:
|
||||
return AsyncIssueTypes(self._client)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> AsyncIssues:
|
||||
return AsyncIssues(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncAttackSurfaceReportWithRawResponse:
|
||||
return AsyncAttackSurfaceReportWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncAttackSurfaceReportWithStreamingResponse:
|
||||
return AsyncAttackSurfaceReportWithStreamingResponse(self)
|
||||
|
||||
|
||||
class AttackSurfaceReportWithRawResponse:
|
||||
def __init__(self, attack_surface_report: AttackSurfaceReport) -> None:
|
||||
self._attack_surface_report = attack_surface_report
|
||||
|
||||
@cached_property
|
||||
def issue_types(self) -> IssueTypesWithRawResponse:
|
||||
return IssueTypesWithRawResponse(self._attack_surface_report.issue_types)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> IssuesWithRawResponse:
|
||||
return IssuesWithRawResponse(self._attack_surface_report.issues)
|
||||
|
||||
|
||||
class AsyncAttackSurfaceReportWithRawResponse:
|
||||
def __init__(self, attack_surface_report: AsyncAttackSurfaceReport) -> None:
|
||||
self._attack_surface_report = attack_surface_report
|
||||
|
||||
@cached_property
|
||||
def issue_types(self) -> AsyncIssueTypesWithRawResponse:
|
||||
return AsyncIssueTypesWithRawResponse(self._attack_surface_report.issue_types)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> AsyncIssuesWithRawResponse:
|
||||
return AsyncIssuesWithRawResponse(self._attack_surface_report.issues)
|
||||
|
||||
|
||||
class AttackSurfaceReportWithStreamingResponse:
|
||||
def __init__(self, attack_surface_report: AttackSurfaceReport) -> None:
|
||||
self._attack_surface_report = attack_surface_report
|
||||
|
||||
@cached_property
|
||||
def issue_types(self) -> IssueTypesWithStreamingResponse:
|
||||
return IssueTypesWithStreamingResponse(self._attack_surface_report.issue_types)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> IssuesWithStreamingResponse:
|
||||
return IssuesWithStreamingResponse(self._attack_surface_report.issues)
|
||||
|
||||
|
||||
class AsyncAttackSurfaceReportWithStreamingResponse:
|
||||
def __init__(self, attack_surface_report: AsyncAttackSurfaceReport) -> None:
|
||||
self._attack_surface_report = attack_surface_report
|
||||
|
||||
@cached_property
|
||||
def issue_types(self) -> AsyncIssueTypesWithStreamingResponse:
|
||||
return AsyncIssueTypesWithStreamingResponse(self._attack_surface_report.issue_types)
|
||||
|
||||
@cached_property
|
||||
def issues(self) -> AsyncIssuesWithStreamingResponse:
|
||||
return AsyncIssuesWithStreamingResponse(self._attack_surface_report.issues)
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, cast
|
||||
|
||||
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 ...._wrappers import ResultWrapper
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.intel.attack_surface_report import IssueTypeGetResponse
|
||||
|
||||
__all__ = ["IssueTypes", "AsyncIssueTypes"]
|
||||
|
||||
|
||||
class IssueTypes(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> IssueTypesWithRawResponse:
|
||||
return IssueTypesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> IssueTypesWithStreamingResponse:
|
||||
return IssueTypesWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
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,
|
||||
) -> IssueTypeGetResponse:
|
||||
"""
|
||||
Get Security Center Issues Types
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issue-types",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssueTypes(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncIssueTypesWithRawResponse:
|
||||
return AsyncIssueTypesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncIssueTypesWithStreamingResponse:
|
||||
return AsyncIssueTypesWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
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,
|
||||
) -> IssueTypeGetResponse:
|
||||
"""
|
||||
Get Security Center Issues Types
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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._get(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issue-types",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class IssueTypesWithRawResponse:
|
||||
def __init__(self, issue_types: IssueTypes) -> None:
|
||||
self._issue_types = issue_types
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
issue_types.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssueTypesWithRawResponse:
|
||||
def __init__(self, issue_types: AsyncIssueTypes) -> None:
|
||||
self._issue_types = issue_types
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
issue_types.get,
|
||||
)
|
||||
|
||||
|
||||
class IssueTypesWithStreamingResponse:
|
||||
def __init__(self, issue_types: IssueTypes) -> None:
|
||||
self._issue_types = issue_types
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
issue_types.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssueTypesWithStreamingResponse:
|
||||
def __init__(self, issue_types: AsyncIssueTypes) -> None:
|
||||
self._issue_types = issue_types
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
issue_types.get,
|
||||
)
|
||||
932
src/cloudflare/resources/intel/attack_surface_report/issues.py
Normal file
932
src/cloudflare/resources/intel/attack_surface_report/issues.py
Normal file
|
|
@ -0,0 +1,932 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, List, Type, cast
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._utils import (
|
||||
maybe_transform,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ....pagination import SyncV4PagePagination, AsyncV4PagePagination
|
||||
from ...._base_client import (
|
||||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.intel.attack_surface_report import (
|
||||
IssueListResponse,
|
||||
IssueTypeResponse,
|
||||
IssueClassResponse,
|
||||
IssueDismissResponse,
|
||||
IssueSeverityResponse,
|
||||
issue_list_params,
|
||||
issue_type_params,
|
||||
issue_class_params,
|
||||
issue_dismiss_params,
|
||||
issue_severity_params,
|
||||
)
|
||||
|
||||
__all__ = ["Issues", "AsyncIssues"]
|
||||
|
||||
|
||||
class Issues(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> IssuesWithRawResponse:
|
||||
return IssuesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> IssuesWithStreamingResponse:
|
||||
return IssuesWithStreamingResponse(self)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
page: int | NotGiven = NOT_GIVEN,
|
||||
per_page: int | NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> SyncV4PagePagination[IssueListResponse]:
|
||||
"""
|
||||
Get Security Center Issues
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
page: Current page within paginated list of results
|
||||
|
||||
per_page: Number of results per page of results
|
||||
|
||||
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}/intel/attack-surface-report/issues",
|
||||
page=SyncV4PagePagination[IssueListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"page": page,
|
||||
"per_page": per_page,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_list_params.IssueListParams,
|
||||
),
|
||||
),
|
||||
model=IssueListResponse,
|
||||
)
|
||||
|
||||
def class_(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueClassResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Class
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/class",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_class_params.IssueClassParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]),
|
||||
)
|
||||
|
||||
def dismiss(
|
||||
self,
|
||||
issue_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
dismiss: bool | 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,
|
||||
) -> IssueDismissResponse:
|
||||
"""
|
||||
Archive Security Center Insight
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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 issue_id:
|
||||
raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
|
||||
return cast(
|
||||
IssueDismissResponse,
|
||||
self._put(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss",
|
||||
body=maybe_transform({"dismiss": dismiss}, issue_dismiss_params.IssueDismissParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(
|
||||
Any, ResultWrapper[IssueDismissResponse]
|
||||
), # Union types cannot be passed in as arguments in the type system
|
||||
),
|
||||
)
|
||||
|
||||
def severity(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueSeverityResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Severity
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/severity",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_severity_params.IssueSeverityParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]),
|
||||
)
|
||||
|
||||
def type(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueTypeResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Type
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/type",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_type_params.IssueTypeParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssues(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncIssuesWithRawResponse:
|
||||
return AsyncIssuesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncIssuesWithStreamingResponse:
|
||||
return AsyncIssuesWithStreamingResponse(self)
|
||||
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
page: int | NotGiven = NOT_GIVEN,
|
||||
per_page: int | NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AsyncPaginator[IssueListResponse, AsyncV4PagePagination[IssueListResponse]]:
|
||||
"""
|
||||
Get Security Center Issues
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
page: Current page within paginated list of results
|
||||
|
||||
per_page: Number of results per page of results
|
||||
|
||||
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}/intel/attack-surface-report/issues",
|
||||
page=AsyncV4PagePagination[IssueListResponse],
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"page": page,
|
||||
"per_page": per_page,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_list_params.IssueListParams,
|
||||
),
|
||||
),
|
||||
model=IssueListResponse,
|
||||
)
|
||||
|
||||
async def class_(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueClassResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Class
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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._get(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/class",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_class_params.IssueClassParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]),
|
||||
)
|
||||
|
||||
async def dismiss(
|
||||
self,
|
||||
issue_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
dismiss: bool | 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,
|
||||
) -> IssueDismissResponse:
|
||||
"""
|
||||
Archive Security Center Insight
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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 issue_id:
|
||||
raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
|
||||
return cast(
|
||||
IssueDismissResponse,
|
||||
await self._put(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss",
|
||||
body=await async_maybe_transform({"dismiss": dismiss}, issue_dismiss_params.IssueDismissParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(
|
||||
Any, ResultWrapper[IssueDismissResponse]
|
||||
), # Union types cannot be passed in as arguments in the type system
|
||||
),
|
||||
)
|
||||
|
||||
async def severity(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueSeverityResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Severity
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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._get(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/severity",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_severity_params.IssueSeverityParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]),
|
||||
)
|
||||
|
||||
async def type(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
dismissed: bool | NotGiven = NOT_GIVEN,
|
||||
issue_class: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_class_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
issue_type_neq: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
| NotGiven = NOT_GIVEN,
|
||||
product: List[str] | NotGiven = NOT_GIVEN,
|
||||
product_neq: List[str] | NotGiven = NOT_GIVEN,
|
||||
severity: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
severity_neq: List[Literal["low", "moderate", "critical"]] | NotGiven = NOT_GIVEN,
|
||||
subject: List[str] | NotGiven = NOT_GIVEN,
|
||||
subject_neq: List[str] | 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,
|
||||
) -> IssueTypeResponse:
|
||||
"""
|
||||
Get Security Center Issue Counts by Type
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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._get(
|
||||
f"/accounts/{account_id}/intel/attack-surface-report/issues/type",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform(
|
||||
{
|
||||
"dismissed": dismissed,
|
||||
"issue_class": issue_class,
|
||||
"issue_class_neq": issue_class_neq,
|
||||
"issue_type": issue_type,
|
||||
"issue_type_neq": issue_type_neq,
|
||||
"product": product,
|
||||
"product_neq": product_neq,
|
||||
"severity": severity,
|
||||
"severity_neq": severity_neq,
|
||||
"subject": subject,
|
||||
"subject_neq": subject_neq,
|
||||
},
|
||||
issue_type_params.IssueTypeParams,
|
||||
),
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]),
|
||||
)
|
||||
|
||||
|
||||
class IssuesWithRawResponse:
|
||||
def __init__(self, issues: Issues) -> None:
|
||||
self._issues = issues
|
||||
|
||||
self.list = to_raw_response_wrapper(
|
||||
issues.list,
|
||||
)
|
||||
self.class_ = to_raw_response_wrapper(
|
||||
issues.class_,
|
||||
)
|
||||
self.dismiss = to_raw_response_wrapper(
|
||||
issues.dismiss,
|
||||
)
|
||||
self.severity = to_raw_response_wrapper(
|
||||
issues.severity,
|
||||
)
|
||||
self.type = to_raw_response_wrapper(
|
||||
issues.type,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssuesWithRawResponse:
|
||||
def __init__(self, issues: AsyncIssues) -> None:
|
||||
self._issues = issues
|
||||
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
issues.list,
|
||||
)
|
||||
self.class_ = async_to_raw_response_wrapper(
|
||||
issues.class_,
|
||||
)
|
||||
self.dismiss = async_to_raw_response_wrapper(
|
||||
issues.dismiss,
|
||||
)
|
||||
self.severity = async_to_raw_response_wrapper(
|
||||
issues.severity,
|
||||
)
|
||||
self.type = async_to_raw_response_wrapper(
|
||||
issues.type,
|
||||
)
|
||||
|
||||
|
||||
class IssuesWithStreamingResponse:
|
||||
def __init__(self, issues: Issues) -> None:
|
||||
self._issues = issues
|
||||
|
||||
self.list = to_streamed_response_wrapper(
|
||||
issues.list,
|
||||
)
|
||||
self.class_ = to_streamed_response_wrapper(
|
||||
issues.class_,
|
||||
)
|
||||
self.dismiss = to_streamed_response_wrapper(
|
||||
issues.dismiss,
|
||||
)
|
||||
self.severity = to_streamed_response_wrapper(
|
||||
issues.severity,
|
||||
)
|
||||
self.type = to_streamed_response_wrapper(
|
||||
issues.type,
|
||||
)
|
||||
|
||||
|
||||
class AsyncIssuesWithStreamingResponse:
|
||||
def __init__(self, issues: AsyncIssues) -> None:
|
||||
self._issues = issues
|
||||
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
issues.list,
|
||||
)
|
||||
self.class_ = async_to_streamed_response_wrapper(
|
||||
issues.class_,
|
||||
)
|
||||
self.dismiss = async_to_streamed_response_wrapper(
|
||||
issues.dismiss,
|
||||
)
|
||||
self.severity = async_to_streamed_response_wrapper(
|
||||
issues.severity,
|
||||
)
|
||||
self.type = async_to_streamed_response_wrapper(
|
||||
issues.type,
|
||||
)
|
||||
|
|
@ -86,7 +86,16 @@ from .miscategorizations import (
|
|||
MiscategorizationsWithStreamingResponse,
|
||||
AsyncMiscategorizationsWithStreamingResponse,
|
||||
)
|
||||
from .attack_surface_report import (
|
||||
AttackSurfaceReport,
|
||||
AsyncAttackSurfaceReport,
|
||||
AttackSurfaceReportWithRawResponse,
|
||||
AsyncAttackSurfaceReportWithRawResponse,
|
||||
AttackSurfaceReportWithStreamingResponse,
|
||||
AsyncAttackSurfaceReportWithStreamingResponse,
|
||||
)
|
||||
from .indicator_feeds.indicator_feeds import IndicatorFeeds, AsyncIndicatorFeeds
|
||||
from .attack_surface_report.attack_surface_report import AttackSurfaceReport, AsyncAttackSurfaceReport
|
||||
|
||||
__all__ = ["Intel", "AsyncIntel"]
|
||||
|
||||
|
|
@ -132,6 +141,10 @@ class Intel(SyncAPIResource):
|
|||
def sinkholes(self) -> Sinkholes:
|
||||
return Sinkholes(self._client)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AttackSurfaceReport:
|
||||
return AttackSurfaceReport(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> IntelWithRawResponse:
|
||||
return IntelWithRawResponse(self)
|
||||
|
|
@ -182,6 +195,10 @@ class AsyncIntel(AsyncAPIResource):
|
|||
def sinkholes(self) -> AsyncSinkholes:
|
||||
return AsyncSinkholes(self._client)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AsyncAttackSurfaceReport:
|
||||
return AsyncAttackSurfaceReport(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncIntelWithRawResponse:
|
||||
return AsyncIntelWithRawResponse(self)
|
||||
|
|
@ -235,6 +252,10 @@ class IntelWithRawResponse:
|
|||
def sinkholes(self) -> SinkholesWithRawResponse:
|
||||
return SinkholesWithRawResponse(self._intel.sinkholes)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AttackSurfaceReportWithRawResponse:
|
||||
return AttackSurfaceReportWithRawResponse(self._intel.attack_surface_report)
|
||||
|
||||
|
||||
class AsyncIntelWithRawResponse:
|
||||
def __init__(self, intel: AsyncIntel) -> None:
|
||||
|
|
@ -280,6 +301,10 @@ class AsyncIntelWithRawResponse:
|
|||
def sinkholes(self) -> AsyncSinkholesWithRawResponse:
|
||||
return AsyncSinkholesWithRawResponse(self._intel.sinkholes)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AsyncAttackSurfaceReportWithRawResponse:
|
||||
return AsyncAttackSurfaceReportWithRawResponse(self._intel.attack_surface_report)
|
||||
|
||||
|
||||
class IntelWithStreamingResponse:
|
||||
def __init__(self, intel: Intel) -> None:
|
||||
|
|
@ -325,6 +350,10 @@ class IntelWithStreamingResponse:
|
|||
def sinkholes(self) -> SinkholesWithStreamingResponse:
|
||||
return SinkholesWithStreamingResponse(self._intel.sinkholes)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AttackSurfaceReportWithStreamingResponse:
|
||||
return AttackSurfaceReportWithStreamingResponse(self._intel.attack_surface_report)
|
||||
|
||||
|
||||
class AsyncIntelWithStreamingResponse:
|
||||
def __init__(self, intel: AsyncIntel) -> None:
|
||||
|
|
@ -369,3 +398,7 @@ class AsyncIntelWithStreamingResponse:
|
|||
@cached_property
|
||||
def sinkholes(self) -> AsyncSinkholesWithStreamingResponse:
|
||||
return AsyncSinkholesWithStreamingResponse(self._intel.sinkholes)
|
||||
|
||||
@cached_property
|
||||
def attack_surface_report(self) -> AsyncAttackSurfaceReportWithStreamingResponse:
|
||||
return AsyncAttackSurfaceReportWithStreamingResponse(self._intel.attack_surface_report)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from .sites import (
|
||||
Sites,
|
||||
AsyncSites,
|
||||
SitesWithRawResponse,
|
||||
AsyncSitesWithRawResponse,
|
||||
SitesWithStreamingResponse,
|
||||
AsyncSitesWithStreamingResponse,
|
||||
)
|
||||
from .routes import (
|
||||
Routes,
|
||||
AsyncRoutes,
|
||||
|
|
@ -66,6 +74,12 @@ __all__ = [
|
|||
"AsyncRoutesWithRawResponse",
|
||||
"RoutesWithStreamingResponse",
|
||||
"AsyncRoutesWithStreamingResponse",
|
||||
"Sites",
|
||||
"AsyncSites",
|
||||
"SitesWithRawResponse",
|
||||
"AsyncSitesWithRawResponse",
|
||||
"SitesWithStreamingResponse",
|
||||
"AsyncSitesWithStreamingResponse",
|
||||
"MagicTransit",
|
||||
"AsyncMagicTransit",
|
||||
"MagicTransitWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from .sites import (
|
||||
Sites,
|
||||
AsyncSites,
|
||||
SitesWithRawResponse,
|
||||
AsyncSitesWithRawResponse,
|
||||
SitesWithStreamingResponse,
|
||||
AsyncSitesWithStreamingResponse,
|
||||
)
|
||||
from .routes import (
|
||||
Routes,
|
||||
AsyncRoutes,
|
||||
|
|
@ -20,6 +28,7 @@ from .gre_tunnels import (
|
|||
GRETunnelsWithStreamingResponse,
|
||||
AsyncGRETunnelsWithStreamingResponse,
|
||||
)
|
||||
from .sites.sites import Sites, AsyncSites
|
||||
from .ipsec_tunnels import (
|
||||
IPSECTunnels,
|
||||
AsyncIPSECTunnels,
|
||||
|
|
@ -57,6 +66,10 @@ class MagicTransit(SyncAPIResource):
|
|||
def routes(self) -> Routes:
|
||||
return Routes(self._client)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> Sites:
|
||||
return Sites(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> MagicTransitWithRawResponse:
|
||||
return MagicTransitWithRawResponse(self)
|
||||
|
|
@ -83,6 +96,10 @@ class AsyncMagicTransit(AsyncAPIResource):
|
|||
def routes(self) -> AsyncRoutes:
|
||||
return AsyncRoutes(self._client)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> AsyncSites:
|
||||
return AsyncSites(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncMagicTransitWithRawResponse:
|
||||
return AsyncMagicTransitWithRawResponse(self)
|
||||
|
|
@ -112,6 +129,10 @@ class MagicTransitWithRawResponse:
|
|||
def routes(self) -> RoutesWithRawResponse:
|
||||
return RoutesWithRawResponse(self._magic_transit.routes)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> SitesWithRawResponse:
|
||||
return SitesWithRawResponse(self._magic_transit.sites)
|
||||
|
||||
|
||||
class AsyncMagicTransitWithRawResponse:
|
||||
def __init__(self, magic_transit: AsyncMagicTransit) -> None:
|
||||
|
|
@ -133,6 +154,10 @@ class AsyncMagicTransitWithRawResponse:
|
|||
def routes(self) -> AsyncRoutesWithRawResponse:
|
||||
return AsyncRoutesWithRawResponse(self._magic_transit.routes)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> AsyncSitesWithRawResponse:
|
||||
return AsyncSitesWithRawResponse(self._magic_transit.sites)
|
||||
|
||||
|
||||
class MagicTransitWithStreamingResponse:
|
||||
def __init__(self, magic_transit: MagicTransit) -> None:
|
||||
|
|
@ -154,6 +179,10 @@ class MagicTransitWithStreamingResponse:
|
|||
def routes(self) -> RoutesWithStreamingResponse:
|
||||
return RoutesWithStreamingResponse(self._magic_transit.routes)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> SitesWithStreamingResponse:
|
||||
return SitesWithStreamingResponse(self._magic_transit.sites)
|
||||
|
||||
|
||||
class AsyncMagicTransitWithStreamingResponse:
|
||||
def __init__(self, magic_transit: AsyncMagicTransit) -> None:
|
||||
|
|
@ -174,3 +203,7 @@ class AsyncMagicTransitWithStreamingResponse:
|
|||
@cached_property
|
||||
def routes(self) -> AsyncRoutesWithStreamingResponse:
|
||||
return AsyncRoutesWithStreamingResponse(self._magic_transit.routes)
|
||||
|
||||
@cached_property
|
||||
def sites(self) -> AsyncSitesWithStreamingResponse:
|
||||
return AsyncSitesWithStreamingResponse(self._magic_transit.sites)
|
||||
|
|
|
|||
61
src/cloudflare/resources/magic_transit/sites/__init__.py
Normal file
61
src/cloudflare/resources/magic_transit/sites/__init__.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from .acls import (
|
||||
ACLs,
|
||||
AsyncACLs,
|
||||
ACLsWithRawResponse,
|
||||
AsyncACLsWithRawResponse,
|
||||
ACLsWithStreamingResponse,
|
||||
AsyncACLsWithStreamingResponse,
|
||||
)
|
||||
from .lans import (
|
||||
Lans,
|
||||
AsyncLans,
|
||||
LansWithRawResponse,
|
||||
AsyncLansWithRawResponse,
|
||||
LansWithStreamingResponse,
|
||||
AsyncLansWithStreamingResponse,
|
||||
)
|
||||
from .wans import (
|
||||
Wans,
|
||||
AsyncWans,
|
||||
WansWithRawResponse,
|
||||
AsyncWansWithRawResponse,
|
||||
WansWithStreamingResponse,
|
||||
AsyncWansWithStreamingResponse,
|
||||
)
|
||||
from .sites import (
|
||||
Sites,
|
||||
AsyncSites,
|
||||
SitesWithRawResponse,
|
||||
AsyncSitesWithRawResponse,
|
||||
SitesWithStreamingResponse,
|
||||
AsyncSitesWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ACLs",
|
||||
"AsyncACLs",
|
||||
"ACLsWithRawResponse",
|
||||
"AsyncACLsWithRawResponse",
|
||||
"ACLsWithStreamingResponse",
|
||||
"AsyncACLsWithStreamingResponse",
|
||||
"Lans",
|
||||
"AsyncLans",
|
||||
"LansWithRawResponse",
|
||||
"AsyncLansWithRawResponse",
|
||||
"LansWithStreamingResponse",
|
||||
"AsyncLansWithStreamingResponse",
|
||||
"Wans",
|
||||
"AsyncWans",
|
||||
"WansWithRawResponse",
|
||||
"AsyncWansWithRawResponse",
|
||||
"WansWithStreamingResponse",
|
||||
"AsyncWansWithStreamingResponse",
|
||||
"Sites",
|
||||
"AsyncSites",
|
||||
"SitesWithRawResponse",
|
||||
"AsyncSitesWithRawResponse",
|
||||
"SitesWithStreamingResponse",
|
||||
"AsyncSitesWithStreamingResponse",
|
||||
]
|
||||
618
src/cloudflare/resources/magic_transit/sites/acls.py
Normal file
618
src/cloudflare/resources/magic_transit/sites/acls.py
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, 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 ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.magic_transit.sites import (
|
||||
ACLGetResponse,
|
||||
ACLListResponse,
|
||||
ACLCreateResponse,
|
||||
ACLDeleteResponse,
|
||||
ACLUpdateResponse,
|
||||
acl_create_params,
|
||||
acl_update_params,
|
||||
)
|
||||
|
||||
__all__ = ["ACLs", "AsyncACLs"]
|
||||
|
||||
|
||||
class ACLs(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> ACLsWithRawResponse:
|
||||
return ACLsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> ACLsWithStreamingResponse:
|
||||
return ACLsWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
acl: acl_create_params.ACL | 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,
|
||||
) -> ACLCreateResponse:
|
||||
"""
|
||||
Creates a new Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls",
|
||||
body=maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
acl: acl_update_params.ACL | 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,
|
||||
) -> ACLUpdateResponse:
|
||||
"""
|
||||
Update a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
body=maybe_transform({"acl": acl}, acl_update_params.ACLUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> ACLListResponse:
|
||||
"""
|
||||
Lists Site ACLs associated with an account.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> ACLDeleteResponse:
|
||||
"""
|
||||
Remove a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> ACLGetResponse:
|
||||
"""
|
||||
Get a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLs(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncACLsWithRawResponse:
|
||||
return AsyncACLsWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncACLsWithStreamingResponse:
|
||||
return AsyncACLsWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
acl: acl_create_params.ACL | 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,
|
||||
) -> ACLCreateResponse:
|
||||
"""
|
||||
Creates a new Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls",
|
||||
body=await async_maybe_transform({"acl": acl}, acl_create_params.ACLCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLCreateResponse], ResultWrapper[ACLCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
acl: acl_update_params.ACL | 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,
|
||||
) -> ACLUpdateResponse:
|
||||
"""
|
||||
Update a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
body=await async_maybe_transform({"acl": acl}, acl_update_params.ACLUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLUpdateResponse], ResultWrapper[ACLUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> ACLListResponse:
|
||||
"""
|
||||
Lists Site ACLs associated with an account.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLListResponse], ResultWrapper[ACLListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> ACLDeleteResponse:
|
||||
"""
|
||||
Remove a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLDeleteResponse], ResultWrapper[ACLDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
acl_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> ACLGetResponse:
|
||||
"""
|
||||
Get a specific Site ACL.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
acl_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not acl_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/acls/{acl_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[ACLGetResponse], ResultWrapper[ACLGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class ACLsWithRawResponse:
|
||||
def __init__(self, acls: ACLs) -> None:
|
||||
self._acls = acls
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLsWithRawResponse:
|
||||
def __init__(self, acls: AsyncACLs) -> None:
|
||||
self._acls = acls
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class ACLsWithStreamingResponse:
|
||||
def __init__(self, acls: ACLs) -> None:
|
||||
self._acls = acls
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncACLsWithStreamingResponse:
|
||||
def __init__(self, acls: AsyncACLs) -> None:
|
||||
self._acls = acls
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
acls.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
acls.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
acls.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
acls.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
acls.get,
|
||||
)
|
||||
622
src/cloudflare/resources/magic_transit/sites/lans.py
Normal file
622
src/cloudflare/resources/magic_transit/sites/lans.py
Normal file
|
|
@ -0,0 +1,622 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, 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 ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.magic_transit.sites import (
|
||||
LanGetResponse,
|
||||
LanListResponse,
|
||||
LanCreateResponse,
|
||||
LanDeleteResponse,
|
||||
LanUpdateResponse,
|
||||
lan_create_params,
|
||||
lan_update_params,
|
||||
)
|
||||
|
||||
__all__ = ["Lans", "AsyncLans"]
|
||||
|
||||
|
||||
class Lans(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> LansWithRawResponse:
|
||||
return LansWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> LansWithStreamingResponse:
|
||||
return LansWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
lan: lan_create_params.Lan | 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,
|
||||
) -> LanCreateResponse:
|
||||
"""Creates a new LAN.
|
||||
|
||||
If the site is in high availability mode, static_addressing
|
||||
is required along with secondary and virtual address.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans",
|
||||
body=maybe_transform({"lan": lan}, lan_create_params.LanCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanCreateResponse], ResultWrapper[LanCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
lan: lan_update_params.Lan | 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,
|
||||
) -> LanUpdateResponse:
|
||||
"""
|
||||
Update a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
body=maybe_transform({"lan": lan}, lan_update_params.LanUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanUpdateResponse], ResultWrapper[LanUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> LanListResponse:
|
||||
"""
|
||||
Lists LANs associated with an account and site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanListResponse], ResultWrapper[LanListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> LanDeleteResponse:
|
||||
"""
|
||||
Remove a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanDeleteResponse], ResultWrapper[LanDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> LanGetResponse:
|
||||
"""
|
||||
Get a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanGetResponse], ResultWrapper[LanGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncLans(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncLansWithRawResponse:
|
||||
return AsyncLansWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncLansWithStreamingResponse:
|
||||
return AsyncLansWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
lan: lan_create_params.Lan | 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,
|
||||
) -> LanCreateResponse:
|
||||
"""Creates a new LAN.
|
||||
|
||||
If the site is in high availability mode, static_addressing
|
||||
is required along with secondary and virtual address.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans",
|
||||
body=await async_maybe_transform({"lan": lan}, lan_create_params.LanCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanCreateResponse], ResultWrapper[LanCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
lan: lan_update_params.Lan | 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,
|
||||
) -> LanUpdateResponse:
|
||||
"""
|
||||
Update a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
body=await async_maybe_transform({"lan": lan}, lan_update_params.LanUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanUpdateResponse], ResultWrapper[LanUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> LanListResponse:
|
||||
"""
|
||||
Lists LANs associated with an account and site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanListResponse], ResultWrapper[LanListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> LanDeleteResponse:
|
||||
"""
|
||||
Remove a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanDeleteResponse], ResultWrapper[LanDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
lan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> LanGetResponse:
|
||||
"""
|
||||
Get a specific LAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
lan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not lan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `lan_identifier` but received {lan_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/lans/{lan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LanGetResponse], ResultWrapper[LanGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class LansWithRawResponse:
|
||||
def __init__(self, lans: Lans) -> None:
|
||||
self._lans = lans
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
lans.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
lans.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
lans.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
lans.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
lans.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncLansWithRawResponse:
|
||||
def __init__(self, lans: AsyncLans) -> None:
|
||||
self._lans = lans
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
lans.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
lans.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
lans.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
lans.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
lans.get,
|
||||
)
|
||||
|
||||
|
||||
class LansWithStreamingResponse:
|
||||
def __init__(self, lans: Lans) -> None:
|
||||
self._lans = lans
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
lans.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
lans.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
lans.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
lans.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
lans.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncLansWithStreamingResponse:
|
||||
def __init__(self, lans: AsyncLans) -> None:
|
||||
self._lans = lans
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
lans.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
lans.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
lans.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
lans.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
lans.get,
|
||||
)
|
||||
670
src/cloudflare/resources/magic_transit/sites/sites.py
Normal file
670
src/cloudflare/resources/magic_transit/sites/sites.py
Normal file
|
|
@ -0,0 +1,670 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from .acls import (
|
||||
ACLs,
|
||||
AsyncACLs,
|
||||
ACLsWithRawResponse,
|
||||
AsyncACLsWithRawResponse,
|
||||
ACLsWithStreamingResponse,
|
||||
AsyncACLsWithStreamingResponse,
|
||||
)
|
||||
from .lans import (
|
||||
Lans,
|
||||
AsyncLans,
|
||||
LansWithRawResponse,
|
||||
AsyncLansWithRawResponse,
|
||||
LansWithStreamingResponse,
|
||||
AsyncLansWithStreamingResponse,
|
||||
)
|
||||
from .wans import (
|
||||
Wans,
|
||||
AsyncWans,
|
||||
WansWithRawResponse,
|
||||
AsyncWansWithRawResponse,
|
||||
WansWithStreamingResponse,
|
||||
AsyncWansWithStreamingResponse,
|
||||
)
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._utils import (
|
||||
maybe_transform,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.magic_transit import (
|
||||
SiteGetResponse,
|
||||
SiteListResponse,
|
||||
SiteCreateResponse,
|
||||
SiteDeleteResponse,
|
||||
SiteUpdateResponse,
|
||||
site_create_params,
|
||||
site_update_params,
|
||||
)
|
||||
|
||||
__all__ = ["Sites", "AsyncSites"]
|
||||
|
||||
|
||||
class Sites(SyncAPIResource):
|
||||
@cached_property
|
||||
def acls(self) -> ACLs:
|
||||
return ACLs(self._client)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> Lans:
|
||||
return Lans(self._client)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> Wans:
|
||||
return Wans(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> SitesWithRawResponse:
|
||||
return SitesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> SitesWithStreamingResponse:
|
||||
return SitesWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
account_identifier: str,
|
||||
*,
|
||||
site: site_create_params.Site | 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,
|
||||
) -> SiteCreateResponse:
|
||||
"""
|
||||
Creates a new Site
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites",
|
||||
body=maybe_transform({"site": site}, site_create_params.SiteCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site: site_update_params.Site | 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,
|
||||
) -> SiteUpdateResponse:
|
||||
"""
|
||||
Update a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
body=maybe_transform({"site": site}, site_update_params.SiteUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
account_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,
|
||||
) -> SiteListResponse:
|
||||
"""Lists Sites associated with an account.
|
||||
|
||||
Use connector_identifier query param to
|
||||
return sites where connector_identifier matches either site.ConnectorID or
|
||||
site.SecondaryConnectorID.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> SiteDeleteResponse:
|
||||
"""
|
||||
Remove a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> SiteGetResponse:
|
||||
"""
|
||||
Get a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncSites(AsyncAPIResource):
|
||||
@cached_property
|
||||
def acls(self) -> AsyncACLs:
|
||||
return AsyncACLs(self._client)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> AsyncLans:
|
||||
return AsyncLans(self._client)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> AsyncWans:
|
||||
return AsyncWans(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncSitesWithRawResponse:
|
||||
return AsyncSitesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncSitesWithStreamingResponse:
|
||||
return AsyncSitesWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
account_identifier: str,
|
||||
*,
|
||||
site: site_create_params.Site | 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,
|
||||
) -> SiteCreateResponse:
|
||||
"""
|
||||
Creates a new Site
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites",
|
||||
body=await async_maybe_transform({"site": site}, site_create_params.SiteCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteCreateResponse], ResultWrapper[SiteCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site: site_update_params.Site | 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,
|
||||
) -> SiteUpdateResponse:
|
||||
"""
|
||||
Update a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
body=await async_maybe_transform({"site": site}, site_update_params.SiteUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteUpdateResponse], ResultWrapper[SiteUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
account_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,
|
||||
) -> SiteListResponse:
|
||||
"""Lists Sites associated with an account.
|
||||
|
||||
Use connector_identifier query param to
|
||||
return sites where connector_identifier matches either site.ConnectorID or
|
||||
site.SecondaryConnectorID.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteListResponse], ResultWrapper[SiteListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> SiteDeleteResponse:
|
||||
"""
|
||||
Remove a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteDeleteResponse], ResultWrapper[SiteDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> SiteGetResponse:
|
||||
"""
|
||||
Get a specific Site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[SiteGetResponse], ResultWrapper[SiteGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class SitesWithRawResponse:
|
||||
def __init__(self, sites: Sites) -> None:
|
||||
self._sites = sites
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
sites.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
sites.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
sites.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
sites.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
sites.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def acls(self) -> ACLsWithRawResponse:
|
||||
return ACLsWithRawResponse(self._sites.acls)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> LansWithRawResponse:
|
||||
return LansWithRawResponse(self._sites.lans)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> WansWithRawResponse:
|
||||
return WansWithRawResponse(self._sites.wans)
|
||||
|
||||
|
||||
class AsyncSitesWithRawResponse:
|
||||
def __init__(self, sites: AsyncSites) -> None:
|
||||
self._sites = sites
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
sites.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
sites.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
sites.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
sites.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
sites.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def acls(self) -> AsyncACLsWithRawResponse:
|
||||
return AsyncACLsWithRawResponse(self._sites.acls)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> AsyncLansWithRawResponse:
|
||||
return AsyncLansWithRawResponse(self._sites.lans)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> AsyncWansWithRawResponse:
|
||||
return AsyncWansWithRawResponse(self._sites.wans)
|
||||
|
||||
|
||||
class SitesWithStreamingResponse:
|
||||
def __init__(self, sites: Sites) -> None:
|
||||
self._sites = sites
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
sites.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
sites.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
sites.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
sites.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
sites.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def acls(self) -> ACLsWithStreamingResponse:
|
||||
return ACLsWithStreamingResponse(self._sites.acls)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> LansWithStreamingResponse:
|
||||
return LansWithStreamingResponse(self._sites.lans)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> WansWithStreamingResponse:
|
||||
return WansWithStreamingResponse(self._sites.wans)
|
||||
|
||||
|
||||
class AsyncSitesWithStreamingResponse:
|
||||
def __init__(self, sites: AsyncSites) -> None:
|
||||
self._sites = sites
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
sites.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
sites.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
sites.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
sites.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
sites.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def acls(self) -> AsyncACLsWithStreamingResponse:
|
||||
return AsyncACLsWithStreamingResponse(self._sites.acls)
|
||||
|
||||
@cached_property
|
||||
def lans(self) -> AsyncLansWithStreamingResponse:
|
||||
return AsyncLansWithStreamingResponse(self._sites.lans)
|
||||
|
||||
@cached_property
|
||||
def wans(self) -> AsyncWansWithStreamingResponse:
|
||||
return AsyncWansWithStreamingResponse(self._sites.wans)
|
||||
618
src/cloudflare/resources/magic_transit/sites/wans.py
Normal file
618
src/cloudflare/resources/magic_transit/sites/wans.py
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, 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 ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.magic_transit.sites import (
|
||||
WanGetResponse,
|
||||
WanListResponse,
|
||||
WanCreateResponse,
|
||||
WanDeleteResponse,
|
||||
WanUpdateResponse,
|
||||
wan_create_params,
|
||||
wan_update_params,
|
||||
)
|
||||
|
||||
__all__ = ["Wans", "AsyncWans"]
|
||||
|
||||
|
||||
class Wans(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> WansWithRawResponse:
|
||||
return WansWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> WansWithStreamingResponse:
|
||||
return WansWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
wan: wan_create_params.Wan | 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,
|
||||
) -> WanCreateResponse:
|
||||
"""
|
||||
Creates a new WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans",
|
||||
body=maybe_transform({"wan": wan}, wan_create_params.WanCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanCreateResponse], ResultWrapper[WanCreateResponse]),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
wan: wan_update_params.Wan | 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,
|
||||
) -> WanUpdateResponse:
|
||||
"""
|
||||
Update a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
body=maybe_transform({"wan": wan}, wan_update_params.WanUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanUpdateResponse], ResultWrapper[WanUpdateResponse]),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> WanListResponse:
|
||||
"""
|
||||
Lists WANs associated with an account and site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanListResponse], ResultWrapper[WanListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> WanDeleteResponse:
|
||||
"""
|
||||
Remove a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanDeleteResponse], ResultWrapper[WanDeleteResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> WanGetResponse:
|
||||
"""
|
||||
Get a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanGetResponse], ResultWrapper[WanGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncWans(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncWansWithRawResponse:
|
||||
return AsyncWansWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncWansWithStreamingResponse:
|
||||
return AsyncWansWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
wan: wan_create_params.Wan | 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,
|
||||
) -> WanCreateResponse:
|
||||
"""
|
||||
Creates a new WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._post(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans",
|
||||
body=await async_maybe_transform({"wan": wan}, wan_create_params.WanCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanCreateResponse], ResultWrapper[WanCreateResponse]),
|
||||
)
|
||||
|
||||
async def update(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_identifier: str,
|
||||
wan: wan_update_params.Wan | 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,
|
||||
) -> WanUpdateResponse:
|
||||
"""
|
||||
Update a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return await self._put(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
body=await async_maybe_transform({"wan": wan}, wan_update_params.WanUpdateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanUpdateResponse], ResultWrapper[WanUpdateResponse]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
self,
|
||||
site_identifier: str,
|
||||
*,
|
||||
account_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,
|
||||
) -> WanListResponse:
|
||||
"""
|
||||
Lists WANs associated with an account and site.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanListResponse], ResultWrapper[WanListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> WanDeleteResponse:
|
||||
"""
|
||||
Remove a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanDeleteResponse], ResultWrapper[WanDeleteResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
wan_identifier: str,
|
||||
*,
|
||||
account_identifier: str,
|
||||
site_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,
|
||||
) -> WanGetResponse:
|
||||
"""
|
||||
Get a specific WAN.
|
||||
|
||||
Args:
|
||||
account_identifier: Identifier
|
||||
|
||||
site_identifier: Identifier
|
||||
|
||||
wan_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
|
||||
if not site_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `site_identifier` but received {site_identifier!r}")
|
||||
if not wan_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `wan_identifier` but received {wan_identifier!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_identifier}/magic/sites/{site_identifier}/wans/{wan_identifier}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[WanGetResponse], ResultWrapper[WanGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class WansWithRawResponse:
|
||||
def __init__(self, wans: Wans) -> None:
|
||||
self._wans = wans
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
wans.create,
|
||||
)
|
||||
self.update = to_raw_response_wrapper(
|
||||
wans.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
wans.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
wans.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
wans.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncWansWithRawResponse:
|
||||
def __init__(self, wans: AsyncWans) -> None:
|
||||
self._wans = wans
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
wans.create,
|
||||
)
|
||||
self.update = async_to_raw_response_wrapper(
|
||||
wans.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
wans.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
wans.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
wans.get,
|
||||
)
|
||||
|
||||
|
||||
class WansWithStreamingResponse:
|
||||
def __init__(self, wans: Wans) -> None:
|
||||
self._wans = wans
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
wans.create,
|
||||
)
|
||||
self.update = to_streamed_response_wrapper(
|
||||
wans.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
wans.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
wans.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
wans.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncWansWithStreamingResponse:
|
||||
def __init__(self, wans: AsyncWans) -> None:
|
||||
self._wans = wans
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
wans.create,
|
||||
)
|
||||
self.update = async_to_streamed_response_wrapper(
|
||||
wans.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
wans.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
wans.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
wans.get,
|
||||
)
|
||||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from .scripts import (
|
||||
Scripts,
|
||||
AsyncScripts,
|
||||
|
|
@ -10,9 +14,30 @@ from .scripts import (
|
|||
ScriptsWithStreamingResponse,
|
||||
AsyncScriptsWithStreamingResponse,
|
||||
)
|
||||
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 .scripts.scripts import Scripts, AsyncScripts
|
||||
from ....._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from .....types.workers_for_platforms.dispatch import (
|
||||
NamespaceGetResponse,
|
||||
NamespaceListResponse,
|
||||
NamespaceCreateResponse,
|
||||
namespace_create_params,
|
||||
)
|
||||
|
||||
__all__ = ["Namespaces", "AsyncNamespaces"]
|
||||
|
||||
|
|
@ -30,6 +55,176 @@ class Namespaces(SyncAPIResource):
|
|||
def with_streaming_response(self) -> NamespacesWithStreamingResponse:
|
||||
return NamespacesWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
name: str | 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,
|
||||
) -> NamespaceCreateResponse:
|
||||
"""
|
||||
Create a new Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
name: The name of the dispatch namespace
|
||||
|
||||
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}/workers/dispatch/namespaces",
|
||||
body=maybe_transform({"name": name}, namespace_create_params.NamespaceCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]),
|
||||
)
|
||||
|
||||
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,
|
||||
) -> NamespaceListResponse:
|
||||
"""
|
||||
Fetch a list of Workers for Platforms namespaces.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceListResponse], ResultWrapper[NamespaceListResponse]),
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
dispatch_namespace: 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,
|
||||
) -> object:
|
||||
"""
|
||||
Delete a Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
|
||||
|
||||
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 dispatch_namespace:
|
||||
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
|
||||
return self._delete(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[object], ResultWrapper[object]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
dispatch_namespace: 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,
|
||||
) -> NamespaceGetResponse:
|
||||
"""
|
||||
Fetch a Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
|
||||
|
||||
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 dispatch_namespace:
|
||||
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncNamespaces(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -44,11 +239,194 @@ class AsyncNamespaces(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse:
|
||||
return AsyncNamespacesWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
*,
|
||||
account_id: str,
|
||||
name: str | 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,
|
||||
) -> NamespaceCreateResponse:
|
||||
"""
|
||||
Create a new Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
name: The name of the dispatch namespace
|
||||
|
||||
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}/workers/dispatch/namespaces",
|
||||
body=await async_maybe_transform({"name": name}, namespace_create_params.NamespaceCreateParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]),
|
||||
)
|
||||
|
||||
async 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,
|
||||
) -> NamespaceListResponse:
|
||||
"""
|
||||
Fetch a list of Workers for Platforms namespaces.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
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._get(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceListResponse], ResultWrapper[NamespaceListResponse]),
|
||||
)
|
||||
|
||||
async def delete(
|
||||
self,
|
||||
dispatch_namespace: 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,
|
||||
) -> object:
|
||||
"""
|
||||
Delete a Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
|
||||
|
||||
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 dispatch_namespace:
|
||||
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
|
||||
return await self._delete(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[object], ResultWrapper[object]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
dispatch_namespace: 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,
|
||||
) -> NamespaceGetResponse:
|
||||
"""
|
||||
Fetch a Workers for Platforms namespace.
|
||||
|
||||
Args:
|
||||
account_id: Identifier
|
||||
|
||||
dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
|
||||
|
||||
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 dispatch_namespace:
|
||||
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class NamespacesWithRawResponse:
|
||||
def __init__(self, namespaces: Namespaces) -> None:
|
||||
self._namespaces = namespaces
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
namespaces.create,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
namespaces.list,
|
||||
)
|
||||
self.delete = to_raw_response_wrapper(
|
||||
namespaces.delete,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
namespaces.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def scripts(self) -> ScriptsWithRawResponse:
|
||||
return ScriptsWithRawResponse(self._namespaces.scripts)
|
||||
|
|
@ -58,6 +436,19 @@ class AsyncNamespacesWithRawResponse:
|
|||
def __init__(self, namespaces: AsyncNamespaces) -> None:
|
||||
self._namespaces = namespaces
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
namespaces.create,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
namespaces.list,
|
||||
)
|
||||
self.delete = async_to_raw_response_wrapper(
|
||||
namespaces.delete,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
namespaces.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def scripts(self) -> AsyncScriptsWithRawResponse:
|
||||
return AsyncScriptsWithRawResponse(self._namespaces.scripts)
|
||||
|
|
@ -67,6 +458,19 @@ class NamespacesWithStreamingResponse:
|
|||
def __init__(self, namespaces: Namespaces) -> None:
|
||||
self._namespaces = namespaces
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
namespaces.create,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
namespaces.list,
|
||||
)
|
||||
self.delete = to_streamed_response_wrapper(
|
||||
namespaces.delete,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
namespaces.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def scripts(self) -> ScriptsWithStreamingResponse:
|
||||
return ScriptsWithStreamingResponse(self._namespaces.scripts)
|
||||
|
|
@ -76,6 +480,19 @@ class AsyncNamespacesWithStreamingResponse:
|
|||
def __init__(self, namespaces: AsyncNamespaces) -> None:
|
||||
self._namespaces = namespaces
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
namespaces.create,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
namespaces.list,
|
||||
)
|
||||
self.delete = async_to_streamed_response_wrapper(
|
||||
namespaces.delete,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
namespaces.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def scripts(self) -> AsyncScriptsWithStreamingResponse:
|
||||
return AsyncScriptsWithStreamingResponse(self._namespaces.scripts)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ from .stream_list_response import StreamListResponse as StreamListResponse
|
|||
from .zone_create_response import ZoneCreateResponse as ZoneCreateResponse
|
||||
from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse
|
||||
from .account_update_params import AccountUpdateParams as AccountUpdateParams
|
||||
from .audit_log_list_params import AuditLogListParams as AuditLogListParams
|
||||
from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret
|
||||
from .origin_ca_certificate import OriginCACertificate as OriginCACertificate
|
||||
from .pagerule_get_response import PageruleGetResponse as PageruleGetResponse
|
||||
|
|
@ -74,6 +75,7 @@ from .pagerule_update_params import PageruleUpdateParams as PageruleUpdateParams
|
|||
from .rate_limit_edit_params import RateLimitEditParams as RateLimitEditParams
|
||||
from .rate_limit_list_params import RateLimitListParams as RateLimitListParams
|
||||
from .account_update_response import AccountUpdateResponse as AccountUpdateResponse
|
||||
from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse
|
||||
from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams
|
||||
from .intel_phishing_url_info import IntelPhishingURLInfo as IntelPhishingURLInfo
|
||||
from .membership_get_response import MembershipGetResponse as MembershipGetResponse
|
||||
|
|
|
|||
75
src/cloudflare/types/audit_log_list_params.py
Normal file
75
src/cloudflare/types/audit_log_list_params.py
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["AuditLogListParams", "Action", "Actor", "Zone"]
|
||||
|
||||
|
||||
class AuditLogListParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
id: str
|
||||
"""Finds a specific log by its ID."""
|
||||
|
||||
action: Action
|
||||
|
||||
actor: Actor
|
||||
|
||||
before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Limits the returned results to logs older than the specified date.
|
||||
|
||||
This can be a date string `2019-04-30` or an absolute timestamp that conforms to
|
||||
RFC3339.
|
||||
"""
|
||||
|
||||
direction: Literal["desc", "asc"]
|
||||
"""Changes the direction of the chronological sorting."""
|
||||
|
||||
export: bool
|
||||
"""Indicates that this request is an export of logs in CSV format."""
|
||||
|
||||
hide_user_logs: bool
|
||||
"""Indicates whether or not to hide user level audit logs."""
|
||||
|
||||
page: float
|
||||
"""Defines which page of results to return."""
|
||||
|
||||
per_page: float
|
||||
"""Sets the number of results to return per page."""
|
||||
|
||||
since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
||||
"""Limits the returned results to logs newer than the specified date.
|
||||
|
||||
This can be a date string `2019-04-30` or an absolute timestamp that conforms to
|
||||
RFC3339.
|
||||
"""
|
||||
|
||||
zone: Zone
|
||||
|
||||
|
||||
class Action(TypedDict, total=False):
|
||||
type: str
|
||||
"""Filters by the action type."""
|
||||
|
||||
|
||||
class Actor(TypedDict, total=False):
|
||||
email: str
|
||||
"""Filters by the email address of the actor that made the change."""
|
||||
|
||||
ip: str
|
||||
"""
|
||||
Filters by the IP address of the request that made the change by specific IP
|
||||
address or valid CIDR Range.
|
||||
"""
|
||||
|
||||
|
||||
class Zone(TypedDict, total=False):
|
||||
name: str
|
||||
"""Filters by the name of the zone associated to the change."""
|
||||
80
src/cloudflare/types/audit_log_list_response.py
Normal file
80
src/cloudflare/types/audit_log_list_response.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["AuditLogListResponse", "Action", "Actor", "Owner", "Resource"]
|
||||
|
||||
|
||||
class Action(BaseModel):
|
||||
result: Optional[bool] = None
|
||||
"""A boolean that indicates if the action attempted was successful."""
|
||||
|
||||
type: Optional[str] = None
|
||||
"""A short string that describes the action that was performed."""
|
||||
|
||||
|
||||
class Actor(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""The ID of the actor that performed the action.
|
||||
|
||||
If a user performed the action, this will be their User ID.
|
||||
"""
|
||||
|
||||
email: Optional[str] = None
|
||||
"""The email of the user that performed the action."""
|
||||
|
||||
ip: Optional[str] = None
|
||||
"""The IP address of the request that performed the action."""
|
||||
|
||||
type: Optional[Literal["user", "admin", "Cloudflare"]] = None
|
||||
"""The type of actor, whether a User, Cloudflare Admin, or an Automated System."""
|
||||
|
||||
|
||||
class Owner(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
|
||||
class Resource(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""An identifier for the resource that was affected by the action."""
|
||||
|
||||
type: Optional[str] = None
|
||||
"""A short string that describes the resource that was affected by the action."""
|
||||
|
||||
|
||||
class AuditLogListResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""A string that uniquely identifies the audit log."""
|
||||
|
||||
action: Optional[Action] = None
|
||||
|
||||
actor: Optional[Actor] = None
|
||||
|
||||
interface: Optional[str] = None
|
||||
"""The source of the event."""
|
||||
|
||||
metadata: Optional[object] = None
|
||||
"""An object which can lend more context to the action being logged.
|
||||
|
||||
This is a flexible value and varies between different actions.
|
||||
"""
|
||||
|
||||
new_value: Optional[str] = FieldInfo(alias="newValue", default=None)
|
||||
"""The new value of the resource that was modified."""
|
||||
|
||||
old_value: Optional[str] = FieldInfo(alias="oldValue", default=None)
|
||||
"""The value of the resource before it was modified."""
|
||||
|
||||
owner: Optional[Owner] = None
|
||||
|
||||
resource: Optional[Resource] = None
|
||||
|
||||
when: Optional[datetime] = None
|
||||
"""A UTC RFC3339 timestamp that specifies when the action being logged occured."""
|
||||
15
src/cloudflare/types/intel/attack_surface_report/__init__.py
Normal file
15
src/cloudflare/types/intel/attack_surface_report/__init__.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .issue_list_params import IssueListParams as IssueListParams
|
||||
from .issue_type_params import IssueTypeParams as IssueTypeParams
|
||||
from .issue_class_params import IssueClassParams as IssueClassParams
|
||||
from .issue_list_response import IssueListResponse as IssueListResponse
|
||||
from .issue_type_response import IssueTypeResponse as IssueTypeResponse
|
||||
from .issue_class_response import IssueClassResponse as IssueClassResponse
|
||||
from .issue_dismiss_params import IssueDismissParams as IssueDismissParams
|
||||
from .issue_severity_params import IssueSeverityParams as IssueSeverityParams
|
||||
from .issue_dismiss_response import IssueDismissResponse as IssueDismissResponse
|
||||
from .issue_severity_response import IssueSeverityResponse as IssueSeverityResponse
|
||||
from .issue_type_get_response import IssueTypeGetResponse as IssueTypeGetResponse
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ...._utils import PropertyInfo
|
||||
|
||||
__all__ = ["IssueClassParams"]
|
||||
|
||||
|
||||
class IssueClassParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dismissed: bool
|
||||
|
||||
issue_class: List[str]
|
||||
|
||||
issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")]
|
||||
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
|
||||
issue_type_neq: Annotated[
|
||||
List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
],
|
||||
PropertyInfo(alias="issue_type~neq"),
|
||||
]
|
||||
|
||||
product: List[str]
|
||||
|
||||
product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")]
|
||||
|
||||
severity: List[Literal["low", "moderate", "critical"]]
|
||||
|
||||
severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")]
|
||||
|
||||
subject: List[str]
|
||||
|
||||
subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["IssueClassResponse", "IssueClassResponseItem"]
|
||||
|
||||
|
||||
class IssueClassResponseItem(BaseModel):
|
||||
count: Optional[int] = None
|
||||
|
||||
value: Optional[str] = None
|
||||
|
||||
|
||||
IssueClassResponse = List[IssueClassResponseItem]
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["IssueDismissParams"]
|
||||
|
||||
|
||||
class IssueDismissParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dismiss: bool
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Union
|
||||
|
||||
__all__ = ["IssueDismissResponse"]
|
||||
|
||||
IssueDismissResponse = Union[object, str]
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ...._utils import PropertyInfo
|
||||
|
||||
__all__ = ["IssueListParams"]
|
||||
|
||||
|
||||
class IssueListParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dismissed: bool
|
||||
|
||||
issue_class: List[str]
|
||||
|
||||
issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")]
|
||||
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
|
||||
issue_type_neq: Annotated[
|
||||
List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
],
|
||||
PropertyInfo(alias="issue_type~neq"),
|
||||
]
|
||||
|
||||
page: int
|
||||
"""Current page within paginated list of results"""
|
||||
|
||||
per_page: int
|
||||
"""Number of results per page of results"""
|
||||
|
||||
product: List[str]
|
||||
|
||||
product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")]
|
||||
|
||||
severity: List[Literal["low", "moderate", "critical"]]
|
||||
|
||||
severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")]
|
||||
|
||||
subject: List[str]
|
||||
|
||||
subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")]
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["IssueListResponse", "Error", "Message", "Result", "ResultIssue"]
|
||||
|
||||
|
||||
class Error(BaseModel):
|
||||
code: int
|
||||
|
||||
message: str
|
||||
|
||||
|
||||
class Message(BaseModel):
|
||||
code: int
|
||||
|
||||
message: str
|
||||
|
||||
|
||||
class ResultIssue(BaseModel):
|
||||
id: Optional[str] = None
|
||||
|
||||
dismissed: Optional[bool] = None
|
||||
|
||||
issue_class: Optional[str] = None
|
||||
|
||||
issue_type: Optional[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
] = None
|
||||
|
||||
payload: Optional[object] = None
|
||||
|
||||
resolve_link: Optional[str] = None
|
||||
|
||||
resolve_text: Optional[str] = None
|
||||
|
||||
severity: Optional[Literal["Low", "Moderate", "Critical"]] = None
|
||||
|
||||
since: Optional[datetime] = None
|
||||
|
||||
subject: Optional[str] = None
|
||||
|
||||
timestamp: Optional[datetime] = None
|
||||
|
||||
|
||||
class Result(BaseModel):
|
||||
count: Optional[int] = None
|
||||
"""Total number of results"""
|
||||
|
||||
issues: Optional[List[ResultIssue]] = None
|
||||
|
||||
page: Optional[int] = None
|
||||
"""Current page within paginated list of results"""
|
||||
|
||||
per_page: Optional[int] = None
|
||||
"""Number of results per page of results"""
|
||||
|
||||
|
||||
class IssueListResponse(BaseModel):
|
||||
errors: List[Error]
|
||||
|
||||
messages: List[Message]
|
||||
|
||||
result: Result
|
||||
|
||||
success: Literal[True]
|
||||
"""Whether the API call was successful"""
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ...._utils import PropertyInfo
|
||||
|
||||
__all__ = ["IssueSeverityParams"]
|
||||
|
||||
|
||||
class IssueSeverityParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dismissed: bool
|
||||
|
||||
issue_class: List[str]
|
||||
|
||||
issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")]
|
||||
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
|
||||
issue_type_neq: Annotated[
|
||||
List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
],
|
||||
PropertyInfo(alias="issue_type~neq"),
|
||||
]
|
||||
|
||||
product: List[str]
|
||||
|
||||
product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")]
|
||||
|
||||
severity: List[Literal["low", "moderate", "critical"]]
|
||||
|
||||
severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")]
|
||||
|
||||
subject: List[str]
|
||||
|
||||
subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["IssueSeverityResponse", "IssueSeverityResponseItem"]
|
||||
|
||||
|
||||
class IssueSeverityResponseItem(BaseModel):
|
||||
count: Optional[int] = None
|
||||
|
||||
value: Optional[str] = None
|
||||
|
||||
|
||||
IssueSeverityResponse = List[IssueSeverityResponseItem]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List
|
||||
|
||||
__all__ = ["IssueTypeGetResponse"]
|
||||
|
||||
IssueTypeGetResponse = List[str]
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ...._utils import PropertyInfo
|
||||
|
||||
__all__ = ["IssueTypeParams"]
|
||||
|
||||
|
||||
class IssueTypeParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
dismissed: bool
|
||||
|
||||
issue_class: List[str]
|
||||
|
||||
issue_class_neq: Annotated[List[str], PropertyInfo(alias="issue_class~neq")]
|
||||
|
||||
issue_type: List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
]
|
||||
|
||||
issue_type_neq: Annotated[
|
||||
List[
|
||||
Literal[
|
||||
"compliance_violation",
|
||||
"email_security",
|
||||
"exposed_infrastructure",
|
||||
"insecure_configuration",
|
||||
"weak_authentication",
|
||||
]
|
||||
],
|
||||
PropertyInfo(alias="issue_type~neq"),
|
||||
]
|
||||
|
||||
product: List[str]
|
||||
|
||||
product_neq: Annotated[List[str], PropertyInfo(alias="product~neq")]
|
||||
|
||||
severity: List[Literal["low", "moderate", "critical"]]
|
||||
|
||||
severity_neq: Annotated[List[Literal["low", "moderate", "critical"]], PropertyInfo(alias="severity~neq")]
|
||||
|
||||
subject: List[str]
|
||||
|
||||
subject_neq: Annotated[List[str], PropertyInfo(alias="subject~neq")]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["IssueTypeResponse", "IssueTypeResponseItem"]
|
||||
|
||||
|
||||
class IssueTypeResponseItem(BaseModel):
|
||||
count: Optional[int] = None
|
||||
|
||||
value: Optional[str] = None
|
||||
|
||||
|
||||
IssueTypeResponse = List[IssueTypeResponseItem]
|
||||
|
|
@ -2,12 +2,19 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from .site_get_response import SiteGetResponse as SiteGetResponse
|
||||
from .route_empty_params import RouteEmptyParams as RouteEmptyParams
|
||||
from .route_get_response import RouteGetResponse as RouteGetResponse
|
||||
from .site_create_params import SiteCreateParams as SiteCreateParams
|
||||
from .site_list_response import SiteListResponse as SiteListResponse
|
||||
from .site_update_params import SiteUpdateParams as SiteUpdateParams
|
||||
from .route_create_params import RouteCreateParams as RouteCreateParams
|
||||
from .route_list_response import RouteListResponse as RouteListResponse
|
||||
from .route_update_params import RouteUpdateParams as RouteUpdateParams
|
||||
from .route_empty_response import RouteEmptyResponse as RouteEmptyResponse
|
||||
from .site_create_response import SiteCreateResponse as SiteCreateResponse
|
||||
from .site_delete_response import SiteDeleteResponse as SiteDeleteResponse
|
||||
from .site_update_response import SiteUpdateResponse as SiteUpdateResponse
|
||||
from .route_create_response import RouteCreateResponse as RouteCreateResponse
|
||||
from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse
|
||||
from .route_update_response import RouteUpdateResponse as RouteUpdateResponse
|
||||
|
|
|
|||
42
src/cloudflare/types/magic_transit/site_create_params.py
Normal file
42
src/cloudflare/types/magic_transit/site_create_params.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["SiteCreateParams", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteCreateParams(TypedDict, total=False):
|
||||
site: Site
|
||||
|
||||
|
||||
class SiteLocation(TypedDict, total=False):
|
||||
lat: str
|
||||
"""Latitude"""
|
||||
|
||||
lon: str
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(TypedDict, total=False):
|
||||
name: Required[str]
|
||||
"""The name of the site."""
|
||||
|
||||
connector_id: str
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: str
|
||||
|
||||
ha_mode: bool
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: SiteLocation
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
secondary_connector_id: str
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
45
src/cloudflare/types/magic_transit/site_create_response.py
Normal file
45
src/cloudflare/types/magic_transit/site_create_response.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["SiteCreateResponse", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteLocation(BaseModel):
|
||||
lat: Optional[str] = None
|
||||
"""Latitude"""
|
||||
|
||||
lon: Optional[str] = None
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_mode: Optional[bool] = None
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: Optional[SiteLocation] = None
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
|
||||
|
||||
class SiteCreateResponse(BaseModel):
|
||||
site: Optional[Site] = None
|
||||
47
src/cloudflare/types/magic_transit/site_delete_response.py
Normal file
47
src/cloudflare/types/magic_transit/site_delete_response.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["SiteDeleteResponse", "DeletedSite", "DeletedSiteLocation"]
|
||||
|
||||
|
||||
class DeletedSiteLocation(BaseModel):
|
||||
lat: Optional[str] = None
|
||||
"""Latitude"""
|
||||
|
||||
lon: Optional[str] = None
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class DeletedSite(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_mode: Optional[bool] = None
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: Optional[DeletedSiteLocation] = None
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
|
||||
|
||||
class SiteDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_site: Optional[DeletedSite] = None
|
||||
45
src/cloudflare/types/magic_transit/site_get_response.py
Normal file
45
src/cloudflare/types/magic_transit/site_get_response.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["SiteGetResponse", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteLocation(BaseModel):
|
||||
lat: Optional[str] = None
|
||||
"""Latitude"""
|
||||
|
||||
lon: Optional[str] = None
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_mode: Optional[bool] = None
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: Optional[SiteLocation] = None
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
|
||||
|
||||
class SiteGetResponse(BaseModel):
|
||||
site: Optional[Site] = None
|
||||
45
src/cloudflare/types/magic_transit/site_list_response.py
Normal file
45
src/cloudflare/types/magic_transit/site_list_response.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["SiteListResponse", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteLocation(BaseModel):
|
||||
lat: Optional[str] = None
|
||||
"""Latitude"""
|
||||
|
||||
lon: Optional[str] = None
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_mode: Optional[bool] = None
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: Optional[SiteLocation] = None
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
|
||||
|
||||
class SiteListResponse(BaseModel):
|
||||
sites: Optional[List[Site]] = None
|
||||
38
src/cloudflare/types/magic_transit/site_update_params.py
Normal file
38
src/cloudflare/types/magic_transit/site_update_params.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["SiteUpdateParams", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteUpdateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site: Site
|
||||
|
||||
|
||||
class SiteLocation(TypedDict, total=False):
|
||||
lat: str
|
||||
"""Latitude"""
|
||||
|
||||
lon: str
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(TypedDict, total=False):
|
||||
connector_id: str
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: str
|
||||
|
||||
location: SiteLocation
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: str
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: str
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
45
src/cloudflare/types/magic_transit/site_update_response.py
Normal file
45
src/cloudflare/types/magic_transit/site_update_response.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["SiteUpdateResponse", "Site", "SiteLocation"]
|
||||
|
||||
|
||||
class SiteLocation(BaseModel):
|
||||
lat: Optional[str] = None
|
||||
"""Latitude"""
|
||||
|
||||
lon: Optional[str] = None
|
||||
"""Longitude"""
|
||||
|
||||
|
||||
class Site(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag."""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_mode: Optional[bool] = None
|
||||
"""Site high availability mode.
|
||||
|
||||
If set to true, the site can have two connectors and runs in high availability
|
||||
mode.
|
||||
"""
|
||||
|
||||
location: Optional[SiteLocation] = None
|
||||
"""Location of site in latitude and longitude."""
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the site."""
|
||||
|
||||
secondary_connector_id: Optional[str] = None
|
||||
"""Magic WAN Connector identifier tag. Used when high availability mode is on."""
|
||||
|
||||
|
||||
class SiteUpdateResponse(BaseModel):
|
||||
site: Optional[Site] = None
|
||||
25
src/cloudflare/types/magic_transit/sites/__init__.py
Normal file
25
src/cloudflare/types/magic_transit/sites/__init__.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .acl_get_response import ACLGetResponse as ACLGetResponse
|
||||
from .lan_get_response import LanGetResponse as LanGetResponse
|
||||
from .wan_get_response import WanGetResponse as WanGetResponse
|
||||
from .acl_create_params import ACLCreateParams as ACLCreateParams
|
||||
from .acl_list_response import ACLListResponse as ACLListResponse
|
||||
from .acl_update_params import ACLUpdateParams as ACLUpdateParams
|
||||
from .lan_create_params import LanCreateParams as LanCreateParams
|
||||
from .lan_list_response import LanListResponse as LanListResponse
|
||||
from .lan_update_params import LanUpdateParams as LanUpdateParams
|
||||
from .wan_create_params import WanCreateParams as WanCreateParams
|
||||
from .wan_list_response import WanListResponse as WanListResponse
|
||||
from .wan_update_params import WanUpdateParams as WanUpdateParams
|
||||
from .acl_create_response import ACLCreateResponse as ACLCreateResponse
|
||||
from .acl_delete_response import ACLDeleteResponse as ACLDeleteResponse
|
||||
from .acl_update_response import ACLUpdateResponse as ACLUpdateResponse
|
||||
from .lan_create_response import LanCreateResponse as LanCreateResponse
|
||||
from .lan_delete_response import LanDeleteResponse as LanDeleteResponse
|
||||
from .lan_update_response import LanUpdateResponse as LanUpdateResponse
|
||||
from .wan_create_response import WanCreateResponse as WanCreateResponse
|
||||
from .wan_delete_response import WanDeleteResponse as WanDeleteResponse
|
||||
from .wan_update_response import WanUpdateResponse as WanUpdateResponse
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Union, Iterable
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["ACLCreateParams", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLCreateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
acl: ACL
|
||||
|
||||
|
||||
class ACLLan1(TypedDict, total=False):
|
||||
lan_id: Required[str]
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: str
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Iterable[int]
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: List[Union[str, str]]
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(TypedDict, total=False):
|
||||
lan_id: Required[str]
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: str
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Iterable[int]
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: List[Union[str, str]]
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(TypedDict, total=False):
|
||||
lan_1: Required[ACLLan1]
|
||||
|
||||
lan_2: Required[ACLLan2]
|
||||
|
||||
name: Required[str]
|
||||
"""The name of the ACL."""
|
||||
|
||||
description: str
|
||||
"""Description for the ACL."""
|
||||
|
||||
protocols: List[Literal["tcp", "udp", "icmp"]]
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["ACLCreateResponse", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLLan1(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: Optional[ACLLan1] = None
|
||||
|
||||
lan_2: Optional[ACLLan2] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None
|
||||
|
||||
|
||||
class ACLCreateResponse(BaseModel):
|
||||
acls: Optional[List[ACL]] = None
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["ACLDeleteResponse", "DeletedACL", "DeletedACLLan1", "DeletedACLLan2"]
|
||||
|
||||
|
||||
class DeletedACLLan1(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class DeletedACLLan2(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class DeletedACL(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: Optional[DeletedACLLan1] = None
|
||||
|
||||
lan_2: Optional[DeletedACLLan2] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None
|
||||
|
||||
|
||||
class ACLDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_acl: Optional[DeletedACL] = None
|
||||
"""Bidirectional ACL policy for local network traffic within a site."""
|
||||
72
src/cloudflare/types/magic_transit/sites/acl_get_response.py
Normal file
72
src/cloudflare/types/magic_transit/sites/acl_get_response.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["ACLGetResponse", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLLan1(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: Optional[ACLLan1] = None
|
||||
|
||||
lan_2: Optional[ACLLan2] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None
|
||||
|
||||
|
||||
class ACLGetResponse(BaseModel):
|
||||
acl: Optional[ACL] = None
|
||||
"""Bidirectional ACL policy for local network traffic within a site."""
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["ACLListResponse", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLLan1(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: Optional[ACLLan1] = None
|
||||
|
||||
lan_2: Optional[ACLLan2] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None
|
||||
|
||||
|
||||
class ACLListResponse(BaseModel):
|
||||
acls: Optional[List[ACL]] = None
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Union, Iterable
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["ACLUpdateParams", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLUpdateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
acl: ACL
|
||||
|
||||
|
||||
class ACLLan1(TypedDict, total=False):
|
||||
lan_id: Required[str]
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: str
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Iterable[int]
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: List[Union[str, str]]
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(TypedDict, total=False):
|
||||
lan_id: Required[str]
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: str
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Iterable[int]
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: List[Union[str, str]]
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(TypedDict, total=False):
|
||||
description: str
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: ACLLan1
|
||||
|
||||
lan_2: ACLLan2
|
||||
|
||||
name: str
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: List[Literal["tcp", "udp", "icmp"]]
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["ACLUpdateResponse", "ACL", "ACLLan1", "ACLLan2"]
|
||||
|
||||
|
||||
class ACLLan1(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACLLan2(BaseModel):
|
||||
lan_id: str
|
||||
"""The identifier for the LAN you want to create an ACL policy with."""
|
||||
|
||||
lan_name: Optional[str] = None
|
||||
"""The name of the LAN based on the provided lan_id."""
|
||||
|
||||
ports: Optional[List[int]] = None
|
||||
"""Array of ports on the provided LAN that will be included in the ACL.
|
||||
|
||||
If no ports are provided, communication on any port on this LAN is allowed.
|
||||
"""
|
||||
|
||||
subnets: Optional[List[Union[str, str]]] = None
|
||||
"""Array of subnet IPs within the LAN that will be included in the ACL.
|
||||
|
||||
If no subnets are provided, communication on any subnets on this LAN are
|
||||
allowed.
|
||||
"""
|
||||
|
||||
|
||||
class ACL(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
"""Description for the ACL."""
|
||||
|
||||
lan_1: Optional[ACLLan1] = None
|
||||
|
||||
lan_2: Optional[ACLLan2] = None
|
||||
|
||||
name: Optional[str] = None
|
||||
"""The name of the ACL."""
|
||||
|
||||
protocols: Optional[List[Literal["tcp", "udp", "icmp"]]] = None
|
||||
|
||||
|
||||
class ACLUpdateResponse(BaseModel):
|
||||
acl: Optional[ACL] = None
|
||||
"""Bidirectional ACL policy for local network traffic within a site."""
|
||||
104
src/cloudflare/types/magic_transit/sites/lan_create_params.py
Normal file
104
src/cloudflare/types/magic_transit/sites/lan_create_params.py
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, List, Iterable
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = [
|
||||
"LanCreateParams",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanCreateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
lan: Lan
|
||||
|
||||
|
||||
class LanNat(TypedDict, total=False):
|
||||
static_prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(TypedDict, total=False):
|
||||
static_prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(TypedDict, total=False):
|
||||
next_hop: Required[str]
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: LanRoutedSubnetNat
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(TypedDict, total=False):
|
||||
server_addresses: List[str]
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(TypedDict, total=False):
|
||||
dhcp_pool_end: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Dict[str, str]
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(TypedDict, total=False):
|
||||
address: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: LanStaticAddressingDhcpRelay
|
||||
|
||||
dhcp_server: LanStaticAddressingDhcpServer
|
||||
|
||||
secondary_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(TypedDict, total=False):
|
||||
physport: Required[int]
|
||||
|
||||
vlan_tag: Required[int]
|
||||
"""VLAN port number."""
|
||||
|
||||
description: str
|
||||
|
||||
ha_link: bool
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: LanNat
|
||||
|
||||
routed_subnets: Iterable[LanRoutedSubnet]
|
||||
|
||||
static_addressing: LanStaticAddressing
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
106
src/cloudflare/types/magic_transit/sites/lan_create_response.py
Normal file
106
src/cloudflare/types/magic_transit/sites/lan_create_response.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"LanCreateResponse",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(BaseModel):
|
||||
next_hop: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: Optional[LanRoutedSubnetNat] = None
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(BaseModel):
|
||||
server_addresses: Optional[List[str]] = None
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(BaseModel):
|
||||
dhcp_pool_end: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Optional[Dict[str, str]] = None
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: Optional[LanStaticAddressingDhcpRelay] = None
|
||||
|
||||
dhcp_server: Optional[LanStaticAddressingDhcpServer] = None
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_link: Optional[bool] = None
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: Optional[LanNat] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
routed_subnets: Optional[List[LanRoutedSubnet]] = None
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[LanStaticAddressing] = None
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class LanCreateResponse(BaseModel):
|
||||
lans: Optional[List[Lan]] = None
|
||||
108
src/cloudflare/types/magic_transit/sites/lan_delete_response.py
Normal file
108
src/cloudflare/types/magic_transit/sites/lan_delete_response.py
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"LanDeleteResponse",
|
||||
"DeletedLan",
|
||||
"DeletedLanNat",
|
||||
"DeletedLanRoutedSubnet",
|
||||
"DeletedLanRoutedSubnetNat",
|
||||
"DeletedLanStaticAddressing",
|
||||
"DeletedLanStaticAddressingDhcpRelay",
|
||||
"DeletedLanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class DeletedLanNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class DeletedLanRoutedSubnetNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class DeletedLanRoutedSubnet(BaseModel):
|
||||
next_hop: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: Optional[DeletedLanRoutedSubnetNat] = None
|
||||
|
||||
|
||||
class DeletedLanStaticAddressingDhcpRelay(BaseModel):
|
||||
server_addresses: Optional[List[str]] = None
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class DeletedLanStaticAddressingDhcpServer(BaseModel):
|
||||
dhcp_pool_end: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Optional[Dict[str, str]] = None
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class DeletedLanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: Optional[DeletedLanStaticAddressingDhcpRelay] = None
|
||||
|
||||
dhcp_server: Optional[DeletedLanStaticAddressingDhcpServer] = None
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class DeletedLan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_link: Optional[bool] = None
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: Optional[DeletedLanNat] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
routed_subnets: Optional[List[DeletedLanRoutedSubnet]] = None
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[DeletedLanStaticAddressing] = None
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class LanDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_lan: Optional[DeletedLan] = None
|
||||
106
src/cloudflare/types/magic_transit/sites/lan_get_response.py
Normal file
106
src/cloudflare/types/magic_transit/sites/lan_get_response.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"LanGetResponse",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(BaseModel):
|
||||
next_hop: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: Optional[LanRoutedSubnetNat] = None
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(BaseModel):
|
||||
server_addresses: Optional[List[str]] = None
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(BaseModel):
|
||||
dhcp_pool_end: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Optional[Dict[str, str]] = None
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: Optional[LanStaticAddressingDhcpRelay] = None
|
||||
|
||||
dhcp_server: Optional[LanStaticAddressingDhcpServer] = None
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_link: Optional[bool] = None
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: Optional[LanNat] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
routed_subnets: Optional[List[LanRoutedSubnet]] = None
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[LanStaticAddressing] = None
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class LanGetResponse(BaseModel):
|
||||
lan: Optional[Lan] = None
|
||||
106
src/cloudflare/types/magic_transit/sites/lan_list_response.py
Normal file
106
src/cloudflare/types/magic_transit/sites/lan_list_response.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"LanListResponse",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(BaseModel):
|
||||
next_hop: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: Optional[LanRoutedSubnetNat] = None
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(BaseModel):
|
||||
server_addresses: Optional[List[str]] = None
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(BaseModel):
|
||||
dhcp_pool_end: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Optional[Dict[str, str]] = None
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: Optional[LanStaticAddressingDhcpRelay] = None
|
||||
|
||||
dhcp_server: Optional[LanStaticAddressingDhcpServer] = None
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_link: Optional[bool] = None
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: Optional[LanNat] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
routed_subnets: Optional[List[LanRoutedSubnet]] = None
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[LanStaticAddressing] = None
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class LanListResponse(BaseModel):
|
||||
lans: Optional[List[Lan]] = None
|
||||
101
src/cloudflare/types/magic_transit/sites/lan_update_params.py
Normal file
101
src/cloudflare/types/magic_transit/sites/lan_update_params.py
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, List, Iterable
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = [
|
||||
"LanUpdateParams",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanUpdateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
lan: Lan
|
||||
|
||||
|
||||
class LanNat(TypedDict, total=False):
|
||||
static_prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(TypedDict, total=False):
|
||||
static_prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(TypedDict, total=False):
|
||||
next_hop: Required[str]
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: LanRoutedSubnetNat
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(TypedDict, total=False):
|
||||
server_addresses: List[str]
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(TypedDict, total=False):
|
||||
dhcp_pool_end: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Dict[str, str]
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(TypedDict, total=False):
|
||||
address: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: LanStaticAddressingDhcpRelay
|
||||
|
||||
dhcp_server: LanStaticAddressingDhcpServer
|
||||
|
||||
secondary_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(TypedDict, total=False):
|
||||
description: str
|
||||
|
||||
nat: LanNat
|
||||
|
||||
physport: int
|
||||
|
||||
routed_subnets: Iterable[LanRoutedSubnet]
|
||||
|
||||
static_addressing: LanStaticAddressing
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: int
|
||||
"""VLAN port number."""
|
||||
106
src/cloudflare/types/magic_transit/sites/lan_update_response.py
Normal file
106
src/cloudflare/types/magic_transit/sites/lan_update_response.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"LanUpdateResponse",
|
||||
"Lan",
|
||||
"LanNat",
|
||||
"LanRoutedSubnet",
|
||||
"LanRoutedSubnetNat",
|
||||
"LanStaticAddressing",
|
||||
"LanStaticAddressingDhcpRelay",
|
||||
"LanStaticAddressingDhcpServer",
|
||||
]
|
||||
|
||||
|
||||
class LanNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnetNat(BaseModel):
|
||||
static_prefix: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class LanRoutedSubnet(BaseModel):
|
||||
next_hop: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
prefix: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
nat: Optional[LanRoutedSubnetNat] = None
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpRelay(BaseModel):
|
||||
server_addresses: Optional[List[str]] = None
|
||||
"""List of DHCP server IPs."""
|
||||
|
||||
|
||||
class LanStaticAddressingDhcpServer(BaseModel):
|
||||
dhcp_pool_end: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dhcp_pool_start: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
dns_server: Optional[str] = None
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
reservations: Optional[Dict[str, str]] = None
|
||||
"""Mapping of MAC addresses to IP addresses"""
|
||||
|
||||
|
||||
class LanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
dhcp_relay: Optional[LanStaticAddressingDhcpRelay] = None
|
||||
|
||||
dhcp_server: Optional[LanStaticAddressingDhcpServer] = None
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
virtual_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Lan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
ha_link: Optional[bool] = None
|
||||
"""mark true to use this LAN for HA probing.
|
||||
|
||||
only works for site with HA turned on. only one LAN can be set as the ha_link.
|
||||
"""
|
||||
|
||||
nat: Optional[LanNat] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
routed_subnets: Optional[List[LanRoutedSubnet]] = None
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[LanStaticAddressing] = None
|
||||
"""
|
||||
If the site is not configured in high availability mode, this configuration is
|
||||
optional (if omitted, use DHCP). However, if in high availability mode,
|
||||
static_address is required along with secondary and virtual address.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class LanUpdateResponse(BaseModel):
|
||||
lan: Optional[Lan] = None
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["WanCreateParams", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanCreateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
wan: Wan
|
||||
|
||||
|
||||
class WanStaticAddressing(TypedDict, total=False):
|
||||
address: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: Required[str]
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(TypedDict, total=False):
|
||||
physport: Required[int]
|
||||
|
||||
vlan_tag: Required[int]
|
||||
"""VLAN port number."""
|
||||
|
||||
description: str
|
||||
|
||||
priority: int
|
||||
|
||||
static_addressing: WanStaticAddressing
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["WanCreateResponse", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
priority: Optional[int] = None
|
||||
"""Priority of WAN for traffic loadbalancing."""
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[WanStaticAddressing] = None
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class WanCreateResponse(BaseModel):
|
||||
wans: Optional[List[Wan]] = None
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["WanDeleteResponse", "DeletedWan", "DeletedWanStaticAddressing"]
|
||||
|
||||
|
||||
class DeletedWanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class DeletedWan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
priority: Optional[int] = None
|
||||
"""Priority of WAN for traffic loadbalancing."""
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[DeletedWanStaticAddressing] = None
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class WanDeleteResponse(BaseModel):
|
||||
deleted: Optional[bool] = None
|
||||
|
||||
deleted_wan: Optional[DeletedWan] = None
|
||||
46
src/cloudflare/types/magic_transit/sites/wan_get_response.py
Normal file
46
src/cloudflare/types/magic_transit/sites/wan_get_response.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["WanGetResponse", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
priority: Optional[int] = None
|
||||
"""Priority of WAN for traffic loadbalancing."""
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[WanStaticAddressing] = None
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class WanGetResponse(BaseModel):
|
||||
wan: Optional[Wan] = None
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["WanListResponse", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
priority: Optional[int] = None
|
||||
"""Priority of WAN for traffic loadbalancing."""
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[WanStaticAddressing] = None
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class WanListResponse(BaseModel):
|
||||
wans: Optional[List[Wan]] = None
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["WanUpdateParams", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanUpdateParams(TypedDict, total=False):
|
||||
account_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
site_identifier: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
wan: Wan
|
||||
|
||||
|
||||
class WanStaticAddressing(TypedDict, total=False):
|
||||
address: Required[str]
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: Required[str]
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(TypedDict, total=False):
|
||||
description: str
|
||||
|
||||
physport: int
|
||||
|
||||
priority: int
|
||||
|
||||
static_addressing: WanStaticAddressing
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: int
|
||||
"""VLAN port number."""
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["WanUpdateResponse", "Wan", "WanStaticAddressing"]
|
||||
|
||||
|
||||
class WanStaticAddressing(BaseModel):
|
||||
address: str
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
gateway_address: str
|
||||
"""A valid IPv4 address."""
|
||||
|
||||
secondary_address: Optional[str] = None
|
||||
"""A valid CIDR notation representing an IP range."""
|
||||
|
||||
|
||||
class Wan(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
description: Optional[str] = None
|
||||
|
||||
physport: Optional[int] = None
|
||||
|
||||
priority: Optional[int] = None
|
||||
"""Priority of WAN for traffic loadbalancing."""
|
||||
|
||||
site_id: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
static_addressing: Optional[WanStaticAddressing] = None
|
||||
"""(optional) if omitted, use DHCP.
|
||||
|
||||
Submit secondary_address when site is in high availability mode.
|
||||
"""
|
||||
|
||||
vlan_tag: Optional[int] = None
|
||||
"""VLAN port number."""
|
||||
|
||||
|
||||
class WanUpdateResponse(BaseModel):
|
||||
wan: Optional[Wan] = None
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .namespace_get_response import NamespaceGetResponse as NamespaceGetResponse
|
||||
from .namespace_create_params import NamespaceCreateParams as NamespaceCreateParams
|
||||
from .namespace_list_response import NamespaceListResponse as NamespaceListResponse
|
||||
from .namespace_create_response import NamespaceCreateResponse as NamespaceCreateResponse
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["NamespaceCreateParams"]
|
||||
|
||||
|
||||
class NamespaceCreateParams(TypedDict, total=False):
|
||||
account_id: Required[str]
|
||||
"""Identifier"""
|
||||
|
||||
name: str
|
||||
"""The name of the dispatch namespace"""
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["NamespaceCreateResponse"]
|
||||
|
||||
|
||||
class NamespaceCreateResponse(BaseModel):
|
||||
created_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
created_on: Optional[datetime] = None
|
||||
"""When the script was created."""
|
||||
|
||||
modified_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
modified_on: Optional[datetime] = None
|
||||
"""When the script was last modified."""
|
||||
|
||||
namespace_id: Optional[str] = None
|
||||
"""API Resource UUID tag."""
|
||||
|
||||
namespace_name: Optional[str] = None
|
||||
"""Name of the Workers for Platforms dispatch namespace."""
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["NamespaceGetResponse"]
|
||||
|
||||
|
||||
class NamespaceGetResponse(BaseModel):
|
||||
created_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
created_on: Optional[datetime] = None
|
||||
"""When the script was created."""
|
||||
|
||||
modified_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
modified_on: Optional[datetime] = None
|
||||
"""When the script was last modified."""
|
||||
|
||||
namespace_id: Optional[str] = None
|
||||
"""API Resource UUID tag."""
|
||||
|
||||
namespace_name: Optional[str] = None
|
||||
"""Name of the Workers for Platforms dispatch namespace."""
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ...._models import BaseModel
|
||||
|
||||
__all__ = ["NamespaceListResponse", "NamespaceListResponseItem"]
|
||||
|
||||
|
||||
class NamespaceListResponseItem(BaseModel):
|
||||
created_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
created_on: Optional[datetime] = None
|
||||
"""When the script was created."""
|
||||
|
||||
modified_by: Optional[str] = None
|
||||
"""Identifier"""
|
||||
|
||||
modified_on: Optional[datetime] = None
|
||||
"""When the script was last modified."""
|
||||
|
||||
namespace_id: Optional[str] = None
|
||||
"""API Resource UUID tag."""
|
||||
|
||||
namespace_name: Optional[str] = None
|
||||
"""Name of the Workers for Platforms dispatch namespace."""
|
||||
|
||||
|
||||
NamespaceListResponse = List[NamespaceListResponseItem]
|
||||
|
|
@ -17,6 +17,52 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|||
class TestKeys:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
key = client.images.v1.keys.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.images.v1.keys.with_raw_response.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
key = response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.images.v1.keys.with_streaming_response.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
key = response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.images.v1.keys.with_raw_response.update(
|
||||
"someKey",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
|
|
@ -59,10 +105,102 @@ class TestKeys:
|
|||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
key = client.images.v1.keys.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.images.v1.keys.with_raw_response.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
key = response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.images.v1.keys.with_streaming_response.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
key = response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.images.v1.keys.with_raw_response.delete(
|
||||
"someKey",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncKeys:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
key = await async_client.images.v1.keys.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.images.v1.keys.with_raw_response.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
key = await response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.images.v1.keys.with_streaming_response.update(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
key = await response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.images.v1.keys.with_raw_response.update(
|
||||
"someKey",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
|
|
@ -104,3 +242,49 @@ class TestAsyncKeys:
|
|||
await async_client.images.v1.keys.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
key = await async_client.images.v1.keys.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.images.v1.keys.with_raw_response.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
key = await response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.images.v1.keys.with_streaming_response.delete(
|
||||
"someKey",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
key = await response.parse()
|
||||
assert_matches_type(ImagesImageKeys, key, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.images.v1.keys.with_raw_response.delete(
|
||||
"someKey",
|
||||
account_id="",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.intel.attack_surface_report import IssueTypeGetResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestIssueTypes:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
issue_type = client.intel.attack_surface_report.issue_types.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issue_types.with_raw_response.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue_type = response.parse()
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issue_types.with_streaming_response.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue_type = response.parse()
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issue_types.with_raw_response.get(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncIssueTypes:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
issue_type = await async_client.intel.attack_surface_report.issue_types.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issue_types.with_raw_response.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue_type = await response.parse()
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issue_types.with_streaming_response.get(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue_type = await response.parse()
|
||||
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issue_types.with_raw_response.get(
|
||||
account_id="",
|
||||
)
|
||||
645
tests/api_resources/intel/attack_surface_report/test_issues.py
Normal file
645
tests/api_resources/intel/attack_surface_report/test_issues.py
Normal file
|
|
@ -0,0 +1,645 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination
|
||||
from cloudflare.types.intel.attack_surface_report import (
|
||||
IssueListResponse,
|
||||
IssueTypeResponse,
|
||||
IssueClassResponse,
|
||||
IssueDismissResponse,
|
||||
IssueSeverityResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestIssues:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
page=1,
|
||||
per_page=25,
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(SyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issues.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = response.parse()
|
||||
assert_matches_type(SyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issues.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = response.parse()
|
||||
assert_matches_type(SyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_class(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_class_with_all_params(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_class(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issues.with_raw_response.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_class(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issues.with_streaming_response.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_class(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.class_(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_dismiss(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_dismiss_with_all_params(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismiss=True,
|
||||
)
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_dismiss(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_dismiss(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issues.with_streaming_response.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_dismiss(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"string",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `issue_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_severity(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_severity_with_all_params(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_severity(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issues.with_raw_response.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_severity(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issues.with_streaming_response.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_severity(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.severity(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_type(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_type_with_all_params(self, client: Cloudflare) -> None:
|
||||
issue = client.intel.attack_surface_report.issues.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_type(self, client: Cloudflare) -> None:
|
||||
response = client.intel.attack_surface_report.issues.with_raw_response.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_type(self, client: Cloudflare) -> None:
|
||||
with client.intel.attack_surface_report.issues.with_streaming_response.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = response.parse()
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_type(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.intel.attack_surface_report.issues.with_raw_response.type(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncIssues:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(AsyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
page=1,
|
||||
per_page=25,
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(AsyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issues.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issues.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePagination[IssueListResponse], issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_class(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_class_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_class(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issues.with_raw_response.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_class(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issues.with_streaming_response.class_(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueClassResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_class(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.class_(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_dismiss(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_dismiss_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismiss=True,
|
||||
)
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_dismiss(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_dismiss(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issues.with_streaming_response.dismiss(
|
||||
"string",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueDismissResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_dismiss(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"string",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `issue_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.dismiss(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_severity(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_severity_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_severity(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issues.with_raw_response.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_severity(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issues.with_streaming_response.severity(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueSeverityResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_severity(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.severity(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_type(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_type_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
issue = await async_client.intel.attack_surface_report.issues.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
dismissed=False,
|
||||
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
|
||||
issue_type=["compliance_violation", "email_security"],
|
||||
issue_type_neq=["compliance_violation", "email_security"],
|
||||
product=["access", "dns"],
|
||||
product_neq=["access", "dns"],
|
||||
severity=["low", "moderate"],
|
||||
severity_neq=["low", "moderate"],
|
||||
subject=["example.com", "example.com", "example.com"],
|
||||
subject_neq=["example.com", "example.com", "example.com"],
|
||||
)
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_type(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.intel.attack_surface_report.issues.with_raw_response.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_type(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.intel.attack_surface_report.issues.with_streaming_response.type(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
issue = await response.parse()
|
||||
assert_matches_type(IssueTypeResponse, issue, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_type(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.intel.attack_surface_report.issues.with_raw_response.type(
|
||||
account_id="",
|
||||
)
|
||||
1
tests/api_resources/magic_transit/sites/__init__.py
Normal file
1
tests/api_resources/magic_transit/sites/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
726
tests/api_resources/magic_transit/sites/test_acls.py
Normal file
726
tests/api_resources/magic_transit/sites/test_acls.py
Normal file
|
|
@ -0,0 +1,726 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
ACLGetResponse,
|
||||
ACLListResponse,
|
||||
ACLCreateResponse,
|
||||
ACLDeleteResponse,
|
||||
ACLUpdateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestACLs:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
acl={
|
||||
"description": "Allows local traffic between PIN pads and cash register.",
|
||||
"lan_1": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"lan_2": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"name": "PIN Pad - Cash Register",
|
||||
"protocols": ["tcp", "udp", "icmp"],
|
||||
},
|
||||
)
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
acl={
|
||||
"description": "Allows local traffic between PIN pads and cash register.",
|
||||
"lan_1": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"lan_2": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"name": "PIN Pad - Cash Register",
|
||||
"protocols": ["tcp", "udp", "icmp"],
|
||||
},
|
||||
)
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
acl = client.magic_transit.sites.acls.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.acls.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = response.parse()
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncACLs:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
acl={
|
||||
"description": "Allows local traffic between PIN pads and cash register.",
|
||||
"lan_1": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"lan_2": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"name": "PIN Pad - Cash Register",
|
||||
"protocols": ["tcp", "udp", "icmp"],
|
||||
},
|
||||
)
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLCreateResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
acl={
|
||||
"description": "Allows local traffic between PIN pads and cash register.",
|
||||
"lan_1": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"lan_2": {
|
||||
"lan_id": "string",
|
||||
"lan_name": "string",
|
||||
"ports": [1, 1, 1],
|
||||
"subnets": ["192.0.2.1", "192.0.2.1", "192.0.2.1"],
|
||||
},
|
||||
"name": "PIN Pad - Cash Register",
|
||||
"protocols": ["tcp", "udp", "icmp"],
|
||||
},
|
||||
)
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLUpdateResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLListResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLDeleteResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
acl = await async_client.magic_transit.sites.acls.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.acls.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
acl = await response.parse()
|
||||
assert_matches_type(ACLGetResponse, acl, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.acls.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
812
tests/api_resources/magic_transit/sites/test_lans.py
Normal file
812
tests/api_resources/magic_transit/sites/test_lans.py
Normal file
|
|
@ -0,0 +1,812 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
LanGetResponse,
|
||||
LanListResponse,
|
||||
LanCreateResponse,
|
||||
LanDeleteResponse,
|
||||
LanUpdateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestLans:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
lan={
|
||||
"description": "string",
|
||||
"ha_link": True,
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"physport": 1,
|
||||
"routed_subnets": [
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
],
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]},
|
||||
"dhcp_server": {
|
||||
"dhcp_pool_end": "192.0.2.1",
|
||||
"dhcp_pool_start": "192.0.2.1",
|
||||
"dns_server": "192.0.2.1",
|
||||
"reservations": {
|
||||
"00:11:22:33:44:55": "192.0.2.100",
|
||||
"AA:BB:CC:DD:EE:FF": "192.168.1.101",
|
||||
},
|
||||
},
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
"virtual_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.lans.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
lan={
|
||||
"description": "string",
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"physport": 1,
|
||||
"routed_subnets": [
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
],
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]},
|
||||
"dhcp_server": {
|
||||
"dhcp_pool_end": "192.0.2.1",
|
||||
"dhcp_pool_start": "192.0.2.1",
|
||||
"dns_server": "192.0.2.1",
|
||||
"reservations": {
|
||||
"00:11:22:33:44:55": "192.0.2.100",
|
||||
"AA:BB:CC:DD:EE:FF": "192.168.1.101",
|
||||
},
|
||||
},
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
"virtual_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.lans.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.lans.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.lans.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
lan = client.magic_transit.sites.lans.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.lans.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = response.parse()
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncLans:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
lan={
|
||||
"description": "string",
|
||||
"ha_link": True,
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"physport": 1,
|
||||
"routed_subnets": [
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
],
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]},
|
||||
"dhcp_server": {
|
||||
"dhcp_pool_end": "192.0.2.1",
|
||||
"dhcp_pool_start": "192.0.2.1",
|
||||
"dns_server": "192.0.2.1",
|
||||
"reservations": {
|
||||
"00:11:22:33:44:55": "192.0.2.100",
|
||||
"AA:BB:CC:DD:EE:FF": "192.168.1.101",
|
||||
},
|
||||
},
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
"virtual_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.lans.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanCreateResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
lan={
|
||||
"description": "string",
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"physport": 1,
|
||||
"routed_subnets": [
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
{
|
||||
"nat": {"static_prefix": "192.0.2.0/24"},
|
||||
"next_hop": "192.0.2.1",
|
||||
"prefix": "192.0.2.0/24",
|
||||
},
|
||||
],
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"dhcp_relay": {"server_addresses": ["192.0.2.1", "192.0.2.1", "192.0.2.1"]},
|
||||
"dhcp_server": {
|
||||
"dhcp_pool_end": "192.0.2.1",
|
||||
"dhcp_pool_start": "192.0.2.1",
|
||||
"dns_server": "192.0.2.1",
|
||||
"reservations": {
|
||||
"00:11:22:33:44:55": "192.0.2.100",
|
||||
"AA:BB:CC:DD:EE:FF": "192.168.1.101",
|
||||
},
|
||||
},
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
"virtual_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.lans.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanUpdateResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.lans.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanListResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.lans.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanDeleteResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
lan = await async_client.magic_transit.sites.lans.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.lans.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
lan = await response.parse()
|
||||
assert_matches_type(LanGetResponse, lan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.lans.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
702
tests/api_resources/magic_transit/sites/test_wans.py
Normal file
702
tests/api_resources/magic_transit/sites/test_wans.py
Normal file
|
|
@ -0,0 +1,702 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit.sites import (
|
||||
WanGetResponse,
|
||||
WanListResponse,
|
||||
WanCreateResponse,
|
||||
WanDeleteResponse,
|
||||
WanUpdateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestWans:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
wan={
|
||||
"description": "string",
|
||||
"physport": 1,
|
||||
"priority": 0,
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"gateway_address": "192.0.2.1",
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.wans.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
wan={
|
||||
"description": "string",
|
||||
"physport": 1,
|
||||
"priority": 0,
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"gateway_address": "192.0.2.1",
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.wans.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.wans.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.wans.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
wan = client.magic_transit.sites.wans.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.wans.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = response.parse()
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncWans:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
wan={
|
||||
"description": "string",
|
||||
"physport": 1,
|
||||
"priority": 0,
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"gateway_address": "192.0.2.1",
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.wans.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanCreateResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.create(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
wan={
|
||||
"description": "string",
|
||||
"physport": 1,
|
||||
"priority": 0,
|
||||
"static_addressing": {
|
||||
"address": "192.0.2.0/24",
|
||||
"gateway_address": "192.0.2.1",
|
||||
"secondary_address": "192.0.2.0/24",
|
||||
},
|
||||
"vlan_tag": 0,
|
||||
},
|
||||
)
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.wans.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanUpdateResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.wans.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanListResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.list(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.wans.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanDeleteResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
wan = await async_client.magic_transit.sites.wans.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.wans.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
wan = await response.parse()
|
||||
assert_matches_type(WanGetResponse, wan, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.wans.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
584
tests/api_resources/magic_transit/test_sites.py
Normal file
584
tests/api_resources/magic_transit/test_sites.py
Normal file
|
|
@ -0,0 +1,584 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.magic_transit import (
|
||||
SiteGetResponse,
|
||||
SiteListResponse,
|
||||
SiteCreateResponse,
|
||||
SiteDeleteResponse,
|
||||
SiteUpdateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestSites:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site={
|
||||
"connector_id": "ac60d3d0435248289d446cedd870bcf4",
|
||||
"description": "string",
|
||||
"ha_mode": True,
|
||||
"location": {
|
||||
"lat": "string",
|
||||
"lon": "string",
|
||||
},
|
||||
"name": "site_1",
|
||||
"secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482",
|
||||
},
|
||||
)
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site={
|
||||
"connector_id": "ac60d3d0435248289d446cedd870bcf4",
|
||||
"description": "string",
|
||||
"location": {
|
||||
"lat": "string",
|
||||
"lon": "string",
|
||||
},
|
||||
"name": "site_1",
|
||||
"secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482",
|
||||
},
|
||||
)
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_update(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_update(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_update(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.list(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_delete(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
site = client.magic_transit.sites.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.magic_transit.sites.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.magic_transit.sites.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = response.parse()
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
client.magic_transit.sites.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncSites:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site={
|
||||
"connector_id": "ac60d3d0435248289d446cedd870bcf4",
|
||||
"description": "string",
|
||||
"ha_mode": True,
|
||||
"location": {
|
||||
"lat": "string",
|
||||
"lon": "string",
|
||||
},
|
||||
"name": "site_1",
|
||||
"secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482",
|
||||
},
|
||||
)
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteCreateResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
site={
|
||||
"connector_id": "ac60d3d0435248289d446cedd870bcf4",
|
||||
"description": "string",
|
||||
"location": {
|
||||
"lat": "string",
|
||||
"lon": "string",
|
||||
},
|
||||
"name": "site_1",
|
||||
"secondary_connector_id": "8d67040d3835dbcf46ce29da440dc482",
|
||||
},
|
||||
)
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.with_streaming_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteUpdateResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.update(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.update(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.with_raw_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.with_streaming_response.list(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteListResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.list(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.with_streaming_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteDeleteResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.delete(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.delete(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
site = await async_client.magic_transit.sites.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.magic_transit.sites.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.magic_transit.sites.with_streaming_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
site = await response.parse()
|
||||
assert_matches_type(SiteGetResponse, site, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.get(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
account_identifier="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_identifier` but received ''"):
|
||||
await async_client.magic_transit.sites.with_raw_response.get(
|
||||
"",
|
||||
account_identifier="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
152
tests/api_resources/test_audit_logs.py
Normal file
152
tests/api_resources/test_audit_logs.py
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types import AuditLogListResponse
|
||||
from cloudflare._utils import parse_datetime
|
||||
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestAuditLogs:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
audit_log = client.audit_logs.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
|
||||
audit_log = client.audit_logs.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
id="f174be97-19b1-40d6-954d-70cd5fbd52db",
|
||||
action={"type": "add"},
|
||||
actor={
|
||||
"ip": "17.168.228.63",
|
||||
"email": "alice@example.com",
|
||||
},
|
||||
before=parse_datetime("2019-04-30T01:12:20Z"),
|
||||
direction="desc",
|
||||
export=True,
|
||||
hide_user_logs=True,
|
||||
page=50,
|
||||
per_page=25,
|
||||
since=parse_datetime("2019-04-30T01:12:20Z"),
|
||||
zone={"name": "example.com"},
|
||||
)
|
||||
assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.audit_logs.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
audit_log = response.parse()
|
||||
assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.audit_logs.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
audit_log = response.parse()
|
||||
assert_matches_type(SyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.audit_logs.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncAuditLogs:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
audit_log = await async_client.audit_logs.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
audit_log = await async_client.audit_logs.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
id="f174be97-19b1-40d6-954d-70cd5fbd52db",
|
||||
action={"type": "add"},
|
||||
actor={
|
||||
"ip": "17.168.228.63",
|
||||
"email": "alice@example.com",
|
||||
},
|
||||
before=parse_datetime("2019-04-30T01:12:20Z"),
|
||||
direction="desc",
|
||||
export=True,
|
||||
hide_user_logs=True,
|
||||
page=50,
|
||||
per_page=25,
|
||||
since=parse_datetime("2019-04-30T01:12:20Z"),
|
||||
zone={"name": "example.com"},
|
||||
)
|
||||
assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.audit_logs.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
audit_log = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.audit_logs.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
audit_log = await response.parse()
|
||||
assert_matches_type(AsyncV4PagePaginationArray[AuditLogListResponse], audit_log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.audit_logs.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.workers_for_platforms.dispatch import (
|
||||
NamespaceGetResponse,
|
||||
NamespaceListResponse,
|
||||
NamespaceCreateResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestNamespaces:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
namespace = client.workers_for_platforms.dispatch.namespaces.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
namespace = client.workers_for_platforms.dispatch.namespaces.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
name="my-dispatch-namespace",
|
||||
)
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.workers_for_platforms.dispatch.namespaces.with_raw_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.workers_for_platforms.dispatch.namespaces.with_streaming_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.workers_for_platforms.dispatch.namespaces.with_raw_response.create(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
namespace = client.workers_for_platforms.dispatch.namespaces.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.workers_for_platforms.dispatch.namespaces.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.workers_for_platforms.dispatch.namespaces.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.workers_for_platforms.dispatch.namespaces.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_delete(self, client: Cloudflare) -> None:
|
||||
namespace = client.workers_for_platforms.dispatch.namespaces.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_delete(self, client: Cloudflare) -> None:
|
||||
response = client.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = response.parse()
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_delete(self, client: Cloudflare) -> None:
|
||||
with client.workers_for_platforms.dispatch.namespaces.with_streaming_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = response.parse()
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
|
||||
client.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
namespace = client.workers_for_platforms.dispatch.namespaces.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.workers_for_platforms.dispatch.namespaces.with_streaming_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = response.parse()
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
|
||||
client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncNamespaces:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
namespace = await async_client.workers_for_platforms.dispatch.namespaces.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
namespace = await async_client.workers_for_platforms.dispatch.namespaces.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
name="my-dispatch-namespace",
|
||||
)
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.workers_for_platforms.dispatch.namespaces.with_streaming_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceCreateResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.workers_for_platforms.dispatch.namespaces.with_raw_response.create(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
namespace = await async_client.workers_for_platforms.dispatch.namespaces.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.workers_for_platforms.dispatch.namespaces.with_streaming_response.list(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceListResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.list(
|
||||
account_id="",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
namespace = await async_client.workers_for_platforms.dispatch.namespaces.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.workers_for_platforms.dispatch.namespaces.with_streaming_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(object, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@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.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"my-dispatch-namespace",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
|
||||
await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.delete(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
namespace = await async_client.workers_for_platforms.dispatch.namespaces.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.workers_for_platforms.dispatch.namespaces.with_streaming_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
namespace = await response.parse()
|
||||
assert_matches_type(NamespaceGetResponse, namespace, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"my-dispatch-namespace",
|
||||
account_id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
|
||||
await async_client.workers_for_platforms.dispatch.namespaces.with_raw_response.get(
|
||||
"",
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue